Bug 337646 - NPE in BundleErrorReporter when trying to report ignored build path problem
Summary: NPE in BundleErrorReporter when trying to report ignored build path problem
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-19 12:22 EST by Stephan Herrmann CLA
Modified: 2011-02-22 12:24 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2011-02-19 12:22:34 EST
Steps (using SDK 3.7 M5):
- check out project org.eclipse.jdt.core
  (I assume any plug-in project with the following setting will do:
     compilers.p.build.source.library=2
  )
- add a source folder "contrib", do not update build.properties

The BundleErrorReporter will try to report:
  "contrib/ is not included in any "source.*" build entry"

However, while trying to report it will die with an NPE:

java.lang.NullPointerException
        at org.eclipse.pde.internal.core.builders.BuildErrorReporter.reportErrors(BuildErrorReporter.java:1068)
        at org.eclipse.pde.internal.core.builders.BuildErrorReporter.validate(BuildErrorReporter.java:164)
        at org.eclipse.pde.internal.core.builders.ErrorReporter.validateContent(ErrorReporter.java:127)
        at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateBuildProperties(ManifestConsistencyChecker.java:316)
        at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.validateProject(ManifestConsistencyChecker.java:231)
        at org.eclipse.pde.internal.core.builders.ManifestConsistencyChecker.build(ManifestConsistencyChecker.java:157)


Cause: report(..) will return null if the problem severity is IGNORED,
but reportErrors(..) does not catch this null but happily proceeds until ...


Naturally, this occurred while working on bug 186342 to support detecting
NPEs at compile time :)
In the future the return of report(..) should be declared as 
  "@Nullable IMarker"
which will cause marker.setAttribute(..) to be flagged as an error.
Simple as that.
Comment 1 Curtis Windatt CLA 2011-02-22 12:24:04 EST
Fixed in HEAD see BundleErrorReporter.java.  Added javadoc comments to the report methods to remind callers.  PDE is 1.4 compliant and we do not use annotations.