Mark Wielaard writes: > Hi Christian, > > On Wed, 2006-03-01 at 11:15 +0100, Christian Thalinger wrote: > > The problem is around ResourceBundle.java:480, or better, at > > Class.java:1136. As you can see, the class contructor throws a NPE, but > > ResourceBundle.tryBundle does only catch IllegalAccessException, > > InstantiationException and ClassNotFoundException. > > > > The jikes rvm, which is the only classpath based JVM that can run dacapo > > xalan, has this code for Class.newInstance: > > > > // Run the default constructor on the it. > > try { > > VM_Reflection.invoke(defaultConstructor, obj, null); > > } catch (Throwable e) { > > InstantiationException ex = new InstantiationException(); > > ex.initCause(e); > > throw ex; > > } > > > > So, every exception in the contructor is converted into an > > InstantiationException, which obviously is caught in > > ResourceBundle.tryBundle. > > Aha. Now I understand the mauve test that Tom added for > Class.newInstance(). I don't have a working jikesrvm here, but jikesrvm > will fail this new test since it doesn't rethrow the exception from the > constructor invocation. (This might be our poor documentation, we should > clearly mention that we get an InvocationTargetException, then we unwrap > it and rethrow the original exception from the constructor.) > > > I think we should handle that properly in GNU Classpath, as all VMs > > would have the same code here. > > Looks like we should catch any exception thrown by the class constructor > in tryBundle() and treat it as if the initialization failed for that > ResourceBundle so we try the next one. > > Does the dacapo xalan work for you with the following patch? > > diff -u -r1.36 ResourceBundle.java > --- java/util/ResourceBundle.java 23 Oct 2005 17:04:46 -0000 1.36 > +++ java/util/ResourceBundle.java 1 Mar 2006 10:59:59 -0000 > @@ -476,9 +476,7 @@ > if (ResourceBundle.class.isAssignableFrom(rbClass)) > bundle = (ResourceBundle) rbClass.newInstance(); > } > - catch (IllegalAccessException ex) {} > - catch (InstantiationException ex) {} > - catch (ClassNotFoundException ex) {} > + catch (Throwable t) { /* Class initialization failed, no valid bundle. */ } Are you sure about this? Do you really want to catch VirtualMachineError here? Andrew.