Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 274554 - [Contributions] StatusLineManager: NullPointerException in setCanceled(...)
Summary: [Contributions] StatusLineManager: NullPointerException in setCanceled(...)
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: 3.6 M3   Edit
Assignee: Paul Webster CLA
QA Contact: Paul Webster CLA
URL:
Whiteboard:
Keywords:
: 296151 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-04-30 13:17 EDT by Elias Volanakis CLA
Modified: 2009-11-25 12:42 EST (History)
4 users (show)

See Also:


Attachments
Snippet to reproduce issue (1.68 KB, text/plain)
2009-04-30 13:17 EDT, Elias Volanakis CLA
no flags Details
Screenshot of the issue which display a stacktrace (94.94 KB, image/png)
2009-09-18 08:43 EDT, Mickael Istria CLA
no flags Details
Proposed patch (804 bytes, patch)
2009-09-18 08:50 EDT, Mickael Istria CLA
pwebster: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elias Volanakis CLA 2009-04-30 13:17:42 EDT
Created attachment 133971 [details]
Snippet to reproduce issue

It is possible to get an NPE from StatusLineManager:188.

public void setCanceled(boolean value) {
  //Don't bother updating for disposed status
  if (statusLine.isDisposed()) {  // <--- 188
    return;
  }
  progressDelegate.setCanceled(value);
}

The problem is that the dispose() method sets statusLine to null:

    public void dispose() {
        if (statusLineExist()) {
			statusLine.dispose();
		}
        statusLine = null;
        ...
    }

The attached snippet contains code to reproduce. Reproducible on 3.5M6.

Originally reported here:
http://dev.eclipse.org/mhonarc/lists/riena-dev/msg00573.html
Comment 1 Paul Webster CLA 2009-04-30 13:57:27 EDT
The question is, what disposed the SLM and still allowed the window#run(*) to be called?

PW
Comment 2 Paul Webster CLA 2009-05-01 08:00:53 EDT
Please attach a stack trace (either mod the code or add a conditional breakpoint) of what is calling the SLM.dispose()

PW
Comment 3 Elias Volanakis CLA 2009-05-01 12:10:31 EDT
Hi Todd, 

i'm not sure how to reproduce this inside a typical Riena application. The Riena SWT ExampleApplication does not invoke StatusLineManager.dispose() or reference this class. 

Could you provide a few more details how to reproduce this?

Thanks,
Elias.
Comment 4 Mickael Istria CLA 2009-09-18 08:08:23 EDT
I faced the same problem when developping an RCP application when I don't want to use a status line (ie I do not call getWindowConfigurer().createStatusLineControl(shell) in my WorkbenchWindowAdvisor).

Then, in such case, statusline == null, and then I get this NPE.
Adding the test for null would be about 3 seconds, can we hope to get this fixed soon in JFace?
Comment 5 Remy Suen CLA 2009-09-18 08:27:08 EDT
(In reply to comment #4)
> I faced the same problem when developping an RCP application when I don't want
> to use a status line (ie I do not call
> getWindowConfigurer().createStatusLineControl(shell) in my
> WorkbenchWindowAdvisor).
> 
> Then, in such case, statusline == null, and then I get this NPE.
> Adding the test for null would be about 3 seconds, can we hope to get this
> fixed soon in JFace?

Is it just the result of calling run(boolean, boolean, IRunnableWithProgress)? Could you attach a stack trace?

If you are interested in attaching a patch yourself, please see below:
http://wiki.eclipse.org/Platform_UI/How_to_Contribute
Comment 6 Mickael Istria CLA 2009-09-18 08:43:46 EDT
Created attachment 147549 [details]
Screenshot of the issue which display a stacktrace

This is the result of a GMF-based editor when getWindowConfigurer().createStatusLineControl(shell) is *not* called in WorkbenchWindowAdvisor.createWindowContents().
Comment 7 Mickael Istria CLA 2009-09-18 08:50:54 EDT
Created attachment 147552 [details]
Proposed patch
Comment 8 Mickael Istria CLA 2009-09-18 08:52:24 EDT
> Is it just the result of calling run(boolean, boolean, IRunnableWithProgress)?
> Could you attach a stack trace?

You can see the stacktrace in its context in the attached screenshot

> If you are interested in attaching a patch yourself, please see below:
> http://wiki.eclipse.org/Platform_UI/How_to_Contribute

Please find as attachement a proposed patch. It solves the issue in my context of a GMF editor without status line.
Comment 9 Paul Webster CLA 2009-09-18 09:16:22 EDT
Thanx for the patch, I'll get it into 3.6.  It should use " if (statusLineExist()) {" just to be consistent with the rest of the class.

PW
Comment 10 Remy Suen CLA 2009-09-18 19:52:16 EDT
I've tried to reproduce this but haven't had any luck. It is not clear to me why the StatusLineManager is disposed in the first place. If it was never created then this wouldn't happen.

Mickael, can you set breakpoints in StatusLineManager's dispose() method and see where it's getting called from?
Comment 11 Paul Webster CLA 2009-10-13 15:06:26 EDT
Released to HEAD >20091013
PW
Comment 12 Paul Webster CLA 2009-10-27 13:31:31 EDT
This doesn't look like it will solve anything:

            public void setCanceled(boolean value) {
                //Don't bother updating for disposed status
                if (statusLineExist()) {
					return;
				}
                progressDelegate.setCanceled(value);

            }

I bungled the conditional.
PW
Comment 13 Paul Webster CLA 2009-10-28 10:44:13 EDT
Released for I20091028-1300
PW
Comment 14 Paul Webster CLA 2009-10-29 09:27:21 EDT
In I20091028-1300
PW
Comment 15 Mickael Istria CLA 2009-10-29 09:48:35 EDT
Thanks, that's about 30 pixels more for the model editor area!
Comment 16 Paul Webster CLA 2009-11-25 12:42:28 EST
*** Bug 296151 has been marked as a duplicate of this bug. ***