Author: manaRH
Date: 2011-09-29 10:05:50 -0400 (Thu, 29 Sep 2011)
New Revision: 14215
Modified:
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/web/MultipartRequestImpl.java
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/web/MultipartRequestImplTest.java
Log:
JBPAPP-6946 - rolled back part of patch from jira
Modified:
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/web/MultipartRequestImpl.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/web/MultipartRequestImpl.java 2011-09-28
20:20:37 UTC (rev 14214)
+++
branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/web/MultipartRequestImpl.java 2011-09-29
14:05:50 UTC (rev 14215)
@@ -428,40 +428,16 @@
{
// move the bytes that weren't read to the start of the buffer
int bytesNotRead = read - pos;
+ System.arraycopy(buffer, pos, buffer, 0, bytesNotRead);
+ read = input.read(buffer, bytesNotRead, buffer.length - bytesNotRead);
- if (buffer.length == bytesNotRead )
+ // Decrement loopCounter if no data was readable
+ if (read == 0)
{
- //if no end of parameter value can be found in the buffer, we have to
increase size of the buffer
-
- byte[] buffer1 = new byte[buffer.length * 2];
- System.arraycopy(buffer, 0, buffer1, 0, buffer.length);
- buffer = buffer1;
-
- read = input.read(buffer, bytesNotRead, buffer.length - bytesNotRead);
- if (read == -1)
- {
- break;// too bad - nothing more to read (EOF) and last parameter
value couldn't be parsed
- }
-
- read += bytesNotRead;
- }
- else
- {
- System.arraycopy(buffer, pos, buffer, 0, bytesNotRead);
- read = input.read(buffer, bytesNotRead, buffer.length -
bytesNotRead);
-
- if (read == -1)
- {
- break;
- // too bad - nothing more to read (EOF) and last parameter value
couldn't be parsed
- }
-
- if(read == 0)
- loopCounter--;
-
- read += bytesNotRead;
- }
+ loopCounter--;
+ }
+ read += bytesNotRead;
}
else
{
Modified:
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/web/MultipartRequestImplTest.java
===================================================================
---
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/web/MultipartRequestImplTest.java 2011-09-28
20:20:37 UTC (rev 14214)
+++
branches/enterprise/JBPAPP_5_0/src/test/unit/org/jboss/seam/test/unit/web/MultipartRequestImplTest.java 2011-09-29
14:05:50 UTC (rev 14215)
@@ -2,13 +2,12 @@
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
import java.util.Map;
-import org.testng.annotations.Test;
-import org.jboss.seam.web.MultipartRequestImpl;
+
import org.jboss.seam.mock.EnhancedMockHttpServletRequest;
+import org.jboss.seam.web.MultipartRequestImpl;
+import org.testng.annotations.Test;
public class MultipartRequestImplTest
{