Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323387

Summary: JAXB Validator throws NPE when no Schema is set
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.oxm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
MOXy - Test Cases
none
Core - Fix none

Description Blaise Doughan CLA 2010-08-23 09:58:55 EDT
Steps to reproduce:

1.  Create a JAXBContext on a model
2.  Create a Validator
3.  Call validateRoot on a root object

Exception in thread "main" javax.xml.bind.ValidationException
 - with linked exception:
[java.lang.NullPointerException]
	at org.eclipse.persistence.jaxb.JAXBValidator.validateRoot(JAXBValidator.java:58)
	at forum38.Demo.main(Demo.java:15)
Caused by: java.lang.NullPointerException
	at sun.misc.MetaIndex.mayContain(MetaIndex.java:225)
	at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:747)
	at sun.misc.URLClassPath.getResource(URLClassPath.java:169)
	at sun.misc.URLClassPath.getResource(URLClassPath.java:221)
	at java.lang.ClassLoader.getBootstrapResource(ClassLoader.java:1151)
	at java.lang.ClassLoader.getResource(ClassLoader.java:1000)
	at java.lang.ClassLoader.getResource(ClassLoader.java:998)
	at java.lang.ClassLoader.getResource(ClassLoader.java:998)
	at org.eclipse.persistence.oxm.schema.XMLSchemaClassPathReference.getURL(XMLSchemaClassPathReference.java:43)
	at org.eclipse.persistence.oxm.schema.XMLSchemaReference.isValid(XMLSchemaReference.java:166)
	at org.eclipse.persistence.oxm.XMLValidator.validateRoot(XMLValidator.java:68)
	at org.eclipse.persistence.jaxb.JAXBValidator.validateRoot(JAXBValidator.java:56)
	... 1 more
Comment 1 Blaise Doughan CLA 2010-11-02 16:18:49 EDT
Created attachment 182248 [details]
MOXy - Test Cases
Comment 2 Blaise Doughan CLA 2010-11-03 10:04:51 EDT
Created attachment 182298 [details]
Core - Fix

Similar to how we implemented XMLSchemaFileReference and XMLSchemaURLReference.  If XMLSchemaClassPathReference encounters a problem with the URL a XMLMarshalException.errorResolvingXMLSchema(e) exception should be thrown.
Comment 3 Blaise Doughan CLA 2010-11-03 10:13:06 EDT
Fix checked into trunk at rev:  8461
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:24:52 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink