Author: darran.lofthouse(a)jboss.com
Date: 2009-05-02 08:52:19 -0400 (Sat, 02 May 2009)
New Revision: 9950
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP04_JBPAPP-1975/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java
Log:
[JBPAPP-1975] Insufficient optimisation in JBossXSModel traversing XML schema.
Modified:
stack/native/branches/jbossws-native-2.0.1.SP2_CP04_JBPAPP-1975/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java
===================================================================
---
stack/native/branches/jbossws-native-2.0.1.SP2_CP04_JBPAPP-1975/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java 2009-05-01
16:32:15 UTC (rev 9949)
+++
stack/native/branches/jbossws-native-2.0.1.SP2_CP04_JBPAPP-1975/src/main/java/org/jboss/ws/metadata/wsdl/xmlschema/JBossXSModel.java 2009-05-02
12:52:19 UTC (rev 9950)
@@ -560,8 +560,8 @@
private HashMap<String, XSElementDeclaration> anonymousElementMap;
// not really a stack, but it does contain items on the stack
- private HashSet<XSComplexTypeDefinition> stack = new
HashSet<XSComplexTypeDefinition>();
-
+ private HashSet<XSComplexTypeDefinition> processed = new
HashSet<XSComplexTypeDefinition>();
+
/**
* Triggers a rebuild of anonymous types only if a build has occured before.
*/
@@ -582,6 +582,9 @@
anonymousElementMap = new HashMap<String, XSElementDeclaration>();
+
+ processed.clear();
+
XSNamedMap namedMap = model.getComponents(XSConstants.TYPE_DEFINITION);
for (int i = 0; i < namedMap.getLength(); i++)
{
@@ -598,6 +601,7 @@
XSElementDeclaration element = (XSElementDeclaration)namedMap.item(i);
analyzeElement(element, null, element.getNamespace(), null, null);
}
+ processed.clear();
}
private void analyzeElement(XSElementDeclaration element, String parentName, String
namespace, Integer minOccurs, Integer maxOccurs)
@@ -674,13 +678,14 @@
private void analyzeComplexType(XSComplexTypeDefinition complexType, String
parentName, String namespace)
{
// Prevent reentrancy
- if (stack.contains(complexType))
+ if (processed.contains(complexType))
+ {
return;
+ }
- stack.add(complexType);
+ processed.add(complexType);
String name = analyzeType(complexType, parentName, namespace);
analyzeParticle(complexType.getParticle(), name, namespace);
- stack.remove(complexType);
}
private void analyzeParticle(XSParticle particle, String parentName, String
namespace)
Show replies by date