Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoopur Gupta2017-05-15 10:07:27 +0000
committerNoopur Gupta2017-05-15 10:11:44 +0000
commitad343a1a2246a36698c5ec2841a24aecc358663c (patch)
treedfd7e40d91314554ad2bb804ffbb65b751ecc86a /org.eclipse.ui.genericeditor.examples
parent2d934aa3b24f3b875d57839f7eb527d26059d2bb (diff)
downloadeclipse.platform.text-ad343a1a2246a36698c5ec2841a24aecc358663c.tar.gz
eclipse.platform.text-ad343a1a2246a36698c5ec2841a24aecc358663c.tar.xz
eclipse.platform.text-ad343a1a2246a36698c5ec2841a24aecc358663c.zip
Fixed bug 510940: SIOOBE in
org.eclipse.ui.genericeditor.examples.dotproject.NaturesAndProjectsContentAssistProcessor Change-Id: I5177543feace125dfdbfe978cecfabed7b2c4230 Signed-off-by: Noopur Gupta <noopur_gupta@in.ibm.com>
Diffstat (limited to 'org.eclipse.ui.genericeditor.examples')
-rw-r--r--org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NaturesAndProjectsContentAssistProcessor.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NaturesAndProjectsContentAssistProcessor.java b/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NaturesAndProjectsContentAssistProcessor.java
index 86f7848b01f..1f8fd98bb90 100644
--- a/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NaturesAndProjectsContentAssistProcessor.java
+++ b/org.eclipse.ui.genericeditor.examples/src/org/eclipse/ui/genericeditor/examples/dotproject/NaturesAndProjectsContentAssistProcessor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2016 Red Hat Inc. and others.
+ * Copyright (c) 2016, 2017 Red Hat Inc. 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
@@ -30,7 +30,8 @@ public class NaturesAndProjectsContentAssistProcessor implements IContentAssistP
String natureTag= "<nature>";
String projectReferenceTag="<project>";
IWorkspace workspace = ResourcesPlugin.getWorkspace();
- if (text.length() >= natureTag.length() && text.substring(offset - natureTag.length(), offset).equals(natureTag)) {
+ int natureTagLength = natureTag.length();
+ if (text.length() >= natureTagLength && offset >= natureTagLength && text.substring(offset - natureTagLength, offset).equals(natureTag)) {
IProjectNatureDescriptor[] natureDescriptors= workspace.getNatureDescriptors();
ICompletionProposal[] proposals = new ICompletionProposal[natureDescriptors.length];
for (int i= 0; i < natureDescriptors.length; i++) {
@@ -39,7 +40,8 @@ public class NaturesAndProjectsContentAssistProcessor implements IContentAssistP
}
return proposals;
}
- if (text.length() >= projectReferenceTag.length() && text.substring(offset - projectReferenceTag.length(), offset).equals(projectReferenceTag)) {
+ int projectReferenceTagLength = projectReferenceTag.length();
+ if (text.length() >= projectReferenceTagLength && offset >= projectReferenceTagLength && text.substring(offset - projectReferenceTagLength, offset).equals(projectReferenceTag)) {
IProject[] projects= workspace.getRoot().getProjects();
//TODO - filter out the project this file is in
ICompletionProposal[] proposals = new ICompletionProposal[projects.length];

Back to the top