AndreVirtimo opened a new issue, #3003:
URL: https://github.com/apache/karaf/issues/3003
In
assemblies/features/base/src/main/filtered-resources/resources/bin/karaf.bat
(around line 270), the Java version check for setting
-Djava.security.manager=allow quotes %JAVA_VERSION% on the left-hand side:
```bat
if "%JAVA_VERSION%" GTR 11 (
set DEFAULT_JAVA_OPTS=%DEFAULT_JAVA_OPTS% -Djava.security.manager=allow
)
```
Problem
In Windows cmd.exe, quoting one or both operands in a GTR comparison forces
a lexicographical string comparison instead of a numeric comparison, including
the literal quote characters (" is ASCII 34, while 1 is ASCII 49). As a result,
"21" GTR 11 (and even "17" GTR 11) always evaluates to false, and
-Djava.security.manager=allow is never added on Windows (unlike in Unix
bin/inc, where [ "${VERSION}" -gt "11" ] works as expected).
Solution
Remove the quotes around %JAVA_VERSION% so cmd.exe performs a numeric
comparison, matching the check on line 237 (if %JAVA_VERSION% GTR 8):
```diff
-if "%JAVA_VERSION%" GTR 11 (
+if %JAVA_VERSION% GTR 11 (
set DEFAULT_JAVA_OPTS=%DEFAULT_JAVA_OPTS% -Djava.security.manager=allow
)
```
Affected: 4.4.11, 4.4.12 and main (tested with Temurin 21.0.12.1 on Windows).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]