commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mario Ivankovits (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (VFS-172) Cache of SFTP after move completely out of sync.
Date Fri, 10 Aug 2007 18:33:43 GMT

     [ https://issues.apache.org/jira/browse/VFS-172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Mario Ivankovits resolved VFS-172.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1
         Assignee: Mario Ivankovits

Applied - Thanks for the patch!
Also implemented the refresh() method now to make the CachePolicy work with sftp too.

Test case still works, so it looks good to me.


> Cache of SFTP after move completely out of sync.
> ------------------------------------------------
>
>                 Key: VFS-172
>                 URL: https://issues.apache.org/jira/browse/VFS-172
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 1.0
>            Reporter: Joerg Schaible
>            Assignee: Mario Ivankovits
>            Priority: Critical
>             Fix For: 1.1
>
>         Attachments: VFS-172.diff
>
>
> Simple test method. See all the bogus cases at the end:
> {code:java}
> 	public void testObjectsAfterMoveOfParentDoNotExistWithSFTP() throws IOException
> 	{
> 		final FileSystemOptions fsOptions = new FileSystemOptions();
> 		final FileSystemManager fsManager = VFS.getManager();
> 		final FileObject root = fsManager.resolveFile(SFTP_BASE_URL + "junit", fsOptions);
> 		if (!root.exists()) {
> 			root.createFolder();
> 		}
> 		assertTrue(root.exists());
> 		final FileObject target = root.resolveFile("target");
> 		if (!target.exists()) {
> 			target.createFolder();
> 		}
> 		assertTrue(target.exists());
> 		final FileObject work = root.resolveFile("work");
> 		if (!work.exists()) {
> 			work.createFolder();
> 		}
> 		assertTrue(work.exists());
> 		FileObject inWork = work.resolveFile("inWork");
> 		if (!inWork.exists()) {
> 			inWork.createFolder();
> 		}
> 		assertTrue(inWork.exists());
> 		final FileObject ready = target.resolveFile("ready-" + System.currentTimeMillis());
> 		assertFalse(ready.exists());
> 		work.moveTo(ready);
> 		assertTrue(ready.exists());
> 		assertFalse(work.exists());
> 		try {
> 			assertFalse(inWork.exists());
> 			fail("Thrown " + AssertionFailedError.class.getName() + " expected, because of buggy
implementation");
> 		} catch (final AssertionFailedError e) {
> 			// <sigh>
> 		}
> 		try {
> 			inWork.refresh();
> 			assertFalse(inWork.exists());
> 			fail("Thrown " + AssertionFailedError.class.getName() + " expected, because of buggy
implementation");
> 		} catch (final AssertionFailedError e) {
> 			// <sigh>
> 		}
> 		try {
> 			assertFalse(work.resolveFile("inWork").exists());
> 			fail("Thrown " + AssertionFailedError.class.getName() + " expected, because of buggy
implementation");
> 		} catch (final AssertionFailedError e) {
> 			// <sigh>
> 		}
> 		try {
> 			work.refresh();
> 			assertFalse(work.resolveFile("inWork").exists());
> 			fail("Thrown " + AssertionFailedError.class.getName() + " expected, because of buggy
implementation");
> 		} catch (final AssertionFailedError e) {
> 			// <sigh>
> 		}
> 		
> 		// it even possible to write into a file of the non-existing folder ...
> 		FileObject file = inWork.resolveFile("test.txt");
> 		OutputStream out = file.getContent().getOutputStream();
> 		out.write("Foo".getBytes());
> 		try {
> 			out.close();
> 		} catch(IOException e) {
> 			// ignore this
> 		}		
> 		assertTrue(file.exists());
> 		// force update of references
> 		file = null;
> 		out = null;
> 		inWork = null;
> 		System.gc();
> 		System.gc();
> 		// ... aaaaahhhh ... something changed
> 		assertFalse(work.resolveFile("inWork").exists());
> 	}
> {code}
> There's not a single possibility to tell VFS that the FileObject is bogus and even worse,
you can write into non-existing files of a non-existing folder without getting an Exception
...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message