Details
-
Bug
-
Status: Closed
-
Trivial
-
Resolution: Won't Fix
-
5.1
-
None
Description
I am trying to start Solr 5.1.0 using Java 1.7.0, Solr does start but I see this error:
$ bin/solr start
bin/solr: line 1290: [[: .0: syntax error: operand expected (error token is ".0")
Waiting to see Solr listening on port 8983 [/]
Started Solr server on port 8983 (pid=13627). Happy searching!
Digging further, I saw in solr script:
1285 JAVA_VERSION=`echo "$("$JAVA" -version 2>&1)" | grep "java version" | awk '
{ print substr($3, 2, length($3)-2); }'`
1286 if [ "${JAVA_VERSION:0:3}" == "1.7" ]; then
1287 # Specific Java version hacking
1288 #GC_TUNE+=('-XX:CMSFullGCsBeforeCompaction=1' '-XX:CMSTriggerPermRatio=80')
1289 JAVA_MINOR_VERSION=${JAVA_VERSION-2)}
1290 if [[ $JAVA_MINOR_VERSION -ge 40 && $JAVA_MINOR_VERSION -le 51 ]]; then
1291 GC_TUNE+=('-XX:-UseSuperWord')
1292 echo -e "\nWARNING: Java version $JAVA_VERSION has known bugs with Lucene and requires the -XX:-UseSuperWord flag. Please consider upgrading your JVM.\n"
When JAVA_VERSION is 1.7.0 to 1.7.9 the line (#1289):
JAVA_MINOR_VERSION=${JAVA_VERSION-2)}
will evaluate JAVA_MINOR_VERSION as .0 hence the if check that follows fails.
The above code would work fine for Java versions 1.7.10 and above
This line should be changed to (chop the string 4 positions from start to get the minor version, instead of chopping 2 positions from the end)
JAVA_MINOR_VERSION=${JAVA_VERSION:(4)}