You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pe...@apache.org on 2012/11/14 11:59:23 UTC

svn commit: r1409150 - /river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java

Author: peter_firmstone
Date: Wed Nov 14 10:59:22 2012
New Revision: 1409150

URL: http://svn.apache.org/viewvc?rev=1409150&view=rev
Log:
Fix NullPointerException due to unsafe publication in DiscoveryProtocolSimulator on my Windows PC.

Modified:
    river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java

Modified: river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java
URL: http://svn.apache.org/viewvc/river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java?rev=1409150&r1=1409149&r2=1409150&view=diff
==============================================================================
--- river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java (original)
+++ river/jtsk/trunk/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java Wed Nov 14 10:59:22 2012
@@ -564,9 +564,9 @@ public class DiscoveryProtocolSimulator 
     /** Unicast discovery request thread code. */
     private class UnicastThread extends Thread {
 	/** Server socket to accepts connections on. */
-	private ServerSocket listen;
+	private final ServerSocket listen;
 	/** Listen port */
-	public int port;
+	public final int port;
 
 	/**
 	 * Create a daemon thread.  Set up the socket now rather than in run,
@@ -574,6 +574,7 @@ public class DiscoveryProtocolSimulator 
 	 */
 	public UnicastThread(int port) throws IOException {
 	    super("unicast request");
+            ServerSocket listen = null;
 	    setDaemon(true);
 	    if (port == 0) {
 		try {
@@ -596,6 +597,7 @@ public class DiscoveryProtocolSimulator 
                     }
                 }
 	    }
+            this.listen = listen;
 	    this.port = listen.getLocalPort();
 	}