if (extension) hasPermission(new AllPermission());
if (extension && !hasPermission(new AllPermission())) throw new BundleException(Msg.BUNDLE_EXTENSION_PERMISSION, new SecurityException(Msg.BUNDLE_EXTENSION_PERMISSION));
	protected void updateWorkerPrivileged(URLConnection source, AccessControlContext callerContext) throws BundleException {		AbstractBundle oldBundle = AbstractBundle.createBundle(bundledata, framework);		boolean reloaded = false;		BundleOperation storage = framework.adaptor.updateBundle(this.bundledata, source);		BundleRepository bundles = framework.getBundles();		try {			BundleData newBundleData = storage.begin();			// Must call framework createBundle to check execution environment.			final AbstractBundle newBundle = framework.createAndVerifyBundle(newBundleData);			String[] nativepaths = framework.selectNativeCode(newBundle);			if (nativepaths != null) {				bundledata.installNativeCode(nativepaths);			}			boolean exporting;			int st = getState();			synchronized (bundles) {				exporting = reload(newBundle);				manifestLocalization = null;			}			// indicate we have loaded from the new version of the bundle			reloaded = true;			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 updated				if (extension)					hasPermission(new AllPermission());				try {					AccessController.doPrivileged(new PrivilegedExceptionAction() {						public Object run() throws Exception {							framework.checkAdminPermission(newBundle, AdminPermission.LIFECYCLE);							if (extension) // need special permission to update extension bundles								framework.checkAdminPermission(newBundle, AdminPermission.EXTENSIONLIFECYCLE);							return null;						}					}, callerContext);				} catch (PrivilegedActionException e) {					throw e.getException();				}			}			// send out unresolved events outside synch block (defect #80610)			if (st == RESOLVED)				framework.publishBundleEvent(BundleEvent.UNRESOLVED, this);			storage.commit(exporting);		} catch (Throwable t) {			try {				storage.undo();				if (reloaded) /*				 * if we loaded from the new version of the				 * bundle				 */{					synchronized (bundles) {						reload(oldBundle); /* revert to old version */					}				}			} catch (BundleException ee) {				/* if we fail to revert then we are in big trouble */				framework.publishFrameworkEvent(FrameworkEvent.ERROR, this, ee);			}			if (t instanceof SecurityException)				throw (SecurityException) t;			if (t instanceof BundleException)				throw (BundleException) t;			throw new BundleException(t.getMessage(), t);		}	}