[296172] Schema causes stack error [301167] UI freeze when grammar loading job name is a very long string
diff --git a/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF index ba454d4..bb4d5d9 100644 --- a/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.xml.core; singleton:=true -Bundle-Version: 1.1.103.qualifier +Bundle-Version: 1.1.104.qualifier Bundle-Activator: org.eclipse.wst.xml.core.internal.XMLCorePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/modelqueryimpl/CMDocumentManagerImpl.java b/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/modelqueryimpl/CMDocumentManagerImpl.java index fa9dc1c..b4f38b0 100644 --- a/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/modelqueryimpl/CMDocumentManagerImpl.java +++ b/bundles/org.eclipse.wst.xml.core/src-contentmodel/org/eclipse/wst/xml/core/internal/contentmodel/modelqueryimpl/CMDocumentManagerImpl.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. + * Copyright (c) 2002, 2010 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 @@ -214,7 +214,9 @@ cmDocumentCache.setStatus(resolvedURI, CMDocumentCache.STATUS_LOADING); //Thread thread = new Thread(new AsyncBuildOperation(publicId, resolvedURI, type)); //thread.start(); - Job job = new Job(XMLCoreMessages.loading + resolvedURI) + final int maxURILength = 150; + String uri = resolvedURI.length() > maxURILength ? resolvedURI.substring(0, maxURILength - 1) : resolvedURI; + Job job = new Job(XMLCoreMessages.loading + uri) { public boolean belongsTo(Object family) {
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 f5a14c2..8db26a8 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,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2002 IBM Corporation and others. + * Copyright (c) 2002, 2009 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 * http://www.eclipse.org/legal/epl-v10.html - * + * * Contributors: * IBM Corporation - initial API and implementation * Jens Lukowski/Innoopract - initial renaming/restructuring @@ -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 @@ public class CMVisitor { protected int indent = 0; + protected Stack visitedCMGroupStack = new Stack(); public void visitCMNode(CMNode node) { @@ -62,7 +65,21 @@ } 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; } }