[tor-commits] [metrics-lib/master] Fix a couple of compile warnings and a real bug.

karsten at torproject.org karsten at torproject.org
Wed Jan 18 13:24:17 UTC 2012


commit 50066cd0d33a60df4049b0e4b36ad0530b5aa907
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Wed Jan 18 14:21:27 2012 +0100

    Fix a couple of compile warnings and a real bug.
    
    Hint: The getter in DescriptorFileImpl was the bug.
---
 .../descriptor/BridgeDescriptorReader.java         |    2 --
 .../descriptor/RelayDescriptorReader.java          |    2 --
 .../descriptor/impl/BandwidthHistoryImpl.java      |    3 ---
 .../descriptor/impl/DescriptorFileImpl.java        |    2 +-
 .../descriptor/impl/DescriptorParseException.java  |    1 +
 .../descriptor/impl/DirSourceEntryImpl.java        |    1 -
 .../descriptor/impl/NetworkStatusEntryImpl.java    |    1 -
 .../descriptor/impl/NetworkStatusImpl.java         |    3 ---
 .../torproject/descriptor/impl/ParseHelper.java    |    2 --
 .../impl/RelayDescriptorDownloaderImpl.java        |    8 --------
 .../impl/RelayNetworkStatusConsensusImpl.java      |    4 ----
 .../impl/RelayOrBridgeDescriptorReaderImpl.java    |    1 -
 .../descriptor/impl/ServerDescriptorImpl.java      |    1 -
 13 files changed, 2 insertions(+), 29 deletions(-)

