ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Reilly <peterrei...@apache.org>
Subject 1.6.5 and javadoc with external files and directories with spaces on windows.
Date Tue, 31 May 2005 09:57:58 GMT
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


Mime
View raw message