You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/02/06 20:31:14 UTC

cvs commit: ws-axis/java/src/org/apache/axis/encoding/ser SimpleDeserializer.java SimpleDeserializerFactory.java

dims        2005/02/06 11:31:13

  Modified:    java/src/org/apache/axis/encoding/ser
                        SimpleDeserializer.java
                        SimpleDeserializerFactory.java
  Log:
  prevent problems with terra test case.
  
  Revision  Changes    Path
  1.44      +11 -9     ws-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java
  
  Index: SimpleDeserializer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- SimpleDeserializer.java	6 Feb 2005 05:12:25 -0000	1.43
  +++ SimpleDeserializer.java	6 Feb 2005 19:31:13 -0000	1.44
  @@ -238,17 +238,19 @@
           }
           
           if(constructor.getParameterTypes().length==0){
  -            Object obj = constructor.newInstance(new Object[]{});
  -            obj.getClass().getMethod("set_value", new Class[]{String.class})
  -                    .invoke(obj, new Object[]{source});
  -            return obj;
  -        } else {
  -            if (args == null) {
  -                args = new Object[] { source };
  +            try {
  +                Object obj = constructor.newInstance(new Object[]{});
  +                obj.getClass().getMethod("set_value", new Class[]{String.class})
  +                        .invoke(obj, new Object[]{source});
  +                return obj;
  +            } catch (Exception e){
  +                //Ignore exception
               }
  -            
  -            return constructor.newInstance(args);
           }
  +        if (args == null) {
  +            args = new Object[]{source};
  +        }
  +        return constructor.newInstance(args);
       }
   
       private Object makeBasicValue(String source) throws Exception {
  
  
  
  1.14      +9 -1      ws-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializerFactory.java
  
  Index: SimpleDeserializerFactory.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializerFactory.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SimpleDeserializerFactory.java	6 Feb 2005 05:12:25 -0000	1.13
  +++ SimpleDeserializerFactory.java	6 Feb 2005 19:31:13 -0000	1.14
  @@ -16,7 +16,8 @@
   
   package org.apache.axis.encoding.ser;
   
  -import org.apache.axis.utils.JavaUtils;
  +import org.apache.axis.utils.BeanUtils;
  +import org.apache.axis.utils.BeanPropertyDescriptor;
   
   import javax.xml.namespace.QName;
   import javax.xml.rpc.JAXRPCException;
  @@ -62,6 +63,13 @@
                   try {
                       constructor = 
                           javaType.getDeclaredConstructor(new Class[]{});
  +                    BeanPropertyDescriptor[] pds = BeanUtils.getPd(javaType);
  +                    if(pds != null) {
  +                        if(BeanUtils.getSpecificPD(pds,"_value")!=null){
  +                            return;
  +                        }
  +                    }
  +                    throw new IllegalArgumentException(e.toString());
                   } catch (java.lang.NoSuchMethodException ex) {
                       throw new IllegalArgumentException(ex.toString());
                   }