DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26563>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26563

Scriptdef task doesn't handle the nested elements properly

           Summary: Scriptdef task doesn't handle the nested elements
                    properly
           Product: Ant
           Version: 1.6.0
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I am using fileset inside a script def task. beanshell is used as a scripting 
language.

When I supply just one fileset to the the task defined with scriptdef then it 
passes it as fileset.

If I supply more than one element then it passes it as ArrayList. 

Say 

         <scriptdef name="scanandrunscript" language="beanshell">
            <attribute name="scriptname"/>
            <element name="fileset" type="fileset"/>
            <![CDATA[

            java.util.ArrayList fs = elements.get("fileset");
            
            java.util.Iterator itr = fs.iterator();
            
            while(itr.hasNext()){
            
                org.apache.tools.ant.types.FileSet fs = 
(org.apache.tools.ant.types.FileSet)itr.next();
                org.apache.tools.ant.DirectoryScanner scanner = 
fs.getDirectoryScanner(project);
                scanner.scan();
                String[] incfiles = scanner.getIncludedFiles();
                for(int i = 0 ; i < incfiles.length ; i++ ){
                        System.out.println(incfile[i]);
                        source(incfile[i]);
                }
            }

            ]]>
          </scriptdef>

runs properly with 

        <target name="hello" >

                <scanandrunscript>
                        <fileset dir="./ssa/services" casesensitive="no">
                          <filename name="*/misc/backend/installscripts/*.bsh"/>
                        </fileset>
                        <fileset dir="./ssa/services" casesensitive="no">
                          <filename name="*/backend/installscripts/*.bsh"/>
                        </fileset>
                        
                </scanandrunscript>

        </target>
but not with

        <target name="hello" >

                <scanandrunscript>
                        <fileset dir="./ssa/services" casesensitive="no">
                          <filename name="*/backend/installscripts/*.bsh"/>
                        </fileset>                      
                </scanandrunscript>

        </target>

I have to change the implementation to      FileSet fs = elements.get
("fileset");

This is not generic enough for a library task like script def.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to