Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 238738

Summary: [StatusHandling] Still an NPE in WorkbenchStatusDialogManager.refreshSingleStatusArea(..)
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: Krzysztof Daniel <krzysztof.daniel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: krzysztof.daniel, Olivier_Thomann, remy.suen, tomasz.zarna, utilisateur_768
Version: 3.4Flags: Kevin_McGuire: review-
Target Milestone: 3.5 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Fix
none
mylyn/context/zip
none
Fix none

Description Markus Keller CLA 2008-06-27 04:57:35 EDT
I20080624-0800. Looks the same as bug 228360.

!SUBENTRY 2 org.eclipse.team.cvs.core 4 -29 2008-06-27 10:39:53.077
!MESSAGE Could not connect to :pserver:anonymous@dev.eclipse.org:/cvsroot/eclipse: I/O has been interrupted.
!STACK 0
java.io.InterruptedIOException: Timeout while reading from input stream
        at org.eclipse.team.internal.core.streams.PollingInputStream.read(PollingInputStream.java:132)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
        at org.eclipse.team.internal.ccvs.core.connection.Connection.readLine(Connection.java:165)
        at org.eclipse.team.internal.ccvs.core.connection.PServerConnection.authenticate(PServerConnection.java:197)
        at org.eclipse.team.internal.ccvs.core.connection.PServerConnection.open(PServerConnection.java:137)
        at org.eclipse.team.internal.ccvs.core.connection.Connection.open(Connection.java:132)
        at org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation.createConnection(CVSRepositoryLocation.java:545)
        at org.eclipse.team.internal.ccvs.core.connection.CVSRepositoryLocation.openConnection(CVSRepositoryLocation.java:803)
        at org.eclipse.team.internal.ccvs.core.client.Session.open(Session.java:159)
        at org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTreeBuilder.fetchDelta(RemoteFolderTreeBuilder.java:192)
        at org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTreeBuilder.buildTree(RemoteFolderTreeBuilder.java:160)
        at org.eclipse.team.internal.ccvs.core.resources.RemoteFolderTreeBuilder.buildRemoteTree(RemoteFolderTreeBuilder.java:143)
        at org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot.getRemoteTree(CVSWorkspaceRoot.java:178)
        at org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree.fetchVariant(CVSResourceVariantTree.java:78)
        at org.eclipse.team.core.variants.AbstractResourceVariantTree.refresh(AbstractResourceVariantTree.java:84)
        at org.eclipse.team.internal.ccvs.core.syncinfo.CVSResourceVariantTree.refresh(CVSResourceVariantTree.java:334)
        at org.eclipse.team.core.variants.AbstractResourceVariantTree.refresh(AbstractResourceVariantTree.java:54)
        at org.eclipse.team.core.variants.ResourceVariantTreeSubscriber.refresh(ResourceVariantTreeSubscriber.java:162)
        at org.eclipse.team.core.variants.ResourceVariantTreeSubscriber.refresh(ResourceVariantTreeSubscriber.java:126)
        at org.eclipse.team.internal.ui.synchronize.RefreshSubscriberParticipantJob.doRefresh(RefreshSubscriberParticipantJob.java:116)
        at org.eclipse.team.internal.ui.synchronize.RefreshParticipantJob.run(RefreshParticipantJob.java:309)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

!ENTRY org.eclipse.ui 4 0 2008-06-27 10:39:53.749
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
        at org.eclipse.swt.SWT.error(SWT.java:3777)
        at org.eclipse.swt.SWT.error(SWT.java:3695)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:136)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
        at org.eclipse.swt.widgets.Display.msgFilterProc(Display.java:3166)
        at org.eclipse.swt.internal.win32.OS.$$YJP$$DefWindowProcW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DefWindowProcW(OS.java)
        at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2365)
        at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
        at org.eclipse.swt.widgets.Composite.WM_SYSCOMMAND(Composite.java:1598)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:3863)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:337)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4528)
        at org.eclipse.swt.internal.win32.OS.$$YJP$$DefWindowProcW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DefWindowProcW(OS.java)
        at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:2365)
        at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:79)
        at org.eclipse.swt.widgets.Control.windowProc(Control.java:3877)
        at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:337)
        at org.eclipse.swt.widgets.Display.windowProc(Display.java:4541)
        at org.eclipse.swt.internal.win32.OS.$$YJP$$DispatchMessageW(Native Method)
        at org.eclipse.swt.internal.win32.OS.DispatchMessageW(OS.java)
        at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2370)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3420)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2382)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2346)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2198)
        at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:493)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:488)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
        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:382)
        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: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)
