openejb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r823667 - in /openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb: assembler/classic/JndiBuilder.java core/ivm/naming/IvmContext.java
Date Fri, 09 Oct 2009 19:11:25 GMT
Author: dblevins
Date: Fri Oct  9 19:11:24 2009
New Revision: 823667

URL: http://svn.apache.org/viewvc?rev=823667&view=rev
Log:
Tightened up naming and jndi strategy code to disallow custom prefixes

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java?rev=823667&r1=823666&r2=823667&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
Fri Oct  9 19:11:24 2009
@@ -178,6 +178,14 @@
 
             format = options.get(JNDINAME_FORMAT, "{deploymentId}{interfaceType.annotationName}");
 
+            { // illegal format check
+                int index = format.indexOf(":");
+                if (index > -1) {
+                    logger.error("Illegal " + JNDINAME_FORMAT + " contains a colon ':'. 
Everything before the colon will be removed, '" + format + "' ");
+                    format = format.substring(index + 1);
+                }
+            }
+
             this.template = new StringTemplate(format);
 
             beanInfos = new HashMap<String, EnterpriseBeanInfo>();

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java?rev=823667&r1=823666&r2=823667&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java
Fri Oct  9 19:11:24 2009
@@ -115,9 +115,7 @@
             if (prefix.equals("openejb")){
                 path = name.path();
                 return openejbURLContextFactory.getContext().lookup(path);
-            }
-
-            if (prefix.equals("java")){
+            } else if (prefix.equals("java")){
                 if (name.getComponent().equals("openejb")){
                     path = name.remaining().path();
                     return openejbURLContextFactory.getContext().lookup(path);
@@ -125,13 +123,10 @@
                     path = name.path();
                     return javaURLContextFactory.getContext().lookup(path);
                 }
+            } else {
+                // we don't know what the prefix means, throw an exception
+                throw new NamingException("Unknown JNDI name prefix '"+prefix +":'");
             }
-
-            // we don't know what the prefix means, default to JNDI
-
-            InitialContext initialContext = new InitialContext();
-            return initialContext.lookup(compositName);
-
         } else {
             /*
               the resolve method always starts with the comparison assuming that the first



Mime
View raw message