ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23273] New: - Java task interprets it's arguments incorrectly if terminated with \\
Date Fri, 19 Sep 2003 15:55:38 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23273>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23273

Java task interprets it's arguments incorrectly if terminated with \\

           Summary: Java task interprets it's arguments incorrectly if
                    terminated with \\
           Product: Ant
           Version: 1.5.4
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: r.rawlinson@emuse.ie


Consider the following ANT task :

        <java classname="MyClass" failonerror="true" fork="true">
            <arg value="Some text\\"/>
            <arg value="Second argument" />
        </java>
 
Which is used to invoke the following Java class :

    public final class MyClass
    {
        public static void main( String[] args )
        {
            int loop = -1;
            while ( ++loop != args.length )
            {
                System.out.println ( loop + ")\t" + args[ loop ] );
            }
        }
    }
 
 
 
The expected output would be:
 
     [java] 0)  Some text\\
     [java] 1)  Second argument
 
 
What actually happens is
 
     [java] 0)  Some text\" Second
     [java] 1)  argument
 
  
 
The first argument has a trailing double back-slash character. This has been 
replaced by a single back slash and a double quote character.

ANT has then broken the second argument into two parts, as separated by a space 
character. The first part of this argument has been concatenated with the first 
argument! If there had been no space character in the second argument, then it 
would have been completely concatenated with the first argument.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message