Class JavaVersionIsSupported

    • Constructor Detail

      • JavaVersionIsSupported

        public JavaVersionIsSupported()
    • Method Detail

      • getJavaVersion

        protected String getJavaVersion()
      • getBambooVersion

        protected String getBambooVersion()
      • isFunctionalTest

        protected boolean isFunctionalTest()
      • isJavaVersionCheckDisabled

        protected boolean isJavaVersionCheckDisabled()
      • doUpgrade

        public void doUpgrade()
                       throws ValidationException
        Checks if the current Java version is compatible with Bamboo. This method first checks if the application is running a functional test or if the Java version check is disabled. If neither of these conditions is true, it parses the current Java version and checks if it is supported by Bamboo. If the Java version is not supported, it throws a ValidationException.
        Throws:
        ValidationException - if the current Java version is not supported by Bamboo
      • isJavaVersionSupported

        public boolean isJavaVersionSupported()
        Checks if a given Java version is supported by Bamboo. This method compares the major, minor, and micro versions of the given Java version with the supported Java versions. It returns true if the given version is equal to or higher than a supported version, and false otherwise.
        Returns:
        true if the Java version is supported, false otherwise
      • parseVersionArray

        public static String[] parseVersionArray​(String version)
        Parses a Java version string into an array representation. The version string should be in a format like "1.8.0_232", "11.0.2", or "9.1.2+123". The returned array contains the major version at index 0, the minor version at index 1, and the micro version at index 2. For Java 8 versions (like "1.8.0_232"), the part after the underscore is considered as part of the minor version. For non-Java 8 versions (like "11.0.2" or "9.1.2+123"), the third part of the version string is considered as the micro version. If the version string does not contain a micro version, "0" is used by default.
        Parameters:
        version - - Java version
        Returns:
        array representation of Java version, eg: "1.8.0_232" -> ["1", "8232", "0"] "11.0.2" -> ["11", "0", "2"] "13-ea" -> ["13", "0", "0"]
      • parseJavaVersion

        public static Version parseJavaVersion​(String[] version)
        Parses an array representation of a Java version into a Version object. The array should have the major version at index 0, the minor version at index 1, and the micro version at index 2. The micro version is considered for all Java versions.
        Parameters:
        version - - array representation of Java version, eg: "1.8.0_212" -> ["1", "8", "212"] "11.0.2" -> ["11", "0", "2"] "13-ea" -> ["13", "0", "0"]
        Returns:
        parsedVersion - Parsed Version object