JDK-6383446 : Regression in Mustang b70 : throws java.lang.IllegalAccessError
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2006-02-09
  • Updated: 2010-08-06
  • Resolved: 2006-02-10
Related Reports
Duplicate :  
Description
Regression in Mustang b70 : throws java.lang.IllegalAccessError

was working till b69 and with Tiger . 

To reproduce the issue :
--------------------------
use Mustang b70 

Please see attached -  Test.java , entref01gold.out and Tidy.jar( this is a testutil jar file )
in Test.java - update  'String docURI'  to the location where entref01gold.out is saved .

setenv CLASSPATH .:./Tidy.jar
javac Test.java 
java Test

error message :
---------------
java Test

fatal error : org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.
line 1 column 1 - Error: <out> is not recognized!
Exception in thread "main" java.lang.IllegalAccessError: tried to access field org.w3c.tidy.ParserImpl._parseHead from class org.w3c.tidy.ParserImpl$ParseHTML
        at org.w3c.tidy.ParserImpl$ParseHTML.parse(ParserImpl.java)
        at org.w3c.tidy.ParserImpl.parseDocument(ParserImpl.java)
        at org.w3c.tidy.Tidy.parse(Tidy.java)
        at org.w3c.tidy.Tidy.parseDOM(Tidy.java)
        at Test.parse(Test.java:69)
        at Test.main(Test.java:17)


the fatal error part in error message can be ignored here - part of the test .

Comments
EVALUATION We're looking into an alternate solution for this, which will base the access control check differently for different classfile versions. Closing this as a duplicate of that work.
10-02-2006

EVALUATION In b70, the VM is tightened to perform access checks by default on local files. Previously to b70, this only occurred when running with '-verify'. You can verify that this is the case by running the example test with b69 and the '-verify' flag. The Tidy.jar jar file contains classes (namely, org.w3c.tidy.ParserImpl$ParseHTML) that attempt to access a private field of another class (org.w3c.tidy.ParserImpl._parseHead). New versions of javac generate synthetic accessors to allow this to happen legally, but old versions of javac just generate the illegal 'getfield' instruction. The VM as of b70 now catches this illegal access. Solution: either recompile Tidy.jar with a newer javac compiler, or disable the VM stricter checking by adding the command-line flag -XX:+RelaxAccessControlCheck.
09-02-2006

WORK AROUND Recompile Tidy.jar
09-02-2006

WORK AROUND -XX:+RelaxAccessControlCheck
09-02-2006