Bug 436082 - Bundle.getHeaders may not return default locale headers
after uninstall

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 0fe0ed5..e71ac9a 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 @@
 		}
 		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 ce17b81..eacfcbc 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.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 @@
 
 	@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 @@
 	@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);
 	}