Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 357145 - NPE encountered when document contains an unmapped CDATA section
Summary: NPE encountered when document contains an unmapped CDATA section
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: 2011-09-08 15:07 EDT by Blaise Doughan CLA
Modified: 2022-06-09 10:28 EDT (History)
1 user (show)

See Also:


Attachments
MOXy - Test Cases (3.98 KB, patch)
2011-09-19 11:36 EDT, Blaise Doughan CLA
no flags Details | Diff
Core - Fix (566 bytes, patch)
2011-09-19 11:37 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 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