cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Wilson (JIRA)" <j...@apache.org>
Subject [jira] Created: (CXF-2779) CXF ignores @XmlAttribute when serializing exception
Date Thu, 22 Apr 2010 09:57:51 GMT
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
         Attachments: 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 [http://www.caucho.com/resin-3.1/doc/jaxb-annotations.xtp#@XmlAttribute|Caucho documentation]
says:

bq. Adding @XmlAttribute to a private field will mark that field as serializable.

{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.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message