CMDJAVA loop issue

SonarQube 7.9.2 LTS, running on RHEL
In comparing the packaged w/LTS 6.7.x to 7.9.x, observed the following addition:
# read java command from wrapper.conf as first uncommented line containing ""
grep "" "$WRAPPER_CONF" | grep -v "^#" | while read -r line; do

Seem like a potential infinite loop situation. This would be cleaner perhaps:

CMDJAVA=$(grep -v '^#' "$WRAPPER_CONF" | grep -m 1 "" | cut -d= -f2)

and inside forcestopit(),

${CMDJAVA:-java} -classpath ...

EDIT: In fact, it seems you have a potentially bigger issue. wrapper takes the last value, not the first, so your will end up picking an inconsistent one if multiples are listed.

steps to reproduce:
# Path to JVM executable. By default it must be available in PATH.
# Can be an absolute path, for example:

./ start:

logs show:
/apps/infra/java/jdk1.8.0_241/jre/bin/java ...

grep -v '^#' "$WRAPPER_CONF" | grep "" | tail -1 | cut -d= -f2