You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2014/07/11 19:12:04 UTC

[jira] [Commented] (VFS-531) Cannot "copyFrom" without access to create parent folder even if folder exists

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

Gary Gregory commented on VFS-531:
----------------------------------

Can you download and build trunk to see if that still happens? We hope to release 2.1 soon.

> 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)