« Return to Thread: Fwd: Exception in SAXParserFactory.newInstance with 3.0M4

Re: Exception in SAXParserFactory.newInstance with 3.0M4

by Andrus Adamchik :: Rate this Message:

Reply to Author | View in Thread

> BTW, I'm using SWT if that is pertinent.

It probably is. The ClassLoader settings are likely different.

Anyways the code in question does look suspect. I implemented a bit  
more paranoid version of this method (without actually knowing whether  
null values are valid here or not). The code is checked in to trunk,  
and you may try this cayenne-server.jar that contains the fix:

http://people.apache.org/~aadamchik/patched/cayenne-server-3.0-07012008.jar

Andrus




On Jul 1, 2008, at 9:02 PM, Jerald Dawson wrote:

> Ok, more info. I have been stepping through the code to see what is  
> actually throwing the NPE and I've come to this code in  
> DataSourceInfo class:
>
>   public PasswordEncoding getPasswordEncoder() {
>       PasswordEncoding encoder = null;
>
>       try {
>           encoder = (PasswordEncoding) Thread
>                   .currentThread()
>                   .getContextClassLoader()
>                   .loadClass(getPasswordEncoderClass())
>                   .newInstance();
>           // encoder = (PasswordEncoding)
>           // Class.forName(getPasswordEncoderClass()).newInstance();
>       }
> ...
>
> Now following the code, I notice that the getContextClassLoader call  
> returns null which seems to be the source of the NPE. Is there a  
> reason getContextClassLoader would be returning null?
>
> BTW, I'm using SWT if that is pertinent.



 « Return to Thread: Fwd: Exception in SAXParserFactory.newInstance with 3.0M4

LightInTheBox - Buy quality products at wholesale price!