Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 211184 - [Intro] [IntroAction] Causes NullPointerException when product intro binding no set
Summary: [Intro] [IntroAction] Causes NullPointerException when product intro binding ...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 295941 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-11-28 04:53 EST by Philipp Kursawe CLA
Modified: 2019-09-02 08:00 EDT (History)
2 users (show)

See Also:


Attachments
Patch to check against a null introDescriptor in ctor (1.11 KB, patch)
2008-07-02 11:19 EDT, Philipp Kursawe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Kursawe CLA 2007-11-28 04:53:01 EST
When calling ActionFactory.INTRO.create(window) the IntroAction constructor causes a NullPointerException when there is no product intro binding set.

The line
IntroDescriptor introDescriptor = ((Workbench) workbenchWindow.getWorkbench()).getIntroDescriptor();
returns null. Subsequent calls using this null descriptor result in NullPointerExceptions.

Interestingly the workbench dies silently and only starting the application using the -console parameter reveals this NPE on the console. No logfile is written.
Comment 1 Philipp Kursawe CLA 2008-07-02 11:19:07 EDT
Created attachment 106317 [details]
Patch to check against a null introDescriptor in ctor
Comment 2 Bernd Wiswedel CLA 2008-10-06 05:28:48 EDT
Please allow me to add a two-line stacktrace so that others are able to find this bug by method calls.

Exception in thread "Thread-1" java.lang.NullPointerException
	at org.eclipse.ui.internal.IntroAction.<init>(IntroAction.java:60)
	at org.eclipse.ui.actions.ActionFactory$11.create(ActionFactory.java:338)
Comment 3 Remy Suen CLA 2008-12-04 04:31:16 EST
I just got this on my computer. :/
Comment 4 Paul Webster CLA 2008-12-04 10:12:03 EST
There is no point in creating an Intro action if there is no intro part (it pops up an error dialog and has other methods that will fail).

We use code like this in IDE:
        if (window.getWorkbench().getIntroManager().hasIntro()) {
            introAction = ActionFactory.INTRO.create(window);
            register(introAction);
        }

I can either do nothing or update the ActionFactory.INTRO javadoc to point out that you shouldn't create this action if there is no intro (with sample code as above).

PW
Comment 5 Philipp Kursawe CLA 2008-12-04 10:20:59 EST
ok, what about the declerative IntroAction (command) if such even exist. In my app I am not using Actions directly anymore, just the "new" menu contribution extension to create my menus. If there is no intro command than your code would indeed be the way (and the updated Java doc) to handle this bug.
Comment 6 Paul Webster CLA 2008-12-04 11:11:46 EST
So do the conversion to commands and handlers?  That certainly sounds do-able, but it would be in M5

PW
Comment 7 Remy Suen CLA 2008-12-06 09:19:36 EST
(In reply to comment #6)
> So do the conversion to commands and handlers?

Are you planning to add a visibleWhen with a property tester for testing whether hasIntro() returns true or false?
Comment 8 Paul Webster CLA 2009-01-19 09:00:06 EST
I've added the snippet to the javadoc, and I'll consider if I can do the command stuff.

PW
Comment 9 Philipp Kursawe CLA 2009-08-28 05:57:29 EDT
I currently use:

pre. try {
			register(ActionFactory.INTRO.create(window));
		} catch (final Exception e) {
		}

Should we close this bug now, or will there be a fix inside the action itself?
Comment 10 Paul Webster CLA 2009-08-28 08:32:03 EDT
This is the suggested code:
        if (window.getWorkbench().getIntroManager().hasIntro()) {
            introAction = ActionFactory.INTRO.create(window);
            register(introAction);
        }

and is now in the javadoc.

I had left this open to consider if this should be changed to a command/handler.

PW
Comment 11 Remy Suen CLA 2009-11-23 17:05:30 EST
*** Bug 295941 has been marked as a duplicate of this bug. ***
Comment 12 Eclipse Genie CLA 2019-09-02 08:00:42 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.