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

Ivan Pryvalov updated VFS-260:
------------------------------

    Environment: 
commons-vfs-1.1-SNAPSHOT (checkouted at 21 of May 2009)

System: Windows XP Sp3, jdk1.5.0_16

  was:commons-vfs-1.1-SNAPSHOT (checkouted at 21 of May 2009)


> ZipFileObject does not release resources
> ----------------------------------------
>
>                 Key: VFS-260
>                 URL: https://issues.apache.org/jira/browse/VFS-260
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: commons-vfs-1.1-SNAPSHOT (checkouted at 21 of May 2009)
> System: Windows XP Sp3, jdk1.5.0_16
>            Reporter: Ivan Pryvalov
>
> Hello!
> I use commons-vfs (1.1-SNAPSHOT branch) and found that ZipFileObject does not 
> release resources
> correctly...
> See code of test-class (File newFile = new File(...); it is any zip file with 
> 1 or more file
> inside):
> /////////////////////////////////////
>               //code test
>               
>               FileSystemManager fsManager = VFS.getManager();         
>               FileObject fileObject = fsManager.toFileObject(newFile);
>               System.out.println("original file : "+fileObject.getURL());
>               FileObject zipFileObject = 
> fsManager.resolveFile("zip:"+fileObject.getURL());           
>               FileObject[] fileObjects = zipFileObject.getChildren();         
>               FileObject zipEntry = fileObjects[0];
>               System.out.println("zip entry : "+zipEntry.getURL());
>               
>               // open stream!!!!
>               zipEntry.getContent().getInputStream();
>               
>               //now try to close opened input stream...
>               zipEntry.getContent().close();
>               zipEntry.close();                               
>               
>               //only this one works
>               
> //VFS.getManager().closeFileSystem(zipFileObject.getFileSystem());
>               
>               
>               //test to rename
>               
>               File newFile2 = new File(newFile.getParentFile(), 
> newFile.getName()+"_2");
>               
>               System.out.println("newFile.exists() = "+newFile.exists());     
>         
>               System.out.println("newFile2.exists() = "+newFile2.exists());
>               
>               boolean result = newFile.renameTo(newFile2);
>               System.out.println("newFile.renameTo(newFile2)="+result);
>               
>               assertTrue(result);
>               
>               
>               /////end snippet test
>               //////////////////////////////////////////
> Truly yours,
> Ivan Pryvalov.

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

Reply via email to