You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by ja...@apache.org on 2023/03/31 20:51:52 UTC

[solr] branch branch_9x updated: SOLR-16721 Java version detection fails when `_JAVA_OPTIONS` is set (#1502)

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

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


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

commit efab25bd4c94a08b83f74bb2a55711f81100835f
Author: Jan Høydahl <ja...@users.noreply.github.com>
AuthorDate: Fri Mar 31 22:50:11 2023 +0200

    SOLR-16721 Java version detection fails when `_JAVA_OPTIONS` is set (#1502)
---
 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 ffaa6efc2cb..df677510719 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -50,6 +50,8 @@ Bug Fixes
 
 * SOLR-16638: Fix Http2SolrClient's exception message when serverBaseUrl is null (Alex Deparvu via Kevin Risden)
 
+* SOLR-16721: Java version detection fails when `_JAVA_OPTIONS` is set (janhoy, Ruoyu Zhong, Andy Webb)
+
 * SOLR-16723: Http2SolrClient should not use Apache Http client classes (Kevin Risden)
 
 Dependency Upgrades
diff --git a/solr/bin/solr b/solr/bin/solr
index d4d6905bc25..d49ed9fdab2 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:"