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).
1 file changed