Author: thomas.diesler(a)jboss.com
Date: 2010-03-26 04:48:19 -0400 (Fri, 26 Mar 2010)
New Revision: 103017
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs30/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java
Log:
[JBOSGI-306] Invalid classloader policy created
Throw ISE in OSGiModule when it is called to create the policy
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
===================================================================
---
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java 2010-03-26
07:42:50 UTC (rev 103016)
+++
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java 2010-03-26
08:48:19 UTC (rev 103017)
@@ -21,6 +21,7 @@
*/
package org.jboss.osgi.framework.classloading;
+import org.jboss.classloader.spi.ClassLoaderPolicy;
import org.jboss.classloading.spi.dependency.Module;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
import org.jboss.deployers.structure.spi.DeploymentUnit;
@@ -41,4 +42,10 @@
{
super(unit);
}
+
+ @Override
+ public ClassLoaderPolicy createClassLoaderPolicy()
+ {
+ throw new IllegalStateException("OSGiClassLoaderFactory is expected to create
the policy");
+ }
}
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/vfs30/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java
===================================================================
---
projects/jboss-osgi/projects/runtime/framework/trunk/vfs30/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java 2010-03-26
07:42:50 UTC (rev 103016)
+++
projects/jboss-osgi/projects/runtime/framework/trunk/vfs30/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java 2010-03-26
08:48:19 UTC (rev 103017)
@@ -25,7 +25,6 @@
import org.jboss.classloader.spi.ClassLoaderPolicy;
import org.jboss.classloader.spi.base.BaseClassLoader;
-import org.jboss.logging.Logger;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleReference;
@@ -37,23 +36,16 @@
*/
public class OSGiBundleClassLoader extends BaseClassLoader implements BundleReference
{
- // Provide logging
- private static final Logger log = Logger.getLogger(OSGiBundleClassLoader.class);
-
private OSGiClassLoaderPolicy osgiPolicy;
public OSGiBundleClassLoader(ClassLoaderPolicy policy)
{
super(policy);
- if (policy instanceof OSGiClassLoaderPolicy)
- osgiPolicy = (OSGiClassLoaderPolicy)policy;
-
- if (osgiPolicy == null)
- {
- log.warn("Invalid policy: " + policy, new IllegalStateException());
- System.out.println("FIXME [JBOSGI-306] Invalid policy: " + policy);
- }
+ if (policy instanceof OSGiClassLoaderPolicy == false)
+ throw new IllegalArgumentException("Invalid policy: " + policy);
+
+ osgiPolicy = (OSGiClassLoaderPolicy)policy;
}
@Override