[
https://jira.jboss.org/jira/browse/JBAS-6725?page=com.atlassian.jira.plug...
]
David Croft commented on JBAS-6725:
-----------------------------------
I looked at it again. In both cases in my previous comment, it looks like the problem is
being caused by whitespace around the pipe, not quotes around quotes.
Here is the error message for the first case (caret before pipe in quotes):
set JAVA_OPTS=-Dhttp.nonProxyHosts="localhost^|*.ldms.ibm.com"
[...]
C:\jboss\bin>rem Add -server to the JVM options, if supported
C:\jboss\bin>"C:\jdk\bin\java" -server -version 2>&1 | findstr /I
hotspot 1>
nul
C:\jboss\bin>if not errorlevel 1 (set
"JAVA_OPTS=-Dhttp.nonProxyHosts="localhost
| *.ldms.ibm.com" -Dprogram.name=run.bat -server")
'*.ldms.ibm.com" -Dprogram.name=run.bat -server"' is not recognized as
an intern
al or external command,
operable program or batch file.
Note the whitespace before and after the pipe toward the end.
Here is the error message for a third case representing my original problem (no caret):
set JAVA_OPTS=-Dhttp.nonProxyHosts="localhost|*.ldms.ibm.com"
[...]
C:\jboss>popd
C:\jboss\bin>set DIRNAME=
C:\jboss\bin>if "Windows_NT" == "Windows_NT" (set
"PROGNAME=run.bat" ) else (se
t "PROGNAME=run.bat" )
| was unexpected at this time.
C:\jboss\bin>if "x-Dhttp.nonProxyHosts="localhost|*.ldms.ibm.com""
== "x" (
In this third case without the caret, I think it might be an issue with the quotes within
quotes causing the pipe to be no longer escaped by quotes and causing a parsing error.
Not sure.
Regardless, it looks like the only way I can get it to work is the workaround I described
in the original bug report description. Note that in that report I was not saying we
should avoid quotes around the JAVA_OPTS value but rather that we should avoid quotes
around the JAVA_OPTS variable. Example:
set JAVA_OPTS="A | B"
(Quotes used around the JAVA_OPTS value to escape the pipe).
echo %JAVA_OPTS%
(Displays: "A | B")
set "JAVA_OPTS=%JAVA_OPTS% C"
(Fails to parse, possibly because the embedded quote unescapes the pipe.)
set JAVA_OPTS=%JAVA_OPTS% C
(No quotes around the JAVA_OPTS variable; parses successfully.)
echo %JAVA_OPTS%
(Displays: "A | B" C)
quotes around JAVA_OPTS in run.bat
----------------------------------
Key: JBAS-6725
URL:
https://jira.jboss.org/jira/browse/JBAS-6725
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Affects Versions: JBossAS-5.0.1.GA, JBossAS-5.1.0.Beta1
Environment: Windows XP and JDK 6
Reporter: David Croft
Assignee: Mladen Turk
In JBoss 4.2.3, I was able to prepend to run.bat a JAVA_OPTS option with a pipe symbol
(|) by escaping it using quote marks.
Example:
set JAVA_OPTS=-Dhttp.nonProxyHosts="localhost|*.ldms.ibm.com"
In JBoss 5.0.1.GA and 5.1.0.Beta1, the run.bat script has been modified slightly so that
this is no longer possible. This modification was to wrap JAVA_OPTS with quote marks
which will not parse if JAVA_OPTS already has quote marks as in the above example. There
are two places where this occurs. Here is the first place:
if "x%JAVA_OPTS%" == "x" (
set "JAVA_OPTS=-Dprogram.name=%PROGNAME%"
) else (
set "JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%"
)
The first place where it occurs can be fixed by reverting to the version 4.2.3 run.bat
code without quote marks:
set JAVA_OPTS=%JAVA_OPTS% -Dprogram.name=%PROGNAME%
The second place it occurs is as follows:
if not errorlevel == 1 (
set "JAVA_OPTS=%JAVA_OPTS% -server"
)
This second place can be fixed by removing the quote marks:
if not errorlevel == 1 (
set JAVA_OPTS=%JAVA_OPTS% -server
)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira