From df498b476f3f3fd088bd0ea131f6f310817aee80 Mon Sep 17 00:00:00 2001 From: Emanuel Graf Date: Wed, 29 Jul 2009 07:17:03 +0000 Subject: [PATCH] FIXED - bug 284888: When I do "extract method" I get a "String index out of range: -1" error https://bugs.eclipse.org/bugs/show_bug.cgi?id=284888 --- .../core/dom/rewrite/changegenerator/ChangeGenerator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java index 1f3da625f7c..130901f1a75 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik + * Copyright (c) 2008, 2009 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 @@ -564,6 +564,7 @@ public class ChangeGenerator extends CPPASTVisitor { do { if (lastCommonPosition >= 0 && lastCommonPositionInOriginal >= 0 + && lastCommonPositionInOriginal - korOffset >= 0 && originalCode.charAt(lastCommonPositionInOriginal - korOffset) == reverseSynthCode .charAt(lastCommonPosition)) {