[jboss-cvs] JBossAS SVN: r78620 - projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 17 00:27:44 EDT 2008


Author: ALRubinger
Date: 2008-09-17 00:27:44 -0400 (Wed, 17 Sep 2008)
New Revision: 78620

Modified:
   projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
Log:
[EJBTHREE-1491] Fallbacks in case no @RemoteBindings are defined

Modified: projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java	2008-09-17 04:26:51 UTC (rev 78619)
+++ projects/ejb3/trunk/proxy/src/main/java/org/jboss/ejb3/proxy/jndiregistrar/JndiSessionRegistrarBase.java	2008-09-17 04:27:44 UTC (rev 78620)
@@ -219,23 +219,26 @@
          // Obtain RemoteBinding URL
          List<RemoteBindingMetaData> bindings = smd.getRemoteBindings();
          
-         // Sanity checks
-         boolean bindingsFound =bindings != null && bindings.size() > 0; 
-         assert bindingsFound : "Remote Bindings are required and none are present";
-         if (!bindingsFound)
+         // Get Client Bind URL
+         RemoteBindingMetaData remoteBinding = null;
+         String url = null;
+         try
          {
-            throw new RuntimeException(
-                  "This bean has been declared as remote (possibly via @RemoteHome, but with no EJB2.1 View), "
-                        + "yet no remote bindings have been defined");
+            // If bindings are specified
+            if (bindings != null)
+            {
+               remoteBinding = bindings.get(0);
+               url = remoteBinding.getClientBindUrl();
+            }
          }
+         // The bindings were empty
+         catch (IndexOutOfBoundsException ioobe)
+         {
+            // Create a new empty remote binding and add to the metadata
+            remoteBinding = new RemoteBindingMetaData();
+            smd.getRemoteBindings().add(remoteBinding);
+         }
          
-         //TODO Remote Bindings should be 1 per defined
-         // http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4176636
-         
-         // Get Remote Binding
-         RemoteBindingMetaData remoteBinding = bindings.get(0);
-         String url = remoteBinding.getClientBindUrl();
-
          // If no explicit Client Bind URL is specified
          if (url == null || url.trim().equals(""))
          {




More information about the jboss-cvs-commits mailing list