Bug 17683 - javac task fails if path for java file contains space and if using external compiler
Summary: javac task fails if path for java file contains space and if using external c...
Status: RESOLVED DUPLICATE of bug 10499
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.5
Hardware: Other All
: P3 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-05 17:18 UTC by Anne Kinsella
Modified: 2008-02-22 12:18 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anne Kinsella 2003-03-05 17:18:52 UTC
If you try to compile java files which are in a directory containing a space 
(for example in program files), you cannot fork the javac task. 
I've worked around the problem by updating the following ant src file:

main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java

Changed the method executeExternalCompile(String[] args, int firstFileName)  to 
put quotes around the java file names.


So the following :

   for (int i = firstFileName; i < args.length; i++) {
      out.println(args[i]);
   }

becomes 

    for (int i = firstFileName; i < args.length; i++) {
      if ( i==0)
      {
         out.println(args[i]);
      }
      else 
      {
        args[i] = args[i].replace('\\', '/');
        out.println( "\"" + args[i] + "\"");
      }
   }
Comment 1 Stefan Bodewig 2003-03-10 09:31:47 UTC

*** This bug has been marked as a duplicate of 10499 ***
Comment 2 Antoine Levy-Lambert 2003-06-03 22:03:39 UTC
Anne, I believe I have solved this bug together with the bug 10499.
However, I did not put this 
     if ( i==0)
      {
         out.println(args[i]);
      }
in CVS, because I did not know why you had put this line.
Maybe the command line arguments used to be in args[0], so you did not want to 
see them quoted. My understanding is that in ant1.6alpha, only filenames are in 
this array, so my fix will be fine. 
Let me know if I am wrong.