Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360241

Summary: Error renaming project: String index out of range: -1
Product: [Technology] EGit Reporter: Robert Munteanu <robert.munteanu>
Component: CoreAssignee: Project Inbox <egit.core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: andy.boothe, remy.suen
Version: 1.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Robert Munteanu CLA 2011-10-07 10:24:41 EDT
What steps will reproduce the problem?
1. Rename a project ( Refactor -> Rename ... )
2. Select a new name
3. Click OK


-- Error Details --
Date: Fri Oct 07 17:18:10 EEST 2011
Message: String index out of range: -1
Severity: Error
Product: Eclipse 1.4.1.20110909-0613 (org.eclipse.epp.package.jee.product)
Plugin: org.eclipse.ltk.ui.refactoring
Session Data:
eclipse.buildId=M20110909-1335
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os linux -ws gtk -arch x86_64 -product org.eclipse.epp.package.jee.product

Exception Stack Trace:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1937)
	at java.lang.String.substring(String.java:1904)
	at org.eclipse.egit.core.GitMoveDeleteHook.moveProject(GitMoveDeleteHook.java:194)
	at org.eclipse.team.internal.core.MoveDeleteManager.moveProject(MoveDeleteManager.java:113)
	at org.eclipse.core.internal.resources.Project.move(Project.java:1053)
	at org.eclipse.jdt.internal.corext.refactoring.changes.RenameJavaProjectChange.doRename(RenameJavaProjectChange.java:76)
	at org.eclipse.jdt.internal.corext.refactoring.AbstractJavaElementRenameChange.perform(AbstractJavaElementRenameChange.java:89)
	at org.eclipse.ltk.core.refactoring.CompositeChange.perform(CompositeChange.java:278)
	at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange.access$0(DynamicValidationStateChange.java:1)
	at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange$1.run(DynamicValidationStateChange.java:102)
	at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4873)
	at org.eclipse.jdt.internal.corext.refactoring.changes.DynamicValidationStateChange.perform(DynamicValidationStateChange.java:105)
	at org.eclipse.ltk.core.refactoring.CompositeChange.perform(CompositeChange.java:278)
	at org.eclipse.ltk.core.refactoring.PerformChangeOperation$1.run(PerformChangeOperation.java:258)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ltk.core.refactoring.PerformChangeOperation.executeChange(PerformChangeOperation.java:306)
	at org.eclipse.ltk.internal.ui.refactoring.UIPerformChangeOperation.executeChange(UIPerformChangeOperation.java:92)
	at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:223)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
Comment 1 Remy Suen CLA 2011-10-07 17:08:23 EDT
Where is the .git folder located relative to your project's root (where its .project file is)?
Comment 2 Robert Munteanu CLA 2011-10-10 03:33:32 EDT
The .project file is located in the same directory as the .git folder .
Comment 3 Andy Boothe CLA 2011-11-15 16:40:01 EST
I can corroborate this issue. Are there any known workarounds?
Comment 4 Remy Suen CLA 2011-11-16 09:45:45 EST
(In reply to comment #3)
> I can corroborate this issue. Are there any known workarounds?

If you disconnect your project from Git and then rename it it would probably work. Though I don't know what consequences it may have when you "reconnect" it back.
Comment 5 Stefan Lay CLA 2011-11-16 10:13:52 EST
I think this is fixed with commit 57b79abd8f486af5f95db42435c374404fa40513.

*** This bug has been marked as a duplicate of bug 334112 ***
Comment 6 Andy Boothe CLA 2011-11-16 12:36:19 EST
> If you disconnect your project from Git and then rename it it would probably
work. Though I don't know what consequences it may have when you "reconnect" it
back.

I tried to disconnect -> rename, but the name change didn't seem to pick up on the "reconnect" step. I tried simply re-checkout, so it makes sense that it didn't pick up; maybe there's a better way.

> I think this is fixed with commit 57b79abd8f486af5f95db42435c374404fa40513.

Awesome! What is the best way for me to pick up that change? I'd rather not run off of nightlies, but is there some sort of stable "intermediate release" tag I could pick up from the nightlies? Or, is it known when the next update will drop?
Comment 7 Remy Suen CLA 2011-11-16 12:56:52 EST
(In reply to comment #6)x
> > I think this is fixed with commit 57b79abd8f486af5f95db42435c374404fa40513.
> 
> Awesome! What is the best way for me to pick up that change?

You have to use the nightlies.

> I'd rather not run
> off of nightlies, but is there some sort of stable "intermediate release" tag I
> could pick up from the nightlies?

No, we don't have these kinds of builds.

> Or, is it known when the next update will
> drop?

I'm guessing February but I'm not sure.