Bug 100803  [osgi] AllPermission check must be done for extension bundles
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 2694c9a..f49882d 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
@@ -716,7 +716,7 @@
 				final boolean extension = (bundledata.getType() & (BundleData.TYPE_BOOTCLASSPATH_EXTENSION | BundleData.TYPE_FRAMEWORK_EXTENSION)) != 0;
 				// must check for AllPermission before allow a bundle extension to be updated
 				if (extension && !hasPermission(new AllPermission()))
-					throw new SecurityException(Msg.BUNDLE_EXTENSION_LIFECYCLE_SECURITY);
+					throw new BundleException(Msg.BUNDLE_EXTENSION_PERMISSION, new SecurityException(Msg.BUNDLE_EXTENSION_PERMISSION));
 				try {
 					AccessController.doPrivileged(new PrivilegedExceptionAction() {
 						public Object run() throws Exception {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExternalMessages.properties b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExternalMessages.properties
index 303b0b9..3b4acca 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExternalMessages.properties
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/ExternalMessages.properties
@@ -20,7 +20,6 @@
 BUNDLE_INSTALL_RECURSION_EXCEPTION=Bundle is already being installed
 BUNDLE_INSTALL_REQUIRED_EE_EXCEPTION=No match is available for the required execution environment: {0}
 BUNDLE_INSTALL_SAME_UNIQUEID=Bundle \"{0}\" version \"{1}\" has already been installed from: {2}
-BUNDLE_EXTENSION_LIFECYCLE_SECURITY=The permission AllPermission is required to install/update an extension bundle.
 BUNDLE_UNINSTALLED_EXCEPTION=Bundle \"{0}\" has been uninstalled
 BUNDLE_CONTEXT_INVALID_EXCEPTION=BundleContext is no longer valid
 BUNDLE_NATIVECODE_MATCH_EXCEPTION=No Bundle-NativeCode match
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
index b794420..eaa33ab 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java
@@ -834,7 +834,7 @@
 					final boolean extension = (bundledata.getType() & (BundleData.TYPE_BOOTCLASSPATH_EXTENSION | BundleData.TYPE_FRAMEWORK_EXTENSION)) != 0;
 					// must check for AllPermission before allow a bundle extension to be installed
 					if (extension && !bundle.hasPermission(new AllPermission()))
-						throw new SecurityException(Msg.BUNDLE_EXTENSION_LIFECYCLE_SECURITY);
+						throw new BundleException(Msg.BUNDLE_EXTENSION_PERMISSION, new SecurityException(Msg.BUNDLE_EXTENSION_PERMISSION));
 					try {
 						AccessController.doPrivileged(new PrivilegedExceptionAction() {
 							public Object run() throws Exception {
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Msg.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Msg.java
index f7acf55..403deb6 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Msg.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Msg.java
@@ -63,7 +63,6 @@
 	public static String BUNDLE_NATIVECODE_MATCH_EXCEPTION;
 	public static String BUNDLE_INSTALL_REQUIRED_EE_EXCEPTION;
 	public static String BUNDLE_INSTALL_SAME_UNIQUEID;
-	public static String BUNDLE_EXTENSION_LIFECYCLE_SECURITY;
 	
 	public static String ECLIPSE_OSGI_NAME;
 	public static String ECLIPSE_OSGI_VERSION;
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/ExternalMessages.properties b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/ExternalMessages.properties
index 303b0b9..3b4acca 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/ExternalMessages.properties
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/ExternalMessages.properties
@@ -20,7 +20,6 @@
 BUNDLE_INSTALL_RECURSION_EXCEPTION=Bundle is already being installed
 BUNDLE_INSTALL_REQUIRED_EE_EXCEPTION=No match is available for the required execution environment: {0}
 BUNDLE_INSTALL_SAME_UNIQUEID=Bundle \"{0}\" version \"{1}\" has already been installed from: {2}
-BUNDLE_EXTENSION_LIFECYCLE_SECURITY=The permission AllPermission is required to install/update an extension bundle.
 BUNDLE_UNINSTALLED_EXCEPTION=Bundle \"{0}\" has been uninstalled
 BUNDLE_CONTEXT_INVALID_EXCEPTION=BundleContext is no longer valid
 BUNDLE_NATIVECODE_MATCH_EXCEPTION=No Bundle-NativeCode match
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/Msg.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/Msg.java
index f7acf55..403deb6 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/Msg.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/Msg.java
@@ -63,7 +63,6 @@
 	public static String BUNDLE_NATIVECODE_MATCH_EXCEPTION;
 	public static String BUNDLE_INSTALL_REQUIRED_EE_EXCEPTION;
 	public static String BUNDLE_INSTALL_SAME_UNIQUEID;
-	public static String BUNDLE_EXTENSION_LIFECYCLE_SECURITY;
 	
 	public static String ECLIPSE_OSGI_NAME;
 	public static String ECLIPSE_OSGI_VERSION;