Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkchong2008-11-12 21:33:29 +0000
committerkchong2008-11-12 21:33:29 +0000
commitf350a64c91c9f939f8db281411b18ef0fcc777c7 (patch)
tree9b6738fa5acec7ada0f97151de679a956827d88b
parent6d9a7d23d3f042a4adf522dc8bc7b6edbd9b88b3 (diff)
downloadwebtools.sourceediting-f350a64c91c9f939f8db281411b18ef0fcc777c7.tar.gz
webtools.sourceediting-f350a64c91c9f939f8db281411b18ef0fcc777c7.tar.xz
webtools.sourceediting-f350a64c91c9f939f8db281411b18ef0fcc777c7.zip
[255112] Schema causes stack error. From 3.0.3 bug 245851.
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMDescriptionBuilder.java13
-rw-r--r--bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMVisitor.java21
-rw-r--r--bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDVisitor.java17
3 files changed, 34 insertions, 17 deletions
diff --git a/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMDescriptionBuilder.java b/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMDescriptionBuilder.java
index f1cc6900ba..a82ab1c9be 100644
--- a/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMDescriptionBuilder.java
+++ b/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMDescriptionBuilder.java
@@ -12,7 +12,6 @@
*******************************************************************************/
package org.eclipse.wst.xml.core.internal.contentmodel.util;
-import java.util.Stack;
import org.eclipse.wst.xml.core.internal.contentmodel.CMAnyElement;
import org.eclipse.wst.xml.core.internal.contentmodel.CMContent;
@@ -29,8 +28,6 @@ public class CMDescriptionBuilder extends CMVisitor
protected StringBuffer sb;
protected CMNode root;
protected boolean isRootVisited;
- protected Stack visitedCMGroupStack = new Stack();
-
public String buildDescription(CMNode node)
{
sb = new StringBuffer();
@@ -62,11 +59,6 @@ public class CMDescriptionBuilder extends CMVisitor
public void visitCMGroup(CMGroup group)
{
- // This is to prevent recursion.
- if (visitedCMGroupStack.contains(group))
- {
- return;
- }
int op = group.getOperator();
if (op == CMGroup.ALL)
{
@@ -82,8 +74,6 @@ public class CMDescriptionBuilder extends CMVisitor
separator = " | "; //$NON-NLS-1$
}
- // Push the current group to check later to avoid potential recursion
- visitedCMGroupStack.push(group);
CMNodeList nodeList = group.getChildNodes();
int size = nodeList.getLength();
@@ -96,9 +86,6 @@ public class CMDescriptionBuilder extends CMVisitor
}
}
- // Pop the current group
- visitedCMGroupStack.pop();
-
sb.append(")"); //$NON-NLS-1$
addOccurenceSymbol(group);
}
diff --git a/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMVisitor.java b/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMVisitor.java
index fc4f35d205..89bb9d6a9a 100644
--- a/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMVisitor.java
+++ b/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/util/CMVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
+ * Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,8 @@
*******************************************************************************/
package org.eclipse.wst.xml.core.internal.contentmodel.util;
+import java.util.Stack;
+
import org.eclipse.wst.xml.core.internal.contentmodel.CMAnyElement;
import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
@@ -25,6 +27,7 @@ import org.eclipse.wst.xml.core.internal.contentmodel.CMNodeList;
public class CMVisitor
{
protected int indent = 0;
+ protected Stack visitedCMGroupStack = new Stack();
public void visitCMNode(CMNode node)
{
@@ -62,7 +65,21 @@ public class CMVisitor
}
case CMNode.GROUP :
{
- visitCMGroup((CMGroup)node);
+ CMGroup group = (CMGroup)node;
+
+ // This is to prevent recursion.
+ if (visitedCMGroupStack.contains(group))
+ {
+ break;
+ }
+
+ // Push the current group to check later to avoid potential recursion
+ visitedCMGroupStack.push(group);
+
+ visitCMGroup(group);
+
+ // Pop the current group
+ visitedCMGroupStack.pop();
break;
}
}
diff --git a/bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDVisitor.java b/bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDVisitor.java
index 27e4a9c5f2..59f5838f67 100644
--- a/bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDVisitor.java
+++ b/bundles/org.eclipse.wst.xsd.core/src-contentmodel/org/eclipse/wst/xsd/contentmodel/internal/XSDVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2001, 2005 IBM Corporation and others.
+ * Copyright (c) 2001, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,6 +11,7 @@
package org.eclipse.wst.xsd.contentmodel.internal;
import java.util.Iterator;
+import java.util.Stack;
import org.eclipse.xsd.XSDAttributeDeclaration;
import org.eclipse.xsd.XSDAttributeGroupDefinition;
@@ -35,6 +36,7 @@ public class XSDVisitor
}
protected XSDSchema schema;
+ protected Stack particleStack = new Stack();
public void visitSchema(XSDSchema schema)
{
@@ -156,7 +158,18 @@ public class XSDVisitor
{
if (particleContent instanceof XSDModelGroupDefinition)
{
- visitModelGroupDefinition((XSDModelGroupDefinition) particleContent);
+ XSDModelGroupDefinition modelGroupDef = (XSDModelGroupDefinition) particleContent;
+
+ if (particleStack.contains(modelGroupDef))
+ {
+ return;
+ }
+
+ particleStack.push(modelGroupDef);
+
+ visitModelGroupDefinition(modelGroupDef);
+
+ particleStack.pop();
}
else if (particleContent instanceof XSDModelGroup)
{

Back to the top