Dynamic Moxy Exception for Enum Value Conversion [message #1222138] |
Thu, 19 December 2013 13:51  |
Eclipse User |
|
|
|
Hi,
I am using the eclipselink dynamic Moxy(2.5.1) to generate the classes from the XSD. While unmarshalling the XML I get the following exception
The XML used of unmarshalling is as follows
<app:Response requestIdentifier="1234-5678-Display" result="success" ../>
The XSD definition for result is as follows
<xsd:attribute name="result" type="app:ResultValue" use="required"/>
<xsd:simpleType name="ResultValue">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="success"/>
<xsd:enumeration value="failure"/>
</xsd:restriction>
</xsd:simpleType>
The Eclipselink exception is as follows
Exception [EclipseLink-116] (Eclipse Persistence Services - 2.5.1.v20130808-8c9f8b2): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: No conversion value provided for the value [success] in field [@result].
Mapping: org.eclipse.persistence.oxm.mappings.XMLDirectMapping[result-->@result]
Descriptor: XMLDescriptor(mycompany.names.xml._1._0.XMLResponse --> [])
at org.eclipse.persistence.exceptions.DescriptorException.noFieldValueConversionToAttributeValueProvided(DescriptorException.java:1065)
at org.eclipse.persistence.mappings.converters.ObjectTypeConverter.convertDataValueToObjectValue(ObjectTypeConverter.java:225)
at org.eclipse.persistence.jaxb.JAXBEnumTypeConverter.convertDataValueToObjectValue(JAXBEnumTypeConverter.java:118)
at org.eclipse.persistence.oxm.mappings.XMLDirectMapping.convertDataValueToObjectValue(XMLDirectMapping.java:528)
at org.eclipse.persistence.oxm.mappings.XMLDirectMapping.getAttributeValue(XMLDirectMapping.java:296)
at org.eclipse.persistence.oxm.mappings.XMLDirectMapping.getAttributeValue(XMLDirectMapping.java:1)
at org.eclipse.persistence.internal.oxm.XMLDirectMappingNodeValue.attribute(XMLDirectMappingNodeValue.java:159)
at org.eclipse.persistence.internal.oxm.record.UnmarshalRecordImpl.startElement(UnmarshalRecordImpl.java:906)
at org.eclipse.persistence.internal.oxm.record.SAXUnmarshallerHandler.startElement(SAXUnmarshallerHandler.java:356)
at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parseEvent(XMLStreamReaderReader.java:132)
at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parse(XMLStreamReaderReader.java:99)
at org.eclipse.persistence.internal.oxm.record.XMLStreamReaderReader.parse(XMLStreamReaderReader.java:86)
at org.eclipse.persistence.internal.oxm.record.SAXUnmarshaller.unmarshal(SAXUnmarshaller.java:895)
at org.eclipse.persistence.oxm.XMLUnmarshaller.unmarshal(XMLUnmarshaller.java:659)
at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:585)
at org.eclipse.persistence.jaxb.JAXBUnmarshaller.unmarshal(JAXBUnmarshaller.java:140)
at EnumTestXMLJSONConverter.main(EnumTestXMLJSONConverter.java:52)
1. How can I avoid this exception without changing the XSD schema or providing external binding file?
2.Are there any properties I can pass to XJC compiler or JAXB so that I get the same behaviour as Static Moxy?
|
|
|
|
Re: Dynamic Moxy Exception for Enum Value Conversion [message #1222826 is a reply to message #1222138] |
Sat, 21 December 2013 09:25   |
Eclipse User |
|
|
|
Hi,
Looks like the Dynamic Moxy while marshalling and unmarshalling is expecting the enum constant(e.g. result="SUCCESS") in the input, rather than the enum value(e.g result="success"). Is this a bug in Dynamic Moxy?
EDIT
The exceptions
[severity=ERROR,message=
Exception Description: No conversion value provided for the value [success] in field [@result].
Mapping: org.eclipse.persistence.oxm.mappings.XMLDirectMapping[result-->@result]
Descriptor: XMLDescriptor(base.xml._1._0.XMLResponse --> []),locator=[node=null,object=null,url=null,line=1,col=156,offset=-1]]
[severity=ERROR,message=
Exception Description: No conversion value provided for the value [fullResult] in field [ns0:searchResponse.@searchStatus].
Mapping: org.eclipse.persistence.oxm.mappings.XMLDirectMapping[searchStatus-->ns0:searchResponse.@searchStatus]
Descriptor: XMLDescriptor(base.xml._1._0.SearchResponse --> [DatabaseTable(ns0:searchResponse)]),locator=[node=null,object=null,url=null,line=1,col=156,offset=-1]]
I have attached the driver code and the schemas.
Thanks
Chandra
[Updated on: Mon, 23 December 2013 06:52] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03975 seconds