EVALUATION
Reproduced, sort of. I get the test failing, with a different backtrace:
com.sun.tools.javac.jvm.ClassReader$BadClassFile: bad class file: Log$2.class
bad enclosing method attribute: com.sun.tools.javac.util.Log$2
Please remove or make sure it appears in the correct subdirectory of the classpath.
at com.sun.tools.javac.jvm.ClassReader.badClassFile(ClassReader.java:281)
at com.sun.tools.javac.jvm.ClassReader.readEnclosingMethodAttr(ClassReader.java:937)
at com.sun.tools.javac.jvm.ClassReader.readMemberAttr(ClassReader.java:918)
at com.sun.tools.javac.jvm.ClassReader.readClassAttr(ClassReader.java:1062)
at com.sun.tools.javac.jvm.ClassReader.readClassAttrs(ClassReader.java:1076)
at com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:1569)
at com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:1667)
at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:1854)
at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1786)
at com.sun.tools.javac.code.Symbol.complete(Symbol.java:398)
at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:775)
at com.sun.tools.javac.code.Symbol$ClassSymbol.flags(Symbol.java:717)
at com.sun.tools.javac.code.Symbol$TypeSymbol.getEnclosedElements(Symbol.java:554)
at Main.main(Main.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
at java.lang.Thread.run(Thread.java:636)
This is from using bootclasspath against openjdk 6, and is caused by extra, inconsistent classes being found on the bootclasspath in tools.jar, when running tests with -Xbootclasspath/p.
|
EVALUATION
I cannot directly reproduce the NPE. The code that generated the NPE has been substantially reorged since the bug was reported, but would now appear to be in file/ZipFileIndexArchive.java, method getFileObject(RelativeDirectory subdir, String file), lines 68-69.
There would still appear to be a potential vulnerability for NPE in these lines:
ZipFileIndex.Entry entry = zfIndex.getZipIndexEntry(fullZipFileName);
JavaFileObject ret = new ZipFileIndexFileObject(fileManager, zfIndex, entry, zfIndex.getZipFile().getPath());
in the case where entry gets initialized to null. Examining usages of this method (getFileObject) should protect against the possibility of null, but arguably it would be worth inserting
if (entry == null)
return null;
The most plausible explanation for provoking null would appear to be an inconsistent set of class files on the class path, so that for example the inner or outer class for a class might be missing. This can happen, for example, after a change to the code base when using -Xbootclasspath, when "orphaned" inner classes might be found.
|