diff options
author | Thomas Watson | 2008-05-07 20:56:50 +0000 |
---|---|---|
committer | Thomas Watson | 2008-05-07 20:56:50 +0000 |
commit | adf1eb77cb913f68fadd7e58aa61bd97d17cc34d (patch) | |
tree | 369ee9caefd4074802d774e1a4f7e19f2326311b /bundles | |
parent | 4ac7be7a40240af9d7d6a5e7fb0d086fc72d23b1 (diff) | |
download | rt.equinox.framework-adf1eb77cb913f68fadd7e58aa61bd97d17cc34d.tar.gz rt.equinox.framework-adf1eb77cb913f68fadd7e58aa61bd97d17cc34d.tar.xz rt.equinox.framework-adf1eb77cb913f68fadd7e58aa61bd97d17cc34d.zip |
Bug 230421 [registry] Translation not found when nl pack installed through dropinsv20080507-1815
Diffstat (limited to 'bundles')
2 files changed, 14 insertions, 10 deletions
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java index 6a77a3793..4e781fd54 100644 --- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java +++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/AbstractBundle.java @@ -43,7 +43,7 @@ public abstract class AbstractBundle implements Bundle, Comparable, KeyedElement /** ProtectionDomain for the bundle */ protected BundleProtectionDomain domain; - protected ManifestLocalization manifestLocalization = null; + volatile protected ManifestLocalization manifestLocalization = null; /** * Bundle object constructor. This constructor should not perform any real @@ -1008,8 +1008,9 @@ public abstract class AbstractBundle implements Bundle, Comparable, KeyedElement */ public Dictionary getHeaders(String localeString) { framework.checkAdminPermission(this, AdminPermission.METADATA); + ManifestLocalization localization; try { - initializeManifestLocalization(); + localization = getManifestLocalization(); } catch (BundleException e) { framework.publishFrameworkEvent(FrameworkEvent.ERROR, this, e); // return an empty dictinary. @@ -1017,7 +1018,7 @@ public abstract class AbstractBundle implements Bundle, Comparable, KeyedElement } if (localeString == null) localeString = Locale.getDefault().toString(); - return manifestLocalization.getHeaders(localeString); + return localization.getHeaders(localeString); } /** @@ -1413,23 +1414,25 @@ public abstract class AbstractBundle implements Bundle, Comparable, KeyedElement * */ public ResourceBundle getResourceBundle(String localeString) { + ManifestLocalization localization; try { - initializeManifestLocalization(); + localization = getManifestLocalization(); } catch (BundleException ex) { return (null); } if (localeString == null) { localeString = Locale.getDefault().toString(); } - return manifestLocalization.getResourceBundle(localeString); + return localization.getResourceBundle(localeString); } - private void initializeManifestLocalization() throws BundleException { - if (manifestLocalization == null) { - Dictionary rawHeaders; - rawHeaders = bundledata.getManifest(); - manifestLocalization = new ManifestLocalization(this, rawHeaders); + private synchronized ManifestLocalization getManifestLocalization() throws BundleException { + ManifestLocalization currentLocalization = manifestLocalization; + if (currentLocalization == null) { + Dictionary rawHeaders = bundledata.getManifest(); + manifestLocalization = currentLocalization = new ManifestLocalization(this, rawHeaders); } + return currentLocalization; } public boolean testStateChanging(Object thread) { diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java index c6d3e41ac..3f3ca8b21 100644 --- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java +++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleHost.java @@ -583,6 +583,7 @@ public class BundleHost extends AbstractBundle { newFragments[newFragments.length - 1] = fragment; fragments = newFragments; } + manifestLocalization = null; } protected BundleLoader getBundleLoader() { |