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 di...@apache.org on 2005/02/07 00:57:27 UTC
cvs commit: ws-axis/java/src/org/apache/axis/encoding/ser SimpleDeserializerFactory.java SimpleSerializer.java
dims 2005/02/06 15:57:27
Modified: java/src/org/apache/axis/encoding/ser
SimpleDeserializerFactory.java
SimpleSerializer.java
Log:
prevent attribute lookup for basic types
Revision Changes Path
1.15 +1 -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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- SimpleDeserializerFactory.java 6 Feb 2005 19:31:13 -0000 1.14
+++ SimpleDeserializerFactory.java 6 Feb 2005 23:57:27 -0000 1.15
@@ -83,7 +83,7 @@
* This is for optimization purposes, so that we don't introspect
* primitive java types or some basic Axis types.
*/
- private static boolean isBasic(Class javaType) {
+ public static boolean isBasic(Class javaType) {
return (javaType.isPrimitive() ||
javaType == java.lang.String.class ||
javaType == java.lang.Boolean.class ||
1.37 +12 -8 ws-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java
Index: SimpleSerializer.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/encoding/ser/SimpleSerializer.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- SimpleSerializer.java 6 Feb 2005 05:12:25 -0000 1.36
+++ SimpleSerializer.java 6 Feb 2005 23:57:27 -0000 1.37
@@ -72,7 +72,7 @@
// generate a fresh one.
if (typeDesc != null) {
propertyDescriptor = typeDesc.getPropertyDescriptors();
- } else {
+ } else if (!SimpleDeserializerFactory.isBasic(javaType)) {
propertyDescriptor = BeanUtils.getPd(javaType, null);
}
}
@@ -129,11 +129,13 @@
return context.qName2String((QName)value);
}
- BeanPropertyDescriptor pd = BeanUtils.getSpecificPD(propertyDescriptor, "_value");
- if(pd != null) {
- try {
- return pd.get(value).toString();
- } catch (Exception e) {
+ if(propertyDescriptor != null) {
+ BeanPropertyDescriptor pd = BeanUtils.getSpecificPD(propertyDescriptor, "_value");
+ if(pd != null) {
+ try {
+ return pd.get(value).toString();
+ } catch (Exception e) {
+ }
}
}
return value.toString();
@@ -157,7 +159,9 @@
try {
// Find each property that is an attribute
// and add it to our attribute list
- for (int i=0; i<propertyDescriptor.length; i++) {
+ for (int i = 0;
+ propertyDescriptor != null && i < propertyDescriptor.length;
+ i++) {
String propName = propertyDescriptor[i].getName();
if (propName.equals("class"))
continue;
@@ -234,7 +238,7 @@
// Get the base type from the "value" element of the bean
String base = "string";
- for (int i=0; i<propertyDescriptor.length; i++) {
+ for (int i=0; propertyDescriptor != null && i<propertyDescriptor.length; i++) {
String propName = propertyDescriptor[i].getName();
if (!propName.equals("value")) {
if (typeDesc != null) {