[jboss-cvs] JBossAS SVN: r70435 - trunk/server/src/main/org/jboss/naming.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 5 11:26:00 EST 2008
Author: dimitris at jboss.org
Date: 2008-03-05 11:26:00 -0500 (Wed, 05 Mar 2008)
New Revision: 70435
Modified:
trunk/server/src/main/org/jboss/naming/ExternalContext.java
Log:
JBAS-4753 - replace the local getAllUniqueInterfaces() with a call to org.jboss.util.Classes.getAllUniqueInterfaces(), since it's now available through commons-core 2.2.3.GA
Modified: trunk/server/src/main/org/jboss/naming/ExternalContext.java
===================================================================
--- trunk/server/src/main/org/jboss/naming/ExternalContext.java 2008-03-05 15:58:40 UTC (rev 70434)
+++ trunk/server/src/main/org/jboss/naming/ExternalContext.java 2008-03-05 16:26:00 UTC (rev 70435)
@@ -30,10 +30,8 @@
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.net.URL;
-import java.util.HashSet;
import java.util.Hashtable;
import java.util.Properties;
-import java.util.Set;
import javax.naming.CompositeName;
import javax.naming.Context;
@@ -47,6 +45,7 @@
import javax.naming.spi.ObjectFactory;
import org.jboss.system.ServiceMBeanSupport;
+import org.jboss.util.Classes;
/**
* A MBean that binds an arbitrary InitialContext into the JBoss default
@@ -513,35 +512,10 @@
this.externalCtx = externalCtx;
}
- /**
- * Returns an array containing all the unique interfaces implemented
- * by the argument class c and all its superclasses. Interfaces that
- * appear multiple times through inheritence are only accounted for once.
- *
- * @param c - the class to start scanning for interfaces
- */
- private static Class[] getAllUniqueInterfaces(Class c)
- {
- Set uniqueIfaces = new HashSet();
- while (c != null )
- {
- Class[] ifaces = c.getInterfaces();
- for (int n = 0; n < ifaces.length; n ++)
- {
- uniqueIfaces.add(ifaces[n]);
- }
- c = c.getSuperclass();
- }
- return (Class[])uniqueIfaces.toArray(new Class[uniqueIfaces.size()]);
- }
-
static Context createProxyContext(Context ctx)
{
ClassLoader loader = Thread.currentThread().getContextClassLoader();
- // TODO, JBAS-4753 - remove the above method and replace the following
- // line with a call to org.jboss.util.Classes.getAllUniqueInterfaces()
- // when the next jboss-common release is made available.
- Class[] interfaces = getAllUniqueInterfaces(ctx.getClass());
+ Class[] interfaces = Classes.getAllUniqueInterfaces(ctx.getClass());
InvocationHandler handler = new CachedContext(ctx);
Context proxyCtx = (Context) Proxy.newProxyInstance(loader, interfaces, handler);
return proxyCtx;
More information about the jboss-cvs-commits
mailing list