You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2004/01/31 05:33:46 UTC

DO NOT REPLY [Bug 26563] New: - Scriptdef task doesn't handle the nested elements properly

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: dev@ant.apache.org
        ReportedBy: senthilandsenthil@yahoo.com


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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org