Skip to content

Commit 4a2727c

Browse files
committed
Check if platform is running
Currently it can happen that the platform is already shut down (e.g. very fast unit test) and then we see ugly exceptions in the log. This now first check if the platform is actually running before access it.
1 parent b713603 commit 4a2727c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/ObjectContributorManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ private static List removeDups(List list) {
658658
* collection of objects.
659659
*/
660660
private List getCommonClasses(List objects, List commonAdapters) {
661-
if (objects == null || objects.isEmpty()) {
661+
if (objects == null || objects.isEmpty() || !Platform.isRunning()) {
662662
return null;
663663
}
664664

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/statushandlers/StatusManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,9 @@ public static StatusManager getManager() {
141141

142142
private StatusManager() {
143143
statusManagerLogListener = new StatusManagerLogListener();
144-
Platform.addLogListener(statusManagerLogListener);
144+
if (Platform.isRunning()) {
145+
Platform.addLogListener(statusManagerLogListener);
146+
}
145147
}
146148

147149
private AbstractStatusHandler getStatusHandler() {

0 commit comments

Comments
 (0)