From ba99bb71252d0895914c8f49faed66fc789bb147 Mon Sep 17 00:00:00 2001 From: Nathan Schulte Date: Sat, 9 Mar 2024 00:54:02 -0600 Subject: [PATCH] console: cleaner java code-style --- .../io/src/main/java/com/rusefi/SimulatorExecHelper.java | 6 ++++-- .../ui/src/main/java/com/rusefi/SimulatorHelper.java | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/java_console/io/src/main/java/com/rusefi/SimulatorExecHelper.java b/java_console/io/src/main/java/com/rusefi/SimulatorExecHelper.java index 2379d0c879..c9147a2a1f 100644 --- a/java_console/io/src/main/java/com/rusefi/SimulatorExecHelper.java +++ b/java_console/io/src/main/java/com/rusefi/SimulatorExecHelper.java @@ -101,11 +101,13 @@ public static void startSimulator() { public static File getSimulatorBinary(String binaryPath) { File binary = new File(binaryPath + SIMULATOR_BINARY_NAME); - if (!binary.exists()) // try also for Windows/PE executable + if (!binary.exists()) { // try also for Windows/PE executable binary = new File(binaryPath + ".exe"); + } - if (!binary.exists() || binary.isDirectory() || !binary.canExecute()) + if (!binary.exists() || binary.isDirectory() || !binary.canExecute()) { throw new IllegalStateException("FOME Simulator program not found"); + } return binary; } diff --git a/java_console/ui/src/main/java/com/rusefi/SimulatorHelper.java b/java_console/ui/src/main/java/com/rusefi/SimulatorHelper.java index 09d7b9e6ec..a1ac249a22 100644 --- a/java_console/ui/src/main/java/com/rusefi/SimulatorHelper.java +++ b/java_console/ui/src/main/java/com/rusefi/SimulatorHelper.java @@ -65,8 +65,9 @@ public static JComponent createSimulatorComponent(final StartupFrame portSelecto return new JLabel(e.getMessage()); } - if (TcpConnector.isTcpPortOpened()) + if (TcpConnector.isTcpPortOpened()) { return new JLabel("Port " + TcpConnector.DEFAULT_PORT + " already busy. Simulator running?"); + } JButton simulatorButton = new JButton("Start Virtual Simulator"); simulatorButton.addActionListener(new ActionListener() {