| Summary: | NPE in JDTPackage constructor for default packages | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [WebTools] Dali JPA Tools | Reporter: | Dmitry Geraskov <geraskov> | ||||||
| Component: | General | Assignee: | Neil Hauge <neil.hauge> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | major | ||||||||
| Priority: | P3 | CC: | geraskov, karenfbutzke, neil.hauge, paul.fullbright | ||||||
| Version: | unspecified | Flags: | neil.hauge:
review+
|
||||||
| Target Milestone: | 3.0.1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | fix_ready | ||||||||
| Attachments: |
|
||||||||
|
Description
Dmitry Geraskov
I would like to create a patch for this, but I didn't find or.eclipse.jpt.common.core in the repository :pserver:anonymous@dev.eclipse.org:/cvsroot/webtools. Could you please help me? It's under org.eclipse.jpa/components/common/plugins/ Just to be clear, are you attempting to add support for package-info.java in default packages (if so, how can that be done?) or are you merely attempting to provide error handling for the error case of having a package-info.java in a default package? There is no problem with having package-info.java in default package from java point of view. The only thing - it is useless as it can't have annotations inside (because of pacakge declaration absence). JDTPackage throws NPE in constructor when we try to create it for such package-info.java (actually there is no null cheks in many places). There are 2 ways of fixing this: 1. As package-info.java in default package is useless we can ignore it in JavaPackageInfoResourceModelProvider and return null from buildResourceModel. 2. Add null PacakgeDeclaration checks in JDTPackage (and probably some other classes) I'll attach a patch with first solution. If it is suitable for you, please apply, or let me know and I'll create a patch with second solution. Created attachment 200690 [details]
The patch which ignore package-info placed in default package
The patch with first solution is attached
Created attachment 200751 [details]
proposed patch against 3.0 maintenance
I think your solution is reasonable. I've attached a new patch that includes the original change plus the same change in the corresponding JavaPackageInfoResourceModelProvider file in org.eclipse.jpt.jaxb.core
Checked in to 3_0_maintenance and HEAD. Thanks for the patch! |