[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [collector/master] BufferedReader wouldn't be closed in case of an Exception.
commit 7752b6d73538140cd34daf2267cc470dcc30b155
Author: iwakeh <iwakeh@xxxxxxxxxxxxxx>
Date: Mon Jan 16 17:34:35 2017 +0100
BufferedReader wouldn't be closed in case of an Exception.
Use try-with-resources to prevent this.
---
.../torproject/collector/bridgedescs/SanitizedBridgesWriter.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
index 0898670..45a7565 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
@@ -156,9 +156,8 @@ public class SanitizedBridgesWriter extends CollecTorMain {
this.bridgeIpSecretsFile = new File(statsDirectory,
"bridge-ip-secrets");
if (this.bridgeIpSecretsFile.exists()) {
- try {
- BufferedReader br = new BufferedReader(new FileReader(
- this.bridgeIpSecretsFile));
+ try (BufferedReader br = new BufferedReader(new FileReader(
+ this.bridgeIpSecretsFile))) {
String line;
while ((line = br.readLine()) != null) {
String[] parts = line.split(",");
@@ -177,7 +176,6 @@ public class SanitizedBridgesWriter extends CollecTorMain {
byte[] secret = Hex.decodeHex(parts[1].toCharArray());
this.secretsForHashingIpAddresses.put(month, secret);
}
- br.close();
if (!this.persistenceProblemWithSecrets) {
logger.debug("Read "
+ this.secretsForHashingIpAddresses.size() + " secrets for "
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits