Author: markt
Date: Sun Apr 11 13:37:51 2010
New Revision: 932896

URL: http://svn.apache.org/viewvc?rev=932896&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48760
Ensure multiple threads do not end up with the same InputStream



Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java
    tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=932896&r1=932895&r2=932896&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Sun Apr 11 13:37:51 2010
@@ -113,12 +113,6 @@ PATCHES PROPOSED TO BACKPORT:
   +1: markt, kkolinko
   -1: 
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48760
-  Ensure multiple threads do not end up with the same InputStream
-  http://svn.apache.org/viewvc?rev=920858&view=rev
-  +1: markt, kkolinko, rjung
-  -1: 
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48701
   Add system property to allow disabling enforcement of JSP.5.3
   The spec recommends, but does not require this enforcement.

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java?rev=932896&r1=932895&r2=932896&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/FileDirContext.java 
Sun Apr 11 13:37:51 2010
@@ -884,7 +884,7 @@ public class FileDirContext extends Base
 
 
     /**
-     * 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 {
@@ -924,7 +924,9 @@ public class FileDirContext extends Base
         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: 
tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java?rev=932896&r1=932895&r2=932896&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/WARDirContext.java 
Sun Apr 11 13:37:51 2010
@@ -938,7 +938,9 @@ public class WARDirContext extends BaseD
             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());

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=932896&r1=932895&r2=932896&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Sun Apr 11 13:37:51 2010
@@ -55,6 +55,11 @@
         the error page is defined. If a response has been committed, always
         include the error page. (markt)
       </fix>
+      <fix>
+        <bug>48760</bug>: Fix potential multi-threading issue in static 
resource
+        serving where multiple threads could try to use the the same
+        InputStream. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to