ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 49492] New: The fileset resource collection doesn't handle file/directory names with spaces
Date Wed, 23 Jun 2010 14:18:59 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=49492

           Summary: The fileset resource collection doesn't handle
                    file/directory names with spaces
           Product: Ant
           Version: 1.8.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: notifications@ant.apache.org
        ReportedBy: sgoor@hotmail.com


The org.apache.tools.ant.types.FileList collection doesn't recognise the files
correctly when they contain spaces (windows os) because white space is
hard-coded as a delimiter in the setFiles() method:

[code]
public void setFiles(String filenames) {
        checkAttributesAllowed();
        if (filenames != null && filenames.length() > 0) {
            StringTokenizer tok = new StringTokenizer(
                filenames, ", \t\n\r\f", false);
            while (tok.hasMoreTokens()) {
               this.filenames.addElement(tok.nextToken());
            }
        }
    }
[/code]

I have a comma separated list of files with spaces in the directory names and
it would not work until I used the short dos name format.

I thought I would try to create a custom task that subclasses the FileSet and
overrides setFiles() but the filenames Vector member variable is private and
has no access in subclasses.

Could the FileSet be updated so that the delimiter can be specified.  I think
this could be done simply by using a member variable and getter and setter for
the delimiter, the default value of the variable could just be set to ",
\t\n\r\f" to ensure backward compatibility.

I also wonder should the filenames Vector member variable have a protected
getter method to allow sub-classing?

Thanks,
Stefan

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message