diff options
author | Thomas Watson | 2014-07-16 13:47:20 +0000 |
---|---|---|
committer | Thomas Watson | 2014-07-16 13:47:20 +0000 |
commit | aa22df38a86fbe220038d26eef575c61473954f8 (patch) | |
tree | 1f4d50b42980d6491103728393de42d49effc7fa /bundles | |
parent | c205fb96168bd942f8ebb0a2dff1bcb1bbed1a9c (diff) | |
download | rt.equinox.framework-aa22df38a86fbe220038d26eef575c61473954f8.tar.gz rt.equinox.framework-aa22df38a86fbe220038d26eef575c61473954f8.tar.xz rt.equinox.framework-aa22df38a86fbe220038d26eef575c61473954f8.zip |
Bug 436082 - Bundle.getHeaders may not return default locale headersI20140806-2000I20140806-0800I20140805-2000I20140805-0800I20140804-2000I20140804-0800I20140803-2000I20140729-0800I20140722-0800
after uninstall
Diffstat (limited to 'bundles')
2 files changed, 20 insertions, 7 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java index 0fe0ed544..e71ac9a9b 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/ClassLoadingBundleTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2013 IBM Corporation and others. + * Copyright (c) 2006, 2014 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -2023,4 +2023,12 @@ public class ClassLoadingBundleTests extends AbstractBundleTests { } return sb.toString(); } + + public void testDefaultLocalUninstall() throws Exception { + Bundle test = installer.installBundle("security.a"); //$NON-NLS-1$ + test.uninstall(); + Dictionary<String, String> headers = test.getHeaders(); + String bundleName = headers.get(Constants.BUNDLE_NAME); + assertEquals("Wrong bundle name header.", "default", bundleName); + } } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java index ce17b8189..eacfcbc6d 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxBundle.java @@ -10,12 +10,6 @@ *******************************************************************************/ package org.eclipse.osgi.internal.framework; -import org.osgi.framework.dto.*; - -import org.osgi.framework.startlevel.dto.BundleStartLevelDTO; -import org.osgi.framework.startlevel.dto.FrameworkStartLevelDTO; -import org.osgi.framework.wiring.dto.BundleRevisionDTO; -import org.osgi.framework.wiring.dto.BundleWiringDTO; import java.io.*; import java.net.URL; import java.security.*; @@ -45,11 +39,16 @@ import org.eclipse.osgi.signedcontent.*; import org.eclipse.osgi.storage.BundleInfo.Generation; import org.eclipse.osgi.storage.Storage; import org.osgi.framework.*; +import org.osgi.framework.dto.*; import org.osgi.framework.launch.Framework; import org.osgi.framework.namespace.HostNamespace; import org.osgi.framework.startlevel.BundleStartLevel; import org.osgi.framework.startlevel.FrameworkStartLevel; +import org.osgi.framework.startlevel.dto.BundleStartLevelDTO; +import org.osgi.framework.startlevel.dto.FrameworkStartLevelDTO; import org.osgi.framework.wiring.*; +import org.osgi.framework.wiring.dto.BundleRevisionDTO; +import org.osgi.framework.wiring.dto.BundleWiringDTO; public class EquinoxBundle implements Bundle, BundleReference { @@ -450,6 +449,8 @@ public class EquinoxBundle implements Bundle, BundleReference { @Override public void uninstall() throws BundleException { + // be sure to prime the headers with default local; calling priv method to avoid permission check + privGetHeaders(null); Storage storage = equinoxContainer.getStorage(); storage.getModuleContainer().uninstall(module); } @@ -462,6 +463,10 @@ public class EquinoxBundle implements Bundle, BundleReference { @Override public Dictionary<String, String> getHeaders(String locale) { equinoxContainer.checkAdminPermission(this, AdminPermission.METADATA); + return privGetHeaders(locale); + } + + private Dictionary<String, String> privGetHeaders(String locale) { Generation current = (Generation) module.getCurrentRevision().getRevisionInfo(); return current.getHeaders(locale); } |