if (graph.contains(removedBundle)) {  AbstractBundle[] dependents = removedLoaderProxy.getDependentBundles(); for (int k = 0; k < dependents.length; k++) { if (!graph.contains(dependents[k])) { graph.addElement(dependents[k]); changed = true; }
AbstractBundle[] dependents = removedLoaderProxy.getDependentBundles(); for (int k = 0; k < dependents.length; k++) { if (!graph.contains(dependents[k])) { graph.addElement(dependents[k]); changed = true;
	private Vector computeAffectedBundles(AbstractBundle[] refresh) {		Vector graph = new Vector();		if (refresh == null) {			int size = removalPending.size();			for (int i = 0; i < size; i++) {				BundleLoaderProxy loaderProxy = (BundleLoaderProxy) removalPending.elementAt(i);				AbstractBundle bundle = loaderProxy.getBundle();				if (!graph.contains(bundle)) {					if (Debug.DEBUG && Debug.DEBUG_PACKAGEADMIN) {						Debug.println(" refresh: " + bundle);					}					graph.addElement(bundle);					// add in any dependents of the removal pending loader.					AbstractBundle[] dependents = loaderProxy.getDependentBundles();					for (int j = 0; j < dependents.length; j++) {						if (!graph.contains(dependents[j])) {							graph.addElement(dependents[j]);						}					}				}			}		} else {			for (int i = 0; i < refresh.length; i++) {				AbstractBundle bundle = refresh[i];				if (bundle == framework.systemBundle) {					continue;				}				if (bundle.isFragment()) {					// if it is a fragment then put the host in the graph					BundleHost host = (BundleHost) bundle.getHost();					if (host != null) {						if (!graph.contains(host)) {							graph.addElement(host);						}					}				}				if (!graph.contains(bundle)) {					if (Debug.DEBUG && Debug.DEBUG_PACKAGEADMIN) {						Debug.println(" refresh: " + bundle);					}					graph.addElement(bundle);				}			}		}		/*		 * If there is nothing to do, then return.		 */		if (graph.size() == 0) {			if (Debug.DEBUG && Debug.DEBUG_PACKAGEADMIN) {				Debug.println("refreshPackages: Empty graph");			}			return graph;		}		/*		 * Complete graph.		 */		if (Debug.DEBUG && Debug.DEBUG_PACKAGEADMIN) {			Debug.println("refreshPackages: Complete graph");		}		boolean changed;		do {			changed = false;			int size = graph.size();			for (int i = size - 1; i >= 0; i--) {				AbstractBundle bundle = (AbstractBundle) graph.elementAt(i);				if (!bundle.isFragment()) {					BundleLoaderProxy loaderProxy = ((BundleHost) bundle).getLoaderProxy();					if (loaderProxy != null) {						// add any dependents						AbstractBundle[] dependents = loaderProxy.getDependentBundles();						for (int j = 0; j < dependents.length; j++) {							if (!graph.contains(dependents[j])) {								graph.addElement(dependents[j]);								changed = true;							}						}					}					// add in any fragments					org.osgi.framework.Bundle[] frags = bundle.getFragments();					if (frags != null) {						for (int j = 0; j < frags.length; j++) {							if (!graph.contains(frags[j])) {								graph.addElement(frags[j]);								changed = true;							}						}					}				} else {					// add in the host.					AbstractBundle host = (AbstractBundle) bundle.getHost();					if (host != null) {						if (!graph.contains(host)) {							graph.addElement(host);							changed = true;						}					}				}			}			// look for the bundles in removalPending list			for (int i = removalPending.size() - 1; i >= 0; i--) {				BundleLoaderProxy removedLoaderProxy = (BundleLoaderProxy) removalPending.elementAt(i);				AbstractBundle removedBundle = removedLoaderProxy.getBundle();				if (graph.contains(removedBundle)) {					// add in the dependents of the removedLoaderProxy					AbstractBundle[] dependents = removedLoaderProxy.getDependentBundles();					for (int k = 0; k < dependents.length; k++) {						if (!graph.contains(dependents[k])) {							graph.addElement(dependents[k]);							changed = true;						}					}				}			}		} while (changed);		return graph;	}