Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331946 - NullPointerException using XMLAnyCollectionMapping with XDK Parser
Summary: NullPointerException using XMLAnyCollectionMapping with XDK Parser
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-12-06 15:13 EST by Rick Barkhouse CLA
Modified: 2022-06-09 10:29 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Barkhouse CLA 2010-12-06 15:13:17 EST
The following two tests are failing when run with the Oracle XDK parser:

Java Project Source w/SAX Parsing: XmlAnyElementTestCase: testRoundTrip
Java Project Source w/SAX Parsing: XmlAnyElementLaxTestCase: testRoundTrip


javax.xml.bind.MarshalException
- with linked exception:
[java.lang.NullPointerException]
at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:466)
at org.eclipse.persistence.testing.jaxb.JAXBTestCases.objectToXMLStringWriter(JAXBTestCases.java:258)
at org.eclipse.persistence.testing.jaxb.JAXBTestCases.testRoundTrip(JAXBTestCases.java:180)
Caused by: java.lang.NullPointerException
at org.eclipse.persistence.internal.oxm.record.DOMReader.parse(DOMReader.java:88)
at org.eclipse.persistence.internal.oxm.record.XMLFragmentReader.parse(XMLFragmentReader.java:53)
at org.eclipse.persistence.oxm.record.WriterRecord.node(WriterRecord.java:298)
at org.eclipse.persistence.internal.oxm.XMLAnyCollectionMappingNodeValue.marshalSingleValue(XMLAnyCollectionMappingNodeValue.java:257)
at org.eclipse.persistence.internal.oxm.XMLAnyCollectionMappingNodeValue.marshal(XMLAnyCollectionMappingNodeValue.java:83)
at org.eclipse.persistence.internal.oxm.NodeValue.marshal(NodeValue.java:151)
at org.eclipse.persistence.internal.oxm.NodeValue.marshal(NodeValue.java:104)
at org.eclipse.persistence.internal.oxm.record.ObjectMarshalContext.marshal(ObjectMarshalContext.java:60)
at org.eclipse.persistence.internal.oxm.XPathNode.marshal(XPathNode.java:322)
at org.eclipse.persistence.internal.oxm.TreeObjectBuilder.buildRow(TreeObjectBuilder.java:325)
at org.eclipse.persistence.oxm.XMLMarshaller.marshal(XMLMarshaller.java:934)
at org.eclipse.persistence.oxm.XMLMarshaller.marshal(XMLMarshaller.java:572)
at org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:464)
Comment 1 Rick Barkhouse CLA 2010-12-06 15:15:38 EST
After debugging this issue, the problem stems from the following method in DomHandlerConverter.  Before the transform, the element is correct, but afterwards the element is removed and only the text content remains, problem seems to lie in the XDK Transformer.

	public Object convertDataValueToObjectValue(Object dataValue, Session session, XMLUnmarshaller unmarshaller) {
		if(dataValue instanceof org.w3c.dom.Element) {
			ErrorHandler handler = unmarshaller.getErrorHandler();
			Result result = null;
			if(handler != null && handler instanceof JAXBErrorHandler) {
				result = domHandler.createUnmarshaller(((JAXBErrorHandler)handler).getValidationEventHandler());
			} else {
				result = domHandler.createUnmarshaller(null);
			}
			xmlTransformer.transform((org.w3c.dom.Element)dataValue, result);
			Object value = domHandler.getElement(result);
			return value;
		}
		return dataValue;
	}
Comment 2 Rick Barkhouse CLA 2010-12-06 16:41:35 EST
A temporary fix for this issue has been checked in as part of bug 329674.

When this bug is fixed, the changes to XmlAnyElementLaxTestCases/XmlAnyElementTestCases that are present on that bug should be rolled back.
Comment 3 Rick Barkhouse CLA 2011-03-15 10:39:58 EDT
Fixed as a result of the fix for bug 339734.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:29:19 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink