[seam-commits] Seam SVN: r9807 - trunk/src/main/org/jboss/seam/web.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Thu Dec 18 19:21:30 EST 2008
Author: shane.bryzak at jboss.com
Date: 2008-12-18 19:21:30 -0500 (Thu, 18 Dec 2008)
New Revision: 9807
Modified:
trunk/src/main/org/jboss/seam/web/MultipartRequestImpl.java
Log:
Fix for infinite loop in some environments
Modified: trunk/src/main/org/jboss/seam/web/MultipartRequestImpl.java
===================================================================
--- trunk/src/main/org/jboss/seam/web/MultipartRequestImpl.java 2008-12-19 00:20:26 UTC (rev 9806)
+++ trunk/src/main/org/jboss/seam/web/MultipartRequestImpl.java 2008-12-19 00:21:30 UTC (rev 9807)
@@ -307,7 +307,10 @@
Param p = null;
- while (read != -1)
+ // This is a fail-safe to prevent infinite loops from occurring in some environments
+ int loopCounter = 20;
+
+ while (read > 0 && loopCounter > 0)
{
for (int i = 0; i < read; i++)
{
@@ -419,6 +422,13 @@
int bytesNotRead = read - pos;
System.arraycopy(buffer, pos, buffer, 0, bytesNotRead);
read = input.read(buffer, bytesNotRead, buffer.length - bytesNotRead);
+
+ // Decrement loopCounter if no data was readable
+ if (read == 0)
+ {
+ loopCounter--;
+ }
+
read += bytesNotRead;
}
else
More information about the seam-commits
mailing list