Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364053 - Error creating context if using subclass of JAXBElement<byte[]>
Summary: Error creating context if using subclass of JAXBElement<byte[]>
Status: CLOSED DUPLICATE of bug 367791
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-17 11:06 EST by Rick Barkhouse CLA
Modified: 2022-06-09 10:28 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rick Barkhouse CLA 2011-11-17 11:06:35 EST
If a user maps a custom subclass of JAXBElement<byte[]>, such as:

public class MyType {
   @XmlElementRef(name = "request",
                  namespace = "ns",
                  type = MyType.Request.class)
   protected MyType.Request request;
   ...
}

public class Request extends JAXBElement<byte[]> {
   public TestRequest(byte[] value) {
      super(new QName("ns", "request"), byte[].class, MyType.class, value);
   }
   ...
}

context creation will fail with:

Exception Description: Class [byte[]] not found.
	at org.eclipse.persistence.exceptions.JAXBException.classNotFoundException(JAXBException.java:657)
	at org.eclipse.persistence.jaxb.javamodel.reflection.JavaModelImpl.getClass(JavaModelImpl.java:82)
	at org.eclipse.persistence.jaxb.javamodel.Helper.getJavaClass(Helper.java:191)
	at org.eclipse.persistence.jaxb.compiler.MappingsGenerator.generateDescriptorForJAXBElementSubclass(MappingsGenerator.java:351)

The TypeInfo holds "byte[]" in 'factoryMethodParamTypes', but this would need to be converted to '[B' in order to do the Class.forName() in JavaModelImpl.

See org.eclipse.persistence.testing.jaxb.xmlelementref.ComplexType for an easy to modify test case.
Comment 1 Matt MacIvor CLA 2012-01-04 13:22:47 EST

*** This bug has been marked as a duplicate of bug 367791 ***
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:28:43 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink