axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ru...@apache.org
Subject cvs commit: xml-axis/java/test/encoding TestDeser.java
Date Thu, 29 Nov 2001 11:11:31 GMT
rubys       01/11/29 03:11:31

  Modified:    java/src/org/apache/axis/encoding ArraySerializer.java
               java/test/encoding TestDeser.java
  Log:
  Nil elements in arrays should map to null, not "".
  
  Revision  Changes    Path
  1.26      +10 -4     xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java
  
  Index: ArraySerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ArraySerializer.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- ArraySerializer.java	2001/11/25 03:13:34	1.25
  +++ ArraySerializer.java	2001/11/29 11:11:31	1.26
  @@ -115,10 +115,6 @@
               category.debug(JavaUtils.getMessage("enter00", "ArraySerializer.startElement()"));
           }
   
  -        if (attributes.getValue(Constants.URI_CURRENT_SCHEMA_XSI,  "nil") != null) {
  -            return;
  -        }
  -
           QName arrayTypeValue = context.getQNameFromString(
                                     attributes.getValue(Constants.URI_SOAP_ENC,
                                                      Constants.ATTR_ARRAY_TYPE));
  @@ -245,6 +241,16 @@
                   curIndex = 
                          Integer.parseInt(pos.substring(leftBracketIndex + 1,
                                                         rightBracketIndex));
  +            }
  +
  +            // If the xsi:nil attribute, set the value to null and return since
  +            // there is nothing to deserialize.
  +            String nil = null;
  +            for (int i=0; i<Constants.URIS_SCHEMA_XSI.length && nil==null; i++)
  +                nil = attributes.getValue(Constants.URIS_SCHEMA_XSI[i], "nil");
  +            if (nil != null && nil.equals("true")) {
  +              valueReady(null, new Integer(curIndex++));
  +              return null;
               }
           }
           
  
  
  
  1.21      +29 -1     xml-axis/java/test/encoding/TestDeser.java
  
  Index: TestDeser.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/test/encoding/TestDeser.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- TestDeser.java	2001/11/15 20:31:38	1.20
  +++ TestDeser.java	2001/11/29 11:11:31	1.21
  @@ -55,7 +55,7 @@
        * Verify that two objects have the same value, handling arrays...
        */
       private static boolean equals(Object obj1, Object obj2) {
  -       if (obj1 == null) return (obj2 == null);
  +       if ( (obj1 == null) || (obj2 == null) ) return (obj1 == obj2);
          if (obj1.equals(obj2)) return true;
          if (obj2.getClass().isArray() && obj1.getClass().isArray()) {
              if (Array.getLength(obj1) != Array.getLength(obj2)) return false;
  @@ -218,6 +218,34 @@
                               "soapenc:arrayType=\"xsd:string[4]\"> " +
         "<item soapenc:position=\"[0]\" xsi:type=\"xsd:string\">abc</item>" +
         "<item soapenc:position=\"[2]\" xsi:type=\"xsd:string\">def</item>" +
  +                    "</result>",
  +                    list);
  +    }
  +
  +    public void testArrayWithNilInt() throws Exception {
  +        ArrayList list = new ArrayList(4);
  +        list.add(new Integer(1));
  +        list.add(null);
  +        list.add(new Integer(3));
  +        deserialize("<result xsi:type=\"soapenc:Array\" " +
  +                            "soapenc:arrayType=\"xsd:int[3]\"> " +
  +                       "<item xsi:type=\"xsd:int\">1</item>" +
  +                       "<item xsi:nil=\"true\"/>" +
  +                       "<item xsi:type=\"xsd:int\">3</item>" +
  +                    "</result>",
  +                    list);
  +    }
  +    
  +    public void testArrayWithNilString() throws Exception {
  +        ArrayList list = new ArrayList(4);
  +        list.add("abc");
  +        list.add(null);
  +        list.add("def");
  +        deserialize("<result xsi:type=\"soapenc:Array\" " +
  +                            "soapenc:arrayType=\"xsd:string[3]\"> " +
  +                       "<item xsi:type=\"xsd:string\">abc</item>" +
  +                       "<item xsi:nil=\"true\"/>" +
  +                       "<item xsi:type=\"xsd:string\">def</item>" +
                       "</result>",
                       list);
       }
  
  
  

Mime
View raw message