cxf-issues mailing list archives

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

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

Peter Szanto commented on CXF-4502:
-----------------------------------

If Set is intentionally not supported then CXF should throw an exception that indicates that
it is intentional. The current situation is quite misleading and requires users to debug CXF
code.

                
> 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