Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340750 - [breadcrumb]NPE in LaunchView CopyToClipboard action after activating breadcrumb
Summary: [breadcrumb]NPE in LaunchView CopyToClipboard action after activating breadcrumb
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.7 RC1   Edit
Assignee: Pawel Piech CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-23 08:31 EDT by Teodor Madan CLA
Modified: 2011-05-09 14:30 EDT (History)
2 users (show)

See Also:
Michael_Rennie: review+


Attachments
Proposed fix. (1.81 KB, patch)
2011-03-23 08:35 EDT, Teodor Madan CLA
no flags Details | Diff
Original patch. (1.77 KB, patch)
2011-05-09 13:50 EDT, Pawel Piech CLA
pawel.1.piech: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Teodor Madan CLA 2011-03-23 08:31:35 EDT
After activating breadcrumb view by resizing debug view, the tree selection will be lost. When attempting to copy breadcrumb contents using keyboard short-cut (CTRL-C on windows) will end up with a NPE dialog. 

Note that this is not reproducible by invoking "Copy Stack" action from pop-up menu as this will create a tree selection.

Stack trace:
java.lang.NullPointerException
at org.eclipse.jface.viewers.CustomHashtable.hashCode(CustomHashtable.java:264)
at org.eclipse.jface.viewers.CustomHashtable.get(CustomHashtable.java:236)
at org.eclipse.jface.viewers.TreeSelection$InitializeData.<init>(TreeSelection.java:60)
at org.eclipse.jface.viewers.TreeSelection$InitializeData.<init>(TreeSelection.java:52)
at org.eclipse.jface.viewers.TreeSelection.<init>(TreeSelection.java:97)
at org.eclipse.jface.viewers.TreeSelection.<init>(TreeSelection.java:108)
at org.eclipse.debug.internal.ui.views.launch.LaunchViewCopyToClipboardActionDelegate.getPrunedSelection(LaunchViewCopyToClipboardActionDelegate.java:34)
at org.eclipse.debug.internal.ui.viewers.model.VirtualCopyToClipboardActionDelegate.run(VirtualCopyToClipboardActionDelegate.java:98)
at org.eclipse.debug.internal.ui.actions.AbstractDebugActionDelegate.runWithEvent(AbstractDebugActionDelegate.java:313)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:241)
at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
.....
Comment 1 Teodor Madan CLA 2011-03-23 08:35:24 EDT
Created attachment 191744 [details]
Proposed fix.

Contract with TreeSelection constructor is to pass null for an empty selection. This is the reason of the jface NPE.

Refactor handling of empty selection to not need to create an empty TreeSelection object
Comment 2 Pawel Piech CLA 2011-05-09 13:09:01 EDT
Hi Mike,
I'd like to commit this for RC1, if it's still open.  The fix is safe in that it only affects the narrow breadcrumb scenario.
Comment 3 Pawel Piech CLA 2011-05-09 13:13:14 EDT
Updated priority to reflect that the bug affects our product.
Comment 4 Pawel Piech CLA 2011-05-09 13:50:46 EDT
Created attachment 195113 [details]
Original patch.

I wrote almost identical solution before I found this bug.
Comment 5 Michael Rennie CLA 2011-05-09 14:02:24 EDT
+1 patch works fine
Comment 6 Pawel Piech CLA 2011-05-09 14:30:26 EDT
Thanks Mike, I committed the change.