Overview:
checkJvmVersion() function code as below (istribution/distribution-karaf/target/assembly/bin/karaf):
checkJvmVersion() {
- echo "`$JAVA -version`"
VERSION=`"$JAVA" -version 2>&1 | egrep '"([0-9].[0-9]\..[0-9])."' | awk ' {print substr($3,2,length($3)-2)}' | awk '
{print substr($1, 3, 3)}' | sed -e 's;\.;;g'`
- echo $VERSION
if [ "$VERSION" -lt "80" ]; then
echo "JVM must be 1.8.0 or greater"
exit 1;
fi
}
The egrep regular expression "([0-9].[0-9]\..[0-9])." is not exact. The first dot(.) doesn't escape and the subexpression [0-9] should use [0-9]+ replaced for the first two, because if java version like this "1.10._111", this regular expression will failed.In summary, the egrep regular expression "([0-9].[0-9]\..[0-9])." should be "([0-9]\.[0-9]\..[0-9])."
Steps to Reproduce: null
Actual Results: null
Expected Results: null
Build Date & Hardware:
Fri Mar 3 17:08:47 CST 2017 PC Linux
Additional Builds and Platforms: null
Additional Information: null