Author: peter_firmstone
Date: Wed Nov 21 11:26:46 2012
New Revision: 1412062

URL: http://svn.apache.org/viewvc?rev=1412062&view=rev
Log:
Alter Reggie to throw IOException if port selected by ServerSocketFactory 
doesn't match requested port, or if default port not available - Changes 
reverted, it would be desirable to have the port required by BaseQATest 
communicated to Reggie, which currently gets the unicast socket port from 
configuration.  BaseQATest falls over when port 4160 is already in use.

Modified:
    river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java
    river/jtsk/trunk/src/net/jini/core/discovery/LookupLocator.java

Modified: river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java?rev=1412062&r1=1412061&r2=1412062&view=diff
==============================================================================
--- river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java (original)
+++ river/jtsk/trunk/src/com/sun/jini/reggie/RegistrarImpl.java Wed Nov 21 
11:26:46 2012
@@ -2568,10 +2568,10 @@ class RegistrarImpl implements Registrar
                    listen = 
serverSocketFactory.createServerSocket(Constants.discoveryPort);
                } catch (IOException e) {
                     e.fillInStackTrace();
-                    throw e;
+//                    throw e;
                     // Swallowing interrupt causes difficult to diagnose test 
failures.
-//                 logger.log(
-//                     Levels.HANDLED, "failed to bind to default port", e);
+                   logger.log(
+                       Levels.HANDLED, "failed to bind to default port", e);
                }
            }
            if (listen == null) {

Modified: river/jtsk/trunk/src/net/jini/core/discovery/LookupLocator.java
URL: 
http://svn.apache.org/viewvc/river/jtsk/trunk/src/net/jini/core/discovery/LookupLocator.java?rev=1412062&r1=1412061&r2=1412062&view=diff
==============================================================================
--- river/jtsk/trunk/src/net/jini/core/discovery/LookupLocator.java (original)
+++ river/jtsk/trunk/src/net/jini/core/discovery/LookupLocator.java Wed Nov 21 
11:26:46 2012
@@ -170,7 +170,10 @@ public class LookupLocator implements Se
     public LookupLocator(String host, int port) {
         if (host == null) throw new NullPointerException("null host");
        StringBuilder sb = new StringBuilder();
-        sb.append("jini://").append(host).append(":").append(port);
+        sb.append("jini://").append(host);
+        if ( port != -1 ) { //URI compliance -1 is converted to discoveryPort.
+            sb.append(":").append(port);
+        }
         try {
             URI uri = parseURI(sb.toString());
             this.host = uri.getHost();


Reply via email to