[
https://issues.apache.org/jira/browse/CXF-4502?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Peter Szanto updated CXF-4502:
------------------------------
Description:
If I have an Exception that has a java.util.Set field like this :
{code}
public class MissingReferenceException extends Exception {
private Set<Integer> references;
private static final long serialVersionUID = -5294298476513084387L;
public MissingReferenceException() {
}
public MissingReferenceException(Set<Integer> references) {
this.setReferences(references);
}
public Set<Integer> getReferences() {
return references;
}
public void setReferences(Set<Integer> references) {
this.references = references;
}
}
{code}
then when I throw it I get the below exception :
Caused by: java.lang.IllegalArgumentException: Argument is not an array
at java.lang.reflect.Array.getLength(Native Method)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeArrayObject(JAXBEncoderDecoder.java:423)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshallException(JAXBEncoderDecoder.java:389)
Looking at the source of JAXBEncoderDecoder.writeArrayObject() it is quite
obvious that List is explicitly handled, but instead it should be Collection
handled to cover all other suclasses like Set, Vector etc...
was:
If I have an Exception that has a java.util.Set field like this :
{code}
public class MissingReferenceException extends Exception {
private Set<Integer> references;
private static final long serialVersionUID = -5294298476513084387L;
public MissingReferenceException() {
}
public MissingReferenceException(Set<Integer> references) {
this.setReferences(references);
}
public Set<Integer> getReferences() {
return references;
}
public void setReferences(Set<Integer> references) {
this.references = references;
}
}
{code}
then when I throw it I get the below exception :
Caused by: java.lang.IllegalArgumentException: Argument is not an array
at java.lang.reflect.Array.getLength(Native Method)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.writeArrayObject(JAXBEncoderDecoder.java:423)
at
org.apache.cxf.jaxb.JAXBEncoderDecoder.marshallException(JAXBEncoderDecoder.java:389)
Looking at the source of JAXBEncoderDecoder.writeArrayObject() it is quite
obvious that List is explicitly handled, but Set is not.
> An Exception cannot be marshalled if contains a field of type java.util.Set
> ----------------------------------------------------------------------------
>
> Key: CXF-4502
> URL: https://issues.apache.org/jira/browse/CXF-4502
> Project: CXF
> Issue Type: Bug
> Components: JAX-WS Runtime, JAXB Databinding
> Affects Versions: 2.6.1
> Reporter: Peter Szanto
> Priority: Critical
>
> If I have an Exception that has a java.util.Set field like this :
> {code}
> public class MissingReferenceException extends Exception {
>
> private Set<Integer> references;
>
> private static final long serialVersionUID = -5294298476513084387L;
> public MissingReferenceException() {
> }
>
> public MissingReferenceException(Set<Integer> references) {
> this.setReferences(references);
> }
> public Set<Integer> getReferences() {
> return references;
> }
> public void setReferences(Set<Integer> references) {
> this.references = references;
> }
> }
> {code}
> then when I throw it I get the below exception :
> Caused by: java.lang.IllegalArgumentException: Argument is not an array
> at java.lang.reflect.Array.getLength(Native Method)
> at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.writeArrayObject(JAXBEncoderDecoder.java:423)
> at
> org.apache.cxf.jaxb.JAXBEncoderDecoder.marshallException(JAXBEncoderDecoder.java:389)
> Looking at the source of JAXBEncoderDecoder.writeArrayObject() it is quite
> obvious that List is explicitly handled, but instead it should be Collection
> handled to cover all other suclasses like Set, Vector etc...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira