From 4830b66cbdcf3bc5ac63bc5d741d65c33edfa20e Mon Sep 17 00:00:00 2001 From: rusEFI LLC Date: Mon, 28 Oct 2024 20:09:19 -0400 Subject: [PATCH] java.lang.NoSuchMethodError: 'java.lang.String com.rusefi.core.io.BundleUtil.readBranchNameToDisplay()' fix #7004 --- java_console/core_ui/build.gradle | 6 ++++ .../java/com/rusefi/core/io/BundleUtil.java | 19 ------------ .../java/com/rusefi/core/rusEFIVersion.java | 2 +- .../main/java/com/rusefi/StartupFrame.java | 2 +- .../main/java/com/rusefi/UiBundleUtil.java | 29 +++++++++++++++++++ 5 files changed, 37 insertions(+), 21 deletions(-) create mode 100644 java_console/ui/src/main/java/com/rusefi/UiBundleUtil.java diff --git a/java_console/core_ui/build.gradle b/java_console/core_ui/build.gradle index 0153824789..3d7b25be9c 100644 --- a/java_console/core_ui/build.gradle +++ b/java_console/core_ui/build.gradle @@ -5,6 +5,12 @@ plugins { // this CORE module cannot depend on model/ini! +/** + * this module is used by both autoupdate and ui subprojects + * note that during auto-update we have UI reference older version of core jars from older autoupdate! + * in order to avoid issues like java.lang.NoSuchMethodError: 'java.lang.String com.rusefi.core.io.BundleUtil.readBranchNameToDisplay()' #7004 + * be careful about using minimal-required project placement while changing API! + */ dependencies { api project(':logging-api') api project(':core_io') diff --git a/java_console/shared_io/src/main/java/com/rusefi/core/io/BundleUtil.java b/java_console/shared_io/src/main/java/com/rusefi/core/io/BundleUtil.java index f7ee56fbcc..78823930b6 100644 --- a/java_console/shared_io/src/main/java/com/rusefi/core/io/BundleUtil.java +++ b/java_console/shared_io/src/main/java/com/rusefi/core/io/BundleUtil.java @@ -16,25 +16,6 @@ public class BundleUtil { private static final char BUNDLE_TOKEN_SEPARATOR = '.'; private static final String SNAPSHOT = "snapshot"; - /** - * @return null in case of error - */ - @Nullable - public static String readBranchNameToDisplay() { - final String bundleFullName = readBundleFullName(); - if (bundleFullName != null) { - try { - final BundleInfo bundleInfo = parse(bundleFullName); - // TODO: get rid of the pornography below: - // we should use `development` instead of `snapshot` for master branch in bundle name. - return (bundleInfo.isMaster() ? "development" : bundleInfo.getBranchName()); - } catch (final Throwable e) { - log.warn(String.format("We failed to parse bundle full name `%s`", bundleFullName), e); - } - } - return null; - } - /** * @return null in case of error */ diff --git a/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java b/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java index efe387d0c2..d4cc2341f1 100644 --- a/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java +++ b/java_console/shared_io/src/main/java/com/rusefi/core/rusEFIVersion.java @@ -10,7 +10,7 @@ public interface rusEFIVersion { * *** BE CAREFUL WE HAVE SEPARATE AUTOUPDATE_VERSION also managed manually *** * @see com.rusefi.autoupdate.Autoupdate#AUTOUPDATE_VERSION */ - int CONSOLE_VERSION = 20241002; + int CONSOLE_VERSION = 20241028; AtomicReference firmwareVersion = new AtomicReference<>("N/A"); static long classBuildTimeMillis() { diff --git a/java_console/ui/src/main/java/com/rusefi/StartupFrame.java b/java_console/ui/src/main/java/com/rusefi/StartupFrame.java index 41860c186b..2fcad20f1c 100644 --- a/java_console/ui/src/main/java/com/rusefi/StartupFrame.java +++ b/java_console/ui/src/main/java/com/rusefi/StartupFrame.java @@ -245,7 +245,7 @@ public class StartupFrame { jLabel.setForeground(Color.red); } else { final Date binaryModificationDate = new Date(binaryModificationTimestamp); - final String branchNameToDisplay = BundleUtil.readBranchNameToDisplay(); + final String branchNameToDisplay = UiBundleUtil.readBranchNameToDisplay(); jLabel = new JLabel(String.format( "
%s files
%s
", branchNameToDisplay, diff --git a/java_console/ui/src/main/java/com/rusefi/UiBundleUtil.java b/java_console/ui/src/main/java/com/rusefi/UiBundleUtil.java new file mode 100644 index 0000000000..45b9961379 --- /dev/null +++ b/java_console/ui/src/main/java/com/rusefi/UiBundleUtil.java @@ -0,0 +1,29 @@ +package com.rusefi; + +import com.devexperts.logging.Logging; +import com.rusefi.core.io.BundleUtil; +import org.jetbrains.annotations.Nullable; + +import static com.devexperts.logging.Logging.getLogging; + +public class UiBundleUtil { + private static final Logging log = getLogging(BundleUtil.class); + /** + * @return null in case of error + */ + @Nullable + public static String readBranchNameToDisplay() { + final String bundleFullName = BundleUtil.readBundleFullName(); + if (bundleFullName != null) { + try { + final BundleUtil.BundleInfo bundleInfo = BundleUtil.parse(bundleFullName); + // TODO: get rid of the pornography below: + // we should use `development` instead of `snapshot` for master branch in bundle name. + return (bundleInfo.isMaster() ? "development" : bundleInfo.getBranchName()); + } catch (Throwable e) { + log.warn(String.format("We failed to parse bundle full name `%s`", bundleFullName), e); + } + } + return null; + } +}