From 38067cacc65e285779afd45220c6f53e51b635c8 Mon Sep 17 00:00:00 2001 From: Andrey Date: Wed, 18 Sep 2024 11:38:24 -0400 Subject: [PATCH] Autoupdate should get the default white label from its jar filename. #6838 only:explicit error message --- .../java/com/rusefi/core/net/ConnectionAndMeta.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/java_console/shared_io/src/main/java/com/rusefi/core/net/ConnectionAndMeta.java b/java_console/shared_io/src/main/java/com/rusefi/core/net/ConnectionAndMeta.java index 7674df8051..10966fcebe 100644 --- a/java_console/shared_io/src/main/java/com/rusefi/core/net/ConnectionAndMeta.java +++ b/java_console/shared_io/src/main/java/com/rusefi/core/net/ConnectionAndMeta.java @@ -50,11 +50,11 @@ public class ConnectionAndMeta { String jarPath = jarUrl.getPath(); String jarFileName = jarPath.substring(jarPath.lastIndexOf('/') + 1); int startOfSuffix = jarFileName.lastIndexOf('_'); - if (startOfSuffix > 0) { - String jarFilePrefix = jarFileName.substring(0, startOfSuffix); - log.info("jarFilePrefix = " + jarFilePrefix); - return jarFilePrefix; - } + if (startOfSuffix == -1) + throw new IllegalStateException("Unexpected jar file name: " + jarFileName); + String jarFilePrefix = jarFileName.substring(0, startOfSuffix); + log.info("jarFilePrefix = " + jarFilePrefix); + return jarFilePrefix; } } catch (Exception e) { log.error("Unexpected " + e, e);