You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Daniel Kulp (JIRA)" <ji...@apache.org> on 2011/09/01 18:44:09 UTC
[jira] [Resolved] (CXF-2779) CXF ignores @XmlAttribute when
serializing exception
[ https://issues.apache.org/jira/browse/CXF-2779?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Kulp resolved CXF-2779.
------------------------------
Resolution: Invalid
Fix Version/s: Invalid
Assignee: Daniel Kulp
I did fix the issue of using getField instead of getDeclaredField.
HOWEVER, the @XmlAttribute thing is not fixed as it would be against the JAX-WS spec and introduce differences in behavior between CXF and other JAX-WS implementations (including the reference implementation). If you want/need information to be in attributes, you must use a fault bean and use the getFaultInfo way of doing it.
> CXF ignores @XmlAttribute when serializing exception
> ----------------------------------------------------
>
> Key: CXF-2779
> URL: https://issues.apache.org/jira/browse/CXF-2779
> Project: CXF
> Issue Type: Bug
> Components: JAXB Databinding
> Affects Versions: 2.2.7
> Reporter: Chris Wilson
> Assignee: Daniel Kulp
> Fix For: Invalid
>
> Attachments: CxfExceptionFieldPropagationTest.java, CxfExceptionFieldPropagationTest.java
>
>
> JAXBEncoderDecoder#unmarshallException} doesn't normally write to private fields, so exception data isn't propagated, unless:
> * either the {@link @XmlAccessorType} annotation is present on the class and used to set the default access method to something other than the default XmlAccessType#PUBLIC_MEMBER,
> * or the {@link XmlAttribute} annotation is present on the individual private members that you want to be serialized.
> The [Caucho documentation|http://www.caucho.com/resin-3.1/doc/jaxb-annotations.xtp#@XmlAttribute] says:
> bq. Adding @XmlAttribute to a private field will mark that field as serializable.
> and they give the following example which clearly implies that no accessors are required:
> {code}
> @XmlRootElement
> class Bean {
> @XmlAttribute("sample-field")
> private String _myField;
> }
> {code}
> Nevertheless:
> * JAXBEncoderDecoder#marshallException calls org.apache.cxf.jaxb.JAXBContextInitializer#isFieldAccepted to see whether the field should be copied
> * that method fails to check for the XmlAttribute annotation on the field
> * so its value is never serialized or deserialized
> and the attached test case fails unless:
> * either a public getter and setter are provided to turn the field into a property,
> * or the access type is changed to something other than PUBLIC_MEMBER.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira