This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 67533

Summary: Exception during startup java.lang.IllegalAccessException: Class org.netbeans.core.xml.FileEntityResolver
Product: platform Reporter: ahe <ahe>
Component: -- Other --Assignee: Jaroslav Tulach <jtulach>
Status: RESOLVED FIXED    
Severity: blocker CC: jchalupa
Priority: P4    
Version: 5.x   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: messages.log

Description ahe 2005-10-26 02:59:51 UTC
During start up of NetBeans 5.0 beta I got this exception.


java.lang.IllegalAccessException: Class org.netbeans.core.xml.FileEntityResolver
can not access a member of class org.openide.loaders.XMLDataObject with
modifiers "static"
        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
        at java.lang.reflect.Method.invoke(Method.java:582)
[catch] at
org.netbeans.core.xml.FileEntityResolver.createInfoLookup(FileEntityResolver.java:206)
        at
org.netbeans.core.xml.FileEntityResolver.findLookup(FileEntityResolver.java:174)
        at
org.netbeans.core.xml.FileEntityResolver.access$200(FileEntityResolver.java:58)
        at
org.netbeans.core.xml.FileEntityResolver$Lkp.update(FileEntityResolver.java:500)
        at
org.netbeans.core.xml.FileEntityResolver$Lkp.beforeLookup(FileEntityResolver.java:466)
        at
org.openide.util.lookup.ProxyLookup$R.myBeforeLookup(ProxyLookup.java:488)
        at org.openide.util.lookup.ProxyLookup$R.computeResult(ProxyLookup.java:413)
        at org.openide.util.lookup.ProxyLookup$R.allItems(ProxyLookup.java:404)
        at
org.openide.loaders.XMLDataObject$InfoParser.lookupCookie(XMLDataObject.java:1080)
        at org.openide.loaders.XMLDataObject.getCookie(XMLDataObject.java:312)
Comment 1 ahe 2005-10-26 03:00:31 UTC
Created attachment 26336 [details]
messages.log
Comment 2 Jaroslav Tulach 2005-10-27 22:22:08 UTC
I'd bet you have not seen this exception more than once. Lucky moment to catch 
such race condition. 
Comment 3 Jaroslav Tulach 2005-10-27 22:25:17 UTC
Double locking is bad: 
 
          if (method == null) { 
              try { 
!                 method = XMLDataObject.class.getDeclaredMethod 
("createInfoLookup", new Class[] { // NOI18N 
                      XMLDataObject.class, 
                      XMLDataObject.Info.class 
                  }); 
!                 method.setAccessible (true); 
              } catch (Exception ex) { 
                  ErrorManager.getDefault ().notify (ex); 
                  return null; 
--- 192,203 ---- 
          // well, it is a wormhole, but just for default compatibility 
          if (method == null) { 
              try { 
!                 java.lang.reflect.Method m = 
XMLDataObject.class.getDeclaredMethod ("createInfoLookup", new Class[] { // 
NOI18N 
                      XMLDataObject.class, 
                      XMLDataObject.Info.class 
                  }); 
!                 m.setAccessible (true); 
!                 method = m;