Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323387 - JAXB Validator throws NPE when no Schema is set
Summary: JAXB Validator throws NPE when no Schema is set
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-23 09:58 EDT by Blaise Doughan CLA
Modified: 2022-06-09 10:24 EDT (History)
1 user (show)

See Also:


Attachments
MOXy - Test Cases (4.14 KB, patch)
2010-11-02 16:18 EDT, Blaise Doughan CLA
no flags Details | Diff
Core - Fix (1.45 KB, patch)
2010-11-03 10:04 EDT, Blaise Doughan CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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