Bug Report/Fix: clientlauncher.sh

I believe there is a bug in the Linux clientlauncher.sh script that causes it to fail sometimes fatally.

The passing of $JAVA_HOME var should be $JAVA_HOME/bin/java since ‘trydefault’ tries to execute that directly to get the version. When it gets a directory name and returns an error that is not handled correctly bad things happen.

In addition it should be checking for if $JAVA_HOME/bin/java is a file because the error handling is pretty minimal, we should do all the checks we can before hand, otherwise if it gets an error, it passes that on to the next function as a version string…

It just so happens to work if the call to clientlauncher.sh does not have a long pathname prefix so that it comes out of the error and falls in to the next ‘java’ check and succeeds. If the pathname is long it splits the error up on all the '/'s and never recovers.

#if version information is supplied check some defaults
if [[ -n $minversion || -n $maxversion ]]
    #try $JAVA_HOME
    if [[ -n $JAVA_HOME ]] && [[ -f $JAVA_HOME/bin/java ]]   <===== **CHECK** Added the -f check..
        trydefault "$JAVA_HOME/bin/java" "${newargs[@]}" <===== **BUG** Added the /bin/java

    #then java in path
    which java &>/dev/null
    if [[ $? -eq 0 ]]
        trydefault java "${newargs[@]}"

To Rebuild the clientlauncher.sh we have to extract the binary, change the script and re-add the binary.

tail -n 7984 clientlauncher.sh > binary
vi clientlauncher.sh # Fix JAVA_HOME and remove binary at bottom (leaving space like it wants)
cat binary >> clientlauncher.sh # Add binary back to script

Hope this helps.