Re: Exception in SAXParserFactory.newInstance with 3.0M4

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Jul 01 2008 - 14:18:34 EDT

  • Next message: Jerald Dawson: "Re: Exception in SAXParserFactory.newInstance with 3.0M4"

    > 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.



    This archive was generated by hypermail 2.0.0 : Tue Jul 01 2008 - 14:19:06 EDT