Fix processing of Windows batch file arguments
----------------------------------------------
Key: JGRP-1166
URL:
https://jira.jboss.org/jira/browse/JGRP-1166
Project: JGroups
Issue Type: Bug
Affects Versions: 2.9, 2.8, 2.6.14, 2.4.8
Environment: Windows
Reporter: Richard Achmatowicz
Assignee: Bela Ban
The file build.bat can sometimes take a rather long set of command line arguments, due to
specification of JVM system properties; for example,
$ build.bat -Djgroups.bind_addr=%MYTESTIP_1% -Djgroups.udp.mcast_addr=%MCAST_ADDR%
-Djgroups.tcpping.initial_hosts="%MYTESTIP_1%[7800],%MYTESTIP_1[7801]"
all-tests-functional
Windows batch files provide positional parameters %0 through %9 to collect the first nine
arguments. Windows batch files also process a single parameter -Dfred=barney as two
parameters -Dfred and barney. This leads to a limit on the number of system properties we
can pass to the build.bat file, due to the way the command line arguments are processed
(i.e. using the maximum number of positional parameters). In the worst case, some system
properties get lost.
One way to fix this is to gather together the all the command line arguments using the
shift operator and store them in a variable, BUILD_ARGS. Here is the code:
REM ******************************************************
REM ********Save the command line arguments***************
REM ******************************************************
set BUILD_ARGS=%1
if ""%1""=="""" goto completedArgs
shift
:processArg
if ""%1""=="""" goto completedArgs
set BUILD_ARGS=%BUILD_ARGS% %1
shift
goto processArg
:completedArgs
The variable BUILD_ARGS can then be passed to the
%JAVA_HOME%\bin\java -classpath "%CP%" org.apache.tools.ant.Main -buildfile
build.xml %BUILD_ARGS%
This gets rid of the limit on command line parameters for batch files.
--
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