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 ga...@apache.org on 2005/01/12 00:35:48 UTC

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

gawor       2005/01/11 15:35:48

  Modified:    java/src/org/apache/axis/encoding/ser BeanSerializer.java
  Log:
  just some minor changes
  
  Revision  Changes    Path
  1.80      +18 -15    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.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- BeanSerializer.java	18 Nov 2004 17:00:40 -0000	1.79
  +++ BeanSerializer.java	11 Jan 2005 23:35:48 -0000	1.80
  @@ -55,13 +55,15 @@
       protected static Log log =
           LogFactory.getLog(BeanSerializer.class.getName());
   
  +    private static final QName MUST_UNDERSTAND_QNAME = 
  +        new QName(Constants.URI_SOAP11_ENV, Constants.ATTR_MUST_UNDERSTAND);
  +
       QName xmlType;
       Class javaType;
   
       protected BeanPropertyDescriptor[] propertyDescriptor = null;
       protected TypeDesc typeDesc = null;
   
  -
       // Construct BeanSerializer for the indicated class/qname
       public BeanSerializer(Class javaType, QName xmlType) {
           this(javaType, xmlType, TypeDesc.getTypeDescForClass(javaType));
  @@ -170,20 +172,21 @@
                           Object propValue =
                               propertyDescriptor[i].get(value);
   
  -                        // an element cannot be null if nillable property is set to "false"
  -                        // and the element cannot be omitted
  -                        if (propValue == null && !isNillable && !isOmittable) {
  -                            throw new IOException(Messages.getMessage("nullNonNillableElement", propName));
  +                        if (propValue == null) {
  +                            // an element cannot be null if nillable property is set to 
  +                            // "false" and the element cannot be omitted
  +                            if (!isNillable && !isOmittable) {
  +                                throw new IOException(Messages.getMessage("nullNonNillableElement", propName));
  +                            }
  +                            
  +                            // if meta data says minOccurs=0, then we can skip
  +                            // it if its value is null and we aren't doing SOAP
  +                            // encoding.
  +                            if (isOmittable && !isEncoded) {
  +                                continue;
  +                            }
                           }
   
  -                        // if meta data says minOccurs=0, then we can skip
  -                        // it if its value is null and we aren't doing SOAP
  -                        // encoding.
  -                        if (propValue == null &&
  -                                isOmittable &&
  -                                !isEncoded)
  -                            continue;
  -
                           context.serialize(qname,
                                             null,
                                             propValue,
  @@ -532,9 +535,9 @@
                       // add to our attributes
                       Object propValue = propertyDescriptor[i].get(value);
                       // Convert true/false to 1/0 in case of soapenv:mustUnderstand
  -                    if (qname.equals(new QName(Constants.URI_SOAP11_ENV, Constants.ATTR_MUST_UNDERSTAND))) {
  +                    if (qname.equals(MUST_UNDERSTAND_QNAME)) {
                       	if (propValue.equals(Boolean.TRUE)) {
  -                    		propValue = "1";
  +                                propValue = "1";
                       	} else if (propValue.equals(Boolean.FALSE)) {
                       		propValue = "0";
                       	}