Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356914 - NPE when activating a task having another task open with same invisible context elements
Summary: NPE when activating a task having another task open with same invisible conte...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Mylyn (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.7   Edit
Assignee: Steffen Pingel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-07 07:12 EDT by Jan Mauersberger CLA
Modified: 2012-02-17 05:56 EST (History)
0 users

See Also:


Attachments
mylyn/context/zip (3.46 KB, application/octet-stream)
2012-02-17 05:56 EST, Steffen Pingel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Mauersberger CLA 2011-09-07 07:12:12 EDT
Build Identifier: M20100909-0800

Well, I have no reproduction scenario yet but I can outline the code parts of MyLyn that are affected. The NPW stack:

java.lang.NullPointerException
	at org.eclipse.mylyn.internal.context.ui.editors.ContextWrapper.isForSameTaskAs(ContextWrapper.java:23)
	at org.eclipse.mylyn.internal.context.ui.editors.InvisibleContextElementsPart.isActiveTask(InvisibleContextElementsPart.java:320)
	at org.eclipse.mylyn.internal.context.ui.editors.InvisibleContextElementsPart.access$0(InvisibleContextElementsPart.java:317)
	at org.eclipse.mylyn.internal.context.ui.editors.InvisibleContextElementsPart$1.contextChanged(InvisibleContextElementsPart.java:124)

The code executed is

public boolean isForSameTaskAs(IInteractionContext context) {
	return context != null && context.getHandleIdentifier().equals(task.getHandleIdentifier());
}

where as the call to "context.getHandleIdentifier()" returns null. The context implementation class is a CompositeInteractionContext, thus the code is:

public String getHandleIdentifier() {
	if (contexts.values().size() == 1) {
		return contexts.keySet().iterator().next();
	} else {
		return null;
	}
}

In my case the contexts hashmap contains several keys, thus null is returned.

Reproducible: Always
Comment 1 Steffen Pingel CLA 2012-02-17 05:56:16 EST
Thanks for the bug report! I have committed a simple fix: http://review.mylyn.org/300. Shawn, please reopen if we need to make adjustments.
Comment 2 Steffen Pingel CLA 2012-02-17 05:56:19 EST
Created attachment 211167 [details]
mylyn/context/zip