Class JavaVersionIsSupported
java.lang.Object
com.atlassian.bamboo.upgrade.AbstractUpgradeTask
com.atlassian.bamboo.upgrade.AbstractBootstrapUpgradeTask
com.atlassian.bamboo.upgrade.tasks.validation.JavaVersionIsSupported
- All Implemented Interfaces:
BootstrapUpgradeTask
,UpgradeTask
-
Field Summary
Fields inherited from class com.atlassian.bamboo.upgrade.AbstractBootstrapUpgradeTask
bootstrapManager, hibernateConfig
Fields inherited from class com.atlassian.bamboo.upgrade.AbstractUpgradeTask
errors
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks if the current Java version is compatible with Bamboo.protected String
protected String
protected boolean
protected boolean
boolean
Checks if a given Java version is supported by Bamboo.static Version
parseJavaVersion
(String[] version) Parses an array representation of a Java version into a Version object.static String[]
parseVersionArray
(String version) Parses a Java version string into an array representation.Methods inherited from class com.atlassian.bamboo.upgrade.AbstractBootstrapUpgradeTask
getDatabaseConnection, getDialect, setBootstrapManager, setHibernateConfig, withDatabaseConnection
Methods inherited from class com.atlassian.bamboo.upgrade.AbstractUpgradeTask
getBuildNumber, getErrors, getShortDescription
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.bamboo.upgrade.UpgradeTask
getBuildNumber, getErrors, getShortDescription
-
Field Details
-
UNSUPPORTED_JAVA_ERROR
- See Also:
-
-
Constructor Details
-
JavaVersionIsSupported
public JavaVersionIsSupported()
-
-
Method Details
-
getJavaVersion
-
getBambooVersion
-
isFunctionalTest
protected boolean isFunctionalTest() -
isJavaVersionCheckDisabled
protected boolean isJavaVersionCheckDisabled() -
doUpgrade
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
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
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
-