[jboss-cvs] JBossAS SVN: r108568 - in branches/Branch_4_2: server/src/main/org/jboss/naming and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 14 05:46:42 EDT 2010


Author: dimitris at jboss.org
Date: 2010-10-14 05:46:41 -0400 (Thu, 14 Oct 2010)
New Revision: 108568

Modified:
   branches/Branch_4_2/build/build-thirdparty.xml
   branches/Branch_4_2/server/src/main/org/jboss/naming/ExternalContext.java
Log:
JBAS-4753, refactored the solution by updating jboss common to 1.2.2.GA-brew

Modified: branches/Branch_4_2/build/build-thirdparty.xml
===================================================================
--- branches/Branch_4_2/build/build-thirdparty.xml	2010-10-14 07:24:15 UTC (rev 108567)
+++ branches/Branch_4_2/build/build-thirdparty.xml	2010-10-14 09:46:41 UTC (rev 108568)
@@ -78,7 +78,7 @@
     <componentref name="jaxen" version="1.1-brew"/>
     <componentref name="jboss/aop" version="1.5.6.GA"/>
     <componentref name="jboss/cache" version="1.4.1.SP9-brew"/>
-    <componentref name="jboss/common" version="1.2.1.GA"/>
+    <componentref name="jboss/common" version="1.2.2.GA-brew"/>
     <componentref name="jboss/dom4j-jarjar" version="1.6.1"/>
     <componentref name="jboss/jaxr" version="1.2.1.GA"/>
     <componentref name="jboss/jbossts14" version="4.2.3.SP7"/>

Modified: branches/Branch_4_2/server/src/main/org/jboss/naming/ExternalContext.java
===================================================================
--- branches/Branch_4_2/server/src/main/org/jboss/naming/ExternalContext.java	2010-10-14 07:24:15 UTC (rev 108567)
+++ branches/Branch_4_2/server/src/main/org/jboss/naming/ExternalContext.java	2010-10-14 09:46:41 UTC (rev 108568)
@@ -1,6 +1,6 @@
 /*
  * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
  * as indicated by the @author tags. See the copyright.txt file in the
  * distribution for a full listing of individual contributors.
  *
@@ -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
@@ -261,11 +260,13 @@
    {
       Context ctx = contextInfo.newContext();
       Context rootCtx = (Context) new InitialContext();
-		log.debug("ctx="+ctx+", env="+ctx.getEnvironment());
+
+      log.debug("ctx="+ctx+", env="+ctx.getEnvironment());
       
       // Get the parent context into which we are to bind
       String jndiName = contextInfo.getJndiName();
       Name fullName = rootCtx.getNameParser("").parse(jndiName);
+
       log.debug("fullName="+fullName);
       
       Name parentName = fullName;
@@ -277,6 +278,7 @@
       log.debug("parentName="+parentName);
       
       Context parentCtx = createContext(rootCtx, parentName);
+      
       log.debug("parentCtx="+parentCtx);
       
       Name atomName = fullName.getSuffix(fullName.size()-1);
@@ -510,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