/*
 * Copyright (c) OSGi Alliance (2000-2009).
 * All Rights Reserved.
 *
 * Implementation of certain elements of the OSGi
 * Specification may be subject to third party intellectual property
 * rights, including without limitation, patent rights (such a third party may
 * or may not be a member of the OSGi Alliance). The OSGi Alliance is not responsible and shall not be
 * held responsible in any manner for identifying or failing to identify any or
 * all such third party intellectual property rights.
 *
 * This document and the information contained herein are provided on an "AS
 * IS" basis and THE OSGI ALLIANCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
 * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL
 * NOT INFRINGE ANY RIGHTS AND ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR
 * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL THE OSGI ALLIANCE BE LIABLE FOR ANY
 * LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF
 * BUSINESS, OR FOR DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTIAL,
 * PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND IN CONNECTION WITH THIS
 * DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH LOSS OR DAMAGE.
 *
 * All Company, brand and product names may be trademarks that are the sole
 * property of their respective owners. All rights reserved.
 */
package org.osgi.test.cases.framework.secure.permissions.admin1;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

/**
 * 
 * @author Shigekuni KONDO, Ikuo YAMASAKI, NTT Corporation
 */
public class Activator implements BundleActivator {

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		Bundle[] bundles = context.getBundles();
		for (int i = 0, l = bundles.length; i < l; i++) {
			Bundle bundle = bundles[i];
			if ("org.osgi.test.cases.framework.secure.permissions.admin2"
					.equals(bundle.getSymbolicName())) {
				bundle
						.loadClass("org.osgi.test.cases.framework.secure.permissions.admin2.TestClass");
				return;
			}
		}
		throw new RuntimeException(
				"unable to find bundle org.osgi.test.cases.framework.secure.permissions.admin2");
	}

	/*
	 * (non-Javadoc)
	 * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		// empty
	}

}
@@ -2163,33 +2163,36 @@
 %09%09%09%09
-bundle%0D%0A%09%09%09%09%09%09.loadClass(
+String requestedClassName = 
 %22org
@@ -2258,22 +2258,286 @@
 ass%22
-);%0D%0A%09%09%09%09return
+;%0D%0A%09%09%09%09Class testClass = bundle.loadClass(requestedClassName);%0D%0A%09%09%09%09if (requestedClassName.equals(testClass.getName())) %7B%0D%0A%09%09%09%09%09return;%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%09throw new RuntimeException(%0D%0A%09%09%09%09%09%09%22unable to load TestClass from bundle org.osgi.test.cases.framework.secure.permissions.admin2%22)
 ;%0D%0A%09

add more checks of loaded class