scheu 02/03/08 14:26:46
Modified: java/src/org/apache/axis/encoding
DefaultTypeMappingImpl.java
java/src/org/apache/axis/encoding/ser BeanSerializer.java
SimpleDeserializerFactory.java
java/test/wsdl/types ComprehensiveTypes.wsdl
VerifyTestCase.java
Log:
Extended the attribute support to accept attributes that are enumerated types.
Added an attribute to ComprehensiveTypes.wsdl that is an enumerated type.
Minor change to SimpleDeserializerFactory to not consume exceptions.
Revision Changes Path
1.12 +3 -1
xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java
Index: DefaultTypeMappingImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/DefaultTypeMappingImpl.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- DefaultTypeMappingImpl.java 5 Mar 2002 14:19:57 -0000 1.11
+++ DefaultTypeMappingImpl.java 8 Mar 2002 22:26:46 -0000 1.12
@@ -353,7 +353,9 @@
xmlType);
}
}
- df = new SimpleDeserializerFactory(javaType, xmlType);
+ if (javaType != java.lang.Object.class) {
+ df = new SimpleDeserializerFactory(javaType, xmlType);
+ }
}
if (onlyDeserFactory) {
sf = null;
1.17 +16 -12
xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java
Index: BeanSerializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/BeanSerializer.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- BeanSerializer.java 8 Mar 2002 20:04:45 -0000 1.16
+++ BeanSerializer.java 8 Mar 2002 22:26:46 -0000 1.17
@@ -510,18 +510,22 @@
// add to our attributes
Object propValue = propertyDescriptor[i].
getReadMethod().invoke(value,noArgs);
- // NOTE: we will always set the attribute here to something,
- // which we may not want (i.e. if null, omit it)
- String propString = propValue != null ? propValue.toString() :
"";
-
- String namespace = qname.getNamespaceURI();
- String localName = qname.getLocalPart();
-
- attrs.addAttribute(namespace,
- localName,
- context.qName2String(qname),
- "CDATA",
- propString);
+ // If the property value does not exist, don't serialize
+ // the attribute. In the future, the decision to serializer
+ // the attribute may be more sophisticated. For example, don't
+ // serialize if the attribute matches the default value.
+ if (propValue != null) {
+ String propString = propValue != null ?
propValue.toString() : "";
+
+ String namespace = qname.getNamespaceURI();
+ String localName = qname.getLocalPart();
+
+ attrs.addAttribute(namespace,
+ localName,
+ context.qName2String(qname),
+ "CDATA",
+ propString);
+ }
}
}
} catch (Exception e) {
1.2 +3 -1
xml-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializerFactory.java
Index: SimpleDeserializerFactory.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializerFactory.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SimpleDeserializerFactory.java 26 Jan 2002 02:40:34 -0000 1.1
+++ SimpleDeserializerFactory.java 8 Mar 2002 22:26:46 -0000 1.2
@@ -123,7 +123,9 @@
constructor =
wrapper.getDeclaredConstructor(new Class [] {String.class});
}
- } catch (Exception e) {}
+ } catch (java.lang.NoSuchMethodException e) {
+ throw new IllegalArgumentException(e.toString());
+ }
}
/**
1.18 +1 -0 xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl
Index: ComprehensiveTypes.wsdl
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/types/ComprehensiveTypes.wsdl,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ComprehensiveTypes.wsdl 26 Feb 2002 22:59:30 -0000 1.17
+++ ComprehensiveTypes.wsdl 8 Mar 2002 22:26:46 -0000 1.18
@@ -79,6 +79,7 @@
<xsd:element name="optArray" minOccurs="0" maxOccurs="1"
type="typens:array" />
<xsd:element name="byteArray" type="typens:array_of_base64" />
</xsd:all>
+ <xsd:attribute name="attr" type="typens:enum" />
</xsd:complexType>
</xsd:element>
1.13 +1 -0 xml-axis/java/test/wsdl/types/VerifyTestCase.java
Index: VerifyTestCase.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/types/VerifyTestCase.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- VerifyTestCase.java 27 Feb 2002 13:41:29 -0000 1.12
+++ VerifyTestCase.java 8 Mar 2002 22:26:46 -0000 1.13
@@ -243,6 +243,7 @@
elemWComplex.setNested( b);
elemWComplex.setOptArray( optArray );
elemWComplex.setByteArray( byteArray );
+ elemWComplex.setAttr(Enum.two);
try {
binding.elemWComplexIn(elemWComplex);
} catch (java.rmi.RemoteException re) {