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

Bug 337882

Summary: NULL POINTER EXCEPTION MARSHALING JAXBELEMENT CONTAINING NULL OBJECT
Product: z_Archived Reporter: Matt MacIvor <matt.macivor>
Component: EclipselinkAssignee: Matt MacIvor <matt.macivor>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed Fix. none

Description Matt MacIvor CLA 2011-02-22 13:49:09 EST
A null pointer exception occurs when marshalling a null wrapped in a JAXBElement through EclipseLink JAXB.

java.lang.NullPointerException
at
org.eclipse.persistence.jaxb.JAXBMarshaller.wrapObjectInXMLRoot(JAXBMarshaller
.java:464)
at
org.eclipse.persistence.jaxb.JAXBMarshaller.wrapObject(JAXBMarshaller.java:453
)
at
org.eclipse.persistence.jaxb.JAXBMarshaller.marshal(JAXBMarshaller.java:377)
at testing.JaxbElementNull.main(JaxbElementNull.java:65) 

This is due to a missing null check when determining if the value wrapped the the JAXBElement is a binary type.
Comment 1 Matt MacIvor CLA 2011-02-22 13:52:23 EST
Created attachment 189527 [details]
Proposed Fix.
Comment 2 Matt MacIvor CLA 2011-02-23 13:18:45 EST
Attached patch checked in to SVN
Reviewed by David McCann
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:09:09 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink