Author: mmillson
Date: 2011-10-25 18:17:30 -0400 (Tue, 25 Oct 2011)
New Revision: 1855
Modified:
branches/2.1.x/java/org/apache/naming/resources/FileDirContext.java
branches/2.1.x/java/org/apache/naming/resources/WARDirContext.java
Log:
Fix concurrency issue with sharing InputStreams in JBossWeb [JBPAPP-7401].
Modified: branches/2.1.x/java/org/apache/naming/resources/FileDirContext.java
===================================================================
--- branches/2.1.x/java/org/apache/naming/resources/FileDirContext.java 2011-10-21
10:17:39 UTC (rev 1854)
+++ branches/2.1.x/java/org/apache/naming/resources/FileDirContext.java 2011-10-25
22:17:30 UTC (rev 1855)
@@ -878,7 +878,7 @@
/**
- * This specialized resource implementation avoids opening the IputStream
+ * This specialized resource implementation avoids opening the InputStream
* to the file right away (which would put a lock on the file).
*/
protected class FileResource extends Resource {
@@ -918,7 +918,9 @@
public InputStream streamContent()
throws IOException {
if (binaryContent == null) {
- inputStream = new FileInputStream(file);
+ FileInputStream fis = new FileInputStream(file);
+ inputStream = fis;
+ return fis;
}
return super.streamContent();
}
Modified: branches/2.1.x/java/org/apache/naming/resources/WARDirContext.java
===================================================================
--- branches/2.1.x/java/org/apache/naming/resources/WARDirContext.java 2011-10-21 10:17:39
UTC (rev 1854)
+++ branches/2.1.x/java/org/apache/naming/resources/WARDirContext.java 2011-10-25 22:17:30
UTC (rev 1855)
@@ -938,7 +938,9 @@
throws IOException {
try {
if (binaryContent == null) {
- inputStream = base.getInputStream(entry);
+ InputStream is = base.getInputStream(entry);
+ inputStream = is;
+ return is;
}
} catch (ZipException e) {
throw new IOException(e.getMessage());
Show replies by date