From f0f0d894f1fc365715a16774de3fb5f297e6ffff Mon Sep 17 00:00:00 2001 From: karoliineh Date: Mon, 28 Feb 2022 16:31:29 +0200 Subject: [PATCH] Compare paths instead of Strings --- src/main/java/Main.java | 2 +- src/main/java/goblintserver/GoblintServer.java | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/Main.java b/src/main/java/Main.java index 9fa8e5f..737e93d 100644 --- a/src/main/java/Main.java +++ b/src/main/java/Main.java @@ -29,8 +29,8 @@ public static void main(String... args) { log.info("Unable to launch MagpieBridge."); } else { magpieServer.launchOnStdio(); - magpieServer.doAnalysis("c", true); log.info("MagpieBridge server launched."); + magpieServer.doAnalysis("c", true); } } } diff --git a/src/main/java/goblintserver/GoblintServer.java b/src/main/java/goblintserver/GoblintServer.java index 0e4f748..351a382 100644 --- a/src/main/java/goblintserver/GoblintServer.java +++ b/src/main/java/goblintserver/GoblintServer.java @@ -23,8 +23,8 @@ public class GoblintServer { private MagpieServer magpieServer; - private File gobPieConf = new File("gobpie.json"); - private File goblintSocket = new File("goblint.sock"); + private String gobPieConf = "gobpie.json"; + private String goblintSocket = "goblint.sock"; private String[] preAnalyzeCommand; private String[] goblintRunCommand; @@ -72,7 +72,8 @@ public boolean startGoblintServer() { WatchKey key; while ((key = watchService.take()) != null) { for (WatchEvent event : key.pollEvents()) { - if (event.context().toString().equals(goblintSocket.toString())) { + + if (((Path) event.context()).equals(Paths.get(goblintSocket))) { log.info("Goblint server started."); return true; } @@ -173,7 +174,7 @@ private boolean readGobPieConfiguration() { "--enable", "server.enabled", "--enable", "server.reparse", "--set", "server.mode", "unix", - "--set", "server.unix-socket", goblintSocket.getAbsolutePath()}), + "--set", "server.unix-socket", new File(goblintSocket).getAbsolutePath()}), Arrays.stream(gobpieConfiguration.getFiles())) .toArray(String[]::new);