cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Kulp (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CXF-4502) An Exception cannot be marshalled if contains a field of type java.util.Set
Date Wed, 19 Sep 2012 15:26:07 GMT

    [ https://issues.apache.org/jira/browse/CXF-4502?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13458750#comment-13458750
] 

Daniel Kulp commented on CXF-4502:
----------------------------------


A patch that would update the JAXBEncoderDecoder methods to handle sets and such would be
welcome.   Writing is likely fairly simple as you could just do "new  ArrayList(set)" to create
a list that is written.   The reading is likely a bit trickier.
                
> 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
>            Assignee: Freeman Fang
>            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

Mime
View raw message