On Wed, Jan 23, 2013 at 2:29 PM, Mark Fortner <[email protected]> wrote:
> Gary, > That's interesting. I didn't know you could get package version > information. Cool. > Don't get too fired up ;) that info has to be in the jar's manifest in the first place for the API to get it. Gary > > Cheers, > > Mark > > > > On Wed, Jan 23, 2013 at 11:23 AM, Gary Gregory <[email protected] > >wrote: > > > On Wed, Jan 23, 2013 at 2:11 PM, Mark Fortner <[email protected]> > wrote: > > > > > Hi Sven, > > > Do you have a runnable test for this? I don't have access to an FTP > > server > > > at the moment so I can't really test this, but I ran this code snippet > > > against the local file system and it seemed to work properly: > > > > > > @GrabConfig(systemClassLoader=true) > > > @Grapes([ > > > @Grab(group='org.apache.commons', module='commons-vfs2', > > > version='2.0'), > > > ]) > > > import org.apache.commons.vfs2.FileObject; > > > import org.apache.commons.vfs2.FileSystemException; > > > import org.apache.commons.vfs2.VFS; > > > import org.apache.commons.vfs2.FileSystemManager; > > > > > > FileSystemManager mgr = VFS.getManager(); > > > FileObject file = mgr.resolveFile(System.getProperty("user.home")); > > > println file; > > > println file.getType(); > > > file.getChildren().each{ > > > println it > > > } > > > > > > One thing that occurred to me is that the grails classloader might be > > > loading an different version of the VFS library than your groovy > script. > > > > > > Gary, is there a way to output the VFS configuration (VFS version, > > > available FileSystems, and FileSystem versions)? > > > > > > > You can get the package information for any Class object and query and > > print that: aClass.getPackage(), the Package has a bunch of APIs. > > > > Gary > > > > > > > > > > Cheers, > > > > > > Mark > > > > > > > > > > > > On Wed, Jan 23, 2013 at 6:00 AM, Sven Johansson < > > [email protected] > > > >wrote: > > > > > > > Hey, list. > > > > > > > > I'm porting a Java app to Groovy (from Play 2.0 to Grails, in fact). > > > > > > > > This app has a page that lists incoming file on an FTP, and I've been > > > using > > > > vfs2 for this - works like a charm. > > > > > > > > Turns out, that when I use the exact same code in Groovy, the > > FileObject > > > > representing the root ftp folder is of type 'file' instead of folder > > (and > > > > an exception > > > > is thrown): > > > > > > > > FileObject incomingFolder = VFS.getManager().resolveFile(" > > > > ftp://myuser:[email protected]/"); > > > > incomingFolder.getChildren(); > > > > > > > > I get the same behavior from a standalone Groovy-script as I get > > running > > > in > > > > Grails. > > > > > > > > If I however move down to vfs 1.0, the FileObject return is a 'file' > > when > > > > running the > > > > GroovyScript, but remains 'folder' in Grails. > > > > > > > > I also tried listing the contents of a subfolder - same results. > > > > > > > > I realize this might be considered a Groovy-specific question and > might > > > be > > > > better > > > > asked on the grails-list or stackoverflow, but I thought I'd give it > a > > > try > > > > here first. > > > > > > > > Any input on what kind of nastiness could be involved in causing this > > > would > > > > be > > > > greatly appreciated - suggestions on how to resolve it even more so. > > > > > > > > Cheers/Sven > > > > > > > > > > > > > > > -- > > E-Mail: [email protected] | [email protected] > > JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0 > > Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK > > Blog: http://garygregory.wordpress.com > > Home: http://garygregory.com/ > > Tweet! http://twitter.com/GaryGregory > > > -- E-Mail: [email protected] | [email protected] JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0 Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory
