Bug 568439 - ApplicationPartServiceImpl#findPart violates contract
Summary: ApplicationPartServiceImpl#findPart violates contract
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.18   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-02 06:35 EST by Karsten Thoms CLA
Modified: 2020-11-02 06:42 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2020-11-02 06:35:11 EST
This issue has been reported before as bug#462610.

I am observing this issue now in my customer application. In this context a job is running on startup. As a result of the job tool items are updated. This seems to happen too early. 

java.lang.IllegalStateException: Application does not have an active window
	at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.getActiveWindowService(ApplicationPartServiceImpl.java:42)
	at org.eclipse.e4.ui.internal.workbench.ApplicationPartServiceImpl.findPart(ApplicationPartServiceImpl.java:103)
	at (CUSTOM CODE)
	at org.eclipse.core.runtime.jobs.Job$2.run(Job.java:185)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

This might not be valid to call findPart at this time, but it shows that the contract is still violated. As originally proposed in the bug I think the ISE should be catched and return null. It may be argued that this should be logged as a warning, as it is likely covering an implementation problem.
Comment 1 Karsten Thoms CLA 2020-11-02 06:42:40 EST
This potentially affects other methods implemented from EPartService also. The all access getActiveWindowService() and will throw an ISE when called.