Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366596 - XMLChoiceCollectionMapping with DOMPlatform failing on null collection
Summary: XMLChoiceCollectionMapping with DOMPlatform failing on null collection
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-12-13 13:36 EST by Blaise Doughan CLA
Modified: 2022-06-09 10:30 EDT (History)
1 user (show)

See Also:


Attachments
MOXy - Test Cases (5.20 KB, patch)
2011-12-13 13:42 EST, Blaise Doughan CLA
no flags Details | Diff
Core - Fix (6.52 KB, patch)
2011-12-13 13:42 EST, Blaise Doughan CLA
no flags Details | Diff
Core - Fix (2.3.3) (6.31 KB, patch)
2011-12-20 13:22 EST, 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-12-13 13:36:20 EST
When XMLChoiceCollectionMapping is used with the DOMPlatform a NPE is thrown if the collection property is null.

javax.xml.bind.MarshalException
 - with linked exception:
[java.lang.NullPointerException]
	at org.eclipse.persistence.jaxb.JAXBBinder.marshal(JAXBBinder.java:79)
	at org.eclipse.persistence.testing.jaxb.listofobjects.NullContainerTestCases.testBinderMarshal(NullContainerTestCases.java:36)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:243)
	at junit.framework.TestSuite.run(TestSuite.java:238)
	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
	at org.eclipse.persistence.internal.queries.CollectionContainerPolicy.iteratorFor(CollectionContainerPolicy.java:150)
	at org.eclipse.persistence.oxm.mappings.XMLChoiceCollectionMapping.writeFromObjectIntoRow(XMLChoiceCollectionMapping.java:281)
	at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.writeOutMappings(XMLObjectBuilder.java:347)
	at org.eclipse.persistence.internal.oxm.XMLObjectBuilder.buildRow(XMLObjectBuilder.java:325)
	at org.eclipse.persistence.oxm.XMLMarshaller.objectToXML(XMLMarshaller.java:1288)
	at org.eclipse.persistence.oxm.XMLBinder.marshal(XMLBinder.java:137)
	at org.eclipse.persistence.jaxb.JAXBBinder.marshal(JAXBBinder.java:76)
	... 20 more
Comment 1 Blaise Doughan CLA 2011-12-13 13:42:01 EST
Created attachment 208327 [details]
MOXy - Test Cases
Comment 2 Blaise Doughan CLA 2011-12-13 13:42:16 EST
Created attachment 208328 [details]
Core - Fix
Comment 3 Blaise Doughan CLA 2011-12-13 14:34:19 EST
Fix checked into trunk at rev:  10588

Code reviewed by:  Rick Barkhouse

Fix Description
In XMLChoiceCollectionMapping make sure the attributeValue is not null before asking the container policy for an iterator.
Comment 4 Blaise Doughan CLA 2011-12-20 13:21:42 EST
Back port fix to 2.3.3
Comment 5 Blaise Doughan CLA 2011-12-20 13:22:21 EST
Created attachment 208638 [details]
Core - Fix (2.3.3)
Comment 6 Blaise Doughan CLA 2011-12-20 13:24:12 EST
Fix checked into 2.3.3 at rev:  10607
Comment 7 Eclipse Webmaster CLA 2022-06-09 10:30:36 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink