[jboss-cvs] JBossAS SVN: r61993 - trunk/ejb3/src/main/org/jboss/ejb3/entity.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 2 13:53:25 EDT 2007


Author: bdecoste
Date: 2007-04-02 13:53:24 -0400 (Mon, 02 Apr 2007)
New Revision: 61993

Modified:
   trunk/ejb3/src/main/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java
Log:
fixed NPE from null map in getNonTxEntityManager() - resolved several CTS tests in persistence.entitytest.apitests

Modified: trunk/ejb3/src/main/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java	2007-04-02 16:53:58 UTC (rev 61992)
+++ trunk/ejb3/src/main/org/jboss/ejb3/entity/ManagedEntityManagerFactory.java	2007-04-02 17:53:24 UTC (rev 61993)
@@ -37,6 +37,7 @@
 import org.jboss.ejb3.tx.TxUtil;
 
 import java.util.IdentityHashMap;
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -56,7 +57,16 @@
    public EntityManager getNonTxEntityManager()
    {
       Map map = nonTxStack.get();
-      EntityManager em = (EntityManager)map.get(this);
+      
+      EntityManager em = null;
+      if (map != null)
+         em = (EntityManager)map.get(this);
+      else
+      {
+         map = new HashMap();
+         nonTxStack.push(map);
+      }
+      
       if (em == null)
       {
          em = entityManagerFactory.createEntityManager();




More information about the jboss-cvs-commits mailing list