Community
Participate
Working Groups
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)
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; }
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.
Fixed as a result of the fix for bug 339734.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink