JDK-6707027 : langtools/test/tools/javac/processing/model/testgetallmember/Main.java fails
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2008-05-26
  • Updated: 2012-01-13
  • Resolved: 2012-01-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b48Fixed OpenJDK6Fixed
Description
FULL PRODUCT VERSION :
openjdk version "1.7.0-internal"
OpenJDK Runtime Environment (build 1.7.0-internal-gafter_2008_05_18_18_43-b00)
OpenJDK Server VM (build 12.0-b03, mixed mode)


ADDITIONAL OS VERSION INFORMATION :
Linux vmware-ubuntu 2.6.24-16-generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 GNU/Linux


A DESCRIPTION OF THE PROBLEM :
One regression test fails

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the langtools regression test in the usual way after building openjdk


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Looking at com.sun.org.apache.xalan.internal.client.XSLTProcessorApplet$TrustedAgent
java.lang.NullPointerException
    at com.sun.tools.javac.util.JavacFileManager$ZipFileIndexFileObject.<init>(JavacFileManager.java:1566)
    at com.sun.tools.javac.util.JavacFileManager$ZipFileIndexArchive.getFileObject(JavacFileManager.java:1703)
    at com.sun.tools.javac.util.JavacFileManager.listDirectory(JavacFileManager.java:367)
    at com.sun.tools.javac.util.JavacFileManager.list(JavacFileManager.java:889)
    at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:2099)
    at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1803)
    at com.sun.tools.javac.code.Symbol.complete(Symbol.java:396)
    at com.sun.tools.javac.jvm.ClassReader.completeOwners(ClassReader.java:1815)
    at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1794)
    at com.sun.tools.javac.code.Symbol.complete(Symbol.java:396)
    at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:773)
    at com.sun.tools.javac.jvm.ClassReader.loadClass(ClassReader.java:1973)
    at com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:860)
    at com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:1025)
    at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:274)
    at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:265)
    at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1657)
    at com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
    at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:268)
    at com.sun.tools.javac.comp.Attr$IdentAttributer.visitMemberSelect(Attr.java:265)
    at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1657)
    at com.sun.tools.javac.comp.Attr.attribIdent(Attr.java:261)
    at com.sun.tools.javac.main.JavaCompiler.resolveIdent(JavaCompiler.java:596)
    at com.sun.tools.javac.model.JavacElements.nameToSymbol(JavacElements.java:171)
    at com.sun.tools.javac.model.JavacElements.getTypeElement(JavacElements.java:153)
    at com.sun.tools.javac.model.JavacElements.getTypeElement(JavacElements.java:62)
    at Main.main(Main.java:80)
    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:623)
    at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:96)
    at java.lang.Thread.run(Thread.java:674)

JavaTest Message: Test threw exception: java.lang.NullPointerException
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.NullPointerException

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Included in openjdk
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
unknown

Release Regression From : 6
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION Applying OpenJDK 6 fix to address spurious failures when running with openjdk=true builds; may not address NPE problem.
27-01-2009

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.
23-09-2008

EVALUATION Test passes in all available promoted builds of JDK 7 and OpenJDK 6.
23-09-2008

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.
23-09-2008