JDK-4250326 : IllegalAccessError calling ElementNode.getFirstChild //ProjectX (XML)
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 1999-06-29
  • Updated: 1999-07-23
  • Resolved: 1999-07-23
Related Reports
Duplicate :  
Description

Name: krT82822			Date: 06/28/99


This problem relates to ProjectX XML parsing on JDK 1.2.  It occurs on NT4 and Solaris with code compiled using JBuilder 3.  

When calling com.sun.xml.tree.ElementNode.getFirstChild I get the following error:

java.lang.IllegalAccessError: try to access class com/sun/xml/tree/ParentNode from class com/inprise/ejb/ddeditor/rootfactory/DescriptorUtils

This call is rightfully an illegal access because getFirstChild is implemented in a package-access abstract class (ParentNode).  However, the Sun compiler does not flag this as illegal.  

I have to write very ugly code to work around this error when using a compiler that enforces strict access control.
(Review ID: 84946) 
======================================================================

Comments
WORK AROUND Name: krT82822 Date: 06/28/99 To get around this IllegalAccessError I do the following: Replace: for (Node n = node.getFirstChild(); n != null; n = n.getNextSibling()) { } With: NodeList nodes = (NodeList)node; //node.getChildNodes(); for (int i = 0; true; i++) { Node n = nodes.item(i); if (n == null) break; ... } ======================================================================
11-06-2004

EVALUATION This is a duplicate of 4183590 janet.koenig@Eng 1999-07-22
22-07-1999