Hi!
Yesterday I investigated the dacapo xalan problem. It's about
Class.newInstance. The exceptions thrown is:
Exception in thread "main" java.lang.NullPointerException
at java.io.InputStreamReader.<init> (InputStreamReader.java:198)
at java.util.Properties.load (Properties.java:198)
at java.util.PropertyResourceBundle.<init> (PropertyResourceBundle.java:109)
at org.apache.xalan.res.XSLTErrorResources.<init>
(XSLTErrorResources.java:82)
at java.lang.reflect.Constructor.constructNative (Native Method)
at java.lang.reflect.Constructor.newInstance (Constructor.java:242)
at java.lang.Class.newInstance (Class.java:1136)
at java.util.ResourceBundle.tryBundle (ResourceBundle.java:480)
at java.util.ResourceBundle.tryBundle (ResourceBundle.java:565)
at java.util.ResourceBundle.getBundle (ResourceBundle.java:403)
at java.util.ResourceBundle.getBundle (ResourceBundle.java:244)
at org.apache.xalan.res.XSLMessages.loadResourceBundle (XSLMessages.java:514)
at org.apache.xalan.xslt.Process.main (Process.java:208)
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.
I think we should handle that properly in GNU Classpath, as all VMs
would have the same code here.
TWISTI