[tor-commits] [metrics-lib/master] Don't catch an exception that the caller should handle.

karsten at torproject.org karsten at torproject.org
Tue Apr 17 16:26:41 UTC 2012


commit 48d9363c82dc13f757e5df86190c9ac9202d6591
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Tue Apr 17 16:10:37 2012 +0200

    Don't catch an exception that the caller should handle.
---
 .../descriptor/impl/ServerDescriptorImpl.java      |   19 +++++++------------
 1 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java b/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
index 5fc6ca1..68b0e70 100644
--- a/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
+++ b/src/org/torproject/descriptor/impl/ServerDescriptorImpl.java
@@ -21,23 +21,18 @@ public class ServerDescriptorImpl extends DescriptorImpl
     implements ServerDescriptor {
 
   protected static List<ServerDescriptor> parseDescriptors(
-      byte[] descriptorsBytes, boolean failUnrecognizedDescriptorLines) {
+      byte[] descriptorsBytes, boolean failUnrecognizedDescriptorLines)
+      throws DescriptorParseException {
     List<ServerDescriptor> parsedDescriptors =
         new ArrayList<ServerDescriptor>();
     List<byte[]> splitDescriptorsBytes =
         DescriptorImpl.splitRawDescriptorBytes(descriptorsBytes,
         "router ");
-    try {
-      for (byte[] descriptorBytes : splitDescriptorsBytes) {
-        ServerDescriptor parsedDescriptor =
-            new ServerDescriptorImpl(descriptorBytes,
-            failUnrecognizedDescriptorLines);
-        parsedDescriptors.add(parsedDescriptor);
-      }
-    } catch (DescriptorParseException e) {
-      /* TODO Handle this error somehow. */
-      System.err.println("Failed to parse descriptor.  Skipping.");
-      e.printStackTrace();
+    for (byte[] descriptorBytes : splitDescriptorsBytes) {
+      ServerDescriptor parsedDescriptor =
+          new ServerDescriptorImpl(descriptorBytes,
+          failUnrecognizedDescriptorLines);
+      parsedDescriptors.add(parsedDescriptor);
     }
     return parsedDescriptors;
   }





More information about the tor-commits mailing list