Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.1.3, 3.1.5
-
None
-
None
-
Unknown
Description
We have services throwing exceptions inherited from super classes.
For example:
public class MyException extends org.springframework.dao.DataAccessException { .. }
Throwing this exception leads to
Caused by: javax.xml.bind.JAXBException: java.lang.Throwable is not known to this context
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getBeanInfo(JAXBContextImpl.java:613)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.getBeanInfo(UnmarshallerImpl.java:599)
at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:394)
at org.apache.cxf.jaxb.JAXBEncoderDecoder.unmarshallException(JAXBEncoderDecoder.java:582)
The problem is the method getMostSpecificCause returning an object of type Throwable.
In older versions (2.4.10) the superclasses of the exception were not processed by JAXBEncoderDecoder.marshallException, only the getters of the actual class.
Now the method Utils.getGetters is used to get the list of getters and it returns also getters of superclasses.
It is not possible to avoid marshalling of the method getMostSpecificCause with XmlTransient because even if it is overidden in the actual class, Utils.getGetters returns the method off the superclass. This is because only annotations of the method of the superclass are checked.