commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1339211 - in /commons/proper/vfs/trunk: core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java src/changes/changes.xml
Date Wed, 16 May 2012 15:03:59 GMT
Author: ggregory
Date: Wed May 16 15:03:58 2012
New Revision: 1339211

URL: http://svn.apache.org/viewvc?rev=1339211&view=rev
Log:
[VFS-258][SFTP][RAM] Unsafe casting to AbstractFileObject subclasses in doRename().

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
    commons/proper/vfs/trunk/src/changes/changes.xml

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java?rev=1339211&r1=1339210&r2=1339211&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/ram/RamFileObject.java
Wed May 16 15:03:58 2012
@@ -27,6 +27,8 @@ import org.apache.commons.vfs2.FileType;
 import org.apache.commons.vfs2.RandomAccessContent;
 import org.apache.commons.vfs2.provider.AbstractFileName;
 import org.apache.commons.vfs2.provider.AbstractFileObject;
+import org.apache.commons.vfs2.provider.local.LocalFile;
+import org.apache.commons.vfs2.util.FileObjectUtils;
 import org.apache.commons.vfs2.util.RandomAccessMode;
 
 /**
@@ -186,7 +188,8 @@ public class RamFileObject extends Abstr
     @Override
     protected void doRename(FileObject newFile) throws Exception
     {
-        fs.rename(this, (RamFileObject) newFile);
+        RamFileObject newRamFileObject = (RamFileObject) FileObjectUtils.getAbstractFileObject(newFile);
+        fs.rename(this, newRamFileObject);
     }
 
     /*

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java?rev=1339211&r1=1339210&r2=1339211&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
Wed May 16 15:03:58 2012
@@ -33,6 +33,7 @@ import org.apache.commons.vfs2.VFS;
 import org.apache.commons.vfs2.provider.AbstractFileName;
 import org.apache.commons.vfs2.provider.AbstractFileObject;
 import org.apache.commons.vfs2.provider.UriParser;
+import org.apache.commons.vfs2.provider.ram.RamFileObject;
 import org.apache.commons.vfs2.util.FileObjectUtils;
 import org.apache.commons.vfs2.util.MonitorInputStream;
 import org.apache.commons.vfs2.util.MonitorOutputStream;
@@ -288,7 +289,8 @@ public class SftpFileObject extends Abst
         final ChannelSftp channel = fileSystem.getChannel();
         try
         {
-            channel.rename(relPath, ((SftpFileObject) newFile).relPath);
+            SftpFileObject newSftpFileObject = (SftpFileObject) FileObjectUtils.getAbstractFileObject(newFile);
+            channel.rename(relPath, newSftpFileObject.relPath);
         }
         finally
         {

Modified: commons/proper/vfs/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1339211&r1=1339210&r2=1339211&view=diff
==============================================================================
--- commons/proper/vfs/trunk/src/changes/changes.xml (original)
+++ commons/proper/vfs/trunk/src/changes/changes.xml Wed May 16 15:03:58 2012
@@ -23,6 +23,9 @@
 
   <body>
     <release version="2.1" date="TBD" description="">
+      <action issue="VFS-258" dev="ggregory" type="update" due-to="mzawirski">
+        [SFTP][RAM] Unsafe casting to AbstractFileObject subclasses in doRename().
+      </action>
       <action issue="VFS-254" dev="ggregory" type="update" due-to="mzawirski">
         Let FileObject and FileContent extend java.io.Closeable.
       </action>



Mime
View raw message