diff --git a/src/org/torproject/descriptor/BridgeDescriptorReader.java b/src/org/torproject/descriptor/BridgeDescriptorReader.java
index c055557..3308e82 100644
--- a/src/org/torproject/descriptor/BridgeDescriptorReader.java
+++ b/src/org/torproject/descriptor/BridgeDescriptorReader.java
@@ -4,8 +4,6 @@ package org.torproject.descriptor;
 
 import java.io.File;
 import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
 
 /* Read bridge descriptors from one or more local directories. */
 public interface BridgeDescriptorReader {
diff --git a/src/org/torproject/descriptor/RelayDescriptorReader.java b/src/org/torproject/descriptor/RelayDescriptorReader.java
index 90063c3..021794e 100644
--- a/src/org/torproject/descriptor/RelayDescriptorReader.java
+++ b/src/org/torproject/descriptor/RelayDescriptorReader.java
@@ -4,8 +4,6 @@ package org.torproject.descriptor;
 
 import java.io.File;
 import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
 
 /* Read relay descriptors from one or more local directories. */
 public interface RelayDescriptorReader {
diff --git a/src/org/torproject/descriptor/impl/BandwidthHistoryImpl.java b/src/org/torproject/descriptor/impl/BandwidthHistoryImpl.java
index f16cc81..db309b7 100644
--- a/src/org/torproject/descriptor/impl/BandwidthHistoryImpl.java
+++ b/src/org/torproject/descriptor/impl/BandwidthHistoryImpl.java
@@ -2,9 +2,6 @@
  * See LICENSE for licensing information */
 package org.torproject.descriptor.impl;
 
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
 import java.util.SortedMap;
 import java.util.TreeMap;
 import org.torproject.descriptor.BandwidthHistory;
diff --git a/src/org/torproject/descriptor/impl/DescriptorFileImpl.java b/src/org/torproject/descriptor/impl/DescriptorFileImpl.java
index 3051066..6794e3e 100644
--- a/src/org/torproject/descriptor/impl/DescriptorFileImpl.java
+++ b/src/org/torproject/descriptor/impl/DescriptorFileImpl.java
@@ -14,7 +14,7 @@ public class DescriptorFileImpl implements DescriptorFile {
     this.directory = directory;
   }
   public File getDirectory() {
-    return this.file;
+    return this.directory;
   }
 
   private File file;
diff --git a/src/org/torproject/descriptor/impl/DescriptorParseException.java b/src/org/torproject/descriptor/impl/DescriptorParseException.java
index 74dc526..30d3e50 100644
--- a/src/org/torproject/descriptor/impl/DescriptorParseException.java
+++ b/src/org/torproject/descriptor/impl/DescriptorParseException.java
@@ -3,6 +3,7 @@
 package org.torproject.descriptor.impl;
 
 public class DescriptorParseException extends Exception {
+  private static final long serialVersionUID = 100L;
   protected DescriptorParseException(String message) {
     super(message);
   }
diff --git a/src/org/torproject/descriptor/impl/DirSourceEntryImpl.java b/src/org/torproject/descriptor/impl/DirSourceEntryImpl.java
index 4145686..16e0c87 100644
--- a/src/org/torproject/descriptor/impl/DirSourceEntryImpl.java
+++ b/src/org/torproject/descriptor/impl/DirSourceEntryImpl.java
@@ -5,7 +5,6 @@ package org.torproject.descriptor.impl;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
-import java.text.ParseException;
 import java.util.SortedSet;
 import java.util.TreeSet;
 import org.torproject.descriptor.DirSourceEntry;
diff --git a/src/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java b/src/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
index fa31f4a..2136810 100644
--- a/src/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
+++ b/src/org/torproject/descriptor/impl/NetworkStatusEntryImpl.java
@@ -5,7 +5,6 @@ package org.torproject.descriptor.impl;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
-import java.util.Arrays;
 import java.util.SortedMap;
 import java.util.SortedSet;
 import java.util.TreeSet;
diff --git a/src/org/torproject/descriptor/impl/NetworkStatusImpl.java b/src/org/torproject/descriptor/impl/NetworkStatusImpl.java
index ec3913c..0a22a0e 100644
--- a/src/org/torproject/descriptor/impl/NetworkStatusImpl.java
+++ b/src/org/torproject/descriptor/impl/NetworkStatusImpl.java
@@ -6,10 +6,7 @@ import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import java.util.Set;
 import java.util.SortedMap;
 import java.util.TreeMap;
 import org.torproject.descriptor.DirSourceEntry;
diff --git a/src/org/torproject/descriptor/impl/ParseHelper.java b/src/org/torproject/descriptor/impl/ParseHelper.java
index 3f80ddb..6984f6a 100644
--- a/src/org/torproject/descriptor/impl/ParseHelper.java
+++ b/src/org/torproject/descriptor/impl/ParseHelper.java
@@ -7,7 +7,6 @@ import java.text.SimpleDateFormat;
 import java.util.SortedMap;
 import java.util.TimeZone;
 import java.util.TreeMap;
-import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.codec.binary.Hex;
@@ -76,7 +75,6 @@ public class ParseHelper {
       String[] addressParts = addressPart.split("/");
       String address = addressParts[0];
       ParseHelper.parseIpv4Address(line, address);
-      String mask = addressParts[1];
       int maskValue = -1;
       try {
         maskValue = Integer.parseInt(addressPart.substring(
diff --git a/src/org/torproject/descriptor/impl/RelayDescriptorDownloaderImpl.java b/src/org/torproject/descriptor/impl/RelayDescriptorDownloaderImpl.java
index fff6b36..168ffd9 100644
--- a/src/org/torproject/descriptor/impl/RelayDescriptorDownloaderImpl.java
+++ b/src/org/torproject/descriptor/impl/RelayDescriptorDownloaderImpl.java
@@ -2,21 +2,13 @@
  * See LICENSE for licensing information */
 package org.torproject.descriptor.impl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Map;
-import java.util.List;
 import java.util.Set;
 import java.util.SortedMap;
 import java.util.TreeMap;
-import org.torproject.descriptor.Descriptor;
 import org.torproject.descriptor.DescriptorRequest;
-import org.torproject.descriptor.DirSourceEntry;
 import org.torproject.descriptor.RelayDescriptorDownloader;
-import org.torproject.descriptor.RelayNetworkStatusConsensus;
-import org.torproject.descriptor.RelayNetworkStatusVote;
 
 public class RelayDescriptorDownloaderImpl
     implements RelayDescriptorDownloader {
diff --git a/src/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java b/src/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java
index 6dc3d74..09b9df5 100644
--- a/src/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java
+++ b/src/org/torproject/descriptor/impl/RelayNetworkStatusConsensusImpl.java
@@ -12,12 +12,8 @@ import java.util.List;
 import java.util.Set;
 import java.util.SortedMap;
 import java.util.SortedSet;
-import java.util.TimeZone;
 import java.util.TreeMap;
 import java.util.TreeSet;
-import org.torproject.descriptor.Descriptor;
-import org.torproject.descriptor.DirSourceEntry;
-import org.torproject.descriptor.NetworkStatusEntry;
 import org.torproject.descriptor.RelayNetworkStatusConsensus;
 
 /* Contains a network status consensus. */
diff --git a/src/org/torproject/descriptor/impl/RelayOrBridgeDescriptorReaderImpl.java b/src/org/torproject/descriptor/impl/RelayOrBridgeDescriptorReaderImpl.java
index 27a5a40..63d7507 100644
--- a/src/org/torproject/descriptor/impl/RelayOrBridgeDescriptorReaderImpl.java
+++ b/src/org/torproject/descriptor/impl/RelayOrBridgeDescriptorReaderImpl.java
@@ -16,7 +16,6 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 import java.util.SortedMap;
 import java.util.Stack;
 import java.util.TreeMap;
diff --git a/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java b/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
index 9fbcd84..b17782f 100644
--- a/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
+++ b/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
@@ -368,7 +368,6 @@ public class ServerDescriptorImpl extends DescriptorImpl
 
   private void parseProtocolsLine(String line, String lineNoOpt,
       String[] partsNoOpt) throws DescriptorParseException {
-    List<String> partsList = Arrays.asList(partsNoOpt);
     boolean isValid = true;
     this.linkProtocolVersions = new ArrayList<Integer>();
     this.circuitProtocolVersions = new ArrayList<Integer>();



More information about the tor-commits mailing list