[tor-commits] [exonerator/release] display warning if lock file cannot be deleted, and why

karsten at torproject.org karsten at torproject.org
Mon Apr 13 10:02:18 UTC 2020


commit d756133dc3ea468d0f2b73a03762c1ebbc990b3c
Author: tordinge <tordinge at aprivatesub.net>
Date:   Mon Feb 24 20:23:57 2020 -0500

    display warning if lock file cannot be deleted, and why
---
 .../torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java
index b5570cd..2f39f5a 100644
--- a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java
+++ b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java
@@ -25,6 +25,8 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.sql.CallableStatement;
 import java.sql.Connection;
 import java.sql.DriverManager;
@@ -397,7 +399,11 @@ public class ExoneraTorDatabaseImporter {
   /* Delete the exonerator-lock file to allow the next executing of this
    * tool. */
   private static void deleteLockFile() {
-    new File("exonerator-lock").delete();
+    try {
+      Files.delete(Paths.get("exonerator-lock"));
+    } catch (IOException e) {
+      logger.warn("Could not delete lock file \"exonerator-lock\"", e);
+    }
   }
 }
 





More information about the tor-commits mailing list