Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318016 - External Metadata - NPE thrown when processing invalid XmlJavaTypeAdapter
Summary: External Metadata - NPE thrown when processing invalid XmlJavaTypeAdapter
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: Blaise Doughan CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-25 13:03 EDT by Blaise Doughan CLA
Modified: 2022-06-09 10:15 EDT (History)
1 user (show)

See Also:


Attachments
Core - Fix (1.53 KB, patch)
2010-06-25 13:05 EDT, Blaise Doughan CLA
no flags Details | Diff
MOXy - Fix (3.84 KB, patch)
2010-06-25 13:06 EDT, Blaise Doughan CLA
no flags Details | Diff
Core - Fix (3.98 KB, patch)
2010-06-28 16:23 EDT, Blaise Doughan CLA
no flags Details | Diff
MOXy - Fix (9.93 KB, patch)
2010-06-28 16:23 EDT, Blaise Doughan CLA
no flags Details | Diff
MOXy - Test Cases (8.70 KB, patch)
2010-06-29 13:21 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-06-25 13:03:52 EDT
The following NPE is thrown if an invalid XmlJavaTypeAdapter is specified in the external metadata:

Caused by: java.lang.NullPointerException
	at org.eclipse.persistence.jaxb.compiler.Property.setAdapterClass(Property.java:132)
	at org.eclipse.persistence.jaxb.compiler.Property.setXmlJavaTypeAdapter(Property.java:518)
	at org.eclipse.persistence.jaxb.compiler.XMLProcessor.processXmlElement(XMLProcessor.java:700)
	at org.eclipse.persistence.jaxb.compiler.XMLProcessor.processJavaAttribute(XMLProcessor.java:350)
	at org.eclipse.persistence.jaxb.compiler.XMLProcessor.processJavaType(XMLProcessor.java:328)
	at org.eclipse.persistence.jaxb.compiler.XMLProcessor.processXML(XMLProcessor.java:278)
	at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:141)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:244)
	... 37 more


ie.

<?xml version="1.0"?>
<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm">
    <java-types>
        <java-type name="org.example.customer.PurchaseOrder">
            <java-attributes>
                <xml-element java-attribute="customer" >
                    <xml-java-type-adapter value="org.example.customer.metadata.InvalidCustomerAdapter"/>
                </xml-element>
            </java-attributes>
        </java-type>
    </java-types>
</xml-bindings>
Comment 1 Blaise Doughan CLA 2010-06-25 13:05:41 EDT
Created attachment 172783 [details]
Core - Fix
Comment 2 Blaise Doughan CLA 2010-06-25 13:06:12 EDT
Created attachment 172784 [details]
MOXy - Fix
Comment 3 Blaise Doughan CLA 2010-06-28 16:23:32 EDT
Created attachment 172950 [details]
Core - Fix
Comment 4 Blaise Doughan CLA 2010-06-28 16:23:50 EDT
Created attachment 172951 [details]
MOXy - Fix
Comment 5 Blaise Doughan CLA 2010-06-29 13:21:41 EDT
Created attachment 173022 [details]
MOXy - Test Cases
Comment 6 Blaise Doughan CLA 2010-06-29 13:25:49 EDT
Fix checked into 2.1.1 at rev:  7717
Fix checked into trunk at rev:  7718

Code reviewed by David McCann

Log messages like the following are now reported:
[EL Warning]: 2010-06-28 16:37:34.057--An invalid XmlJavaTypeAdapter [invalid.class.name.1] was specified for package [org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmladapter.negative], and will be ignored.
[EL Warning]: 2010-06-28 16:37:34.057--An invalid XmlJavaTypeAdapter [invalid.class.name.2] was specified for class [org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmladapter.negative.Customer], and will be ignored.
[EL Warning]: 2010-06-28 16:37:34.073--An invalid XmlJavaTypeAdapter [invalid.class.name.3] was specified for field/property [id] on class [org.eclipse.persistence.testing.jaxb.externalizedmetadata.xmladapter.negative.Customer], and will be ignored.
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:10:49 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 8 Eclipse Webmaster CLA 2022-06-09 10:15:12 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink