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

Bug 362578

Summary: Error unmarshalling when JAXB Context is created from both byte[].class and DataHandler.class
Product: z_Archived Reporter: Matt MacIvor <matt.macivor>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed Fix and Tests
none
proposed fix and test none

Description Matt MacIvor CLA 2011-11-01 13:09:30 EDT
If we create a JAXBContext
containing both byte[] and DataHandler classes, we get an unmarshal error
trying to unmarshal a DOM node containing base64Binary data as a byte[].  If
we remove DataHandler.class from the JAXBContext, it works fine. 

Exception [EclipseLink-3001] (Eclipse Persistence Services -
2.3.1.v20111019-r10246):
org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [4xuxMDM=], of class [class
java.lang.String], could not be converted to [class [B].
at
org.eclipse.persistence.exceptions.ConversionException.couldNotBeConverted(Con
versionException.java:71)
at
org.eclipse.persistence.internal.helper.Helper.buildBytesFromHexString(Helper.
java:237)
at
org.eclipse.persistence.internal.helper.ConversionManager.convertObjectToByteA
rray(ConversionManager.java:316)
at
org.eclipse.persistence.internal.helper.ConversionManager.convertObject(Conver
sionManager.java:133)
at
org.eclipse.persistence.internal.oxm.XMLConversionManager.convertObject(XMLCon
versionManager.java:183)
at
org.eclipse.persistence.oxm.record.XMLRootRecord.getCurrentObject(XMLRootRecor
d.java:80)
at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmar
shaller.java:444)
at
org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmar
shaller.java:389)
at
org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:496
)
at
org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:
262)
at testing.DomTest.main(DomTest.java:27)

WORKAROUND:
-----------

TESTCASE DETAILS (REQUIRED):
----------------------------
Note the actual failing code in JRF creates the JAXBContext using the other
API and properly configured service providers, but with the same issue:

jaxbContext = (org.eclipse.persistence.jaxb.JAXBContext)
            JAXBContextFactory.createContext(schemaContentClasses,
properties);
Comment 1 Matt MacIvor CLA 2011-11-01 13:38:47 EDT
Created attachment 206281 [details]
Proposed Fix and Tests
Comment 2 Matt MacIvor CLA 2011-11-01 14:59:54 EDT
Created attachment 206289 [details]
proposed fix and test
Comment 3 Matt MacIvor CLA 2011-11-02 14:54:24 EDT
Proposed fix has been submitted into trunk and 2.3 streams
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:25:47 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink