You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by am...@apache.org on 2006/12/15 10:57:16 UTC

svn commit: r487504 - /webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java

Author: amilas
Date: Fri Dec 15 01:57:14 2006
New Revision: 487504

URL: http://svn.apache.org/viewvc?view=rev&rev=487504
Log:
fixed the issue AXIS2-1809 with some changes to the srinaths' patch

Modified:
    webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java

Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?view=diff&rev=487504&r1=487503&r2=487504
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Fri Dec 15 01:57:14 2006
@@ -59,13 +59,7 @@
 import java.io.StringWriter;
 import java.io.StringReader;
 import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
+import java.util.*;
 
 /**
  * Framework-linked code used by XMLBeans data binding support. This is accessed
@@ -231,8 +225,8 @@
                                 if (primitiveType != null) {
                                     mapper.addTypeMappingStatus(partQName, Boolean.TRUE);
                                 }
-                                if (elementProperty.extendsJavaArray()){
-                                    mapper.addTypeMappingStatus(partQName,Constants.ARRAY_TYPE);
+                                if (elementProperty.extendsJavaArray()) {
+                                    mapper.addTypeMappingStatus(partQName, Constants.ARRAY_TYPE);
                                 }
                             }
                         }
@@ -484,24 +478,37 @@
             if (systemId.startsWith("project://local/")) {
                 systemId = systemId.substring("project://local/".length());
             }
+
+            StringTokenizer pathElements = new StringTokenizer(systemId, File.separator);
+            Stack pathElementStack = new Stack();
+            while (pathElements.hasMoreTokens()) {
+                String pathElement = pathElements.nextToken();
+                if (".".equals(pathElement)) {
+                } else if ("..".equals(pathElement)) {
+                    if (!pathElementStack.isEmpty())
+                        pathElementStack.pop();
+                } else {
+                    pathElementStack.push(pathElement);
+                }
+            }
+            StringBuffer pathBuilder = new StringBuffer();
+            for (Iterator iter = pathElementStack.iterator(); iter.hasNext();) {
+                pathBuilder.append(File.separator + iter.next());
+            }
+            systemId = pathBuilder.toString();
+
             log.info("Resolving schema with publicId [" + publicId + "] and systemId [" + systemId + "]");
             try {
                 for (int i = 0; i < schemas.length; i++) {
                     XmlSchema schema = schemas[i];
-                    boolean found = false;
-                    if (systemId.indexOf('/') == -1 && schema.getSourceURI() != null && schema.getSourceURI().endsWith(systemId))
-                    {
-                        found = true;
-                    } else if (schema.getSourceURI() != null && schema.getSourceURI().equals(systemId)) {
-                        found = true;
-                    }
-                    if (found) {
+                    if (schema.getSourceURI() != null && schema.getSourceURI().endsWith(systemId)) {
                         try {
                             return new InputSource(getSchemaAsReader(schemas[i]));
                         } catch (IOException e) {
                             throw new RuntimeException(e);
                         }
                     }
+
                 }
                 for (int i = 0; i < schemas.length; i++) {
                     XmlSchema schema = schemas[i];



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