[ ant-contrib-Bugs-1709994 ] CommandLineCompiler should allow for java added quotes

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.ant-contrib.devel
Message-ID <[email protected]>
Bugs item #1709994, was opened at 2007-04-30 10:22
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1709994&group_id=36177

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Tom Quarendon (tomq42)
Assigned to: Nobody/Anonymous (nobody)
Summary: CommandLineCompiler should allow for java added quotes

Initial Comment:
The code in CommandLineCompiler.compile that attempts to calculate how many source files it can compile in one go withoug blowing the maximum command line length doesn't allow for the fact that the java code that launches the process can add quotes around an argument if if contains spaces and is not already surrounded in quotes.
I had a compile task that the CommandLineCompiler.compile method calculated was 32765 characters long, cut one of the arguments specifying an include directory contained a space, so java added quotes around it when cnverting from the array of Strings to the single string to pass to CreateProcess. This took the line length to 32767 which windows then complained at.

A sufficient fix for my purposes was to change the bit that's calculating the length of the base arguments to 

       for (int i = 0; i < args.length; i++) {
           baseLength += args[i].length();
           if (args[i].indexOf(' ')!=-1) baseLength += 2; // allow for quotes surrounding value.
        }

However I admit that that may be a windows specific fix (maybe java on other platforms deals with spaces in the arguments in other ways)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=416920&aid=1709994&group_id=36177

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.