[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [collector/master] Use try-with-resources and refer to new bridge auth in comment.



commit 105c1f82a92988e0932ac65eca16de356e318ed5
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date:   Fri Sep 30 12:01:47 2016 +0200

    Use try-with-resources and refer to new bridge auth in comment.
---
 .../torproject/collector/bridgedescs/BridgeSnapshotReader.java    | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java b/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
index 683cb1c..2a9b568 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/BridgeSnapshotReader.java
@@ -34,7 +34,7 @@ public class BridgeSnapshotReader {
       BridgeSnapshotReader.class);
 
   /**
-   * Reads the half-hourly snapshots of bridge descriptors from Tonga.
+   * Reads the half-hourly snapshots of bridge descriptors from Bifroest.
    */
   public BridgeSnapshotReader(BridgeDescriptorParser bdp,
       File bridgeDirectoriesDir, File statsDirectory) throws ConfigurationException {
@@ -241,13 +241,11 @@ public class BridgeSnapshotReader {
           + "(skipped " + skippedExtraInfoDescriptors + ").");
       if (!parsed.isEmpty() && modified) {
         logger.debug("Writing file " + pbdFile.getAbsolutePath() + "...");
-        try {
-          pbdFile.getParentFile().mkdirs();
-          BufferedWriter bw = new BufferedWriter(new FileWriter(pbdFile));
+        pbdFile.getParentFile().mkdirs();
+        try (BufferedWriter bw = new BufferedWriter(new FileWriter(pbdFile))) {
           for (String f : parsed) {
             bw.append(f + "\n");
           }
-          bw.close();
           logger.debug("Finished writing file " + pbdFile.getAbsolutePath()
               + ".");
         } catch (IOException e) {



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits