Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getResourceAsStream shouldn't throw Exception? #2

Closed
dratak opened this issue Jul 2, 2011 · 1 comment
Closed

getResourceAsStream shouldn't throw Exception? #2

dratak opened this issue Jul 2, 2011 · 1 comment
Assignees

Comments

@dratak
Copy link

dratak commented Jul 2, 2011

Great work on this. I'm using it to create an isolated container for running scheduled tasks.

However, I found an issue when using the JarClassLoader to load a spring configuration file.
During the rather convoluted jaxp/xerces validation sequence that occurs at one point the xerces code attempts to load a configuration setting which may or may not exist 'META-INF/services/org.apache.xerces.xni.parser.XMLParserConfiguration'.

The calling xerces code is not expecting an exception to be thrown if the resource does not exist rather it is simply checking for a null value to be returned. Due to the exception the whole sequence fails etc.

I was able to get around it by subclassing the JarClassLoader and simply overriding the getResourceAsStream method to swallow the exception and throw null. But it took some time to figure out this is what was causing the issue.

You may want to consider not throwing the exception so it is more consistent with the standard ClassLoader.( The current java 6 ClassLoader also does not throw an exception but simply returns null).
Thanks.

@ghost ghost assigned kamranzafar Oct 8, 2011
@kamranzafar
Copy link
Owner

fixed in v2.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants