[
https://issues.apache.org/jira/browse/VFS-454?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14001477#comment-14001477
]
MH edited comment on VFS-454 at 5/19/14 8:09 AM:
-------------------------------------------------
So, calling close() is recommended but you must not call it if you want the
manager again? I use it this way:
1. vfs = VFS.getManager();
...
2. vfs.resolveFile(...
...
3. ((DefaultFileSystemManager) vfs).close();
The next time I use VFS, these 3 steps are called again. So how should I get an
vfs manager if not via VFS.getManager() so that I can close() on it (as
recommended)? The constructor
private static FileSystemManager createManager(final String managerClassName)
requires a name - looking into the source of VFS,
public static synchronized FileSystemManager getManager()
uses hard coded "org.apache.commons.vfs2.impl.StandardFileSystemManager". I
don't think that's it good practise to call
createManager("org.apache.commons.vfs2.impl.StandardFileSystemManager")
... is it?
At least, you should make this clear in the Javadocs of close(), so that other
developers don't ask the same question.
was (Author: mhilpert):
So, calling close() is recommended but you must not call it if you want the
manager again? I use it this way:
1. vfs = VFS.getManager();
...
2. vfs.resolveFile(...
...
3. ((DefaultFileSystemManager) vfs).close();
The next time I use VFS, these 3 steps are called again. So how should I get an
vfs manager if not via VFS.getManager() so that I can close() on it (as
recommended)? The constructor
private static FileSystemManager createManager(final String managerClassName)
requires a name - looking into the source of VFS,
public static synchronized FileSystemManager getManager()
uses hard coded "org.apache.commons.vfs2.impl.StandardFileSystemManager". I
don't think that's it good practise to call
createManager("org.apache.commons.vfs2.impl.StandardFileSystemManager")
... is it?
> SFTP: first access OK, second access: Unknown scheme "sftp" in URI
> "sftp://..."
> -------------------------------------------------------------------------------
>
> Key: VFS-454
> URL: https://issues.apache.org/jira/browse/VFS-454
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: Java 1.7.0_13 64 Bit
> Reporter: MH
> Priority: Critical
>
> I access files from an SFTP server and accesm them roughly via
> -----------------
> vfs.resolveFile(uri, opts);
> ...
> vfs.resolveFile(cwd, directory);
> ...
> cwd.getChildren();
> ...
> vfs.resolveFile(fn);
> ...
> ((DefaultFileSystemManager) vfs).close();
> --------------------------
> If the same code runs a second time, the first call to resolveFile() throws
> Unknown scheme "sftp" in URI "sftp://..."
> I tried
> vfs.closeFileSystem(children[0].getFileSystem());
> like stated in http://wiki.apache.org/commons/SimpleSftpFileDownload, but
> this doesn't help!
--
This message was sent by Atlassian JIRA
(v6.2#6252)