[JIRA] Updated: (JXT-90) NullPointerException in createClassInstance in org.opensaml.xml.XMLConfigurator

Scott Cantor (JIRA) noreply at shibboleth.net
Wed Oct 24 14:24:07 EDT 2012


     [ https://issues.shibboleth.net/jira/browse/JXT-90?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Scott Cantor updated JXT-90:
----------------------------

    Fix Version/s: 1.4.0

> NullPointerException in createClassInstance in org.opensaml.xml.XMLConfigurator
> -------------------------------------------------------------------------------
>
>                 Key: JXT-90
>                 URL: https://issues.shibboleth.net/jira/browse/JXT-90
>             Project: XMLTooling - Java
>          Issue Type: Bug
>          Components: Validation
>    Affects Versions: 1.3.4
>         Environment: Stand-alone Java application using system classloader
>            Reporter: jbuhacoff at idp.protectnetwork.org
>            Assignee: Brent Putman
>            Priority: Minor
>             Fix For: 1.4.0
>
>   Original Estimate: 5 minutes
>  Remaining Estimate: 5 minutes
>
> In a stand-alone Java application using the system classloader, when using OpenSAML to verify a SAML assertion, the function createClassInstance is called (for example, to create an instance of XSAnyBuilder) and causes a NullPointerException.
> This happens because the getClassLoader() function may return null if the class was loaded by the system, or bootstrap, class loader. I tested with Sun JRE versions 1.5, 1.6, and 1.7 and they all do return null for the bootstrap classloader.
> Here are the relevant lines from XMLConfigurator in xmltooling version 1.3.4: 
> 328	            ClassLoader classLoader = this.getClass().getClassLoader();
> 329	            Class clazz = classLoader.loadClass(className);
> When running in a web container or Junit test in an IDE, there is a custom classloader hierarchy in place and everything works fine. But in an independent environment using the system class loader, the code throws a NullPointerException.
> This can be easily fixed by inserting the following line between the two lines shown:
>   if( classLoader == null ) { classLoader = ClassLoader.getSystemClassLoader(); }
> I made this patch in my own project and it's working fine now.
> Hope you will adopt this little fix in the next release.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the commits mailing list