Community
Participate
Working Groups
We ran into the following NPE from SourceTypeConverter calling CharOperation.subarray: java.lang.NullPointerException at org.eclipse.jdt.core.compiler.CharOperation.subarray(CharOperation.java:2675) at org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.convertAnnotations(SourceTypeConverter.java:562) at org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.convert(SourceTypeConverter.java:432) at org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.convert(SourceTypeConverter.java:150) at org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter.buildCompilationUnit(SourceTypeConverter.java:89) at org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.resolve(HierarchyResolver.java:511) at org.eclipse.jdt.internal.core.hierarchy.HierarchyResolver.resolve(HierarchyResolver.java:486) at org.eclipse.jdt.internal.core.hierarchy.HierarchyBuilder.buildSupertypes(HierarchyBuilder.java:119) at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.build(IndexBasedHierarchyBuilder.java:134) at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.compute(TypeHierarchy.java:320) at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.refresh(TypeHierarchy.java:1255) at com.bea.wlw.netui.core.pageflow.model.PageFlowProject$2.run(PageFlowProject.java:281) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76) It seems to have been caused by the getSource() call returning null, which I believe can happen if the underlying file is deleted at just the wrong time. I'm afraid I don't have a repro for this -- it's only happened a couple times. I attempted a fix by checking the results of getSource(), but Frederic reported the following via email: "SourceTypeConverter.getSource() should never return null. There's surely a real problem here and we must find the origin of it..."
+1 for 3.2RC2
Indeed the only path that can lead to null being returned is if the compilation unit's buffer is closed while getContents() runs.
Added null check in CompilationUnit#getContents() in the case of #IBuffer#getCharacters() returning null. In this case, returns an empty char array. Cannot add a test case since this is a timing issue.
Verified with I20060427-1600 for 3.2RC2