axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: xml-axis/java/src/org/apache/axis/encoding/ser BeanDeserializer.java
Date Wed, 01 May 2002 19:52:46 GMT
tomj        02/05/01 12:52:46

  Modified:    java/src/org/apache/axis/utils resources.properties
               java/src/org/apache/axis/encoding/ser BeanDeserializer.java
  Log:
  Move the construction of the bean object from the constructor to startElement()
  
  This allows us to throw an exception with a reasonable error if we are unable
  to create the object.
  
  An example would be a bean without a default constructor.
  
  Revision  Changes    Path
  1.94      +4 -0      xml-axis/java/src/org/apache/axis/utils/resources.properties
  
  Index: resources.properties
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/resources.properties,v
  retrieving revision 1.93
  retrieving revision 1.94
  diff -u -r1.93 -r1.94
  --- resources.properties	30 Apr 2002 19:07:31 -0000	1.93
  +++ resources.properties	1 May 2002 19:52:45 -0000	1.94
  @@ -806,3 +806,7 @@
   cantGetDoc00=Unable to retrieve WSDL document: {0}
   implAlreadySet=Attempt to set implementation class on a ServiceDesc which has already been
configured
   
  +cantCreateBean00=Unable to create JavaBean of type {0}.  Missing default constructor? 
Error was: {1}.
  +
  +
  +
  
  
  
  1.21      +12 -9     xml-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java
  
  Index: BeanDeserializer.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanDeserializer.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- BeanDeserializer.java	20 Apr 2002 00:22:24 -0000	1.20
  +++ BeanDeserializer.java	1 May 2002 19:52:46 -0000	1.21
  @@ -113,14 +113,6 @@
               BeanPropertyDescriptor descriptor = pd[i];
               propertyMap.put(descriptor.getName(), descriptor);
           }
  -
  -        // create a value
  -        try {
  -            value=javaType.newInstance();
  -        } catch (Exception e) {
  -            //throw new SAXException(e.toString());
  -        }
  -        
       }
   
       /**
  @@ -263,9 +255,20 @@
                                  DeserializationContext context)
               throws SAXException {
   
  +        // create a value
  +        try {
  +            value=javaType.newInstance();
  +        } catch (Exception e) {
  +            throw new SAXException(JavaUtils.getMessage("cantCreateBean00", 
  +                                                  javaType.getName(), 
  +                                                  e.toString()));
  +        }
  +
  +        // If no type description meta data, there are no attributes,
  +        // so we are done.
           if (typeDesc == null)
               return;
  -        
  +
           // loop through the attributes and set bean properties that 
           // correspond to attributes
           for (int i=0; i < attributes.getLength(); i++) {
  
  
  

Mime
View raw message