You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by im...@apache.org on 2005/05/25 10:21:50 UTC
svn commit: r178411 -
/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java
Author: imario
Date: Wed May 25 01:21:49 2005
New Revision: 178411
URL: http://svn.apache.org/viewcvs?rev=178411&view=rev
Log:
PR: 34942
Reported By: Jacob Kjome <hoju -at- visi.com>
Close old tarfile before recreating it
Modified:
jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java
Modified: jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java?rev=178411&r1=178410&r2=178411&view=diff
==============================================================================
--- jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java (original)
+++ jakarta/commons/proper/vfs/trunk/src/java/org/apache/commons/vfs/provider/tar/TarFileSystem.java Wed May 25 01:21:49 2005
@@ -27,7 +27,6 @@
import org.apache.commons.vfs.Selectors;
import org.apache.commons.vfs.VfsLog;
import org.apache.commons.vfs.provider.AbstractFileSystem;
-import org.apache.commons.vfs.provider.AbstractFileObject;
import org.apache.commons.vfs.provider.UriParser;
import org.apache.commons.vfs.provider.bzip2.Bzip2FileObject;
@@ -35,9 +34,9 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import java.util.ArrayList;
import java.util.zip.GZIPInputStream;
/**
@@ -154,17 +153,33 @@
// with an input stream.
if (this.file.exists())
{
- TarInputStream tarFile = createTarFile(this.file);
- this.tarFile = tarFile;
+ recreateTarFile();
+ }
+ }
+
+ private void recreateTarFile() throws FileSystemException
+ {
+ if (this.tarFile != null)
+ {
+ try
+ {
+ this.tarFile.close();
+ }
+ catch (IOException e)
+ {
+ throw new FileSystemException("vfs.provider.tar/close-tar-file.error", file, e);
+ }
+ tarFile = null;
}
+ TarInputStream tarFile = createTarFile(this.file);
+ this.tarFile = tarFile;
}
protected TarInputStream getTarFile() throws FileSystemException
{
if (tarFile == null && this.file.exists())
{
- TarInputStream tarFile = createTarFile(this.file);
- this.tarFile = tarFile;
+ recreateTarFile();
}
return tarFile;
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org