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 di...@apache.org on 2006/12/18 15:29:25 UTC
svn commit: r488280 -
/webservices/axis2/branches/java/1_1/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
Author: dims
Date: Mon Dec 18 06:29:24 2006
New Revision: 488280
URL: http://svn.apache.org/viewvc?view=rev&rev=488280
Log:
fix for AXIS2-1809 - WSDL2Java tool fails to gather all the schemas if they are imported or included using a path with '.' or '..'
Modified:
webservices/axis2/branches/java/1_1/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
Modified: webservices/axis2/branches/java/1_1/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_1/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?view=diff&rev=488280&r1=488279&r2=488280
==============================================================================
--- webservices/axis2/branches/java/1_1/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/branches/java/1_1/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Mon Dec 18 06:29:24 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
@@ -484,18 +478,30 @@
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) {
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org