[jboss-cvs] JBoss Messaging SVN: r2371 - trunk/src/main/org/jboss/jms/client/remoting.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Feb 20 15:30:19 EST 2007


Author: ron_sigal
Date: 2007-02-20 15:30:19 -0500 (Tue, 20 Feb 2007)
New Revision: 2371

Modified:
   trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
Log:
JBMESSAGING-863: Make sure bisocket "port" is > 0.

Modified: trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java	2007-02-20 19:45:36 UTC (rev 2370)
+++ trunk/src/main/org/jboss/jms/client/remoting/JMSRemotingConnection.java	2007-02-20 20:30:19 UTC (rev 2371)
@@ -132,7 +132,26 @@
             if (propertyPort == null)
             {
                String guid = new GUID().toString();
-               metadata.put(Client.CALLBACK_SERVER_PORT, Integer.toString(guid.hashCode()));
+               int hash = guid.hashCode();
+               
+               // Make sure the hash code is > 0.  See JBMESSAGING-863.
+               if (hash < 0)
+               {
+                  if (hash == Integer.MIN_VALUE)
+                     hash = Integer.MAX_VALUE;
+                  else
+                     hash = -hash;
+               }
+               else
+               {
+                  while (hash == 0)
+                  {
+                     guid = new GUID().toString();
+                     hash = guid.hashCode();
+                  }
+               }
+               
+               metadata.put(Client.CALLBACK_SERVER_PORT, Integer.toString(hash));
                metadata.put("guid", guid);
             }
          }




More information about the jboss-cvs-commits mailing list