Author: imario
Date: Fri Apr 21 03:54:48 2006
New Revision: 395845
URL: http://svn.apache.org/viewcvs?rev=395845&view=rev
Log:
PR: 39375
Reported By: Attila Pal
Determine if the parent is writeable in case we move the file on the same
filesystem (rename)
Thanks for reporting it!
Modified:
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
Modified:
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties?rev=395845&r1=395844&r2=395845&view=diff
==============================================================================
---
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties
(original)
+++
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/Resources.properties
Fri Apr 21 03:54:48 2006
@@ -21,6 +21,7 @@
vfs.provider/list-children.error=Could not list the contents of folder "{0}".
vfs.provider/delete-read-only.error=Could not delete "{0}" because it is
read-only.
vfs.provider/rename-read-only.error=Could not rename "{0}" because it is
read-only.
+vfs.provider/rename-parent-read-only.error=Could not rename "{0}" because
"{1}" is read-only.
vfs.provider/rename-dest-exists.error=Destination "{0}" already existent.
vfs.provider/delete.error=Could not delete "{0}".
vfs.provider/rename.error=Could not rename "{0}" to "{1}".
Modified:
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
URL:
http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java?rev=395845&r1=395844&r2=395845&view=diff
==============================================================================
---
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
(original)
+++
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/AbstractFileObject.java
Fri Apr 21 03:54:48 2006
@@ -894,9 +894,19 @@
*/
public void moveTo(FileObject destFile) throws FileSystemException
{
- if (!isWriteable())
+ if (canRenameTo(destFile))
{
- throw new
FileSystemException("vfs.provider/rename-read-only.error", getName());
+ if (!getParent().isWriteable())
+ {
+ throw new
FileSystemException("vfs.provider/rename-parent-read-only.error", new
FileName[] {getName(), getParent().getName()});
+ }
+ }
+ else
+ {
+ if (!isWriteable())
+ {
+ throw new
FileSystemException("vfs.provider/rename-read-only.error", getName());
+ }
}
if (destFile.exists())
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]