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) {