From d14ca16039c90182987e91ed9501414e317ab86a Mon Sep 17 00:00:00 2001 From: rusefillc Date: Wed, 16 Oct 2024 22:44:42 -0400 Subject: [PATCH] allowDuplicateNames --- reader/src/main/java/com/rusefi/can/Launcher.java | 5 +++++ reader/src/main/java/com/rusefi/can/reader/dbc/DbcFile.java | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/reader/src/main/java/com/rusefi/can/Launcher.java b/reader/src/main/java/com/rusefi/can/Launcher.java index 6b25379..94f58c4 100644 --- a/reader/src/main/java/com/rusefi/can/Launcher.java +++ b/reader/src/main/java/com/rusefi/can/Launcher.java @@ -12,6 +12,8 @@ public class Launcher { public static String fileNameFilter; public static final String DBC_FILENAME_PROPERTY = "-dbc"; public static String dbcFileName; + public static final String DBC_DUP_FIELD_NAMES = "-allow-dup-names"; + public static boolean allowDuplicateNames = false; public static void main(String[] args) throws IOException { if (args.length < 1) { @@ -26,6 +28,9 @@ public class Launcher { String inputFolderName = args[0]; for (int i = 1; i < args.length; i++) { switch (args[i]) { + case DBC_DUP_FIELD_NAMES: + allowDuplicateNames = true; + break; case FILENAME_SUFFIX_PROPERTY: i += 1; fileNameSuffixValue = args[i]; diff --git a/reader/src/main/java/com/rusefi/can/reader/dbc/DbcFile.java b/reader/src/main/java/com/rusefi/can/reader/dbc/DbcFile.java index 36da5e2..b07749d 100644 --- a/reader/src/main/java/com/rusefi/can/reader/dbc/DbcFile.java +++ b/reader/src/main/java/com/rusefi/can/reader/dbc/DbcFile.java @@ -1,5 +1,6 @@ package com.rusefi.can.reader.dbc; +import com.rusefi.can.Launcher; import com.rusefi.mlv.LoggingStrategy; import com.rusefi.sensor_logs.BinaryLogEntry; @@ -82,7 +83,7 @@ public class DbcFile { if (debugEnabled) System.out.println("Found " + field); if (field != null) { - if (!fieldNames.add(field.getName())) + if (!fieldNames.add(field.getName()) && !Launcher.allowDuplicateNames) throw new IllegalArgumentException("Let's use unique field names: " + field.getName()); currentPacket.add(field); }