geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] Commented: (XBEAN-39) NPE in XBeanHelper.createBeanDefinitionReader with some Classloaders
Date Thu, 10 Aug 2006 09:00:14 GMT
    [ http://issues.apache.org/jira/browse/XBEAN-39?page=comments#action_12427148 ] 
            
Guillaume Nodet commented on XBEAN-39:
--------------------------------------

Could you also indicate which system you use ? It may be useful for other users (and i'm a
bit curious ;) )

For the SpringVersion.getVersion problem, I think we could auto-discover the spring version
relying on class loaders.
Some classes in spring core have been changed in v2 and it should be easy to use that to autodiscover
the version
instead of relying on another external file.

For the second problem, i would suggest to invert the test you added and put it first:

    protected InputStream loadResource(String uri) {
        if (System.getProperty("xbean.dir") != null) {
            File f = new File(System.getProperty("xbean.dir") + uri);
            try {
                return new FileInputStream(f);
            } catch (FileNotFoundException e) {
                // Ignore
            }
        }
        // lets try the thread context class loader first
        InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(uri);
        if (in == null) {
            in = getClass().getClassLoader().getResourceAsStream(uri);
            if (in == null) {
                logger.debug("Could not find resource: " + uri);
            }
        }
        return in;
    }

This could be used to override an existing xbean mapping definition also.

Thoughts ?



> NPE in XBeanHelper.createBeanDefinitionReader with some Classloaders
> --------------------------------------------------------------------
>
>                 Key: XBEAN-39
>                 URL: http://issues.apache.org/jira/browse/XBEAN-39
>             Project: XBean
>          Issue Type: Bug
>    Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.5
>            Reporter: Stefan Kleineikenscheidt
>         Attachments: XBEAN-39.patch
>
>
> XBean fails on systems with some classloaders, which do not return sensible values from
the following methods
>   pkg.getImplementationVersion();  or
>   cl.getResourceAsStream(name);
> This leads to 
> a) a NPE thrown by SpringVersion.getVersion,
> b) the property files with custom mappings are not found.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message