axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/encoding TypeMappingRegistry.java
Date Wed, 12 Dec 2001 00:31:43 GMT
dug         01/12/11 16:31:43

  Modified:    java/src/org/apache/axis/encoding TypeMappingRegistry.java
  Log:
  Fix the way we lookup serializers - we didn't take into account
  interfaces that extended the class we're looking for.
  
  Revision  Changes    Path
  1.37      +12 -20    xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java
  
  Index: TypeMappingRegistry.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/TypeMappingRegistry.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- TypeMappingRegistry.java	2001/11/25 23:49:33	1.36
  +++ TypeMappingRegistry.java	2001/12/12 00:31:43	1.37
  @@ -69,6 +69,7 @@
   import java.io.Serializable;
   import java.util.Enumeration;
   import java.util.Hashtable;
  +import java.util.Vector;
   
   /**
    * @author James Snell (jasnell@us.ibm.com)
  @@ -242,34 +243,25 @@
           throws IOException
       {
           if (value != null) {
  -            Class _class = value.getClass();
  -            
  -            // Find a Serializer for this class, walking up the inheritance
  -            // hierarchy and implemented interfaces list.
  -            while (_class != null) {
  +            Vector classes = new Vector();
  +            classes.add( value.getClass() );
  +    
  +            while( classes.size() != 0 ) {
  +                Class _class = (Class) classes.remove( 0 );
                   Serializer ser = getSerializer(_class);
  -                if (ser != null) {
  +                if ( ser != null ) {
                       QName type = getTypeQName(_class);
                       attributes = setTypeAttribute(attributes, type, context);
                       ser.serialize(name, attributes, value, context);
                       return;
  -                }
  -
  -                Class [] ifaces = _class.getInterfaces();
  -                for (int i = 0; i < ifaces.length; i++) {
  -                    Class iface = ifaces[i];
  -                    ser = getSerializer(iface);
  -                    if (ser != null) {
  -                        QName type = getTypeQName(iface);
  -                        attributes = setTypeAttribute(attributes, type, context);
  -                        ser.serialize(name, attributes, value, context);
  -                        return;
  -                    }
                   }
  -                
  +                Class[] ifaces = _class.getInterfaces();
  +                for (int i = 0 ; i < ifaces.length ; i++ ) 
  +                    classes.add( ifaces[i] );
                   _class = _class.getSuperclass();
  +                if ( _class != null ) classes.add( _class );
               }
  -            
  +
               throw new IOException(JavaUtils.getMessage("noSerializer00",
                       value.getClass().getName(), "" + this));
           }
  
  
  

Mime
View raw message