[jbossws-commits] JBossWS SVN: r9630 - stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Thu Mar 19 10:06:58 EDT 2009
Author: richard.opalka at jboss.com
Date: 2009-03-19 10:06:58 -0400 (Thu, 19 Mar 2009)
New Revision: 9630
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
Log:
[JBWS-2241] fix
Modified: stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java
===================================================================
--- stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2009-03-19 14:06:32 UTC (rev 9629)
+++ stack/native/trunk/modules/core/src/main/java/org/jboss/ws/tools/wsdl/WSDL11Reader.java 2009-03-19 14:06:58 UTC (rev 9630)
@@ -32,6 +32,7 @@
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -422,18 +423,21 @@
String localname = domElementClone.getLocalName();
try
{
+ List<URL> published = new LinkedList<URL>();
if ("import".equals(localname))
{
- processSchemaImport(destTypes, wsdlLoc, domElementClone);
+ processSchemaImport(destTypes, wsdlLoc, domElementClone, published);
}
else if ("schema".equals(localname))
{
- processSchemaInclude(destTypes, wsdlLoc, domElementClone);
+ processSchemaInclude(destTypes, wsdlLoc, domElementClone, published);
}
else
{
throw new IllegalArgumentException("Unsuported schema element: " + localname);
}
+ published.clear();
+ published = null;
}
catch (IOException e)
{
@@ -525,7 +529,7 @@
}
}
- private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl) throws IOException, WSDLException
+ private void processSchemaImport(WSDLTypes types, URL wsdlLoc, Element importEl, List<URL> published) throws IOException, WSDLException
{
if (wsdlLoc == null)
throw new IllegalArgumentException("Cannot process import, parent location not set");
@@ -538,12 +542,16 @@
URL locationURL = getLocationURL(wsdlLoc, location);
Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream());
- URL newloc = processSchemaInclude(types, locationURL, rootElement);
- if (newloc != null)
- importEl.setAttribute("schemaLocation", newloc.toExternalForm());
+ if (!published.contains(locationURL))
+ {
+ published.add(locationURL);
+ URL newloc = processSchemaInclude(types, locationURL, rootElement, published);
+ if (newloc != null)
+ importEl.setAttribute("schemaLocation", newloc.toExternalForm());
+ }
}
- private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl) throws IOException, WSDLException
+ private URL processSchemaInclude(WSDLTypes types, URL wsdlLoc, Element schemaEl, List<URL> published) throws IOException, WSDLException
{
if (wsdlLoc == null)
throw new IllegalArgumentException("Cannot process iclude, parent location not set");
@@ -572,9 +580,13 @@
URL locationURL = getLocationURL(wsdlLoc, location);
Element rootElement = DOMUtils.parse(new ResourceURL(locationURL).openStream());
- URL newloc = processSchemaInclude(types, locationURL, rootElement);
- if (newloc != null)
- includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
+ if (!published.contains(locationURL))
+ {
+ published.add(locationURL);
+ URL newloc = processSchemaInclude(types, locationURL, rootElement, published);
+ if (newloc != null)
+ includeEl.setAttribute("schemaLocation", newloc.toExternalForm());
+ }
}
String targetNS = getOptionalAttribute(schemaEl, "targetNamespace");
More information about the jbossws-commits
mailing list