[ODLPARENT-73] Check JVM version regular expression is not exact in karaf script Created: 03/Mar/17  Updated: 24/Sep/18  Resolved: 24/Sep/18

Status: Resolved
Project: odlparent
Component/s: General
Affects Version/s: None
Fix Version/s: 3.0.0

Type: Improvement
Reporter: dingrui Assignee: Vratko Polak
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC



 Description   

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


 Comments   
Comment by Vratko Polak [ 03/Mar/17 ]

Karaf resources reside in Odlparent project.

Fix attempt: https://git.opendaylight.org/gerrit/#/c/52770/1

Comment by Vratko Polak [ 23/Mar/17 ]

Fixed for Carbon Karaf 3, not fixed for Karaf 4.

Comment by Robert Varga [ 05/Sep/18 ]

ding.rui@zte.com.cn is this still applicable?

Generated at Wed Feb 07 20:27:33 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.