harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhouke...@apache.org
Subject svn commit: r933861 - in /harmony/enhanced/java/trunk/classlib/modules/jndi/src: main/java/javax/naming/spi/ main/java/org/apache/harmony/jndi/internal/ test/java/org/apache/harmony/jndi/tests/javax/naming/spi/
Date Wed, 14 Apr 2010 06:32:40 GMT
Author: zhoukevin
Date: Wed Apr 14 06:32:40 2010
New Revision: 933861

URL: http://svn.apache.org/viewvc?rev=933861&view=rev
Log:
Apply patch for HARMONY-6220, NamingManager.getURLContext() should not return null for rmi
schema

Modified:
    harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
    harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java
    harmony/enhanced/java/trunk/classlib/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerTest.java

Modified: harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java?rev=933861&r1=933860&r2=933861&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
Wed Apr 14 06:32:40 2010
@@ -636,7 +636,7 @@ public class NamingManager {
     public static Context getURLContext(String schema, Hashtable<?, ?> envmt)
             throws NamingException {
 
-        if (null == schema || 0 == schema.length() || null == envmt) {
+        if (null == schema || 0 == schema.length()) {
             return null;
         }
 

Modified: harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java?rev=933861&r1=933860&r2=933861&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/jndi/src/main/java/org/apache/harmony/jndi/internal/EnvironmentReader.java
Wed Apr 14 06:32:40 2010
@@ -449,10 +449,11 @@ public final class EnvironmentReader {
                 }
             }
         }
-        // if key is Context.URL_PKG_PREFIXES, append "com.sun.jndi.url" at the
-        // end
+        // if key is Context.URL_PKG_PREFIXES, append "com.sun.jndi.url" and
+        // "org.apache.harmony.jndi.provider" at the end
         if (Context.URL_PKG_PREFIXES.equals(key)) {
             fnames.add("com.sun.jndi.url"); //$NON-NLS-1$
+            fnames.add("org.apache.harmony.jndi.provider"); //$NON-NLS-1$
         }
         // return factory names
         return fnames.toArray(new String[fnames.size()]);

Modified: harmony/enhanced/java/trunk/classlib/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/java/trunk/classlib/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerTest.java?rev=933861&r1=933860&r2=933861&view=diff
==============================================================================
--- harmony/enhanced/java/trunk/classlib/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerTest.java
(original)
+++ harmony/enhanced/java/trunk/classlib/modules/jndi/src/test/java/org/apache/harmony/jndi/tests/javax/naming/spi/NamingManagerTest.java
Wed Apr 14 06:32:40 2010
@@ -1450,6 +1450,31 @@ public class NamingManagerTest extends T
 		}
 	}
 
+    public void testGetURLContext_RMI_scenario1() throws Exception {
+        Context context = NamingManager.getURLContext("rmi", null);
+        assertNotNull(context);
+    }
+
+    public void testGetURLContext_RMI_scenario2() throws Exception {
+        Hashtable env = new Hashtable();
+        Context context = NamingManager.getURLContext("rmi", env);
+        assertNotNull(context);
+    }
+
+    public void testGetURLContext_RMI_scenario3() throws Exception {
+        Hashtable env = new Hashtable();
+        env.put(Context.URL_PKG_PREFIXES, "org.apache.harmony.jndi.provider");
+        Context context = NamingManager.getURLContext("rmi", env);
+        assertNotNull(context);
+    }
+
+    public void testGetURLContext_RMI_scenario4() throws Exception {
+        Hashtable env = new Hashtable();
+        env.put(Context.URL_PKG_PREFIXES, "com.sun.jndi.url");
+        Context context = NamingManager.getURLContext("rmi", env);
+        assertNotNull(context);
+    }
+
 	public void testGetURLContext_null_null() {
 		log.setMethod("testGetURLContext_null_null()");
 		String schema = null;



Mime
View raw message