commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Woonsan Ko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (VFS-298) FTP: Exception is thrown when renaming a file
Date Tue, 06 May 2014 03:47:15 GMT

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

Woonsan Ko commented on VFS-298:
--------------------------------

Hi [~garydgregory],

I have reproducible code from my application unit test:

    @Test
    public void testFtpUnsupportedOperationException() throws Exception {
        // testRoot is a FileObject resolved @Before from something like ftp://username:password@localhost/pub/testRoot.
        FileObject file1 = fileSystemManager.resolveFile(testRoot, "sub1/sub2/file1.dat");
        file1.createFile();
        FileObject file2 = fileSystemManager.resolveFile(testRoot, "sub3/sub4/file2.dat");
        file2.getParent().createFolder();
        // NOTE: file1 should be re-resolved to reproduce this problem.
        file1 = fileSystemManager.resolveFile(testRoot, "sub1/sub2/file1.dat");
        file1.moveTo(file2);
    }

Then I see the following exception:

java.lang.UnsupportedOperationException
	at java.util.Collections$UnmodifiableMap.remove(Collections.java:1286)
	at org.apache.commons.vfs2.provider.ftp.FtpFileObject.onChildrenChanged(FtpFileObject.java:271)
	at org.apache.commons.vfs2.provider.AbstractFileObject.childrenChanged(AbstractFileObject.java:240)
	at org.apache.commons.vfs2.provider.AbstractFileObject.notifyParent(AbstractFileObject.java:1931)
	at org.apache.commons.vfs2.provider.AbstractFileObject.handleCreate(AbstractFileObject.java:1577)
	at org.apache.commons.vfs2.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1866)
...

When re-resolved, the parent folder such as sub1 and sub2 seem to be imaginary files and so
its children member seems unmodifiable. So, removing from unmodifiable children after notification
seems to fail.

Could you take look into it?

Thanks in advance,

Woonsan

> FTP: Exception is thrown when renaming a file
> ---------------------------------------------
>
>                 Key: VFS-298
>                 URL: https://issues.apache.org/jira/browse/VFS-298
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: Nightly Builds
>            Reporter: Kirill Safonov
>
> java.lang.UnsupportedOperationException
> 	at java.util.Collections$UnmodifiableMap.remove(Collections.java:1289)
> 	at org.apache.commons.vfs.provider.ftp.FtpFileObject.onChildrenChanged(FtpFileObject.java:288)
> 	at org.apache.commons.vfs.provider.AbstractFileObject.childrenChanged(AbstractFileObject.java:1612)
> 	at org.apache.commons.vfs.provider.AbstractFileObject.notifyParent(AbstractFileObject.java:1633)
> 	at org.apache.commons.vfs.provider.AbstractFileObject.handleDelete(AbstractFileObject.java:1558)
> 	at org.apache.commons.vfs.provider.AbstractFileObject.moveTo(AbstractFileObject.java:1078)
> FtpFileObject.children may be an EMPTY_FTP_FILE_MAP if the last ls() returned empty collection.
This is the case for the move untitled36/src/com/test/Base.as -> untitled36/src/Base.as:
> > CWD /opt/lampp/htdocs/ftp_root
> 250 Directory successfully changed.
> > RNFR untitled36/src/com/test/Base.as
> 350 Ready for RNTO.
> > RNTO untitled36/src/Base.as
> 250 Rename successful.
> > PWD
> 257 "/opt/lampp/htdocs/ftp_root"
> > CWD untitled36/src/com/test
> 250 Directory successfully changed.
> > PORT 192,168,0,112,51,217
> 200 PORT command successful. Consider using PASV.
> > LIST
> 150 Here comes the directory listing.
> 226 Directory send OK.
> (LIST returned no children)



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message