[freenet-cvs] r13950 - trunk/freenet/src/freenet/clients/http

toad at freenetproject.org toad at freenetproject.org
Fri Jul 6 15:26:04 UTC 2007


Author: toad
Date: 2007-07-06 15:26:03 +0000 (Fri, 06 Jul 2007)
New Revision: 13950

Modified:
   trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
Log:
doh, signum() is a 1.5ism

Modified: trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java
===================================================================
--- trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java	2007-07-06 15:20:40 UTC (rev 13949)
+++ trunk/freenet/src/freenet/clients/http/ConnectionsToadlet.java	2007-07-06 15:26:03 UTC (rev 13950)
@@ -78,7 +78,9 @@
 			if(sortBy.equals("address")){
 				return firstNode.getPeerAddress().compareToIgnoreCase(secondNode.getPeerAddress());
 			}else if(sortBy.equals("location")){
-				return (int) Math.signum(firstNode.getLocation() - secondNode.getLocation()); // Can occasionally be the same, and we must have a consistent sort order
+				double diff = firstNode.getLocation() - secondNode.getLocation(); // Can occasionally be the same, and we must have a consistent sort order
+				if(Double.MIN_VALUE*2 < Math.abs(diff)) return 0;
+				return diff > 0 ? 1 : -1;
 			}else if(sortBy.equals("version")){
 				return Version.getArbitraryBuildNumber(firstNode.getVersion()) - Version.getArbitraryBuildNumber(secondNode.getVersion());
 			}else




More information about the cvs mailing list