if (extension) bundle.hasPermission(new AllPermission());
if (extension && !bundle.hasPermission(new AllPermission())) throw new BundleException(Msg.BUNDLE_EXTENSION_PERMISSION, new SecurityException(Msg.BUNDLE_EXTENSION_PERMISSION));
	protected AbstractBundle installWorkerPrivileged(String location, URLConnection source, AccessControlContext callerContext) throws BundleException {		BundleOperation storage = adaptor.installBundle(location, source);		final AbstractBundle bundle;		try {			BundleData bundledata = storage.begin();			bundle = createAndVerifyBundle(bundledata);			try {				// Select the native code paths for the bundle;				// this is not done by the adaptor because this				// should be a static algorithm spec'ed by OSGi				// that we do not allow to be adapted.				String[] nativepaths = selectNativeCode(bundle);				if (nativepaths != null) {					bundledata.installNativeCode(nativepaths);				}				bundle.load();				if (System.getSecurityManager() != null) {					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());					try {						AccessController.doPrivileged(new PrivilegedExceptionAction() {							public Object run() throws Exception {								checkAdminPermission(bundle, AdminPermission.LIFECYCLE);								if (extension) // need special permission to install extension bundles									checkAdminPermission(bundle, AdminPermission.EXTENSIONLIFECYCLE);								return null;							}						}, callerContext);					} catch (PrivilegedActionException e) {						throw e.getException();					}				}				storage.commit(false);			} catch (Throwable error) {				synchronized (bundles) {					bundle.unload();				}				bundle.close();				throw error;			}			/* bundle has been successfully installed */			bundles.add(bundle);		} catch (Throwable t) {			try {				storage.undo();			} catch (BundleException ee) {				publishFrameworkEvent(FrameworkEvent.ERROR, systemBundle, ee);			}			if (t instanceof SecurityException)				throw (SecurityException) t;			if (t instanceof BundleException)				throw (BundleException) t;			throw new BundleException(t.getMessage(), t);		}		return bundle;	}