You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by lh...@apache.org on 2022/06/14 06:51:17 UTC
[pulsar] branch master updated: [fix][env] Support the java version like 'XX-internal' in env file (#16008)
This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 0a58f58fed7 [fix][env] Support the java version like 'XX-internal' in env file (#16008)
0a58f58fed7 is described below
commit 0a58f58fed7fa21d31f2b437f86993fd79a00aba
Author: Guoxiong Li <lg...@gmail.com>
AuthorDate: Tue Jun 14 14:51:04 2022 +0800
[fix][env] Support the java version like 'XX-internal' in env file (#16008)
* [fix][env] Support the java version like 'XX-internal' in env file
* Adjust bkenv.sh
* Remove unnecessary dot.
---
conf/bkenv.sh | 6 +++++-
conf/pulsar_env.sh | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/conf/bkenv.sh b/conf/bkenv.sh
index 10089f09e7f..c9157e7ba9a 100644
--- a/conf/bkenv.sh
+++ b/conf/bkenv.sh
@@ -46,13 +46,17 @@ else
JAVA_BIN="$JAVA_HOME/bin/java"
fi
for token in $("$JAVA_BIN" -version 2>&1 | grep 'version "'); do
- if [[ $token =~ \"([[:digit:]]+)\.([[:digit:]]+)\.(.*)\" ]]; then
+ if [[ $token =~ \"([[:digit:]]+)\.([[:digit:]]+)(.*)\" ]]; then
if [[ ${BASH_REMATCH[1]} == "1" ]]; then
JAVA_MAJOR_VERSION=${BASH_REMATCH[2]}
else
JAVA_MAJOR_VERSION=${BASH_REMATCH[1]}
fi
break
+ elif [[ $token =~ \"([[:digit:]]+)(.*)\" ]]; then
+ # Process the java versions without dots, such as `17-internal`.
+ JAVA_MAJOR_VERSION=${BASH_REMATCH[1]}
+ break
fi
done
diff --git a/conf/pulsar_env.sh b/conf/pulsar_env.sh
index e5c24386656..b5142457be8 100755
--- a/conf/pulsar_env.sh
+++ b/conf/pulsar_env.sh
@@ -53,13 +53,17 @@ else
JAVA_BIN="$JAVA_HOME/bin/java"
fi
for token in $("$JAVA_BIN" -version 2>&1 | grep 'version "'); do
- if [[ $token =~ \"([[:digit:]]+)\.([[:digit:]]+)\.(.*)\" ]]; then
+ if [[ $token =~ \"([[:digit:]]+)\.([[:digit:]]+)(.*)\" ]]; then
if [[ ${BASH_REMATCH[1]} == "1" ]]; then
JAVA_MAJOR_VERSION=${BASH_REMATCH[2]}
else
JAVA_MAJOR_VERSION=${BASH_REMATCH[1]}
fi
break
+ elif [[ $token =~ \"([[:digit:]]+)(.*)\" ]]; then
+ # Process the java versions without dots, such as `17-internal`.
+ JAVA_MAJOR_VERSION=${BASH_REMATCH[1]}
+ break
fi
done