[jboss-jira] [JBoss JIRA] Commented: (JBXB-79) Array parameter is being appended rather than passed intact

Alexey Loubyansky (JIRA) jira-events at jboss.com
Fri Sep 1 03:53:17 EDT 2006


    [ http://jira.jboss.com/jira/browse/JBXB-79?page=comments#action_12342577 ] 
            
Alexey Loubyansky commented on JBXB-79:
---------------------------------------

The problem occurs during unmarshalling. An instance of the class is created and then array items are appended to the array. The fix would be to ignore the initialization you do in the class initializer and just set the unmarshalled value. That's what I meant.

> Array parameter is being appended rather than passed intact
> -----------------------------------------------------------
>
>                 Key: JBXB-79
>                 URL: http://jira.jboss.com/jira/browse/JBXB-79
>             Project: JBoss XML Binding (JBossXB)
>          Issue Type: Bug
>            Reporter: David Boeren
>         Assigned To: Alexey Loubyansky
>         Attachments: coils.ZIP
>
>
> When I call a webservice method and pass an object containing an array of another object type, the server receives the array with additional elements.  The array elements that I pass are appended, so that if I send 1 element the server receives 81.  If  I send 80 elements, the server receives 160.  There are always 80 element preceding the first one that I pass.
> The value 80 comes from code in the object constructor that preinitializes the array to this size.
> This form causes the bug:
> public class Coils implements Serializable{
> 	private int			numberOfCoils;
> 	private CoilData[]	array = new CoilData[80];
> }
> This form likewise causes the bug:
> public class Coils implements Serializable{
> 	private int			numberOfCoils;
> 	private CoilData[]	array;
> 	public Coils() {
>             array = new CoilData[80];
>         }
> }
> This form does not cause the bug:
> public class Coils implements Serializable{
> 	private int			numberOfCoils;
> 	private CoilData[]	array;
> 	public Coils() {
>         }
> }
> Coils coils = new Coils();
> coils.setArray(new CoilData[80]);
> So, it has something to do with initializing it in the construction of the object.
> Attached is a full Eclipse project exhibiting the bug that you can run on JBoss 4.0.4.GA with JBossWS.
> To keep the attachment size down, I left off the library files.  You will need:
> activation.jar, jbossall-client.jar, jbossws-client.jar, mail.jar, xercesImpl.jar

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list