You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/08/26 21:49:13 UTC

svn commit: r437218 - in /incubator/harmony/enhanced/classlib/trunk/modules/rmi/src: main/java/java/rmi/registry/LocateRegistry.java test/api/java/org/apache/harmony/rmi/registry/ test/api/java/org/apache/harmony/rmi/registry/LocateRegistryTest.java

Author: ndbeyer
Date: Sat Aug 26 12:49:11 2006
New Revision: 437218

URL: http://svn.apache.org/viewvc?rev=437218&view=rev
Log:
Apply path for HARMONY-1231: [classlib][rmi] compatibility: LocateRegistry.createRegistry(-1) throws IllegalArgumentException on RI and ExportException on Harmony

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/registry/
    incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/registry/LocateRegistryTest.java   (with props)
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/registry/LocateRegistry.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/registry/LocateRegistry.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/registry/LocateRegistry.java?rev=437218&r1=437217&r2=437218&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/registry/LocateRegistry.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/main/java/java/rmi/registry/LocateRegistry.java Sat Aug 26 12:49:11 2006
@@ -54,6 +54,9 @@
                                           RMIClientSocketFactory csf,
                                           RMIServerSocketFactory ssf)
             throws RemoteException {
+        if (port < 0) {
+            throw new IllegalArgumentException("Port value out of range: " + port);
+        }
         return new RegistryImpl(port, csf, ssf);
     }
 

Added: incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/registry/LocateRegistryTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/registry/LocateRegistryTest.java?rev=437218&view=auto
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/registry/LocateRegistryTest.java (added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/rmi/src/test/api/java/org/apache/harmony/rmi/registry/LocateRegistryTest.java Sat Aug 26 12:49:11 2006
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed 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.registry;
+
+import java.rmi.registry.LocateRegistry;
+
+import junit.framework.TestCase;
+
+public class LocateRegistryTest extends TestCase {
+
+    /**
+     * Test for method createRegistry(int port)
+     */
+    public void test_createRegistryI() throws Exception {
+        try {
+            LocateRegistry.createRegistry(-1);
+            fail("IllegalArgumentException expected");
+        } catch (IllegalArgumentException e) {
+        	//expected
+        }
+    }
+}

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