diff options
author | nsandonato | 2011-05-09 21:00:54 +0000 |
---|---|---|
committer | nsandonato | 2011-05-09 21:00:54 +0000 |
commit | 152941a893fcebb42fb30c31cb7aac6671033709 (patch) | |
tree | 8b5cfc46374ff381942c11dce93d0e852f0e2a9d | |
parent | 5d56ca105d47822f315a73aceae776f22edfffdf (diff) | |
download | webtools.sourceediting-152941a893fcebb42fb30c31cb7aac6671033709.tar.gz webtools.sourceediting-152941a893fcebb42fb30c31cb7aac6671033709.tar.xz webtools.sourceediting-152941a893fcebb42fb30c31cb7aac6671033709.zip |
[344723] StackOverFlowError in erroneous jsp file - destabilizing issue
4 files changed, 15 insertions, 10 deletions
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/IntStack.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/IntStack.java index 89fdc139da..a4588ef8c5 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/IntStack.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/contenttype/IntStack.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2005 IBM Corporation and others. + * Copyright (c) 2001, 2011 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 @@ -14,7 +14,7 @@ package org.eclipse.jst.jsp.core.internal.contenttype; /* * - * A non-resizable class implementing the behavior of java.util.Stack, but + * A resizable class implementing the behavior of java.util.Stack, but * directly for the <code> integer </code> primitive. */ import java.util.EmptyStackException; @@ -25,7 +25,7 @@ public class IntStack { private int size = 0; public IntStack() { - this(100); + this(10); } public IntStack(int maxdepth) { @@ -87,7 +87,9 @@ public class IntStack { */ public int push(int newValue) { if (size == list.length) { - throw new StackOverflowError(); + int[] newList = new int[size * 2]; + System.arraycopy(list, 0, newList, 0, size); + list = newList; } list[size++] = newValue; return newValue; diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/parser/internal/JSPTokenizer.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/parser/internal/JSPTokenizer.java index 11faaf92b9..3f468cbba2 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/parser/internal/JSPTokenizer.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/parser/internal/JSPTokenizer.java @@ -21,6 +21,7 @@ import java.util.Iterator; import java.util.List; import org.eclipse.jst.jsp.core.internal.Logger; +import org.eclipse.jst.jsp.core.internal.contenttype.IntStack; import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts; import org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker; import org.eclipse.wst.sse.core.internal.ltk.parser.BlockTokenizer; @@ -30,7 +31,6 @@ import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; import org.eclipse.wst.sse.core.internal.util.Debug; import org.eclipse.wst.sse.core.utils.StringUtils; import org.eclipse.wst.xml.core.internal.parser.ContextRegionContainer; -import org.eclipse.wst.xml.core.internal.parser.IntStack; /** diff --git a/bundles/org.eclipse.wst.sse.core/DevTimeSupport/SedModel/HTMLTokenizer/devel/JSPTokenizer.jflex b/bundles/org.eclipse.wst.sse.core/DevTimeSupport/SedModel/HTMLTokenizer/devel/JSPTokenizer.jflex index b4c0dfb83f..93591302af 100644 --- a/bundles/org.eclipse.wst.sse.core/DevTimeSupport/SedModel/HTMLTokenizer/devel/JSPTokenizer.jflex +++ b/bundles/org.eclipse.wst.sse.core/DevTimeSupport/SedModel/HTMLTokenizer/devel/JSPTokenizer.jflex @@ -19,6 +19,7 @@ import java.util.Iterator; import java.util.List;
import org.eclipse.jst.jsp.core.internal.Logger;
+import org.eclipse.jst.jsp.core.internal.contenttype.IntStack;
import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts;
import org.eclipse.wst.sse.core.internal.ltk.parser.BlockMarker;
import org.eclipse.wst.sse.core.internal.ltk.parser.BlockTokenizer;
@@ -28,7 +29,6 @@ import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList; import org.eclipse.wst.sse.core.internal.util.Debug;
import org.eclipse.wst.sse.core.utils.StringUtils;
import org.eclipse.wst.xml.core.internal.parser.ContextRegionContainer;
-import org.eclipse.wst.xml.core.internal.parser.IntStack;
%%
diff --git a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/rules/PresentationCollector.java b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/rules/PresentationCollector.java index 436d510b0c..e79a989ff4 100644 --- a/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/rules/PresentationCollector.java +++ b/bundles/org.eclipse.wst.sse.ui/src/org/eclipse/wst/sse/ui/internal/rules/PresentationCollector.java @@ -1,5 +1,5 @@ /*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2011 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
@@ -54,9 +54,12 @@ class PresentationCollector extends AbstractCollection { public boolean add(Object o) {
StyleRange range = (StyleRange) o;
if (lastOffset > range.start) {
- IllegalArgumentException e = new IllegalArgumentException("Overlapping start in StyleRange " + range.start + ":" + range.length); //$NON-NLS-1$ //$NON-NLS-2$
- Logger.logException(e);
- throw e;
+ Logger.log(Logger.ERROR, "Overlapping start in StyleRange " + range.start + ":" + range.length); //$NON-NLS-1$ //$NON-NLS-2$
+ return false;
+ }
+ else if (range.length < 0) {
+ Logger.log(Logger.ERROR, "StyleRange with negative length" + range.start + ":" + range.length); //$NON-NLS-1$ //$NON-NLS-2$
+ return false;
}
lastOffset = range.start + range.length;
fPresentation.addStyleRange(range);
|