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 2008/09/25 17:41:19 UTC

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

Author: amilas
Date: Thu Sep 25 08:41:18 2008
New Revision: 699005

URL: http://svn.apache.org/viewvc?rev=699005&view=rev
Log:
fixed the issue AXIS2-3983

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?rev=699005&r1=699004&r2=699005&view=diff
==============================================================================
--- 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 Thu Sep 25 08:41:18 2008
@@ -596,26 +596,30 @@
                 systemId = systemId.substring("project://local/".length());
             }
 
-            StringTokenizer pathElements = new StringTokenizer(systemId, "/");
-            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);
+            // if the system id has // final system id gives only one / after tokenizing process
+            // to avoid this we check whether it is started with http:// or not
+            if (!systemId.startsWith("http://")) {
+                StringTokenizer pathElements = new StringTokenizer(systemId, "/");
+                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().substring(1);
             }
-            StringBuffer pathBuilder = new StringBuffer();
-            for (Iterator iter = pathElementStack.iterator(); iter.hasNext();) {
-                pathBuilder.append(File.separator + iter.next());
-            }
-            systemId = pathBuilder.toString().substring(1);
+            
 
-            log.info("Resolving schema with publicId [" + publicId + "] and systemId [" + systemId +
-                    "]");
+            log.info("Resolving schema with publicId [" + publicId + "] and systemId [" + systemId + "]");
             try {
                 for (int i = 0; i < schemas.length; i++) {
                     XmlSchema schema = schemas[i];