harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r487581 - in /harmony/enhanced/classlib/trunk/modules/rmi/src: main/java/java/rmi/Naming.java test/api/java/org/apache/harmony/rmi/NamingTest.java
Date Fri, 15 Dec 2006 15:34:28 GMT
Author: ayza
Date: Fri Dec 15 07:34:27 2006
New Revision: 487581

URL: http://svn.apache.org/viewvc?view=rev&rev=487581
Log:
Applying patch from HARMONY-1391 ([classlib][rmi] compatibility: Naming.bidi(String, null)
expected NPE)

Added:
    harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/NamingTest.java
  (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/Naming.java

Modified: harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/Naming.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/Naming.java?view=diff&rev=487581&r1=487580&r2=487581
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/Naming.java (original)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/Naming.java Fri Dec
15 07:34:27 2006
@@ -72,6 +72,10 @@
 
     public static void bind(String name, Remote obj) throws AlreadyBoundException,
             MalformedURLException, RemoteException {
+        if (obj == null) {
+            throw new NullPointerException(Messages.getString("rmi.5C")); //$NON-NLS-1$
+        }
+
         if (name == null) {
             // rmi.00=URL could not be null.
             throw new NullPointerException(Messages.getString("rmi.00")); //$NON-NLS-1$

Added: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/NamingTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/NamingTest.java?view=auto&rev=487581
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/NamingTest.java
(added)
+++ harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/NamingTest.java
Fri Dec 15 07:34:27 2006
@@ -0,0 +1,44 @@
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.rmi;
+
+import java.rmi.Naming;
+
+import junit.framework.TestCase;
+
+public class NamingTest extends TestCase {
+
+    public void testBidiBad() throws Exception {
+        // Regression test HARMONY-1391
+        
+        try {
+            Naming.bind("", null);
+            fail("Expected NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+        
+        try {
+            Naming.bind("//ttt:2222/zzz", null);
+            fail("Expected NPE");
+        } catch (NullPointerException e) {
+            // expected
+        }
+    }
+    
+}

Propchange: harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/NamingTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message