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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to