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

Bug 340672

Summary: Start Debug throws ArrayIndexOutOfBoundsException when JDK_HOME is a drive letter
Product: [Eclipse Project] JDT Reporter: smartiro
Component: DebugAssignee: Michael Rennie <Michael_Rennie>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: chmontgomery, curtis.windatt.public
Version: 3.7Flags: curtis.windatt.public: review+
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows All   
Whiteboard:
Attachments:
Description Flags
fix none

Description smartiro CLA 2011-03-22 11:32:09 EDT
Build Identifier: 20110218-0911

I have JDK_HOME set to j:
When trying to start debug session on any of my programs I get:

java.lang.ArrayIndexOutOfBoundsException: -1
at org.eclipse.core.runtime.Path.segment(Path.java:855)
at org.eclipse.jdt.internal.launching.StandardVMDebugger.prependJREPath(StandardVMDebugger.java:374)
at org.eclipse.jdt.internal.launching.StandardVMDebugger.run(StandardVMDebugger.java:221)
at org.eclipse.jdt.launching.JavaLaunchDelegate.launch(JavaLaunchDelegate.java:101)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:702)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:924)
at org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlugin.java:1010)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)

This works fine when I set java to point to c:\java1.6_20 instead of j:
so that line: 
    jrepath.segment(jrepath.segmentCount()-2).equals(JRE)

in StandardVMDebugger.java does not throw

Reproducible: Always

Steps to Reproduce:
1. subst J: C:\jdk1.6.0_20 
2. set path to use j: instead of C:\jdk1.6.0_20
3. point eclipse to JDK of j:
4. Run any debug session.
Comment 1 Michael Rennie CLA 2011-03-23 11:56:56 EDT
Created attachment 191766 [details]
fix

Easily reproduced using the given steps. The patch prevents the AIOOBE.
Comment 2 Michael Rennie CLA 2011-03-23 11:59:38 EDT
applied patch to HEAD, Curtis could you verify the fix on WinXP?
Comment 3 Curtis Windatt CLA 2011-03-25 16:18:02 EDT
Verified
Comment 4 Michael Rennie CLA 2012-04-10 13:14:45 EDT
*** Bug 286537 has been marked as a duplicate of this bug. ***