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

Bug 357145

Summary: NPE encountered when document contains an unmapped CDATA section
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 2011-09-08 15:07:03 EDT
If a document that contains an unmapped CDATA section is unmarshalled the following NPE is thrown:

Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.persistence.oxm.record.UnmarshalRecord.startCDATA(UnmarshalRecord.java:1105)
	at org.eclipse.persistence.internal.oxm.record.XMLReader$LexicalHandlerWrapper.startCDATA(XMLReader.java:263)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startCDATA(Unknown Source)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at org.eclipse.persistence.internal.oxm.record.XMLReader.parse(XMLReader.java:171)
	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:573)
	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:482)
	at org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:560)
	at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:322)
	at blog.weather.YahooDemo.main(YahooDemo.java:32)
Comment 1 Blaise Doughan CLA 2011-09-19 11:36:42 EDT
Created attachment 203607 [details]
MOXy - Test Cases
Comment 2 Blaise Doughan CLA 2011-09-19 11:37:10 EDT
Created attachment 203609 [details]
Core - Fix
Comment 3 Blaise Doughan CLA 2011-09-19 12:10:47 EDT
Fix checked into 2.3.1 at rev:  10115
Fix checked into trunk at rev:  10116

Code reviewed by:  Denise Smith

Fix Details:
In UnmarshalRecord.startCDATA I check to see if the xPathNode is not null before performing actions on it.  It would be null for unmapped content.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:28:15 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink