commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 39375] New: - VFS is not able to rename or move read-only files
Date Fri, 21 Apr 2006 10:23:14 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39375>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39375

           Summary: VFS is not able to rename or move read-only files
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: VFS
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: atipal@gmail.com


I got this exception when I tried to move a read-only file.

Caused by: org.apache.commons.vfs.FileSystemException: Could not rename
"file:///appl/henrich/data_pp/agg_filter/in/data/msgp01-CF7193.DAT_TS_20060419141018"
because it is read-only.
        at
org.apache.commons.vfs.provider.AbstractFileObject.moveTo(AbstractFileObject.java:899)

I think the correct behaviour is to check the writability on the parent
directory and not on the file. So I think that a read-only file should be
deleteable, moveable but not changeable. The ability to move and the ability to
delete of a file should depend on the rights set on the directory, which
contains that file.

I recommend this change in code (it helped to me): 
Index: src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
===================================================================
--- src/java/org/apache/commons/vfs/provider/AbstractFileObject.java   
(revision 395811)
+++ src/java/org/apache/commons/vfs/provider/AbstractFileObject.java    (working
copy)
@@ -894,7 +894,7 @@
      */
     public void moveTo(FileObject destFile) throws FileSystemException
     {
-        if (!isWriteable())
+        if (!(getParent().isWriteable()))
         {
             throw new
FileSystemException("vfs.provider/rename-read-only.error", getName());
         }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message