Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349933 - [clipboard] Open from Clipboard throws StringIndexOutOfBoundsException for incomplete stacktrace
Summary: [clipboard] Open from Clipboard throws StringIndexOutOfBoundsException for in...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7.2   Edit
Assignee: Deepak Azad CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-21 06:52 EDT by Markus Keller CLA
Modified: 2011-12-06 04:18 EST (History)
4 users (show)

See Also:
daniel_megert: review+


Attachments
Clipboard contents (2.43 KB, text/plain)
2011-06-21 06:52 EDT, Markus Keller CLA
no flags Details
fix+test (3.46 KB, patch)
2011-08-18 03:52 EDT, Deepak Azad CLA
daniel_megert: review+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-06-21 06:52:51 EDT
Created attachment 198319 [details]
Clipboard contents

I20110613-1736

Open from Clipboard throws a StringIndexOutOfBoundsException for an incomplete stacktrace.

Steps:
Copy the attached text to the clipboard and then invoke Open from Clipboard.
=> Exception in log:

java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1958)
	at org.eclipse.jdt.internal.debug.ui.actions.OpenFromClipboardAction.getJavaElementMatches(OpenFromClipboardAction.java:311)
	at org.eclipse.jdt.internal.debug.ui.actions.OpenFromClipboardAction.handleSingleLineInput(OpenFromClipboardAction.java:255)
	at org.eclipse.jdt.internal.debug.ui.actions.OpenFromClipboardAction.run(OpenFromClipboardAction.java:187)
	at org.eclipse.ui.internal.handlers.ActionDelegateHandlerProxy.execute(ActionDelegateHandlerProxy.java:289)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
	at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508)
	at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1262)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1104)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1100)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1509)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4640)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4528)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4972)
	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2424)
	at org.eclipse.swt.internal.BidiUtil.windowProc(BidiUtil.java:639)
	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2530)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Comment 1 Markus Keller CLA 2011-06-21 07:00:18 EDT
Just to make this clear: I copied this from a JUnit test result page, but the trace was already badly formatted there (no line breaks). I don't expect a nicely formatted trace in the Console view. The problem is only the exception.
Comment 2 Dani Megert CLA 2011-07-12 03:42:40 EDT
Simpler test case:
1. Copy the following line:
createContainer(ZipLeveledStructureProvider.java:78)
2. Navigate > Open from Clipboard
Comment 3 Deepak Azad CLA 2011-08-18 03:52:15 EDT
Created attachment 201697 [details]
fix+test

Problems mentioned in comment 0 and comment 2 are slightly different.

With the patch "createContainer(ZipLeveledStructureProvider.java:78)" is handled nicely.

(In reply to comment #1)
> Just to make this clear: I copied this from a JUnit test result page, but the
> trace was already badly formatted there (no line breaks). I don't expect a
> nicely formatted trace in the Console view. The problem is only the exception.
The patch avoids an exception but you still get an input edit dialog because there are no line breaks. I tried to copy a stacktrace from a JUnit test result page and it had proper line breaks, I wonder how you ended up in this situation. In any case handling (absence of) line breaks more gracefully is bug 327443.
Comment 4 Dani Megert CLA 2011-08-18 05:32:04 EDT
Comment on attachment 201697 [details]
fix+test

The patch breaks the following:

ZipLeveledStructureProvider.java:78
(ZipLeveledStructureProvider.java:78)

No longer opens the editor on line 78.
Comment 5 Dani Megert CLA 2011-08-18 05:42:11 EDT
Comment on attachment 201697 [details]
fix+test

> The patch breaks the following:
> 
> ZipLeveledStructureProvider.java:78
> (ZipLeveledStructureProvider.java:78)
> 
> No longer opens the editor on line 78.

Sorry Deepak, my bad: I forgot that this class is not part of the JRE and hence it couldn't find it in my test workspace.

Reviewed the patch and the tests.
Comment 6 Dani Megert CLA 2011-08-18 07:40:54 EDT
Fixed in R3_7_maintenance.
Available in builds >= M20110824-2000.

Fixed in HEAD.
Available in builds >= N20110818-2000.
Comment 7 Curtis Windatt CLA 2011-10-06 15:23:27 EDT
The fix for this bug was not tagged and released for 3.7.1.  The last change to the map file was on Aug 17th before this change was backported (and the last time the jdt debug entries were changed was Aug 3rd).

This can be confirmed by downloading 3.7.1 and trying the original steps.
Comment 8 Dani Megert CLA 2011-10-07 03:18:01 EDT
Mike, don't you do the weekly build input? What happened here?
Comment 9 Michael Rennie CLA 2011-10-07 10:41:24 EDT
(In reply to comment #8)
> Mike, don't you do the weekly build input? What happened here?

I do, and to be honest I have no idea what happened.

Remarking as fixed, it got (re?)tagged into 3.7.2 with the build input I did yesterday
Comment 10 Dani Megert CLA 2011-12-06 04:18:18 EST
Verified in M20111128-1153.