Bug 226761 - [regression] NPE when expanding filter pools and filters in the Team View
Summary: [regression] NPE when expanding filter pools and filters in the Team View
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.0 RC1   Edit
Assignee: David Dykstal CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on: 218304
Blocks:
  Show dependency tree
 
Reported: 2008-04-11 16:56 EDT by David Dykstal CLA
Modified: 2008-05-15 22:07 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Dykstal CLA 2008-04-11 16:56:31 EDT
For some reason the following code is returning null instead of an adapter. This code is found in SystemViewFilterPoolAdapter, SystemViewFilterAdapter, and SystemViewFilterStringAdapter.

ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter)filter.getProvider().getAdapter(ISubSystemConfigurationAdapter.class);

Here is the log for one of these exceptions:

eclipse.buildId=I20080330-1350
java.version=1.4.2_16
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=carbon, NL=en_US
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data /Users/david/Work/workspaces/OpenRSE/../runtime_workspace_01 -dev file:/Users/david/Work/workspaces/OpenRSE/.metadata/.plugins/org.eclipse.pde.core/OpenRSE-new/dev.properties -os macosx -ws carbon -arch x86


Error
Fri Apr 11 15:55:04 CDT 2008
Problems occurred when invoking code from plug-in: "org.eclipse.jface".

java.lang.NullPointerException
at org.eclipse.rse.internal.ui.view.SystemViewFilterPoolAdapter.getImageDescriptor(SystemViewFilterPoolAdapter.java:103)
at org.eclipse.rse.internal.ui.view.team.SystemTeamViewLabelProvider.getImage(SystemTeamViewLabelProvider.java:99)
at org.eclipse.jface.viewers.WrappedViewerLabelProvider.getImage(WrappedViewerLabelProvider.java:117)
at org.eclipse.jface.viewers.WrappedViewerLabelProvider.update(WrappedViewerLabelProvider.java:165)
at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:142)
at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:932)
at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:102)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1012)
at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:466)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.runtime.Platform.run(Platform.java:880)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2041)
at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:827)
at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractTreeViewer.java:802)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:776)
at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:628)
at org.eclipse.jface.viewers.AbstractTreeViewer.handleTreeExpand(AbstractTreeViewer.java:1442)
at org.eclipse.jface.viewers.TreeViewer.handleTreeExpand(TreeViewer.java:921)
at org.eclipse.jface.viewers.AbstractTreeViewer$4.treeExpanded(AbstractTreeViewer.java:1453)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:125)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:83)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1553)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1577)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1562)
at org.eclipse.swt.widgets.Tree.itemNotificationProc(Tree.java:2376)
at org.eclipse.swt.widgets.Display.itemNotificationProc(Display.java:2367)
at org.eclipse.swt.internal.carbon.OS.CallNextEventHandler(Native Method)
at org.eclipse.swt.widgets.Widget.kEventControlTrack(Widget.java:1104)
at org.eclipse.swt.widgets.Control.kEventControlTrack(Control.java:2013)
at org.eclipse.swt.widgets.Widget.controlProc(Widget.java:373)
at org.eclipse.swt.widgets.Display.controlProc(Display.java:839)
at org.eclipse.swt.internal.carbon.OS.CallNextEventHandler(Native Method)
at org.eclipse.swt.widgets.Tree.kEventMouseDown(Tree.java:2557)
at org.eclipse.swt.widgets.Widget.mouseProc(Widget.java:1320)
at org.eclipse.swt.widgets.Display.mouseProc(Display.java:2889)
at org.eclipse.swt.internal.carbon.OS.SendEventToEventTarget(Native Method)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3011)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2375)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2339)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2205)
at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:478)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:473)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
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:362)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
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:324)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:549)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
at org.eclipse.equinox.launcher.Main.main(Main.java:1212)
Comment 1 David Dykstal CLA 2008-04-11 16:58:02 EDT
Dave M -- 

Did the adapter factories for ISubSystemConfigurationAdapter change recently?
Comment 2 Martin Oberhuber CLA 2008-04-11 17:12:30 EDT
They did! In fact this is most likely a regression due to the fix for bug 218304. Fortunately the fix is relatively easy. Thanks for finding the required places.
Do you think you can handle this or should I?
Comment 3 David Dykstal CLA 2008-04-11 17:36:15 EDT
I think I can handle it. It looks like I need to load the adapter if the original call returns null, correct? I can probably do this at the point of expansion. I don't think a load should take too long.
Comment 4 Martin Oberhuber CLA 2008-04-11 17:50:22 EDT
Well it kinda depends. If it's just for the image, you can also fall back to using the Proxy. Question is, do you want UI adapters loaded when children are expanded? Ideally, adapter loading should be avoided as long as possible, and ideally adapter loading should always occur in a background Job (e.g. deferred expansion of children).

But it's not a must. There have also been places where I'd just do
   Platform.getAdapterManager().loadAdapter()
even in the UI Thread when opening a context menu, just to get things right. 
It's OK when you have a good understanding of what plugins get activated by the adapter loading. When there's risk that 3rd party contributed bundles are loaded (which might have tons of dependencies themselves), you'd better not do it.

SearcCVS helps you finding all the places where I have made modifications for that bug: http://www.eclipse.org/dsdp/tm/searchcvs.php?q=%5B218304%5D&project=0
Comment 5 Martin Oberhuber CLA 2008-04-11 17:50:45 EDT
PS does the NPE happen in an important place so we'd better go for M6?
Comment 6 David Dykstal CLA 2008-04-11 17:57:21 EDT
I thought it was only in the team view. But it looks like it pops up everywhere - getName in the SystemView for example. This has to be fixed for M6.
Comment 7 David Dykstal CLA 2008-04-11 18:02:33 EDT
Umm. It looks like what I'm seeing now in the System View is the result of another fix I'm working on and not this problem. Can you give this a good look from the system view? If its just a problem in the team view then I don't think it is high priority.
Comment 8 Martin Oberhuber CLA 2008-04-11 18:04:59 EDT
Hm... I have tested this very thoroughly and I'm surprised that you're hitting
this. Are you sure that your workspace is on HEAD everywhere? Can you give
exact steps for reproducing?

If it's really the adapter issue, it should happen only pretty soon after initially launching RSE and not afterwards (because later on the adapters are loaded).

You might also want to try the N-build which just got available:
http://download.eclipse.org/dsdp/tm/downloads/drops/N20080411-1712/index.php

Thanks for testing and finding this!
Comment 9 David Dykstal CLA 2008-04-11 22:23:39 EDT
(In reply to comment #8)
> Hm... I have tested this very thoroughly and I'm surprised that you're hitting
> this. Are you sure that your workspace is on HEAD everywhere? Can you give
> exact steps for reproducing?
> 
> If it's really the adapter issue, it should happen only pretty soon after
> initially launching RSE and not afterwards (because later on the adapters are
> loaded).
> 
> You might also want to try the N-build which just got available:
> http://download.eclipse.org/dsdp/tm/downloads/drops/N20080411-1712/index.php
> 
> Thanks for testing and finding this!
> 

I figured out that the problem I was running into in the SystemView was a result of a bug in another fix I was working on -- managed to screw up loaded profiles and so was getting NPEs all over the place. So you can ignore all my panic about that problem.

The original problem occurs when you close the workspace with the Team View visible and the System View covered. This means the Team View is the one initializing the adapters on startup and it apparently doesn't do it quite right. So the priority of fixing this is probably P3. I'll move it back to that. I think fixing in M7 is fine.
Comment 10 David Dykstal CLA 2008-05-15 22:07:44 EDT
Fixed in RC1