commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary D. Gregory (Jira)" <j...@apache.org>
Subject [jira] [Comment Edited] (VFS-733) Parent layer of ZipFileSystem vanishes through OnCallRefreshFileObject
Date Sun, 06 Oct 2019 00:52:00 GMT

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

Gary D. Gregory edited comment on VFS-733 at 10/6/19 12:51 AM:
---------------------------------------------------------------

Please see the new (failing and ignored) unit test {{org.apache.commons.vfs2.provider.zip.Jira733TestCase}}.
You or anyone willing to help can test any PRs based on this test and the whole build.

The simplest way I found to fix this test and allow the whole build to pass of course, is
to not clear the {{FileObject}} for the parent layer, which seems OK at first glance since
closing other {{FileObject}}s _should_ be done elsewhere in VFS or in application code:
{code:none}
diff --git a/commons-vfs2/dummy.txt b/commons-vfs2/dummy.txt
new file mode 100644
index 0000000..47d2739
--- /dev/null
+++ b/commons-vfs2/dummy.txt
@@ -0,0 +1 @@
+new content
\ No newline at end of file
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
index 8132328..6f538e5 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/AbstractFileSystem.java
@@ -123,8 +123,6 @@
     @Override
     public void close() {
         closeCommunicationLink();
-
-        parentLayer = null;
     }
 
     /**
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/Jira733TestCase.java
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/Jira733TestCase.java
index 84d03e2..6d6f73f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/Jira733TestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/zip/Jira733TestCase.java
@@ -30,7 +30,6 @@
 import org.junit.Ignore;
 import org.junit.Test;
 
-@Ignore
 public class Jira733TestCase {
 
     @After
{code}
Either:
 - this fix is fine since we have no unit test failures as I mentioned, including the new
test I added.
 - this fix is not fine but we do not know because our unit tests are missing a use case.

Anyone care to opine?

Gary
  


was (Author: garydgregory):
Please see the new (failing and ignored) unit test {{org.apache.commons.vfs2.provider.zip.Jira733TestCase}}.
You or anyone willing to help can test any PRs based on this test and the whole build.

> Parent layer of ZipFileSystem vanishes through OnCallRefreshFileObject
> ----------------------------------------------------------------------
>
>                 Key: VFS-733
>                 URL: https://issues.apache.org/jira/browse/VFS-733
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.2, 2.4, 2.3, 2.4.1
>            Reporter: Falco
>            Priority: Major
>
> When using {{FileObject#exists}} and {{FileObject#getContent}} on a ZIP file (in any
order), the reference to the parent file system is set to {{null}}.
> {code}
> final FileObject zippedFile = new OnCallRefreshFileObject(fileInZip());
> assertNotNull(zippedFile.getFileSystem().getParentLayer());
> zippedFile.exists();
> zippedFile.getContent();
> assertNotNull(zippedFile.getFileSystem().getParentLayer()); // fails
> {code}
> For an executable example, refer to [https://github.com/f4lco/vfs-repro/blob/master/src/test/java/vfs/ZipParentLayerTest.java].
> I come to believe this does not work as intended. I'm also relatively clueless about
a potential fix or workaround. For me, this bug blocks upgrading from VFS 2.1.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message