ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 29888] New: - AbstractFileSet.toString() doesn't return correctly for referenced fileset
Date Fri, 02 Jul 2004 18:41:45 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=29888>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=29888

AbstractFileSet.toString() doesn't return correctly for referenced fileset

           Summary: AbstractFileSet.toString() doesn't return correctly for
                    referenced fileset
           Product: Ant
           Version: 1.6.1
          Platform: All
        OS/Version: Windows 9x
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: jesse.demmel@openwave.com


I am building my own task and wanted to wrap FileSet so that I could use 
them.  In doing so, I found that fileset.toString() will not return the 
expected result (includedfile1;includedfile2) when the fileset is a reference.

Relevant sections of my build.xml:

<fileset id="jutil.3p.jars" dir="${3rdparty.base}">
      <include name="webmethods/${GLUE_V}/jars/GLUE-STD.jar" />
      <include name="sun/jmx/${JMX_V}/jars/jmxri.jar" />   
</fileset>

<!-- target to run mytask... -->
   <target name="do-mytask" description="task I made.">
      <taskdef name="mytask" classname="MyTask" />
      <mytask>
         <fileset refid="jutil.3p.jars"/>
      </mytask>
   </target>

Relevant code for mytask:

import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.DirectoryScanner;
import java.io.File;
public class MyTask extends Task 
{
    private FileSet fileset;
  
    public void addConfiguredFileset ( FileSet fs )
    {
        fileset = fs;
    }
    public void execute () throws BuildException
    {
        try
        {
            String[] myfiles = fileset.toString();
            // Expected result of myfiles.length == 2, instead it's 1
            // with the value of the String being the reference.

            // The workaround
            DirectoryScanner ds = fileset.getDirectoryScanner(getProject());
            String[] jars = ds.getIncludedFiles();
        }
        catch( Exception e)
        {
            throw new BuildException( "Exception caught: " + e.toString());
        }
        
    }

The toString() just needs to check isReference() first... I don't think this 
is a big deal, but it is a bug... the workaround is pretty easy too.

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


Mime
View raw message