aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordj2011-09-12 11:10:16 (EDT)
committerdj2011-09-12 11:10:16 (EDT)
commit04e4a5d855e69373ee8ad2af57b0f1b8d1c9a7cc (patch)
treeb69098a5b8685a688a248e8faa505d95c061cace
parentf295d953913532ad08a9ff4853dd1c5a2129de73 (diff)
downloadeclipse.platform.runtime-04e4a5d855e69373ee8ad2af57b0f1b8d1c9a7cc.zip
eclipse.platform.runtime-04e4a5d855e69373ee8ad2af57b0f1b8d1c9a7cc.tar.gz
eclipse.platform.runtime-04e4a5d855e69373ee8ad2af57b0f1b8d1c9a7cc.tar.bz2
Bug 356306 - NPE when invoking Platform.getInstallLocation() fromv20110912-1510v
multiple threads
-rw-r--r--bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java59
1 files changed, 32 insertions, 27 deletions
diff --git a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
index 5a6822e..e347eb7 100644
--- a/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
+++ b/bundles/org.eclipse.core.runtime/src/org/eclipse/core/internal/runtime/InternalPlatform.java
@@ -708,18 +708,9 @@ public final class InternalPlatform {
*/
public void start(BundleContext runtimeContext) {
this.context = runtimeContext;
- logReaderTracker = new ServiceTracker(context, ExtendedLogReaderService.class.getName(), null);
- logReaderTracker.open();
- extendedLogTracker = new ServiceTracker(context, ExtendedLogService.class.getName(), null);
- extendedLogTracker.open();
+ openOSGiTrackers();
splashEnded = false;
- // get the environment tracker here rather than in startServices because we use it right away
- environmentTracker = new ServiceTracker(context, EnvironmentInfo.class.getName(), null);
- environmentTracker.open();
processCommandLine(getEnvironmentInfoService().getNonFrameworkArgs());
- // get the debug tracker here rather than in startServices because we use it right away
- debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
- debugTracker.open();
initializeDebugFlags();
initialized = true;
getMetaArea();
@@ -750,16 +741,7 @@ public final class InternalPlatform {
context = null;
}
- private void startServices() {
- // The check for getProduct() is relatively expensive (about 3% of the headless startup),
- // so we don't want to enforce it here.
- customPreferencesService = context.registerService(IProductPreferencesService.class.getName(), new ProductPreferencesService(), new Hashtable());
-
- // Only register this interface if compatibility is installed - the check for a bundle presence
- // is a quick test that doesn't consume much.
- if (getBundle(CompatibilityHelper.PI_RUNTIME_COMPATIBILITY) != null)
- legacyPreferencesService = context.registerService(ILegacyPreferences.class.getName(), new InitLegacyPreferences(), new Hashtable());
-
+ private void openOSGiTrackers() {
Filter filter = null;
try {
filter = context.createFilter(Location.INSTANCE_FILTER);
@@ -768,7 +750,7 @@ public final class InternalPlatform {
}
instanceLocation = new ServiceTracker(context, filter, null);
instanceLocation.open();
-
+
try {
filter = context.createFilter(Location.USER_FILTER);
} catch (InvalidSyntaxException e) {
@@ -776,7 +758,7 @@ public final class InternalPlatform {
}
userLocation = new ServiceTracker(context, filter, null);
userLocation.open();
-
+
try {
filter = context.createFilter(Location.CONFIGURATION_FILTER);
} catch (InvalidSyntaxException e) {
@@ -784,7 +766,7 @@ public final class InternalPlatform {
}
configurationLocation = new ServiceTracker(context, filter, null);
configurationLocation.open();
-
+
try {
filter = context.createFilter(Location.INSTALL_FILTER);
} catch (InvalidSyntaxException e) {
@@ -792,22 +774,22 @@ public final class InternalPlatform {
}
installLocation = new ServiceTracker(context, filter, null);
installLocation.open();
-
+
if (context != null) {
logTracker = new ServiceTracker(context, FrameworkLog.class.getName(), null);
logTracker.open();
}
-
+
if (context != null) {
bundleTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
bundleTracker.open();
}
-
+
if (context != null) {
contentTracker = new ServiceTracker(context, IContentTypeManager.class.getName(), null);
contentTracker.open();
}
-
+
if (context != null) {
preferencesTracker = new ServiceTracker(context, IPreferencesService.class.getName(), null);
preferencesTracker.open();
@@ -820,6 +802,29 @@ public final class InternalPlatform {
}
groupProviderTracker = new ServiceTracker(context, filter, null);
groupProviderTracker.open();
+
+ logReaderTracker = new ServiceTracker(context, ExtendedLogReaderService.class.getName(), null);
+ logReaderTracker.open();
+
+ extendedLogTracker = new ServiceTracker(context, ExtendedLogService.class.getName(), null);
+ extendedLogTracker.open();
+
+ environmentTracker = new ServiceTracker(context, EnvironmentInfo.class.getName(), null);
+ environmentTracker.open();
+
+ debugTracker = new ServiceTracker(context, DebugOptions.class.getName(), null);
+ debugTracker.open();
+ }
+
+ private void startServices() {
+ // The check for getProduct() is relatively expensive (about 3% of the headless startup),
+ // so we don't want to enforce it here.
+ customPreferencesService = context.registerService(IProductPreferencesService.class.getName(), new ProductPreferencesService(), new Hashtable());
+
+ // Only register this interface if compatibility is installed - the check for a bundle presence
+ // is a quick test that doesn't consume much.
+ if (getBundle(CompatibilityHelper.PI_RUNTIME_COMPATIBILITY) != null)
+ legacyPreferencesService = context.registerService(ILegacyPreferences.class.getName(), new InitLegacyPreferences(), new Hashtable());
}
private void stopServices() {