Bug 329625 - NPE in AbstractTreeViewer.getSelection()
Summary: NPE in AbstractTreeViewer.getSelection()
Status: RESOLVED DUPLICATE of bug 341895
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Lakshmi P Shanmugam CLA
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2010-11-06 22:50 EDT by Guillaume Massé CLA
Modified: 2011-08-24 02:23 EDT (History)
7 users (show)

See Also:


Attachments
Screenshots and log (136.87 KB, application/zip)
2010-11-08 07:22 EST, Guillaume Massé CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guillaume Massé CLA 2010-11-06 22:50:23 EDT
Build Identifier: M20100909-0800

It gives me a Null Pointer Exception

Reproducible: Always

Steps to Reproduce:
1.Select two classes from package A
2.Drag-n-drop them to package B
Comment 1 Dani Megert CLA 2010-11-08 03:11:42 EST
This works fine for me. Can you please provide the .log with the NPE.
Comment 2 Guillaume Massé CLA 2010-11-08 07:22:34 EST
Created attachment 182601 [details]
Screenshots and log
Comment 3 Dani Megert CLA 2010-11-08 08:06:46 EST
!ENTRY org.eclipse.ui.workbench 4 2 2010-11-08 10:12:27.592!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.ui.workbench".!STACK 0java.lang.NullPointerException
    at org.eclipse.jface.viewers.AbstractTreeViewer.getSelection(AbstractTreeViewer.java:2892)
    at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$8.getShowInContext(PackageExplorerPart.java:1253)
    at org.eclipse.ui.internal.services.WorkbenchSourceProvider.getContext(WorkbenchSourceProvider.java:412)
    at org.eclipse.ui.internal.services.WorkbenchSourceProvider.updateActivePart(WorkbenchSourceProvider.java:478)
    at org.eclipse.ui.internal.services.WorkbenchSourceProvider.checkActivePart(WorkbenchSourceProvider.java:305)
    at org.eclipse.ui.internal.services.WorkbenchSourceProvider.checkActivePart(WorkbenchSourceProvider.java:300)
    at org.eclipse.ui.internal.services.WorkbenchSourceProvider$2.windowDeactivated(WorkbenchSourceProvider.java:270)
    at org.eclipse.ui.internal.Workbench$15.run(Workbench.java:1018)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.ui.internal.Workbench.fireWindowDeactivated(Workbench.java:1016)
    at org.eclipse.ui.internal.WorkbenchWindow$28.shellDeactivated(WorkbenchWindow.java:3125)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:111)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1669)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1693)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1674)
    at org.eclipse.swt.widgets.Shell.kEventWindowDeactivated(Shell.java:1174)
    at org.eclipse.swt.widgets.Shell.kEventWindowDeactivated(Shell.java:1164)
    at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2211)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:4427)
    at org.eclipse.swt.internal.carbon.OS.ReceiveNextEvent(Native Method)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3216)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
    at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
    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:369)
    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:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Comment 4 Prakash Rangaraj CLA 2010-11-08 08:22:56 EST
I can't reproduce this.

Looking at the code:

Widget[] items = getSelection(getControl());
ArrayList list = new ArrayList(items.length);
for (int i = 0; i < items.length; i++) {
	Widget item = items[i];
	if (item.getData() != null) {


NPE is at item.getData(). This is possible only if the getSelection() returns an array with a null element in it.

By any chance, PackageExplorer overriding the TreeViewer.getSelection(Control)? If not, then this could be a SWT bug.
Comment 5 Markus Keller CLA 2010-11-08 09:25:18 EST
Guillaume, are you using the Cocoa or the Carbon version of Eclipse?
What's your Mac OS X version?

> By any chance, PackageExplorer overriding the TreeViewer.getSelection(Control)?
Nope (would be quite hard to do, since that method is protected).

Moving to SWT.
Comment 6 Markus Keller CLA 2010-11-08 09:42:37 EST
Could be related to bug 148051.
Comment 7 Guillaume Massé CLA 2010-11-08 09:59:54 EST
Hi Markus,

I'm using OSX 10.6.4

It's the Carbon 32 bit version.

I don't know about you, but the 64 bit Cocoa was really unstable
( Debuger not working at all and various other problems ).

(In reply to comment #5)
> Guillaume, are you using the Cocoa or the Carbon version of Eclipse?
> What's your Mac OS X version?
> 
> > By any chance, PackageExplorer overriding the TreeViewer.getSelection(Control)?
> Nope (would be quite hard to do, since that method is protected).
> 
> Moving to SWT.
Comment 8 Guillaume Massé CLA 2010-11-08 10:00:10 EST
Hi Markus,

I'm using OSX 10.6.4

It's the Carbon 32 bit version.

I don't know about you, but the 64 bit Cocoa was really unstable
( Debuger not working at all and various other problems ).

(In reply to comment #5)
> Guillaume, are you using the Cocoa or the Carbon version of Eclipse?
> What's your Mac OS X version?
> 
> > By any chance, PackageExplorer overriding the TreeViewer.getSelection(Control)?
> Nope (would be quite hard to do, since that method is protected).
> 
> Moving to SWT.
Comment 9 Scott Kovatch CLA 2010-11-08 12:30:49 EST
The chances of it being fixed on Carbon are pretty low at this point. Please give the 32-bit Cocoa version a try, at the very least. If other problems are keeping you from moving to Cocoa, let us know (via new bugs) and we'll try to address them for 3.7.
Comment 10 Scott Kovatch CLA 2010-11-17 13:09:52 EST
Moving to triaged, as this is Carbon. If you can move to Cocoa, please do so; we will not be fixing any 3.7 Carbon bugs.
Comment 11 Lakshmi P Shanmugam CLA 2011-08-24 02:23:23 EDT
This is fixed in 3.7

*** This bug has been marked as a duplicate of bug 341895 ***