Community
Participate
Working Groups
My javascript-containing project (Faceted project with java and javascript) fails to build, logging the following error about JavaScript Validator. Sometimes it works (and manages to mark things like missing semicolons), sometimes it throws this error (and does not mark those errors). Warning Thu Jul 16 19:56:09 NZST 2009 Errors running builder 'JavaScript Validator' on project '<my-project-name>'. java.lang.NullPointerException at org.eclipse.wst.jsdt.internal.compiler.ast.ConditionalExpression.resolveType(ConditionalExpression.java:199) at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteralField.resolveType(ObjectLiteralField.java:70) at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteral.resolveType(ObjectLiteral.java:80) at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteralField.resolveType(ObjectLiteralField.java:70) at org.eclipse.wst.jsdt.internal.compiler.ast.ObjectLiteral.resolveType(ObjectLiteral.java:80) at org.eclipse.wst.jsdt.internal.compiler.ast.Assignment.resolveType(Assignment.java:161) at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolve(Expression.java:745) at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:402) at org.eclipse.wst.jsdt.internal.compiler.Compiler.process(Compiler.java:596) at org.eclipse.wst.jsdt.internal.compiler.Compiler.compile(Compiler.java:356) at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:311) at org.eclipse.wst.jsdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:168) at org.eclipse.wst.jsdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:248) at org.eclipse.wst.jsdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:58) at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:291) at org.eclipse.wst.jsdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:199) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:627) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:170) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:253) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:256) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:309) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:341) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:140) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:238) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) eclipse.buildId=I20090611-1540 java.version=1.6.0_14 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_NZ Framework arguments: -product org.eclipse.epp.package.jee.product Command-line arguments: -os linux -ws gtk -arch x86 -product org.eclipse.epp.package.jee.product -- Configuration Details -- Product: Eclipse 1.2.0.20090618-0904 (org.eclipse.epp.package.jee.product) Installed Features: org.eclipse.platform 3.5.0.v20090611a-9gEeG1HFtQcmRThO4O3aR_fqSMvJR2sJ
Nick, Please include steps to reproduce your bug. Providing sample code is the best way to do so. Thanks, Chris
Categorizing JSDT bugzillas for planning purposes.
For the sake of documentation: ConditionalExpression, where exception is thrown represents an expression like "condition ? valueIfTrue : valueIfFalse". The exception seems to be thrown in following line (199): constant = condConstant.booleanValue() ? trueConstant : falseConstant; only candidate for NPE in this line is condConstant, because it's method is called. condConstant value is initialized in following assignment in line 194: condConstant = condition.constant So condition.constant must be null at that point. Condition.constant should be initialized in condition.resolveTypeExpecting(scope, TypeBinding.BOOLEAN) called in line 142. resolveTypeExpecting(...) basically calls Expression.resolveType(scope) which has many different implementations for all various types of expressions (literal, assignment, reference, etc.). I can't see any Expression subtype that would not initialize this.condition in the first few lines, so I can't find out why does this NullPointerException happens :-P Any sample javascript source code that exhibits this issue would be welcome... :-)
Created attachment 165179 [details] File containing the failing statement I get this too. The condition is a FieldReference and the expression looks like this. (YAHOO.util.DragDrop ? true : false) The culprit file is attached. I managed to get around the problem by changing line 195 from: constant = condConstant.booleanValue() ? trueConstant : falseConstant; to: constant = (condConstant != null && condConstant.booleanValue()) ? trueConstant : falseConstant;
I can't reproduce this and the original defect was opened with a build ID over a year old.
I am trying to get an open source project to build. jadaSite... It's a webshop. I downloaded the WAR and imported it. At the moment it Starts the Java Script Validation I get load of these missing semicolons And then in eclipse popup. Errors occurred during the build. Errors running builder 'JavaScript Validator' on project 'jada'. java.lang.NullPointerException Could it be the Script Validator used to except something which it doesn't anymore?
(In reply to comment #6) > I am trying to get an open source project to build. > jadaSite... It's a webshop. I downloaded the WAR and imported it. At the moment > it Starts the Java Script Validation I get load of these missing semicolons And > then in eclipse popup. > Errors occurred during the build. > Errors running builder 'JavaScript Validator' on project 'jada'. > java.lang.NullPointerException > > Could it be the Script Validator used to except something which it doesn't > anymore? Marco, This bugzilla is not the appropriate place to ask your question. If you feel you have found a defect please open a new bug and include a full stack trace. If possible include the files needed or steps to reproduce the problem. Chris