commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Poulard <Philippe.Poul...@sophia.inria.fr>
Subject Re: [vfs] vfs-sandbox jar 's vfs-providers.xml gets auto-loaded even when manually configuring
Date Wed, 04 Apr 2007 07:36:12 GMT
Kostis Anagnostopoulos wrote:
> Hi,
> 
> I've been trying to build a stripped-down version of VFS fileSystem
> manager and i'm having problem with the sandboxed providers.
> 
> Since the name of the included within-the-jar configuration file is
> vfs-providers.xml, i think it triggers its discovery by the fileSystem
> manager and it is always included.
> 
> So i cannot use a
> StandardFileSystemManager.configure("my-providers-only.xml") because
> i'm getting a:
> 
> org.apache.commons.vfs.FileSystemException: Multiple providers
> registered for URL scheme "smb".
>        at 
> org.apache.commons.vfs.impl.DefaultFileSystemManager.addProvider(DefaultFileSystemManager.java:174)

> 
>        at 
> org.apache.commons.vfs.impl.StandardFileSystemManager.addProvider(StandardFileSystemManager.java:354)

> 
>        at 
> org.apache.commons.vfs.impl.StandardFileSystemManager.configure(StandardFileSystemManager.java:254)

> 
>        at 
> org.apache.commons.vfs.impl.StandardFileSystemManager.configure(StandardFileSystemManager.java:187)

> 
>        ... 29 more
> 
> 
> 
> Notice that this error happens EVEN WHEN myproviders-only.xml file
> DOES NOT SPECIFY the smb provider!
> 
> 
> Any ideas on how to circumvent this?
> 

hi,

instead of doing this :
         StandardFileSystemManager fsm = (StandardFileSystemManager) 
VFS.getManager();

try this :
         StandardFileSystemManager fsm = new StandardFileSystemManager();
         fsm.setConfiguration( YourClass.class.getResource( 
"my-providers-only.xml" ) );
         fsm.init();
         String dir = System.getProperty( "user.dir" );
         fsm.setBaseFile( new File( dir ) );
         fsm.setDefaultProvider( new FallbackFileProvider() );

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message