strange results with int array
------------------------------

                 Key: JIBX-286
                 URL: http://jira.codehaus.org/browse/JIBX-286
             Project: JiBX
          Issue Type: Bug
          Components: core
    Affects Versions: JiBX 1.2
            Reporter: Alex


Tried to serialize a bean with int[] properties. The xml seems to mixup ints 
from different properties.
See snippets below.
================================

        public static void main(String[] args) throws Exception 
        {
                test.TestBean test = new test.TestBean();
                test.setName(Blah");
                test.setStuff(new int[] {1,2,3});
                test.setMoreStuff(new int[] {4,5,6});
                
                
                IBindingFactory bfact = 
                BindingDirectory.getFactory(test.TestBean.class);
                
                IMarshallingContext mctx = bfact.createMarshallingContext();
            mctx.marshalDocument(test, "UTF-8", null,
                new FileOutputStream("c:\\1.xml"));
        }

================================
<?xml version="1.0" encoding="UTF-8"?>
<testBean><name>Blah</name><int>1</int><int>2</int><int>3</int><int>4</int><int>5</int><int>6</int></testBean>
================================
<binding name="binding" package="test">
  <mapping abstract="true" type-name="testBean" class="test.TestBean">
    <value style="element" name="name" field="name" usage="optional"/>
    <collection field="stuff" usage="optional">
      <value name="int" type="int"/>
    </collection>
    <collection field="moreStuff" usage="optional">
      <value name="int" type="int"/>
    </collection>
  </mapping>
  <mapping class="test.TestBean" name="testBean">
    <structure map-as="testBean"/>
  </mapping>
</binding>
================================
public class TestBean 
{
        private String name;
        private int[] stuff;
        private int[] moreStuff;
        
        public TestBean()
        {
        }
        
        public String getName()
        {
                return name;
        } 
        
        public void setName(String name)
        {
                this.name = name;
        }
        
        public int[] getStuff()
        {
                return stuff;
        }
        
        public void setStuff(int[] stuff)
        {
                this.stuff = stuff;
        }
        
        public int[] getMoreStuff()
        {
                return moreStuff;
        }
        
        public void setMoreStuff(int[] moreStuff)
        {
                this.moreStuff = moreStuff;
        }
}
-

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

        

------------------------------------------------------------------------------
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to