Remove BOM characters from file lines in `Utils` and `TaskProcessorCommand` to ensure... master
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Wed, 21 Jan 2026 22:44:08 +0000 (00:44 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Wed, 21 Jan 2026 22:44:08 +0000 (00:44 +0200)
src/main/java/eu/svjatoslav/alyverkko_cli/Utils.java
src/main/java/eu/svjatoslav/alyverkko_cli/commands/task_processor/TaskProcessorCommand.java

index b80f9e7..c9a7ffa 100644 (file)
@@ -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:");
     }
 
index 9fbaa51..3789b6f 100644 (file)
@@ -338,6 +338,7 @@ public class TaskProcessorCommand implements Command {
      * @return a map of settings derived from that line.
      */
     private Map<String, String> parseSettings(String toComputeLine) {
+        toComputeLine = toComputeLine.replace("\uFEFF", "");  // Remove BOM if present
         if (!toComputeLine.startsWith("TOCOMPUTE:")) {
             throw new IllegalArgumentException("Invalid TOCOMPUTE line: " + toComputeLine);
         }