diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eacf75..818971f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ ChangeLog --------- +### v3.0.6 (2020-03-19) +* Fixed an issue related to Java 4-8 version number detection (PR #81, Thanks to @thatChadM for his contribution) + ### v3.0.5 (2019-12-15) * If java is missing, offer a choice between Oracle and AdoptOpenJDK download buttons (#78) * Support Array style `Java:Arguments` for Apple Plist style (#76) diff --git a/LICENSE b/LICENSE index fe1f190..c58a05e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014-2018 Tobias Fischer +Copyright (c) 2014-2020 Tobias Fischer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/universalJavaApplicationStub b/src/universalJavaApplicationStub index 3670a65..3525556 100755 --- a/src/universalJavaApplicationStub +++ b/src/universalJavaApplicationStub @@ -11,14 +11,14 @@ # # # @author Tobias Fischer # # @url https://github.com/tofi86/universalJavaApplicationStub # -# @date 2019-12-15 # -# @version 3.0.5 # +# @date 2020-03-19 # +# @version 3.0.6 # # # ################################################################################## # # # The MIT License (MIT) # # # -# Copyright (c) 2014-2018 Tobias Fischer # +# Copyright (c) 2014-2020 Tobias Fischer # # # # Permission is hereby granted, free of charge, to any person obtaining a copy # # of this software and associated documentation files (the "Software"), to deal # @@ -477,7 +477,7 @@ function get_comparable_java_version() { ################################################################################ function is_valid_requirement_pattern() { local java_req=$1 - java8pattern='1\.[4-8](\.0)?(\.0_[0-9]+)?[*+]?' + java8pattern='1\.[4-8](\.[0-9]+)?(\.0_[0-9]+)?[*+]?' java9pattern='(9|1[0-9])(-ea|[*+]|(\.[0-9]+){1,2}[*+]?)?' # test matches either old Java versioning scheme (up to 1.8) or new scheme (starting with 9) if [[ ${java_req} =~ ^(${java8pattern}|${java9pattern})$ ]]; then diff --git a/test/java-version-tester.sh b/test/java-version-tester.sh index 0a70c8d..48151e7 100755 --- a/test/java-version-tester.sh +++ b/test/java-version-tester.sh @@ -1,7 +1,7 @@ #!/bin/bash # Tests for the functions used in universalJavaApplicationStub script -# tofi86 @ 2018-07-29 +# tofi86 @ 2020-02-11 @@ -84,7 +84,7 @@ function get_comparable_java_version() { ################################################################################ function is_valid_requirement_pattern() { local java_req=$1 - java8pattern='1\.[4-8](\.0)?(\.0_[0-9]+)?[*+]?' + java8pattern='1\.[4-8](\.[0-9]+)?(\.0_[0-9]+)?[*+]?' java9pattern='(9|1[0-9])(-ea|[*+]|(\.[0-9]+){1,2}[*+]?)?' # test matches either old Java versioning scheme (up to 1.8) or new scheme (starting with 9) if [[ ${java_req} =~ ^(${java8pattern}|${java9pattern})$ ]]; then @@ -179,6 +179,7 @@ echo "Tests with Java 1.6:" testExtractMajor "1.6" "6" testExtractMajor "1.6+" "6" testExtractMajor "1.6.0" "6" +testExtractMajor "1.6.2" "6" testExtractMajor "1.6.0_07" "6" testExtractMajor "1.6.0_45" "6" testExtractMajor "1.6.0_65-b14-468" "6" @@ -328,6 +329,7 @@ testValidReqPattern "1.6.0_45" "0" testValidReqPattern "1.6.0_45+" "0" testValidReqPattern "1.6.0_100" "0" testValidReqPattern "1.6.0_100+" "0" +testValidReqPattern "1.6.2" "0" echo "" echo "Tests with old version scheme (invalid requirements):" testValidReqPattern "1.2" "1"