Skip to content

Commit 27852ff

Browse files
Jörg Kubitzjukzi
authored andcommitted
Fix "The application has not been initialized." after shutdown
to "The application is already stopped." As seen logged at the end of many junit tests.
1 parent ad50c26 commit 27852ff

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

runtime/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public final class InternalPlatform {
102102

103103
private boolean splashEnded = false;
104104
private volatile boolean initialized;
105+
private volatile boolean stopped;
105106
private static final String KEYRING = "-keyring"; //$NON-NLS-1$
106107
private String keyringFile;
107108

@@ -182,8 +183,13 @@ public void addLogListener(ILogListener listener) {
182183

183184
private void assertInitialized() {
184185
//avoid the Policy.bind if assertion is true
185-
if (!initialized)
186-
Assert.isTrue(false, Messages.meta_appNotInit);
186+
if (!initialized) {
187+
if (stopped) {
188+
Assert.isTrue(false, Messages.meta_appStopped);
189+
} else {
190+
Assert.isTrue(false, Messages.meta_appNotInit);
191+
}
192+
}
187193
}
188194

189195
/**
@@ -677,6 +683,7 @@ public void start(BundleContext runtimeContext) {
677683
processCommandLine(getEnvironmentInfoService().getNonFrameworkArgs());
678684
initializeDebugFlags();
679685
initialized = true;
686+
stopped = false;
680687
initializeAuthorizationHandler();
681688
startServices();
682689
}
@@ -691,6 +698,7 @@ public void stop(BundleContext bundleContext) {
691698
stopServices(); // should be done after preferences shutdown
692699
initialized = false;
693700
closeOSGITrackers();
701+
stopped = true;
694702
context = null;
695703
}
696704

runtime/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/Messages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ public class Messages extends NLS {
2929

3030
// metadata
3131
public static String meta_appNotInit;
32+
public static String meta_appStopped;
3233
public static String meta_exceptionParsingLog;
34+
3335
// parsing/resolve
3436
public static String plugin_deactivatedLoad;
3537

runtime/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/messages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ auth_notAvailable = Authorization infrastructure (org.eclipse.core.runtime.compa
1919

2020
### metadata
2121
meta_appNotInit = The application has not been initialized.
22+
meta_appStopped=The application is already stopped.
2223
meta_exceptionParsingLog = An exception occurred while parsing the log file: {0}
2324

2425
### plugins

0 commit comments

Comments
 (0)