This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9f844604cb1f50037dbb5510b5eb5de3b663479e Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Fri Aug 14 10:30:32 2020 +0200 CAMEL-15403: Added to junit 4 for backport --- .../org/apache/camel/test/junit4/TestSupport.java | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java b/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java index 19de853..61aa141 100644 --- a/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java +++ b/components/camel-test/src/main/java/org/apache/camel/test/junit4/TestSupport.java @@ -490,7 +490,6 @@ public abstract class TestSupport extends Assert { @Deprecated public static boolean isJava16() { return getJavaMajorVersion() == 6; - } /** @@ -502,7 +501,6 @@ public abstract class TestSupport extends Assert { @Deprecated public static boolean isJava17() { return getJavaMajorVersion() == 7; - } /** @@ -512,8 +510,27 @@ public abstract class TestSupport extends Assert { */ public static boolean isJava18() { return getJavaMajorVersion() == 8; + } + /** + * Tells whether the current Java version is 1.8 and build_no 261 and later. + * + * @return <tt>true</tt> if its Java 1.8.0_261 and later, <tt>false</tt> if its not (for + * example Java 1.8.0_251) + */ + // CHECKSTYLE:OFF + public static boolean isJava18_261_later() { + boolean ret; + String version = System.getProperty("java.version"); + try { + ret = version != null && version.startsWith("1.8.0_") + && Integer.parseInt(version.substring(6)) >= 261; + } catch (NumberFormatException ex) { + ret = false; + } + return ret; } + // CHECKSTYLE:ON /** * Is this Java 1.9 @@ -522,14 +539,13 @@ public abstract class TestSupport extends Assert { */ public static boolean isJava19() { return getJavaMajorVersion() == 9; - } /** * Returns the current major Java version e.g 8. * <p/> * Uses <tt>java.specification.version</tt> from the system properties to determine the major version. - + * * @return the current major Java version. */ public static int getJavaMajorVersion() {