jastrachan | 14 May 09:48 2004
Picon

Re: bug with recursive methods in scripts?


On 14 May 2004, at 05:37, Matt Quail wrote:

> I've attached a groovy script that contains a recursive function. It  
> fails to run on groovy-1.0-beta-5 with this exception:
>> Caught: groovy.lang.MissingMethodException: No signature of method  
>> test.scanStatic() is applicable for argument types: (
>> java.io.File) values: [D:\tmp]

I don't see a method scanStatic() with 1 argument defined in your  
script...

>> groovy.lang.MissingMethodException: No signature of method  
>> test.scanStatic() is applicable for argument types: (java.io.
>> File) values: [D:\tmp]
>>         at groovy.lang.MetaClass.invokeMethod(MetaClass.java:317)
>>         at groovy.lang.MetaClass.invokeMethod(MetaClass.java:291)
>>         at  
>> groovy.lang.GroovyObjectSupport.invokeMethod(GroovyObjectSupport.java: 
>> 73)
>
>
> Any tips? Am I doing something wrong, or is this a bug?
>
> =Matt
>
>
> -- 
> "good, fast, cheap: pick two"
> import java.io.File
>
> def scanStatic(root,  path) {
>   dir = new File(root, path)
>   println "at ${dir}"
>   dir.eachFile {|f|
>     fpath = path + "/" + f.name
>     if (f.isDirectory()) {
>       println "${root.class} ${fpath.class}"
>       scanStatic(root, fpath)
>     } else {
>       println fpath
>     }
>   }
> }
>
> scanStatic(new File("D:/tmp", ""))

Shouldn't this last line be

> scanStatic(new File("D:/tmp"), "")

i.e. pass in 2 parameters to scanStatic(), not just a single File  
object as you were doing

James
-------
http://radio.weblogs.com/0112098/

Gmane