https://issues.apache.org/bugzilla/show_bug.cgi?id=56895

            Bug ID: 56895
           Summary: catalina.bat does not properly compose JAVA_OPTS
           Product: Tomcat 7
           Version: 7.0.54
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Integration
          Assignee: dev@tomcat.apache.org
          Reporter: lucasthei...@apache.org

When composing JAVA_OPTS, the current bat script uses this approach:

set JAVA_OPTS=%JAVA_OPTS% %OTHER_STUFF%

However, this leads to issues if the existing JAVA_OPTS had some sort of escape
sequence in it.  For example, in my setenv.bat, I add some proxy info:

SET "JAVA_OPTS=-Dhttp.proxyHost=myproxy.localdomain
-Dhttp.nonProxyHosts=*.localdomain^|localhost^|appserver.localdomain"

Using the existing approach, the escape sequence ^| gets processed into |
leaving the next evaluation to treat it as a command pipe, which causes
immediate failure.

If instead you use this approach:

set "JAVA_OPTS=%JAVA_OPTS% %OTHER_STUFF%"

Then those escape sequences are preserved.  Here is the patch for version
7.0.54:

--- catalina.bat_ORIGINAL       2014-08-27 18:37:05.173641700 -0400
+++ catalina.bat        2014-08-27 18:06:22.779721000 -0400
@@ -176,12 +176,12 @@
 if not exist "%CATALINA_BASE%\conf\logging.properties" goto noJuliConfig
 set
LOGGING_CONFIG=-Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"
 :noJuliConfig
-set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%
+set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG%"

 if not "%LOGGING_MANAGER%" == "" goto noJuliManager
 set
LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
 :noJuliManager
-set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%
+set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%"

 rem ----- Execute The Requested Command
---------------------------------------

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to