lrbarber commented on issue #895:
URL:
https://github.com/apache/daffodil-vscode/issues/895#issuecomment-1804165254
utils.js contains this block of code that eventually is used by batch (or
bash) script to construct a command line invoking java program...
```
const extraArgs = isAtLeastJdk17
? ['-J--add-opens', '-Jjava.base/java.lang=ALL-UNNAMED']
: [ ]
```
The batch file is invoked:
```
daffodil-vscode\daffodil-debugger-3.5.0-1.3.1\bin\daffodil-debugger.bat
--listenPort 4711 -J"--add-opens java.base/java.lang=ALL-UNNAMED"
```
However, when the .bat file parses this, it breaks the second parameter into
several pieces and produces the following command:
```
java --add-opens java -cp
""C:\Users\larry.barber\Documents\daffodil-vscode\daffodil-debugger-3.5.0-1.3.1\bin\\\..\lib\\org.apache.daffodil.daffodil-debugger-1.3.1-classpath.jar""
org.apache.daffodil.debugger.dap.DAPodil --listenPort 4711 .base/java.lang
ALL-UNNAMED
```
The two parameters actually are a single option setting and must be place
together and with the '=' in place.
I tried changing the utils.ts file to use only a single entry `-J--add-opens
java.base/java.lang=ALL-UNNAMED` which still didn't work correctly, but adding
double quotes fixed it `-J"--add-opens java.base/java.lang=ALL-UNNAMED"`
and produced the following command:
```
java --add-opens java.base/java.lang=ALL-UNNAMED -cp
""C:\Users\larry.barber\Documents\daffodil-vscode\daffodil-debugger-3.5.0-1.3.1\bin\\\..\lib\\org.apache.daffodil.daffodil-debugger-1.3.1-classpath.jar""
org.apache.daffodil.debugger.dap.DAPodil --listenPort 4711
```
Unfortunately, the double quotes are not eliminated by the bash file's
parsing and the linux version of the command becomes:
```
java "--add-opens java.base/java.lang=ALL-UNNAMED" -cp
""C:\Users\larry.barber\Documents\daffodil-vscode\daffodil-debugger-3.5.0-1.3.1\bin\\\..\lib\\org.apache.daffodil.daffodil-debugger-1.3.1-classpath.jar""
org.apache.daffodil.debugger.dap.DAPodil --listenPort 4711
```
Which, of course, java doesn't like.
After further experimentation with Hitesh, we discovered that there is a
formatting of the text in utils.ts that works for both Windows & Linux -- it's
just ugly!
```
const extraArgs = isAtLeastJdk17
? ['-J--add-opens', '-J"java.base/java.lang""=""ALL-UNNAMED"']
: [ ]
```
Don't ask us how this works, but...
Windows parses it and produces this:
```
--add-opens java.base/java.lang"="ALL-UNNAMED
```
and Rocky9 this:
```
--add-opens java.base/java.lang=ALL-UNNAMED
```
Both of which actually seem to run.
The only alternative to this would be to add logic to the utils.ts file to
contain different settings based upon the operating system with an if
then...else clause.
--
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]