]> WPIA git - gigi.git/blobdiff - util-testing/org/cacert/gigi/DevelLauncher.java
fix: Make certs optional
[gigi.git] / util-testing / org / cacert / gigi / DevelLauncher.java
index df5a790d24297fd728316c9e0978da3ae8924eb7..c32b6b30a6c83240735857e2283007119124466b 100644 (file)
@@ -16,6 +16,7 @@ import java.lang.reflect.Field;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.file.Files;
+import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Collections;
 import java.util.HashMap;
@@ -55,7 +56,13 @@ public class DevelLauncher {
         ByteArrayOutputStream chunkConfig = new ByteArrayOutputStream();
         DataOutputStream dos = new DataOutputStream(chunkConfig);
         byte[] cacerts = Files.readAllBytes(Paths.get("config/cacerts.jks"));
-        byte[] keystore = Files.readAllBytes(Paths.get("config/keystore.pkcs12"));
+        byte[] keystore = null;
+        Path p = Paths.get("config/keystore.pkcs12");
+        if (p.toFile().exists()) {
+            keystore = Files.readAllBytes(p);
+        } else {
+            mainProps.setProperty("proxy", "true");
+        }
 
         DevelLauncher.writeGigiConfig(dos, "changeit".getBytes("UTF-8"), "changeit".getBytes("UTF-8"), mainProps, cacerts, keystore);
         dos.flush();
@@ -229,6 +236,9 @@ public class DevelLauncher {
     }
 
     private static void putTarEntry(byte[] data, TarOutputStream tos, String name) throws IOException {
+        if (data == null) {
+            return;
+        }
         TarHeader th = new TarHeader();
         th.name = new StringBuffer(name);
         th.size = data.length;