Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2009-08-26 04:35:43 -0400
committerAnton Leherbauer2009-08-26 04:35:43 -0400
commitff454842114a13fbf67512b82d757f3eae4c9243 (patch)
tree3141c22d112f45fd5518359a9ae00adfb3317185
parent13d9e97f42c74f6fe86c638b16e93a5ec319e9ae (diff)
downloadorg.eclipse.cdt-ff454842114a13fbf67512b82d757f3eae4c9243.tar.gz
org.eclipse.cdt-ff454842114a13fbf67512b82d757f3eae4c9243.tar.xz
org.eclipse.cdt-ff454842114a13fbf67512b82d757f3eae4c9243.zip
Bug 280417 - ArrayIndexOutOfBoundsException in MementoTokenizer causes "could not update landmark markers" error
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java10
-rw-r--r--core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java10
2 files changed, 18 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java
index d0c288723f..389bb1f97f 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/SourceManipulation.java
@@ -245,13 +245,16 @@ public class SourceManipulation extends Parent implements ISourceManipulation, I
final String elementName;
if (token.charAt(0) != CEM_ELEMENTTYPE) {
elementName= token;
+ if (!memento.hasMoreTokens()) return null;
token= memento.nextToken();
} else {
// anonymous
elementName= ""; //$NON-NLS-1$
}
// element type
- assert token.charAt(0) == CEM_ELEMENTTYPE;
+ if (token.charAt(0) != CEM_ELEMENTTYPE || !memento.hasMoreTokens()) {
+ return null;
+ }
String typeString= memento.nextToken();
int elementType;
try {
@@ -270,6 +273,11 @@ public class SourceManipulation extends Parent implements ISourceManipulation, I
if (token.charAt(0) != CEM_PARAMETER) {
break;
}
+ if (!memento.hasMoreTokens()) {
+ params.add(""); //$NON-NLS-1$
+ token= null;
+ break;
+ }
params.add(memento.nextToken());
token= null;
} while (memento.hasMoreTokens());
diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
index 4cc093cd25..f3b588da3e 100644
--- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
+++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/TranslationUnit.java
@@ -1016,13 +1016,16 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
final String elementName;
if (token.charAt(0) != CEM_ELEMENTTYPE) {
elementName= token;
+ if (!memento.hasMoreTokens()) return null;
token= memento.nextToken();
} else {
// anonymous
elementName= ""; //$NON-NLS-1$
}
// element type
- assert token.charAt(0) == CEM_ELEMENTTYPE;
+ if (token.charAt(0) != CEM_ELEMENTTYPE || !memento.hasMoreTokens()) {
+ return null;
+ }
String typeString= memento.nextToken();
int elementType;
try {
@@ -1041,6 +1044,11 @@ public class TranslationUnit extends Openable implements ITranslationUnit {
if (token.charAt(0) != CEM_PARAMETER) {
break;
}
+ if (!memento.hasMoreTokens()) {
+ params.add(""); //$NON-NLS-1$
+ token= null;
+ break;
+ }
params.add(memento.nextToken());
token= null;
} while (memento.hasMoreTokens());

Back to the top