From: Svjatoslav Agejenko Date: Wed, 21 Jan 2026 22:44:08 +0000 (+0200) Subject: Remove BOM characters from file lines in `Utils` and `TaskProcessorCommand` to ensure... X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=c02970ae040b7ec37ccb9621826f5718712591f7;p=alyverkko-cli.git Remove BOM characters from file lines in `Utils` and `TaskProcessorCommand` to ensure proper processing. --- diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java b/src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java index b80f9e7..c9a7ffa 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java @@ -40,7 +40,9 @@ public class Utils { */ public static String getFirstLine(File file) throws IOException { try (BufferedReader reader = new BufferedReader(new FileReader(file))) { - return reader.readLine(); + String line = reader.readLine(); + line = line.replace("\uFEFF", ""); // Remove BOM if present + return line; } } @@ -53,6 +55,7 @@ public class Utils { */ public static boolean fileHasToComputeMarker(File file) throws IOException { String firstLine = getFirstLine(file); + firstLine = firstLine.replace("\uFEFF", ""); // Remove BOM if present return firstLine != null && firstLine.startsWith("TOCOMPUTE:"); } diff --git a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/task_processor/TaskProcessorCommand.java b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/task_processor/TaskProcessorCommand.java index 9fbaa51..3789b6f 100644 --- a/src/main/java/eu/svjatoslav/alyverkko_cli/commands/task_processor/TaskProcessorCommand.java +++ b/src/main/java/eu/svjatoslav/alyverkko_cli/commands/task_processor/TaskProcessorCommand.java @@ -338,6 +338,7 @@ public class TaskProcessorCommand implements Command { * @return a map of settings derived from that line. */ private Map parseSettings(String toComputeLine) { + toComputeLine = toComputeLine.replace("\uFEFF", ""); // Remove BOM if present if (!toComputeLine.startsWith("TOCOMPUTE:")) { throw new IllegalArgumentException("Invalid TOCOMPUTE line: " + toComputeLine); }