axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dee...@apache.org
Subject svn commit: r559340 - /webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
Date Wed, 25 Jul 2007 07:22:22 GMT
Author: deepal
Date: Wed Jul 25 00:22:11 2007
New Revision: 559340

URL: http://svn.apache.org/viewvc?view=rev&rev=559340
Log:
fixing AXIS2-3006

Modified:
    webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java

Modified: webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java?view=diff&rev=559340&r1=559339&r2=559340
==============================================================================
--- webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/adb/src/org/apache/axis2/databinding/utils/BeanUtil.java
Wed Jul 25 00:22:11 2007
@@ -149,8 +149,7 @@
                     Method readMethod = propDesc.getReadMethod();
                     Object value;
                     if(readMethod!=null){
-                      value = readMethod.invoke(beanObject,
-                                                                   null);
+                      value = readMethod.invoke(beanObject, null);
                     } else {
                         throw new AxisFault("can not find read method for : "  + propDesc.getName());
                     }
@@ -159,7 +158,6 @@
                     object.add(value == null ? null : SimpleTypeMapper.getStringValue(value));
                 } else if (ptype.isArray()) {
                     if (SimpleTypeMapper.isSimpleType(ptype.getComponentType())) {
-
                         Method readMethod = propDesc.getReadMethod();
                         Object value;
                         if(readMethod!=null){
@@ -169,17 +167,21 @@
                             throw new AxisFault("can not find read method for : "  + propDesc.getName());
                         }
                         if (value != null) {
-                            int i1 = Array.getLength(value);
-                            for (int j = 0; j < i1; j++) {
-                                Object o = Array.get(value, j);
+                            if("byte".equals(ptype.getComponentType().getName())) {
                                 addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare);
-                                object.add(o == null ? null : SimpleTypeMapper.getStringValue(o));
+                                object.add(Base64.encode((byte[]) value));
+                            } else {
+                                int i1 = Array.getLength(value);
+                                for (int j = 0; j < i1; j++) {
+                                    Object o = Array.get(value, j);
+                                    addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare);
+                                    object.add(o == null ? null : SimpleTypeMapper.getStringValue(o));
+                                }
                             }
                         } else {
                             addTypeQname(elemntNameSpace, object, propDesc, beanName,processingDocLitBare);
                             object.add(value);
                         }
-
                     } else {
                         Object value [] = (Object[])propDesc.getReadMethod().invoke(beanObject,
                                                                                     null);
@@ -302,25 +304,29 @@
             if (beanClass.isArray()) {
                 ArrayList valueList = new ArrayList();
                 Class arrayClassType = beanClass.getComponentType();
-                Iterator parts = beanElement.getChildElements();
-                OMElement omElement;
-                while (parts.hasNext()) {
-                    Object objValue = parts.next();
-                    if (objValue instanceof OMElement) {
-                        omElement = (OMElement)objValue;
-                        if (!arrayLocalName.equals(omElement.getLocalName())) {
-                            continue;
-                        }
-                        Object obj = deserialize(arrayClassType,
-                                                 omElement,
-                                                 objectSupplier, null);
-                        if (obj != null) {
-                            valueList.add(obj);
+                if ("byte".equals(arrayClassType.getName())) {
+                    return Base64.decode(beanElement.getFirstElement().getText());
+                } else {
+                    Iterator parts = beanElement.getChildElements();
+                    OMElement omElement;
+                    while (parts.hasNext()) {
+                        Object objValue = parts.next();
+                        if (objValue instanceof OMElement) {
+                            omElement = (OMElement)objValue;
+                            if (!arrayLocalName.equals(omElement.getLocalName())) {
+                                continue;
+                            }
+                            Object obj = deserialize(arrayClassType,
+                                    omElement,
+                                    objectSupplier, null);
+                            if (obj != null) {
+                                valueList.add(obj);
+                            }
                         }
                     }
+                    return ConverterUtil.convertToArray(arrayClassType,
+                            valueList);
                 }
-                return ConverterUtil.convertToArray(arrayClassType,
-                                                    valueList);
             } else {
                 if (SimpleTypeMapper.isSimpleType(beanClass)) {
                     return SimpleTypeMapper.getSimpleTypeObject(beanClass, beanElement);



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message