You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Peter Reilly <pe...@apache.org> on 2005/05/31 11:57:58 UTC

1.6.5 and javadoc with external files and directories with spaces on windows.

There was some discussion last week about bug 27814.
http://issues.apache.org/bugzilla/show_bug.cgi?id=27814

Basicly, because of  invalid doc for javadoc, ant generates external files
containing invalid filenames for the javadoc.  - "a:\a dir with 
spaces\subdir\file.name"
javadoc does like this (backspaces within a string delimited by ").
The fix that Stefan placed
in was to replace File.separatorChar with "/" - which is a valid 
alternative file separator
character on windows. The fix has been tested by at least two people 
(Jesse and Tom Klasse)
on windows.

The change is very small:


Index: Javadoc.java
===================================================================
RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
retrieving revision 1.124.2.8
diff -u -3 -p -r1.124.2.8 Javadoc.java
--- Javadoc.java        30 Mar 2005 16:56:19 -0000      1.124.2.8
+++ Javadoc.java        31 May 2005 09:30:06 -0000
@@ -1905,7 +1905,9 @@ public class Javadoc extends Task {
                 String sourceFileName = sf.getFile().getAbsolutePath();
                 if (useExternalFile) {
                     if (javadoc4 && sourceFileName.indexOf(" ") > -1) {
-                        srcListWriter.println("\"" + sourceFileName + 
"\"");
+                        String name =
+                            sourceFileName.replace(File.separatorChar, 
'/');
+                        srcListWriter.println("\"" + name + "\"");
                     } else {
                         srcListWriter.println(sourceFileName);
                     }

However, I would like to make a small change:
Index: Javadoc.java
===================================================================
RCS file: 
/home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
retrieving revision 1.124.2.8
diff -u -3 -p -r1.124.2.8 Javadoc.java
--- Javadoc.java        30 Mar 2005 16:56:19 -0000      1.124.2.8
+++ Javadoc.java        31 May 2005 09:32:38 -0000
@@ -1905,7 +1905,11 @@ public class Javadoc extends Task {
                 String sourceFileName = sf.getFile().getAbsolutePath();
                 if (useExternalFile) {
                     if (javadoc4 && sourceFileName.indexOf(" ") > -1) {
-                        srcListWriter.println("\"" + sourceFileName + 
"\"");
+                        String name = sourceFileName;
+                        if (File.separatorChar == '\\') {
+                            name = 
sourceFileName.replace(File.separatorChar, '/');
+                        }
+                        srcListWriter.println("\"" + name + "\"");
                     } else {
                         srcListWriter.println(sourceFileName);
                     }

-i.e. only do the substituation if the File separator character is '\'.

I think that should go into ant 1.6.5 as
  - it is a bug fix,
  - it is small and localized
  - it affects a well used task - javadoc

Peter

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


Re: 1.6.5 and javadoc with external files and directories with spaces on windows.

Posted by Stefan Bodewig <bo...@apache.org>.
On Tue, 31 May 2005, Peter Reilly <pe...@apache.org> wrote:

> The fix that Stefan placed in was to replace File.separatorChar with
> "/"

And the only reason I didn't merge it into the 1.6 branch before 1.6.3
was that nobody had confirmed it by then.

> The fix has been tested by at least two people (Jesse and Tom
> Klasse) on windows.

+1 for merging it into 1.6.5 then.

> However, I would like to make a small change:

The code I used can be found in some Javac adapters as well, I'm fine
with your change, but then we should be consistent.  In HEAD, that is.

Stefan

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