Hi Rutger, can you please create a new issue in jira (http://jira.codehaus.org/browse/CASTOR) for what you have found. It would be great if you could also attach a test case to allow the committer to reproduce the problem.
Regards Ralf Castor JDO, committer Lubbers, Rutger, VF-NL schrieb: > Hi there, > > I'm trying to (junit) test some code via an ant task. In this unit test > a castor generated object is marshalled to xml. > This marshalling now fails because of a null pointer: > [junit] Testcase: testUserType took 0,174 sec > [junit] Caused an ERROR > [junit] null > [junit] java.lang.NullPointerException > [junit] at > org.exolab.castor.xml.util.ClassDescriptorResolverImpl.loadPackageMappin > g(ClassDescriptorResolverImpl.java:802) > [junit] at > org.exolab.castor.xml.util.ClassDescriptorResolverImpl.resolve(ClassDesc > riptorResolverImpl.java:258) > [junit] at > org.exolab.castor.xml.Validator.validate(Validator.java:111) > [junit] at > org.exolab.castor.xml.Marshaller.validate(Marshaller.java:2482) > [junit] at > org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:811) > > The code in 0.9.7 did work, >0.9.9 did have this problem. > > The code here assumes that a class loader exists for a given class > (which is ofcourse true, otherwise it couldn't be executed ;-). From the > java API doc, 'null' may be returned instead of the bootstrap class > loader, so the class loader may not always be represented by an actual > class. > > The following code should remedy this, in > org.exolab.castor.xml.util.ClassDescriptorResolverImpl#loadPackageList, > lines 718 - 721: > URL url = null; > if (loader == null) loader = _loader; > if (loader == null) loader = getClass().getClassLoader(); > if (loader != null) url = loader.getResource(filename); > > The same goes for the method > org.exolab.castor.xml.util.ClassDescriptorResolverImpl#loadPackageMappin > g, lines 801-804 > URL url = null; > if (loader == null) loader = _loader; > if (loader == null) loader = getClass().getClassLoader(); > if (loader != null) url = loader.getResource(filename); > > Now I don't see the NPE anymore. :-) > > Hope this helps, > > Rutger Lubbers > > > > > ------------------------------------------------- > If you wish to unsubscribe from this list, please > send an empty message to the following address: > > [EMAIL PROTECTED] > ------------------------------------------------- > ------------------------------------------------- If you wish to unsubscribe from this list, please send an empty message to the following address: [EMAIL PROTECTED] -------------------------------------------------

