[jboss-cvs] JBossAS SVN: r73067 - projects/ejb3/trunk/core/src/main/java/org/jboss/injection.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon May 5 21:18:00 EDT 2008


Author: ALRubinger
Date: 2008-05-05 21:18:00 -0400 (Mon, 05 May 2008)
New Revision: 73067

Modified:
   projects/ejb3/trunk/core/src/main/java/org/jboss/injection/EJBRemoteHandler.java
Log:
[EJBTHREE-1289] More descriptive error message on assertion failure

Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/injection/EJBRemoteHandler.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/injection/EJBRemoteHandler.java	2008-05-06 01:05:39 UTC (rev 73066)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/injection/EJBRemoteHandler.java	2008-05-06 01:18:00 UTC (rev 73067)
@@ -158,6 +158,9 @@
       if (mappedName != null && mappedName.trim().equals(""))
          mappedName = null;
       
+      // Initialize the lookupName to the encName
+      String lookupName = encName;
+      
       // mappedName can be null, because an annotation has not been augmented with resolvedJndiName
       if (mappedName == null)
       {
@@ -165,21 +168,26 @@
          AnnotatedEJBReferencesMetaData amds = container.getEnvironmentRefGroup().getAnnotatedEjbReferences();
          if(amds != null)
          {
-            AnnotatedEJBReferenceMetaData amd = amds.get(encName);
-            if(amd == null && fieldName != null)
-               amd = amds.get(fieldName);
-            if(amd != null)
+            AnnotatedEJBReferenceMetaData amd = amds.get(lookupName);
+            if (amd == null && fieldName != null)
             {
+               lookupName = fieldName;
+               amd = amds.get(lookupName);
+            }
+            if (amd != null)
+            {
                mappedName = amd.getMappedName();
-               if(mappedName == null)
+               if (mappedName == null)
                   mappedName = amd.getResolvedJndiName();
             }
          }
       }
 
       // The MappedDeploymentEndpointResolver should have put resolvedJndiName everywhere.
-      // If no mappedName is know by now, we have a bug.
-      assert mappedName != null : "mappedName for enc " + encName + " is null (container.environmentRefGroup.annotatedEjbReferences = " + container.getEnvironmentRefGroup().getAnnotatedEjbReferences() + ")";
+      // If no mappedName is known by now, we have a bug.
+      assert mappedName != null : "mappedName for enc \"" + encName + "\", field \"" + fieldName
+            + "\" is null (container.environmentRefGroup.annotatedEjbReferences = "
+            + container.getEnvironmentRefGroup().getAnnotatedEjbReferences() + ")";
       
       EncInjector injector = null;
       




More information about the jboss-cvs-commits mailing list