Uploaded image for project: 'odlparent'
  1. odlparent
  2. ODLPARENT-73

Check JVM version regular expression is not exact in karaf script

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Done
    • 3.0.0
    • None
    • General
    • None
    • Operating System: Linux
      Platform: PC

      Overview:
      checkJvmVersion() function code as below (istribution/distribution-karaf/target/assembly/bin/karaf):
      checkJvmVersion() {

      1. 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'`

      2. 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

            vrpolak Vratko Polak
            ding.rui@zte.com.cn dingrui
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: