Bug 27814 - javadoc task does not encode baskslashes when generating file list by useexternalfile
Summary: javadoc task does not encode baskslashes when generating file list by useexte...
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.6.1
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.6.5
Assignee: Ant Notifications List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-20 06:30 UTC by Trustin Lee
Modified: 2014-02-17 13:59 UTC (History)
5 users (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trustin Lee 2004-03-20 06:30:11 UTC
'file.separator' in Windows platform is backslash('\'), but the 'javadoc' task 
doesn't seem to encode single backslash to doubled one ('\\'), so it outputs 
the error messages such as:

[javadoc] javadoc: File not found: "C:Documents and SettingsTrustin LeeMy 
Documentsworkspacericasrcjava
[javadoc] etgleamynodecollectionIntList.java"

The actual file path had to be:

"C:\Document and Settings\Trustin Lee\My 
Documents\workspace\arica\src\java\net\gleamynode\net\collection\IntList.java"

The worksaround for this problem is to specify '-Dfile.separator=/' in command 
line.

It is quite weird this bug still exists, no windows ant users anywhere? :)
Comment 1 Steve Loughran 2004-03-21 22:38:10 UTC
This is interesting; nobody else has picked up on it. And if you look at the
javadoc manual, you can see that Sun explicitly show non-escaped backslashes in
the external file.

http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javadoc.html#argumentfiles

What version of java/javadoc are involved here? 
Comment 2 Trustin Lee 2004-03-22 00:28:57 UTC
I am using Sun JDK 1.4.2. I ran Ant in Cygwin commandline.

I used Ant 1.6.1 via Maven; I modified startup script files for Maven to use 
Ant 1.6.1, because Ant 1.5.1 which is bundled with Maven has the bug that it 
cannot process the path which contains spaces.

Is Cygwin or Maven the cause of this problem?
Comment 3 Ryan 2004-09-17 15:30:51 UTC
I'm having the same problem in Ant 1.6.2 with Sun's JDK 1.4.2_02 under Windows XP.
Comment 4 Ryan 2004-09-17 15:56:43 UTC
Sorry, it's actually 1.4.2_01 (not 1.4.2_02) for me.
Comment 5 asdf 2004-11-17 08:21:53 UTC
Here's the diff for this against version 1.130

1887,1888d1886
<                         sourceFileName = sourceFileName.replaceAll("\\\\",
<                         "\\\\\\\\");

Haven't tested on unix though.
Comment 6 David Konecny 2004-12-02 13:10:41 UTC
I found this issue while fixing NetBeans issue
<http://www.netbeans.org/issues/show_bug.cgi?id=51372>. I can reproduce the
problem on WinXP too and playing directly with the javadoc.exe from JDK 1.4.2 or
from 1.5 I believe that it is JDK bug. I filed it as
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6202474>
Comment 7 Stefan Bodewig 2005-03-21 16:29:48 UTC
For forked javac we already replace \ with / which should work on Windows as
well, if I read the original comment correctly.  Just done so in Javadoc now.

Maybe this only happens if the file name is quoted?  Ant only quotes the names
if they contain a space, so maybe it just didn't happen for most users because
they don't run Ant in directories with spaces in their names.

I've just assumed this is the case (since we only map \ to / in javac if we quote
the file names as well).  Should work in CVS HEAD.

If anybody could run some tests on Windows, that would be fine, since I won't
merge it into Ant 1.6.3 myself (can't test it since I don't run Windows)
otherwise.
Comment 8 Stefan Bodewig 2005-03-21 16:30:43 UTC
just assigning it to myself so that I remember merging it or moving the target
milestone to 1.7.
Comment 9 Jesse Glick 2005-03-29 21:41:16 UTC
Stefan do you still plan to fix this for 1.6.3? Let me know if you want help.
Comment 10 Stefan Bodewig 2005-03-30 09:08:35 UTC
I don't run Windows, so I can't really test it.  All I need is a confirmation that
the problem is fixed and I haven't created new ones.
Comment 11 Jesse Glick 2005-04-01 02:08:25 UTC
It does appear to be fixed in the trunk. Methodology: XP, JDK 1.5.0. I created a dir

  e:\test27814\nasty dir with spaces\

and put in it a build.xml:

<project default="x">
    <target name="x">
        <javadoc destdir="jd" useexternalfile="true">
            <fileset dir="src"/>
        </javadoc>
    </target>
</project>

where src\pkg\Cnnn.java contain each "public class Cnnn {}", for nnn in 000..999.

If I cd into this directory from the command shell (making sure that the cwd is
reported as the full path name, not e.g. E:\test27~1\NASTYD~1\ or whatever it
is), and run

e:\ant162\bin\ant -v

it fails with the usual messages like

Could not find file e:        test27814
astydirwithspaces

indicating \t, \n, etc. are being treated as escape characters.

If I run

e:\antdev\bin\ant -v

it succeeds; output mentions e.g.

  [javadoc] Loading source file E:/test27814/nasty dir with
spaces/src/pkg/C042.java...

which looks OK.

So I believe this is FIXED for 1.7 but still broken in 1.6.3. I would recommend
merging the fix, though it would be nice if someone who actually runs Windows on
a daily basis could confirm that nothing obvious was broken by it.
Comment 12 Jesse Glick 2005-04-05 16:23:24 UTC
For reference, the patch in question seems to have been

RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
revision 1.138
date: 2005/03/21 15:26:49;  author: bodewig;  state: Exp;  lines: +3 -1
replace '\' if quoting file names, PR 27814
Comment 13 Tom Klaasen 2005-05-25 14:46:58 UTC
I use ant in a windows environment, and I've ran into this bug several times now.
I can confirm that the version "ant_20050525041200" (cvs snapshot) fixes the
bug, while release 1.6.4 does not.
I've tested this by running the "dist-all" target on the project I'm currently
working on (generate all distributions for the project, including sources and
javadocs. The target also uses some external tasks such as xdoclet).
I would very much like the bugfix to be included in the next release, so if
there's anything I can do to help/assert in this process, please let me know.