]> WPIA git - gigi.git/commitdiff
Fix: exceptional resource leaks.
authorFelix Dörre <felix@dogcraft.de>
Sun, 22 Feb 2015 00:34:15 +0000 (01:34 +0100)
committerFelix Dörre <felix@dogcraft.de>
Sun, 22 Feb 2015 00:34:15 +0000 (01:34 +0100)
util-testing/org/cacert/gigi/util/SimpleSigner.java
util/org/cacert/gigi/util/FetchLocales.java

index 1c635c2e73a55082ea17124d3a8468293c3cb4ad..c6f4660fc57ac6170b52451a8e54d5f8063f3051 100644 (file)
@@ -305,7 +305,9 @@ public class SimpleSigner {
                 Process p1 = Runtime.getRuntime().exec(call, null, new File("keys/unassured.ca"));
 
                 int waitFor = p1.waitFor();
-                f.delete();
+                if ( !f.delete()) {
+                    System.err.println("Could not delete SAN-File " + f.getAbsolutePath());
+                }
                 if (waitFor == 0) {
                     try (InputStream is = new FileInputStream(crt)) {
                         CertificateFactory cf = CertificateFactory.getInstance("X.509");
index 87beaacef16fa53275f2771e2e60a96f44f7fe05..21a789f3342c8757f03e95d047123841ad744f6d 100644 (file)
@@ -35,7 +35,9 @@ public class FetchLocales {
     public static void main(String[] args) throws IOException, ParserConfigurationException, TransformerException {
         System.out.println("downloading locales ...");
         File locale = new File("locale");
-        locale.mkdir();
+        if ( !locale.mkdir()) {
+            throw new IOException("Could not create locales directory.");
+        }
 
         DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
         DocumentBuilder db = dbf.newDocumentBuilder();