[ 
https://issues.apache.org/jira/browse/VFS-531?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14059321#comment-14059321
 ] 

Laplie Anderson commented on VFS-531:
-------------------------------------

Still happens on 2.1-SNAPSHOT downloaded today.  Here is the new stacktrace:

{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:439)
        at 
org.apache.commons.vfs2.provider.AbstractFileObject.getOutputStream(AbstractFileObject.java:1377)
        at 
org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:479)
        at 
org.apache.commons.vfs2.provider.DefaultFileContent.getOutputStream(DefaultFileContent.java:458)
        at 
org.apache.commons.vfs2.provider.DefaultFileContent.write(DefaultFileContent.java:772)
        at 
org.apache.commons.vfs2.provider.DefaultFileContent.write(DefaultFileContent.java:796)
        at org.apache.commons.vfs2.FileUtil.copyContent(FileUtil.java:90)
        at 
org.apache.commons.vfs2.provider.AbstractFileObject.copyFrom(AbstractFileObject.java:341)
        ... 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:428)
        ... 9 more
{code}

I also found something else out, giving *execute* access, {{chmod 755 
/home/usera}} fixes the issue.  Write access to that folder is not needed.

> 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
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> 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)

Reply via email to