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

Bug 364053

Summary: Error creating context if using subclass of JAXBElement<byte[]>
Product: z_Archived Reporter: Rick Barkhouse <rick.barkhouse>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: matt.macivor
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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