Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 347470 - Error thrown when object mapped with @XmlTransformation does not have a 0-arg constructor
Summary: Error thrown when object mapped with @XmlTransformation does not have a 0-arg...
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-05-27 11:18 EDT by Blaise Doughan CLA
Modified: 2022-06-09 10:34 EDT (History)
1 user (show)

See Also:


Attachments
Proposed changes and test (21.12 KB, patch)
2011-06-07 14:56 EDT, Denise Smith CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Blaise Doughan CLA 2011-05-27 11:18:01 EDT
If an object mapped with an @XmlTransformation mapping does not have a 0-arg constructor the following exception is thrown.  MOXy should treat @XmlTransformation in the same way that it does @XmlJavaTypeAdapter.  Since the user is responsible for constructing the object themselves it should not matter what type of constructor it has.

Exception in thread "main" javax.xml.bind.JAXBException: 
Exception Description: The class blog.transformation2.FOO requires a zero argument constructor or a specified factory method.  Note that non-static inner classes do not have zero argument constructors and are not supported.
 - with linked exception:
[Exception [EclipseLink-50001] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The class blog.transformation2.FOO requires a zero argument constructor or a specified factory method.  Note that non-static inner classes do not have zero argument constructors and are not supported.]
	at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:825)
	at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:136)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:142)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:129)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:93)
	at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:83)
	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 javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:202)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:331)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
	at blog.transformation2.Demo.main(Demo.java:12)
Caused by: Exception [EclipseLink-50001] (Eclipse Persistence Services - 2.3.0.qualifier): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The class blog.transformation2.FOO requires a zero argument constructor or a specified factory method.  Note that non-static inner classes do not have zero argument constructors and are not supported.
	at org.eclipse.persistence.exceptions.JAXBException.factoryMethodOrConstructorRequired(JAXBException.java:127)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.finalizeProperties(AnnotationsProcessor.java:709)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:234)
	at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:147)
	at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:822)
	... 14 more
Comment 1 Denise Smith CLA 2011-06-07 14:56:08 EDT
Created attachment 197533 [details]
Proposed changes and test
Comment 2 Denise Smith CLA 2011-06-07 15:42:14 EDT
Fix checked in to trunk, still needs to be checked in to 2.3 stream.
Comment 3 Denise Smith CLA 2011-06-24 15:08:45 EDT
Checked in to 2.3 stream
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:34:08 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink