[or-cvs] r22288: {projects} Fix two edge cases found when writing the ExoneraTor web ver (projects/archives/trunk/exonerator)

Karsten Loesing karsten.loesing at gmx.net
Wed May 5 19:19:11 UTC 2010


Author: kloesing
Date: 2010-05-05 19:19:11 +0000 (Wed, 05 May 2010)
New Revision: 22288

Modified:
   projects/archives/trunk/exonerator/ExoneraTor.java
Log:
Fix two edge cases found when writing the ExoneraTor web version.


Modified: projects/archives/trunk/exonerator/ExoneraTor.java
===================================================================
--- projects/archives/trunk/exonerator/ExoneraTor.java	2010-05-05 16:08:48 UTC (rev 22287)
+++ projects/archives/trunk/exonerator/ExoneraTor.java	2010-05-05 19:19:11 UTC (rev 22288)
@@ -188,8 +188,8 @@
         String address = parts[6];
         if (address.equals(relayIP)) {
           byte[] result = Base64.decode(parts[3] + "==");
-          String hex = new BigInteger(1, Base64.decode(parts[3] +
-              "==")).toString(16).substring(0, 40);
+          String hex = String.format("%040x", new BigInteger(1,
+               Base64.decode(parts[3] + "==")));
           if (!relevantDescriptors.containsKey(hex))
             relevantDescriptors.put(hex, new HashSet<File>());
           relevantDescriptors.get(hex).add(consensus);
@@ -265,8 +265,8 @@
                       continue; // IP address does not match
                     String[] ruleIPParts = ruleAddress.split("/")[0].
                         replace(".", " ").split(" ");
-                    int ruleNetwork = Integer.parseInt(
-                        ruleAddress.split("/")[1]);
+                    int ruleNetwork = ruleAddress.contains("/") ?
+                        Integer.parseInt(ruleAddress.split("/")[1]) : 32;
                     for (int i = 0; i < 4; i++) {
                       if (ruleNetwork == 0) {
                         break;



More information about the tor-commits mailing list