You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2015/04/06 20:17:54 UTC

svn commit: r1671629 - in /commons/proper/jcs/trunk/commons-jcs-core/src: main/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtils.java test/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtilsUnitTest.java

Author: tv
Date: Mon Apr  6 18:17:54 2015
New Revision: 1671629

URL: http://svn.apache.org/r1671629
Log:
Log error rather than throwing exceptions

Modified:
    commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtils.java
    commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtilsUnitTest.java

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtils.java?rev=1671629&r1=1671628&r2=1671629&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtils.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/main/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtils.java Mon Apr  6 18:17:54 2015
@@ -231,10 +231,8 @@ public class RemoteUtils
      * Parse remote server and port from the string representation server:port and store them in
      * the RemoteCacheAttributes
      *
-     * @param registryHost
-     * @param registryPort
-     * @param serviceName
-     * @return
+     * @param server the input string
+     * @param rca the target attribute object
      */
     public static void parseServerAndPort(final String server, final RemoteCacheAttributes rca)
     {
@@ -247,7 +245,7 @@ public class RemoteUtils
         }
         else
         {
-            throw new RuntimeException("Invalid server descriptor: " + server);
+            log.error("Invalid server descriptor: " + server);
         }
     }
 }

Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtilsUnitTest.java?rev=1671629&r1=1671628&r2=1671629&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtilsUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/RemoteUtilsUnitTest.java Mon Apr  6 18:17:54 2015
@@ -61,14 +61,11 @@ public class RemoteUtilsUnitTest
         assertEquals("server2", rca.getRemoteHost());
         assertEquals(4567, rca.getRemotePort());
 
-        try
-        {
-            RemoteUtils.parseServerAndPort("server2  :  port", rca);
-            fail("Parsing should not succeed");
-        }
-        catch (Exception e)
-        {
-            // expected
-        }
+        rca.setRemoteHost("");
+        rca.setRemotePort(0);
+        // Should not change anything
+        RemoteUtils.parseServerAndPort("server2  :  port", rca);
+        assertEquals("", rca.getRemoteHost());
+        assertEquals(0, rca.getRemotePort());
     }
 }