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

jbonofre pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/master by this push:
     new 3df12a1  Improve activemq init JAVACMD auto detection
     new 7a243f9  Merge pull request #394 from jlmuir/init-javacmd-auto-fix
3df12a1 is described below

commit 3df12a15b1a21747ac51548e7be95ba72e55d449
Author: J. Lewis Muir <jlm...@imca-cat.org>
AuthorDate: Fri Sep 27 14:59:13 2019 -0500

    Improve activemq init JAVACMD auto detection
    
    If JAVACMD is set to "auto" (the default from the "env" file) and
    the current working directory contains a directory named "auto", the
    activemq init script will incorrectly detect the "auto" directory as the
    "java" binary thus leaving JAVACMD set to "auto" which is incorrect and
    will obviously fail to execute the Java VM.
    
    To fix this, in the second attempt to detect the "java" binary, repeat
    the tests for a zero-length JAVACMD or a JAVACMD equal to "auto" before
    testing whether JAVACMD does not exist or is not executable.  This is
    necessary because when JAVA_HOME's length is zero, the first attempt to
    detect the location of the "java" binary will not set JAVACMD (so it
    will still be "auto" when it reaches the second auto-detection attempt).
---
 assembly/src/release/bin/activemq | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/assembly/src/release/bin/activemq 
b/assembly/src/release/bin/activemq
index 358204b..c8d7f03 100755
--- a/assembly/src/release/bin/activemq
+++ b/assembly/src/release/bin/activemq
@@ -245,7 +245,7 @@ if [ -z "$JAVACMD" ] || [ "$JAVACMD" = "auto" ] ; then
 fi
 
 # Hm, we still do not know the location of the java binary
-if [ ! -x "$JAVACMD" ] ; then
+if [ -z "$JAVACMD" ] || [ "$JAVACMD" = "auto" ] || [ ! -x "$JAVACMD" ] ; then
     JAVACMD=`which java 2> /dev/null `
     if [ -z "$JAVACMD" ] ; then
         JAVACMD=java

Reply via email to