AbstractClassLoader getResourceAsStream method issue
Brought to you by:
xeus_man
AbstractClassLoader getResourceAsStream method violates ClassLoader specification. When it can't find resource it should return null but it throws ResourceNotFoundException exception.
Some code may depend on this behaviour - in my case it was JAXB which was not able to create JAXBContext ( javax.xml.bind.ContextFinder.find(String factoryId, String contextPath, ClassLoader classLoader, Map properties) )
Piece of exception stack trace:
org.xeustechnologies.jcl.exception.ResourceNotFoundException: Resource org/openapplications/oagis/_9/jaxb.index not found.
at org.xeustechnologies.jcl.AbstractClassLoader.getResourceAsStream(AbstractClassLoader.java:140)
at com.sun.xml.bind.v2.ContextFactory.loadIndexedClasses(ContextFactory.java:216)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:186)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:277)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)