You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by gd...@apache.org on 2004/02/24 16:28:46 UTC

cvs commit: ws-axis/java/src/org/apache/axis/wsdl/fromJava Types.java

gdaniels    2004/02/24 07:28:46

  Modified:    java/src/org/apache/axis/encoding/ser BeanSerializer.java
               java/src/org/apache/axis/wsdl/fromJava Types.java
  Log:
  Fix bug 22999 (again).
  
  * Propagate type information for fields down into writeField(),
    and use it unlesss the java type is an array (NOTE: we
    really need to move to passing around Type descriptors and
    not just QNames/java Classes)
  
  * Make isArray in Types public
  
  Revision  Changes    Path
  1.72      +10 -1     ws-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
  
  Index: BeanSerializer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v
  retrieving revision 1.71
  retrieving revision 1.72
  diff -u -r1.71 -r1.72
  --- BeanSerializer.java	15 Jan 2004 18:30:34 -0000	1.71
  +++ BeanSerializer.java	24 Feb 2004 15:28:45 -0000	1.72
  @@ -387,6 +387,7 @@
                       } else {
                           writeField(types,
                                      propName,
  +                                   fieldXmlType,
                                      fieldType,
                                      propertyDescriptor[i].isIndexed(),
                                      field.isMinOccursZero(),
  @@ -395,12 +396,14 @@
                   } else {
                       writeField(types,
                                  propName,
  +                               null,
                                  fieldType,
                                  propertyDescriptor[i].isIndexed(), false, all, false);
                   }
               } else {
                   writeField(types,
                              propName,
  +                           null,
                              fieldType,
                              propertyDescriptor[i].isIndexed(), false, all, false);
               }
  @@ -414,6 +417,7 @@
        * write a schema representation of the given Class field and append it to
        * the where Node, recurse on complex types
        * @param fieldName name of the field
  +     * @param xmlType the schema type of the field
        * @param fieldType type of the field
        * @param isUnbounded causes maxOccurs="unbounded" if set
        * @param where location for the generated schema node
  @@ -421,6 +425,7 @@
        */
       protected void writeField(Types types,
                                 String fieldName,
  +                              QName xmlType,
                                 Class fieldType,
                                 boolean isUnbounded,
                                 boolean isOmittable,
  @@ -431,7 +436,11 @@
               elem = types.createElementWithAnonymousType(fieldName,
               fieldType, isOmittable, where.getOwnerDocument());
           } else {
  -            String elementType = types.writeType(fieldType);
  +            if (Types.isArray(fieldType)) {
  +                xmlType = null;
  +            }
  +            
  +            String elementType = types.writeType(fieldType, xmlType);
   
               if (elementType == null) {
                   // If writeType returns null, then emit an anytype in such situations.
  
  
  
  1.89      +3 -4      ws-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java
  
  Index: Types.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/fromJava/Types.java,v
  retrieving revision 1.88
  retrieving revision 1.89
  diff -u -r1.88 -r1.89
  --- Types.java	26 Dec 2003 15:18:48 -0000	1.88
  +++ Types.java	24 Feb 2004 15:28:45 -0000	1.89
  @@ -153,8 +153,7 @@
       /** Keep track of the element QNames we've written to avoid dups */
       private Set writtenElementQNames = new HashSet();
   
  -
  -    private static boolean isArray(Class clazz)
  +    public static boolean isArray(Class clazz)
       {
           return clazz.isArray() || java.util.Collection.class.isAssignableFrom(clazz);
       }
  @@ -691,8 +690,8 @@
           // If the javaType is an array and the qName is
           // SOAP_ARRAY, construct the QName using the
           // QName of the component type
  -        if (isArray(javaType) && (qName != null)
  -                && Constants.equals(Constants.SOAP_ARRAY, qName)) {
  +        if (isArray(javaType) && 
  +                Constants.equals(Constants.SOAP_ARRAY, qName)) {
               Class componentType = getComponentType(javaType);
   
               // If component namespace uri == targetNamespace