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

Bug 364215

Summary: Error with XmlAdapter<byte[], Foo>
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.oxm-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
MOXY - Test Cases
none
Core - Fix none

Description Blaise Doughan CLA 2011-11-19 06:40:10 EST
There is currently an error when a byte[] is used as the value type in an XmlAdapter.
Comment 1 Blaise Doughan CLA 2011-11-19 06:50:02 EST
Created attachment 207263 [details]
MOXY - Test Cases
Comment 2 Blaise Doughan CLA 2011-11-19 06:50:38 EST
Created attachment 207264 [details]
Core - Fix
Comment 3 Blaise Doughan CLA 2011-11-19 06:56:34 EST
Sample Exception:

javax.xml.bind.UnmarshalException
 - with linked exception:
[Exception [EclipseLink-3001] (Eclipse Persistence Services - 2.3.2.qualifier): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [[B@513cf0], of class [class [B], could not be converted to [class org.eclipse.persistence.testing.jaxb.xmladapter.bytearray.BinaryData].]
	at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:143)
	at org.eclipse.persistence.testing.jaxb.JAXBTestCases.testXMLToObjectFromInputStream(JAXBTestCases.java:201)
	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: Exception [EclipseLink-3001] (Eclipse Persistence Services - 2.3.2.qualifier): org.eclipse.persistence.exceptions.ConversionException
Exception Description: The object [[B@513cf0], of class [class [B], could not be converted to [class org.eclipse.persistence.testing.jaxb.xmladapter.bytearray.BinaryData].
	at org.eclipse.persistence.exceptions.ConversionException.couldNotBeConverted(ConversionException.java:71)
	at org.eclipse.persistence.internal.helper.ConversionManager.convertObject(ConversionManager.java:169)
	at org.eclipse.persistence.internal.oxm.XMLConversionManager.convertObject(XMLConversionManager.java:180)
	at org.eclipse.persistence.internal.oxm.XMLBinaryDataHelper.convertObject(XMLBinaryDataHelper.java:85)
	at org.eclipse.persistence.internal.oxm.XMLInlineBinaryHandler.endElement(XMLInlineBinaryHandler.java:102)
	at org.eclipse.persistence.internal.oxm.record.deferred.EndElementEvent.processEvent(EndElementEvent.java:37)
	at org.eclipse.persistence.internal.oxm.record.deferred.DeferredContentHandler.executeEvents(DeferredContentHandler.java:61)
	at org.eclipse.persistence.internal.oxm.record.deferred.BinaryMappingContentHandler.executeEvents(BinaryMappingContentHandler.java:75)
	at org.eclipse.persistence.internal.oxm.record.deferred.BinaryMappingContentHandler.processSimpleElement(BinaryMappingContentHandler.java:67)
	at org.eclipse.persistence.internal.oxm.record.deferred.DeferredContentHandler.endElement(DeferredContentHandler.java:119)
	at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parseEvent(XMLStreamReaderReader.java:127)
	at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parse(XMLStreamReaderReader.java:86)
	at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parse(XMLStreamReaderReader.java:76)
	at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:734)
	at org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:598)
	at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:503)
	at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:134)
	... 20 more
Comment 4 Blaise Doughan CLA 2011-11-19 14:01:29 EST
Fix checked into 2.3.2 at rev:  10429
Fix checked into trunk at rev:  10430


Fix By:  Matt MacIvor
Reviewed and Tested By: Blaise Doughan

Fix Details:
Changed where the conversion is done based on the presence of a converter (XmlAdapter).
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:25:12 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink