axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r785647 - in /webservices/axis2/trunk/java/modules/metadata: src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java
Date Wed, 17 Jun 2009 15:04:01 GMT
Author: scheu
Date: Wed Jun 17 15:04:01 2009
New Revision: 785647

URL: http://svn.apache.org/viewvc?rev=785647&view=rev
Log:
JIRA:AXIS2-4388
Contributors:Rich Scheuerle and Paul Mariduena
Summary:
Fixed DescriptionBuilderUtils to properly detect and correct array classes.
For example [my.Foo is now corrected to[Lmy.Foo;

Modified:
    webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java
    webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java

Modified: webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java?rev=785647&r1=785646&r2=785647&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java
(original)
+++ webservices/axis2/trunk/java/modules/metadata/src/org/apache/axis2/jaxws/description/builder/DescriptionBuilderUtils.java
Wed Jun 17 15:04:01 2009
@@ -290,7 +290,34 @@
      * @return
      */
     static String reparseIfArray(String classToLoad) {
-
+        if (log.isDebugEnabled())
+        {
+            log.debug("entry with String parameter classToLoad: " + classToLoad);
+        }
+        if (classToLoad.startsWith("[")) {
+            // It appears that the string is already in binary form.
+            // Detect if the form is valid and fix it if it is not.
+            // For example, sometimes a [my.Foo is input instead of the required [Lmy.Foo;
+            String binaryForm = classToLoad;
+            
+            int indexAfterBracket = classToLoad.lastIndexOf("[") + 1;
+            
+            String base = classToLoad.substring(indexAfterBracket);
+            String dims = classToLoad.substring(0, indexAfterBracket);
+            
+            if (getPrimitiveClass(base) == null) {
+                // Make sure the base starts with an L and ends with a ;
+                if (!base.startsWith("L") && !base.endsWith(";")) {
+                    binaryForm = dims + "L" + base + ";";
+                }
+            }
+            if (log.isDebugEnabled())
+            {
+                log.debug("exit method with String return value binaryForm: " + binaryForm);
+            }            
+            return binaryForm;
+        }
+                    
         String reparsedClassName = classToLoad;
         if (isClassAnArray(classToLoad)) {
             String baseType = getBaseArrayClassName(classToLoad);
@@ -301,6 +328,10 @@
                 reparsedClassName = dimensionPrefix + "L" + baseType + ";";
             }
         }
+        if (log.isDebugEnabled())
+        {
+            log.debug("exit method with String return value reparsedClassName: " + reparsedClassName);
+        }        
         return reparsedClassName;
     }
 

Modified: webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java?rev=785647&r1=785646&r2=785647&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java
(original)
+++ webservices/axis2/trunk/java/modules/metadata/test/org/apache/axis2/jaxws/description/builder/DescriptionBuilderTests.java
Wed Jun 17 15:04:01 2009
@@ -22,6 +22,7 @@
 
 import junit.framework.TestCase;
 import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.description.builder.DescriptionBuilderUtils;
 
 import javax.jws.WebParam.Mode;
 import javax.jws.WebService;
@@ -251,6 +252,12 @@
         assertNotNull(ex);
     }
     
+    public void testDescriptionBuilderUtilsReparseIfArray() {
+        String expected = "[Lmy.Class;";
+        String out = DescriptionBuilderUtils.reparseIfArray("[my.Class");
+        assertEquals("DescriptionBuilderUtils reparseIfArray method did not reformat binary
class name properly", expected, out);
+    }       
+    
     class TestProcessor implements CustomAnnotationProcessor {
         
         private String annotationInstanceClassName;



Mime
View raw message