Here's the patch Dave referred to previously (see "RE: do an Apache SOAP 2.3
release ?" 4/26/2002 in soap-dev).
It allows xsi:null="1" and xsi:null="true" to be properly handled by
refactoring the 0/1/true/false handling code in BooleanDeserializer into a
new method in SoapEncUtils called decodeBooleanValue. The SoapEncUtils
isNull method and the BooleanDeserializer unmarshall method both use this
new method for parsing boolean values.
-- Marc
Index: SoapEncUtils.java
===================================================================
RCS file:
/home/cvspublic/xml-soap/java/src/org/apache/soap/encoding/soapenc/SoapEncUtils.java,v
retrieving revision 1.8
diff -u -r1.8 SoapEncUtils.java
--- SoapEncUtils.java 16 Apr 2002 17:14:14 -0000 1.8
+++ SoapEncUtils.java 30 Apr 2002 16:24:09 -0000
@@ -212,7 +212,22 @@
Constants.ATTR_NULL);
return nullValue != null
- && nullValue.equals(Constants.ATTRVAL_TRUE);
+ && decodeBooleanValue(nullValue);
+ }
+
+ public static boolean decodeBooleanValue(String value)
+ {
+ switch (value.charAt(0))
+ {
+ case '0': case 'f': case 'F':
+ return false;
+
+ case '1': case 't': case 'T':
+ return true;
+
+ default:
+ throw new IllegalArgumentException("Invalid boolean value: " + value);
+ }
}
public static QName getAttributeValue(Element el,
Index: BooleanDeserializer.java
===================================================================
RCS file:
/home/cvspublic/xml-soap/java/src/org/apache/soap/encoding/soapenc/BooleanDeserializer.java,v
retrieving revision 1.2
diff -u -r1.2 BooleanDeserializer.java
--- BooleanDeserializer.java 16 Jul 2001 01:44:14 -0000 1.2
+++ BooleanDeserializer.java 30 Apr 2002 16:25:03 -0000
@@ -81,16 +81,8 @@
if ((value == null) || (value.length() == 0))
throw new IllegalArgumentException("Missing boolean value");
-
- switch (value.charAt(0)) {
- case '0': case 'f': case 'F':
- return new Bean(boolean.class, Boolean.FALSE);
-
- case '1': case 't': case 'T':
- return new Bean(boolean.class, Boolean.TRUE);
-
- default:
- throw new IllegalArgumentException("Invalid boolean value: " + value);
- }
+
+ return SoapEncUtils.decodeBooleanValue(value) ?
+ new Bean(boolean.class, Boolean.TRUE) : new Bean(boolean.class,
+Boolean.FALSE);
}
}