axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdani...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/wsdl/fromJava ClassRep.java
Date Mon, 07 Jan 2002 20:39:55 GMT
gdaniels    02/01/07 12:39:55

  Modified:    java/src/org/apache/axis/wsdl/fromJava ClassRep.java
  Log:
  Fix bug when emitting fields - Vector.contains() apparently wasn't calling
  equals() as defined in FieldRep, so the check to see if a field had already
  been defined was not in fact working.  We thus were emitting schema
  elements for both the lowercase and the uppercase versions of fields with
  get/set accessors.  We now use a hashmap to explicitly check the names.
  
  Revision  Changes    Path
  1.5       +25 -24    xml-axis/java/src/org/apache/axis/wsdl/fromJava/ClassRep.java
  
  Index: ClassRep.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/ClassRep.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ClassRep.java	3 Jan 2002 20:33:43 -0000	1.4
  +++ ClassRep.java	7 Jan 2002 20:39:55 -0000	1.5
  @@ -58,6 +58,7 @@
   import java.lang.reflect.Modifier;
   import java.lang.reflect.Field;
   import java.util.Vector;
  +import java.util.HashMap;
   
   import org.apache.axis.utils.JavapUtils;
   
  @@ -130,6 +131,7 @@
       private Vector   _interfaces = new Vector();
       private Vector   _methods    = new Vector();
       private Vector   _fields     = new Vector();
  +    private HashMap  _fieldNames = new HashMap();
       
   
       /**
  @@ -239,17 +241,18 @@
               if (Modifier.isPublic(mod) ||
                   isJavaBeanNormal(cls, f.getName(), f.getType()) ||
                   isJavaBeanIndexed(cls, f.getName(), f.getType())) {
  -                if (!isJavaBeanIndexed(cls, f.getName(), f.getType())) {
  -                    FieldRep fr = new FieldRep(f);
  -                    if (!_fields.contains(fr))
  -                        _fields.add(fr);
  -                } else {
  -                    FieldRep fr = new FieldRep();
  -                    fr.setName(f.getName());
  -                    fr.setType(f.getType().getComponentType());
  -                    fr.setIndexed(true);
  -                    if (!_fields.contains(fr))
  -                        _fields.add(fr);
  +                if (_fieldNames.get(f.getName().toLowerCase()) == null) {
  +                    FieldRep fr;
  +                    if (!isJavaBeanIndexed(cls, f.getName(), f.getType())) {
  +                        fr = new FieldRep(f);
  +                    } else {
  +                        fr = new FieldRep();
  +                        fr.setName(f.getName());
  +                        fr.setType(f.getType().getComponentType());
  +                        fr.setIndexed(true);
  +                    }
  +                    _fields.add(fr);
  +                    _fieldNames.put(f.getName().toLowerCase(), fr);
                   }
               }
           }
  @@ -268,21 +271,19 @@
                       name = name.substring(3);
                   }
                   Class type = method.getReturnType();
  -                if (isJavaBeanNormal(cls, name, type) ||
  -                    isJavaBeanIndexed(cls, name, type)) {
  -                    if (!isJavaBeanIndexed(cls, name, type)) {
  +                if (_fieldNames.get(name.toLowerCase()) == null) {
  +                    if (isJavaBeanNormal(cls, name, type) ||
  +                            isJavaBeanIndexed(cls, name, type)) {
                           FieldRep fr = new FieldRep();
                           fr.setName(name);
  -                        fr.setType(type);
  -                        if (!_fields.contains(fr))
  -                            _fields.add(fr);
  -                    } else {
  -                        FieldRep fr = new FieldRep();
  -                        fr.setName(name);
  -                        fr.setType(type.getComponentType());
  -                        fr.setIndexed(true);
  -                        if (!_fields.contains(fr))
  -                            _fields.add(fr);
  +                        if (!isJavaBeanIndexed(cls, name, type)) {
  +                            fr.setType(type);
  +                        } else {
  +                            fr.setType(type.getComponentType());
  +                            fr.setIndexed(true);
  +                        }
  +                        _fields.add(fr);
  +                        _fieldNames.put(name.toLowerCase(), fr);
                       }
                   }
                   
  
  
  

Mime
View raw message