Caused by: java.lang.NullPointerException
        at org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager.refreshSingleStatusArea(WorkbenchStatusDialogManager.java:1929)
        at org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager.updateTitleArea(WorkbenchStatusDialogManager.java:2194)
        at org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager.refresh(WorkbenchStatusDialogManager.java:1904)
        at org.eclipse.ui.statushandlers.WorkbenchStatusDialogManager.addStatusAdapter(WorkbenchStatusDialogManager.java:1126)
        at org.eclipse.ui.statushandlers.WorkbenchErrorHandler$1.run(WorkbenchErrorHandler.java:73)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
        ... 42 more
Comment 1 Krzysztof Daniel CLA 2008-07-22 08:49:52 EDT
Created attachment 108053 [details]
Fix
Comment 2 Krzysztof Daniel CLA 2008-07-22 08:49:57 EDT
Created attachment 108054 [details]
mylyn/context/zip
Comment 3 Kevin McGuire CLA 2008-07-22 18:30:32 EDT
Q: Why are we getting null in this case?

The patch is straight forward but there are two other references to
    statusListLabelProvider.getColumnText()
(in getViewerComparator()) and by rights these should have null guard checks too.  

Another option is to never return null, although the javadoc for ITableLabelProvider suggests you can. I'm not sure if we can legally javadoc our inner class to not return it and thus be stricter than the interface.  Markus do you know off hand?

In theory we also need to guard against null from getColumnImage() but I don't see any refs.
Comment 4 Kevin McGuire CLA 2008-07-24 18:28:32 EDT
(In reply to comment #3)
> Q: Why are we getting null in this case?

Still would like to understand how we get into the fail state.

In any case this first change is good and is the right approach (null checks on return values from getColumnText()):

+		String message = statusListLabelProvider.getColumnText(
+				statusAdapter, 0);
+		singleStatusLabel.setText(message != null ? message : ""); //$NON-NLS-1$

> but there are two other references to
>     statusListLabelProvider.getColumnText()
> (in getViewerComparator()) and by rights these should have null guard checks
> too.  

but we need these resolved too as part of this fix.

Also not sure of the reason for this change:

 	private void refreshSingleStatusArea() {
-		String description = statusListLabelProvider.getColumnText(
-				statusAdapter, 0);
-		if (description.equals(singleStatusLabel.getText()))
-			singleStatusLabel.setText(" "); //$NON-NLS-1$
-		singleStatusLabel.setText(description);

I mean, the code looks suspicious and is probably bad but I'd like to understand how it relates.

Marking patch -1 because I need more info to release it. Summary:

1) Explain how we got null in the first place. Looking through the getColumnText() code it doesn't look like we should be getting null back from it.  I want to make sure there isn't some other bug triggering this (e.g. bug in  getPrimaryMessage()).

2) Other callers of statusListLabelProvider.getColumnText() should be guarded against null. Although they're not failing as part of this bug, they look like failures waiting to happen.

3) Explain removal of code from refreshSingleStatusArea().
Comment 5 Olivier Thomann CLA 2008-08-14 13:38:52 EDT
*** Bug 244199 has been marked as a duplicate of this bug. ***
Comment 6 Boris Bokowski CLA 2008-09-02 01:03:46 EDT
*** Bug 245527 has been marked as a duplicate of this bug. ***
Comment 7 Paul Webster CLA 2008-12-08 07:19:39 EST
*** Bug 257710 has been marked as a duplicate of this bug. ***
Comment 8 Krzysztof Daniel CLA 2008-12-12 06:00:04 EST
Does anyone remember if progress indicator reported error just before NPE occurred?
Comment 9 Krzysztof Daniel CLA 2008-12-12 06:38:16 EST
Created attachment 120302 [details]
Fix

This should solve the issue.
Comment 10 Krzysztof Daniel CLA 2008-12-15 03:49:15 EST
Fixed in 2008-12-15. The problem occured when a job reported an error that should not be presented immediately. Next status tried to create single status dialog, but there were already two statuses to display.
Comment 11 Krzysztof Daniel CLA 2009-01-27 10:26:31 EST
verified (tested against scenario desribed in comment 10)