[
https://issues.apache.org/jira/browse/VFS-730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jorge updated VFS-730:
----------------------
Labels: StaticUserAuthenticator copyFrom (was: )
> Error while creating a file/folder on a shared network folder using
> StaticUserAuthenticator
> -------------------------------------------------------------------------------------------
>
> Key: VFS-730
> URL: https://issues.apache.org/jira/browse/VFS-730
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.4.1
> Environment: The code works fine on develomnet environment where the
> user running tomcat is a local user, but fails when the user running tomcat
> is the SYSTEM user.
> Our guess is that in the first situation copyFrom is not using the
> Authenticator and therefore works fine.
> The targetPath is in a shared folder on a server with W{color:#000000}indows
> 2008 R2 standard, The folder has permissions to read and write and we already
> check that is accesible from the computer running apache.{color}
> When the execution reach the copyFrom line is fire a FileSystemException:
> org.apache.commons.vfs2.FileSystemException: Could not copy
> "file:///C:/localpath/file.txt" to
> "file:////192.168.1.1/targetFolder/file.txt".
>
> Reporter: Jorge
> Priority: Major
> Labels: StaticUserAuthenticator, copyFrom
>
> The following code is failing to create the target file:
>
> {code:java}
> private void copyUsingCredentials(Path sourcePath, Path targetPath)
> throws IOException {
> String domain = "domain";
> //String domain = "192.168.1.1";
> String username = "username";
> String password = "1234";
>
> FileObject sourceFile =
> VFS.getManager().resolveFile(sourcePath.toFile().getAbsolutePath());
> StaticUserAuthenticator auth = new StaticUserAuthenticator(domain,
> username, password);
> FileSystemOptions opts = new FileSystemOptions();
>
> DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(opts, auth);
> FileObject targetFile =
> VFS.getManager().resolveFile(targetPath.toFile().getAbsolutePath(), opts);
> targetFile.copyFrom(sourceFile, Selectors.SELECT_SELF);
> targetFile.close();
> }
> {code}
>
> {code:java}
> sourcePath = file:///C:/localpath/file.txt
> targetPath = file:////192.168.1.1/targetFolder/file.txt{code}
> The code works fine on develomnet environment where the user running tomcat
> is a local user, but fails when the user running tomcat is the SYSTEM user.
> Our guess is that in the first situation copyFrom is not using the
> Authenticator and therefore works fine.
> The targetPath is in a shared folder on a server with Windows 2008 R2
> standard, The folder has permissions to read and write and we already check
> that is accesible from the computer running apache.
> When the execution reach the copyFrom line is fire a FileSystemException:
> org.apache.commons.vfs2.FileSystemException: Could not copy
> "file:///C:/localpath/file.txt" to
> "file:////192.168.1.1/targetFolder/file.txt".
--
This message was sent by Atlassian Jira
(v8.3.4#803005)