Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364838 - [Contributions] [Compatibility] NPE in PopupMenuExtender#cleanUpContributionCache while running SWTBot
Summary: [Contributions] [Compatibility] NPE in PopupMenuExtender#cleanUpContributionC...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 355161 (view as bug list)
Depends on:
Blocks: 365316
  Show dependency tree
 
Reported: 2011-11-25 08:50 EST by Nicolas Bros CLA
Modified: 2019-12-10 07:23 EST (History)
4 users (show)

See Also:


Attachments
stacktrace (12.46 KB, text/plain)
2011-11-25 08:51 EST, Nicolas Bros CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Bros CLA 2011-11-25 08:50:35 EST
I get a NPE in PopupMenuExtender#cleanUpContributionCache when running the EMF Facet SWTBot tests on Eclipse 4.2. It didn't happen with Eclipse 3.7.

This is maybe linked to a workaround we had to implement for a bug in SWTBot (Bug 261360) that prevents it from reliably simulating clicks in sub-menus.

See:
https://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.facet/trunk/plugins/org.eclipse.emf.facet.util.tests.swtbot/src/org/eclipse/emf/facet/util/tests/swtbot/internal/ContextMenuUtils.java
Comment 1 Nicolas Bros CLA 2011-11-25 08:51:07 EST
Created attachment 207532 [details]
stacktrace

stacktrace : see the "caused by" part
Comment 2 Nicolas Bros CLA 2011-11-25 10:02:42 EST
The message associated to the stacktrace is:

Exception while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/ui/UIElement/visible/SET] to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@6be4cb82

I get a ton of these errors when running our SWTBot tests.

To reproduce, you can use this launch configuration:
https://dev.eclipse.org/svnroot/modeling/org.eclipse.emft.facet/trunk/tests/org.eclipse.emf.facet.tests/EMFFacet_AllTestsNotInUIThread.launch
with all the EMF Facet plug-ins in your workspace

This is with:
Eclipse SDK
Version: 4.1.0
Build id: I20110916-1615
Comment 3 Paul Webster CLA 2011-11-25 15:20:42 EST
Nicolas, can you try the problem on http://download.eclipse.org/eclipse/downloads/drops4/I20111123-0610/index.php

The NPE seems to imply the IEclipseContext for the part that holds this context menu is null.  That means it was never rendered, or it has already been disposed by the time this code runs.

That's a lot of little dialogs opening on the stack:
org.eclipse.emf.facet.widgets.nattable.internal.dialogs.ColumnsToHideDialog.open(ColumnsToHideDialog.java:198)



PW
Comment 4 Nicolas Bros CLA 2011-11-26 04:22:43 EST
(In reply to comment #3)
> Nicolas, can you try the problem on
I have tried the EMF Facet build with this platform build, but I am getting errors with org.eclipse.jetty.* bundles that are not found.

> The NPE seems to imply the IEclipseContext for the part that holds this context
> menu is null.  That means it was never rendered, or it has already been
> disposed by the time this code runs.
This happens when run by SWTBot tests, so it means that lots of views, dialogs and editors are opened and closed very fast. Maybe this triggers a race condition of some sort?

> That's a lot of little dialogs opening on the stack
I noticed that too in the stacktrace, but I don't know why it's doing that yet. It happens on Hudson, but does not seem to happen when I run the tests locally.
Comment 5 Paul Webster CLA 2011-11-28 08:45:23 EST
(In reply to comment #4)
> I have tried the EMF Facet build with this platform build, but I am getting
> errors with org.eclipse.jetty.* bundles that are not found.

This is probably caused by the changes to jetty and javax.servlet that are happening in 3.8.

> This happens when run by SWTBot tests, so it means that lots of views, dialogs
> and editors are opened and closed very fast. Maybe this triggers a race
> condition of some sort?

The code in question is added in an asyncExec(*), and if the SWT bot is not allowing the events to be processed regularly they could accumulate.  We have code like this at checkpoints in our UI tests:

while (display.readAndDispatch()) ;

I can add some checks the thew asyncExec(*) to validate the context, but if your tests won't even run on 4.2 I don't know how you can confirm that helps.

PW
Comment 6 Paul Webster CLA 2011-12-02 11:54:08 EST
I've released NPE guards for the method in the stack trace:

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=f097b46cc771f29fc8abbb29b233745c6e9532ea



PW
Comment 7 Remy Suen CLA 2012-01-27 15:43:43 EST
*** Bug 355161 has been marked as a duplicate of this bug. ***
Comment 8 Eclipse Genie CLA 2019-12-10 07:23:51 EST
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.