[jboss-cvs] JBossAS SVN: r71880 - in projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3: stateful and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Apr 10 04:17:58 EDT 2008


Author: ALRubinger
Date: 2008-04-10 04:17:58 -0400 (Thu, 10 Apr 2008)
New Revision: 71880

Modified:
   projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
   projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
   projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java
Log:
[EJBTHREE-1253] Avoid NPE, bind StatefulBean/local as LinkRef to StatefulBean/localProxyFactory

Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2008-04-10 08:15:50 UTC (rev 71879)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/session/SessionContainer.java	2008-04-10 08:17:58 UTC (rev 71880)
@@ -486,7 +486,7 @@
    
    public Object createSession()
    {
-      return createSession(null, null);
+      return createSession(new Class<?>[]{}, new Object[]{});
    }
    
    /**

Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java	2008-04-10 08:15:50 UTC (rev 71879)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java	2008-04-10 08:17:58 UTC (rev 71880)
@@ -25,6 +25,14 @@
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.NamingException;
+import javax.naming.RefAddr;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+
+import org.jboss.ejb3.JndiProxyFactory;
 import org.jboss.ejb3.ProxyFactory;
 import org.jboss.ejb3.session.SessionSpecContainer;
 import org.jboss.logging.Logger;
@@ -74,6 +82,26 @@
    public void start() throws Exception
    {
       this.init();
+      
+      // Bind the Proxy Factory
+      Context ctx = getContainer().getInitialContext();
+      Name name = ctx.getNameParser("").parse(jndiName);
+      ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
+      String atom = name.get(name.size() - 1);
+      RefAddr refAddr = new StringRefAddr(JndiProxyFactory.FACTORY, jndiName + PROXY_FACTORY_NAME);
+      Reference ref = new Reference(Object.class.getName(), refAddr, JndiProxyFactory.class.getName(), null);
+      try
+      {
+         log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + atom);
+         Util.rebind(ctx, atom, ref);
+      }
+      catch (NamingException e)
+      {
+         NamingException namingException = new NamingException("Could not bind stateful proxy with ejb name "
+               + getContainer().getEjbName() + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + atom);
+         namingException.setRootCause(e);
+         throw namingException;
+      }
    }
 
    public void stop() throws Exception

Modified: projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java
===================================================================
--- projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java	2008-04-10 08:15:50 UTC (rev 71879)
+++ projects/ejb3/dev/ejbthree1253/core/src/main/java/org/jboss/ejb3/stateful/BaseStatefulRemoteProxyFactory.java	2008-04-10 08:17:58 UTC (rev 71880)
@@ -152,26 +152,6 @@
    public void start() throws Exception
    {
       super.start();
-
-      // Bind the Proxy Factory
-      Context ctx = getContainer().getInitialContext();
-      Name name = ctx.getNameParser("").parse(jndiName);
-      ctx = Util.createSubcontext(ctx, name.getPrefix(name.size() - 1));
-      String atom = name.get(name.size() - 1);
-      RefAddr refAddr = new StringRefAddr(JndiProxyFactory.FACTORY, jndiName + PROXY_FACTORY_NAME);
-      Reference ref = new Reference(Object.class.getName(), refAddr, JndiProxyFactory.class.getName(), null);
-      try
-      {
-         log.debug("Binding reference for " + getContainer().getEjbName() + " in JNDI at " + atom);
-         Util.rebind(ctx, atom, ref);
-      }
-      catch (NamingException e)
-      {
-         NamingException namingException = new NamingException("Could not bind stateful proxy with ejb name "
-               + getContainer().getEjbName() + " into JNDI under jndiName: " + ctx.getNameInNamespace() + "/" + atom);
-         namingException.setRootCause(e);
-         throw namingException;
-      }
    }
 
    // Accessors / Mutators




More information about the jboss-cvs-commits mailing list