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

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


The following commit(s) were added to refs/heads/main by this push:
     new 2ad89af03b4 Tolerate JVM warning lines when detecting Java version 
(#4765)
2ad89af03b4 is described below

commit 2ad89af03b498a09158c0d49e7a99582e64f2f8f
Author: Matthias Pigulla <[email protected]>
AuthorDate: Sat Nov 21 16:00:51 2026 +0100

    Tolerate JVM warning lines when detecting Java version (#4765)
---
 changelog/unreleased/PR#4765-improve-java-version-parsing.yml | 9 +++++++++
 solr/bin/solr                                                 | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/changelog/unreleased/PR#4765-improve-java-version-parsing.yml 
b/changelog/unreleased/PR#4765-improve-java-version-parsing.yml
new file mode 100644
index 00000000000..0c612178b8d
--- /dev/null
+++ b/changelog/unreleased/PR#4765-improve-java-version-parsing.yml
@@ -0,0 +1,9 @@
+# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc
+title: Tolerate JVM warning lines when detecting Java version
+type: fixed # added, changed, fixed, deprecated, removed, dependency_update, 
security, other
+authors:
+  - name: Matthias Pigulla
+    nick: mpdude
+links:
+  - name: PR#4765
+    url: https://github.com/apache/solr/pull/4765
diff --git a/solr/bin/solr b/solr/bin/solr
index 7b8f851852c..85d156c3f09 100755
--- a/solr/bin/solr
+++ b/solr/bin/solr
@@ -175,7 +175,7 @@ if [[ $? -ne 0 ]] ; then
   echo >&2 "${PATH}"
   exit 1
 else
-  JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | head -1 | awk -F '"' 
'/version/ {print $2}' | sed -e's/^1\.//' | sed -e's/[._-].*$//')
+  JAVA_VER_NUM=$(echo "$JAVA_VER" | grep -v '_OPTIONS' | awk -F '"' '/ version 
"/ {print $2; exit}' | sed -e's/^1\.//' | sed -e's/[._-].*$//')
   if (( JAVA_VER_NUM < 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