This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch branch_9_2
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/branch_9_2 by this push:
     new 7e61b558a3c SOLR-16721 Java version detection fails when 
`_JAVA_OPTIONS` is set (#1502)
7e61b558a3c is described below

commit 7e61b558a3c60cb46b3f01c6ca80200bf8848421
Author: Jan Høydahl <[email protected]>
AuthorDate: Fri Mar 31 22:50:11 2023 +0200

    SOLR-16721 Java version detection fails when `_JAVA_OPTIONS` is set (#1502)
    
    Signed-off-by: Jan Høydahl <[email protected]>
---
 solr/CHANGES.txt | 2 ++
 solr/bin/solr    | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index a78836e6b25..85151137da5 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -17,6 +17,8 @@ Bug Fixes
 
 * SOLR-16734: SOLR_DATA_HOME is only honored in verbode mode (Kevin Risden)
 
+* SOLR-16721: Java version detection fails when `_JAVA_OPTIONS` is set 
(janhoy, Ruoyu Zhong, Andy Webb)
+
 * SOLR-16649: Http2SolrClient.processErrorsAndResponse uses wrong instance of 
ResponseParser (Andrzej Białecki)
 
 Other Changes
diff --git a/solr/bin/solr b/solr/bin/solr
index f199da293e9..45a844995ea 100644
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -163,7 +163,7 @@ if [[ $? -ne 0 ]] ; then
   echo >&2 "${PATH}"
   exit 1
 else
-  JAVA_VER_NUM=$(echo "$JAVA_VER" | head -1 | awk -F '"' '/version/ {print 
$2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//')
+  JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | head -1 | awk -F '"' 
'/version/ {print $2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//')
   if [[ "$JAVA_VER_NUM" -lt "$JAVA_VER_REQ" ]] ; then
     echo >&2 "Your current version of Java is too old to run this version of 
Solr."
     echo >&2 "We found major version $JAVA_VER_NUM, using command '${JAVA} 
-version', with response:"

Reply via email to