Author: manaRH
Date: 2009-01-07 08:32:21 -0500 (Wed, 07 Jan 2009)
New Revision: 9881
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/web/MultipartRequest.java
Log:
JBPAPP-1553
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/web/MultipartRequest.java
===================================================================
---
branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/web/MultipartRequest.java 2009-01-07
12:51:40 UTC (rev 9880)
+++
branches/enterprise/JBPAPP_4_3_FP01/src/main/org/jboss/seam/web/MultipartRequest.java 2009-01-07
13:32:21 UTC (rev 9881)
@@ -306,8 +306,11 @@
int pos = 0;
Param p = null;
+
+ // This is a fail-safe to prevent infinite loops from occurring in some
environments
+ int loopCounter = 20;
- while (read != -1)
+ 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
Show replies by date