invalidState = false;
	protected StateManager createStateManager() {		File stateLocation = new File(getBundleStoreRootDir(), ".state"); //$NON-NLS-1$		stateManager = new StateManager(stateLocation);		State systemState = stateManager.readSystemState(context);		if (systemState != null)			return stateManager;		systemState = stateManager.createSystemState(context);		Bundle[] installedBundles = context.getBundles();		if (installedBundles == null)			return stateManager;		StateObjectFactory factory = stateManager.getFactory();		for (int i = 0; i < installedBundles.length; i++) {			Bundle toAdd = installedBundles[i];			try {				Dictionary manifest = toAdd.getHeaders(""); //$NON-NLS-1$				BundleDescription newDescription = factory.createBundleDescription(manifest, toAdd.getLocation(), toAdd.getBundleId());				systemState.addBundle(newDescription);			} catch (BundleException be) {				// just ignore bundle datas with invalid manifests			}		}		// we need the state resolved		systemState.resolve();		return stateManager;	}