commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@apache.org>
Subject Re: [VFS] bug ?
Date Fri, 19 Aug 2005 08:30:59 GMT

On 19.08.2005, at 10:07, Philippe Poulard wrote:

> hi Mario,
>
> there is a bug in VFS RC3 :
>
> StandardFileSystemManager fsm = null;
> fsm = (StandardFileSystemManager) VFS.getManager();
> fsm.setBaseFile( new File( System.getProperty( "user.dir" ) ) );
> fsm.setDefaultProvider( new UrlFileProvider() );
> FileObject fo = fsm.resolveFile( "file:///path/to/file" );
> System.out.println( fsm.resolveFile( fo, "file:///chemin/vers/ 
> fichier" ) );
> System.out.println( fsm.resolveFile( fo, "/chemin/vers/fichier" ) );
> System.out.println( fsm.resolveFile( fo, "chemin/vers/fichier" ) );
>
> output is :
>
> file:///chemin/vers/fichier
> file:///chemin/vers/fichier
> file:///path/to/file/chemin/vers/fichier
>
> the last must be :
>
> file:///path/to/chemin/vers/fichier
>
> the same with java.net.URI gives the right result :
>
> URI uri = new URI( "file:///path/to/file" );
> System.out.println( uri.resolve( "file:///chemin/vers/fichier" ) );
> System.out.println( uri.resolve( "/chemin/vers/fichier" ) );
> System.out.println( uri.resolve( "chemin/vers/fichier" ) );

Maybe the URI class is a bit smarter
but why would you use a *file* as a
base anyway????

VFS should probably check whether it's
a dir and if not use the parent.

But IMHO the above example looks more
like a wrong use of the API.

my 2 cents

cheers
--
Torsten

Mime
View raw message