Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 362578 - Error unmarshalling when JAXB Context is created from both byte[].class and DataHandler.class
Summary: Error unmarshalling when JAXB Context is created from both byte[].class and D...
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-11-01 13:09 EDT by Matt MacIvor CLA
Modified: 2022-06-09 10:25 EDT (History)
0 users

See Also:


Attachments
Proposed Fix and Tests (1002 bytes, patch)
2011-11-01 13:38 EDT, Matt MacIvor CLA
no flags Details | Diff
proposed fix and test (5.65 KB, patch)
2011-11-01 14:59 EDT, Matt MacIvor CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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