Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Do nothing on close if there was no demand for the stream.

  • Loading branch information...
commit 719b66d1d08c747a93fa31284d101f3ec87f470d 1 parent 7b9ddd6
@alesj alesj authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/main/java/org/jboss/vfs/util/LazyInputStream.java
View
9 src/main/java/org/jboss/vfs/util/LazyInputStream.java
@@ -33,6 +33,9 @@
* Delaying opening stream from underlying virtual file as long as possible.
* Won't be opened if not used at all.
*
+ * Synchronization is very simplistic, as it's highly unlikely
+ * there will be a lot of concurrent requests.
+ *
* @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
*/
public class LazyInputStream extends InputStream
@@ -91,9 +94,13 @@ public int available() throws IOException
}
@Override
- public void close() throws IOException
+ public synchronized void close() throws IOException
{
+ if (stream == null)
+ return;
+
openStream().close();
+ stream = null; // reset the stream
}
@Override
Please sign in to comment.
Something went wrong with that request. Please try again.