[jira] [Created] (VFS-358) RamFileRandomAccessContent.close() does call RamFileObject.close().

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (VFS-358) RamFileRandomAccessContent.close() does call RamFileObject.close().

ASF GitHub Bot (Jira)
RamFileRandomAccessContent.close() does call RamFileObject.close().
-------------------------------------------------------------------

                 Key: VFS-358
                 URL: https://issues.apache.org/jira/browse/VFS-358
             Project: Commons VFS
          Issue Type: Bug
    Affects Versions: 1.0
            Reporter: Miroslav Pokorny


The problem manifests itself if one uses RandomAccessContent from a FileObject which is from ram://. Closing any stream from the RAC does not cleanup some counters which means future calls to FileObject.isContentOpen() return true which is wrong because the RAC.close().

The fix to RamFileRandomAccessContent.close() is a simple one liner.

    /*
     * (non-Javadoc)
     *
     * @see org.apache.commons.vfs.RandomAccessContent#close()
     */
    @Override
    public void close() throws IOException {
        // do not try and call rafis.close() which does nothing but call this method.
        this.file.close();
    }



--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Updated] (VFS-358) RamFileRandomAccessContent.close() does *NOT* call RamFileObject.close().

ASF GitHub Bot (Jira)

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

Miroslav Pokorny updated VFS-358:
---------------------------------

    Summary: RamFileRandomAccessContent.close() does *NOT* call RamFileObject.close().  (was: RamFileRandomAccessContent.close() does call RamFileObject.close().)

> RamFileRandomAccessContent.close() does *NOT* call RamFileObject.close().
> -------------------------------------------------------------------------
>
>                 Key: VFS-358
>                 URL: https://issues.apache.org/jira/browse/VFS-358
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 1.0
>            Reporter: Miroslav Pokorny
>
> The problem manifests itself if one uses RandomAccessContent from a FileObject which is from ram://. Closing any stream from the RAC does not cleanup some counters which means future calls to FileObject.isContentOpen() return true which is wrong because the RAC.close().
> The fix to RamFileRandomAccessContent.close() is a simple one liner.
>     /*
>      * (non-Javadoc)
>      *
>      * @see org.apache.commons.vfs.RandomAccessContent#close()
>      */
>     @Override
>     public void close() throws IOException {
>         // do not try and call rafis.close() which does nothing but call this method.
>         this.file.close();
>     }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (VFS-358) RamFileRandomAccessContent.close() does *NOT* call RamFileObject.close().

ASF GitHub Bot (Jira)
In reply to this post by ASF GitHub Bot (Jira)

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

Ralph Goers commented on VFS-358:
---------------------------------

From what I can see none of the RandomAccessContent implementations close their associated FileObject so I'm not sure why that should be done here. It seems to me the RandomAccessContent needs to be invalidated during close and any further calls should throw an exception.

> RamFileRandomAccessContent.close() does *NOT* call RamFileObject.close().
> -------------------------------------------------------------------------
>
>                 Key: VFS-358
>                 URL: https://issues.apache.org/jira/browse/VFS-358
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 1.0
>            Reporter: Miroslav Pokorny
>
> The problem manifests itself if one uses RandomAccessContent from a FileObject which is from ram://. Closing any stream from the RAC does not cleanup some counters which means future calls to FileObject.isContentOpen() return true which is wrong because the RAC.close().
> The fix to RamFileRandomAccessContent.close() is a simple one liner.
>     /*
>      * (non-Javadoc)
>      *
>      * @see org.apache.commons.vfs.RandomAccessContent#close()
>      */
>     @Override
>     public void close() throws IOException {
>         // do not try and call rafis.close() which does nothing but call this method.
>         this.file.close();
>     }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira