Laplie Anderson created VFS-531:
-----------------------------------
Summary: Cannot "copyFrom" without access to create parent folder
even if folder exists
Key: VFS-531
URL: https://issues.apache.org/jira/browse/VFS-531
Project: Commons VFS
Issue Type: Bug
Affects Versions: 2.0
Environment: Linux
Reporter: Laplie Anderson
Using copyFrom when you don't have access to create the parent folder fails
even when the parent folder exists.
I have the folder structure of:
/home/usera/subfolder
Userb has r/w access to the subfolder and read access to the parent folders.
CopyFrom with a destination of "/home/usera/subfolder/file" fails
{code:borderStyle=solid}
Caused by: org.apache.commons.vfs2.FileSystemException: Could not create folder
"file:///home/usera/subfolder".
at
org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:999)
at
org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1424)
at
org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:461)
at
org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:441)
at org.apache.commons.vfs2.FileUtil.copyContent(FileUtil.java:111)
at
org.apache.commons.vfs2.provider.AbstractFileObject.copyFrom(AbstractFileObject.java:1053)
... 2 more
Caused by: org.apache.commons.vfs2.FileSystemException: Could not create
directory "/home/usera/subfolder".
at
org.apache.commons.vfs2.provider.local.LocalFile.doCreateFolder(LocalFile.java:153)
at
org.apache.commons.vfs2.provider.AbstractFileObject.createFolder(AbstractFileObject.java:988)
... 7 more
{code}
It looks like the issue is that the code doesn't check if the destination
folder exists before calling create. Create throws an exception any time the
folder is not created (even if it didn't have to create the folder.)
--
This message was sent by Atlassian JIRA
(v6.2#6252)