Summary: | [exceptions] NullPointerException in org.eclipse.wst.jsdt.internal.compiler.ast.ConditionalExpression.resolveType | ||||||
---|---|---|---|---|---|---|---|
Product: | [WebTools] JSDT | Reporter: | Nick Clarke <memorius> | ||||
Component: | General | Assignee: | Ian Tewksbury <itewksbu> | ||||
Status: | RESOLVED WORKSFORME | QA Contact: | Nitin Dahyabhai <thatnitind> | ||||
Severity: | major | ||||||
Priority: | P3 | CC: | cmjaun, jacek.pospychala, marco.schoolenberg, thomas | ||||
Version: | unspecified | Keywords: | needinfo | ||||
Target Milestone: | 3.2.1 | ||||||
Hardware: | PC | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Nick Clarke
2009-07-16 04:18:48 EDT
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 |