From 17a25bfdd8b3cb809d1f82334b817fbb69ff212c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20Op=C3=A1lka?= Date: Wed, 20 Sep 2023 12:31:22 +0200 Subject: [PATCH] [WFCORE-6506] Initial Java releases contain neither minor nor micro part in the version string. Adjusting tests to reflect this --- .../as/host/controller/ManagedServerBootCmdFactoryTestCase.java | 2 +- .../test/java/org/wildfly/core/launcher/CommandBuilderTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/host-controller/src/test/java/org/jboss/as/host/controller/ManagedServerBootCmdFactoryTestCase.java b/host-controller/src/test/java/org/jboss/as/host/controller/ManagedServerBootCmdFactoryTestCase.java index fc8bcddea5c..6bc63571866 100644 --- a/host-controller/src/test/java/org/jboss/as/host/controller/ManagedServerBootCmdFactoryTestCase.java +++ b/host-controller/src/test/java/org/jboss/as/host/controller/ManagedServerBootCmdFactoryTestCase.java @@ -121,7 +121,7 @@ public void testCreateConfiguration() throws UnknownHostException { private static int getJavaVersion() throws NumberFormatException { final String versionString = System.getProperty("java.version"); int indexOfDot = versionString.indexOf('.'); - return Integer.valueOf(versionString.substring(0, indexOfDot)).intValue(); + return Integer.valueOf(indexOfDot > 0 ? versionString.substring(0, indexOfDot) : versionString).intValue(); } /** diff --git a/launcher/src/test/java/org/wildfly/core/launcher/CommandBuilderTest.java b/launcher/src/test/java/org/wildfly/core/launcher/CommandBuilderTest.java index fc3bdc8b0c4..c4b7e2ec450 100644 --- a/launcher/src/test/java/org/wildfly/core/launcher/CommandBuilderTest.java +++ b/launcher/src/test/java/org/wildfly/core/launcher/CommandBuilderTest.java @@ -293,7 +293,7 @@ private void testJPMSArguments(final Collection command, final int expec private static int getJavaVersion() throws NumberFormatException { final String versionString = System.getProperty("java.version"); int indexOfDot = versionString.indexOf('.'); - return Integer.valueOf(versionString.substring(0, indexOfDot)).intValue(); + return Integer.valueOf(indexOfDot > 0 ? versionString.substring(0, indexOfDot) : versionString).intValue(); } private void testModularJvmArguments(final Collection command, final int expectedCount) {