[richfaces-svn-commits] JBoss Rich Faces SVN: r9273 - trunk/framework/impl/src/main/java/org/ajax4jsf/request.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Jun 27 07:56:47 EDT 2008


Author: andrei_exadel
Date: 2008-06-27 07:56:46 -0400 (Fri, 27 Jun 2008)
New Revision: 9273

Modified:
   trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
Log:
RF-3746 

Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
--- trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java	2008-06-27 11:41:11 UTC (rev 9272)
+++ trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java	2008-06-27 11:56:46 UTC (rev 9273)
@@ -334,7 +334,9 @@
     	encoding = request.getCharacterEncoding();
 
     	parameters = new HashMap<String, Param>();
-    	File file = null; 
+    	
+    	int loopCounter = 20; // 20 attempts to read not-readable data 
+ 
     	this.percentMap = getProgressData();
 
     	try {
@@ -351,7 +353,7 @@
 
     			Param p = null;
 
-    			while (read != -1) {
+    			while (read > 0 && loopCounter > 0) {
     				for (int i = 0; i < read; i++) {
     					switch (readState) {
     					case BOUNDARY: {
@@ -381,7 +383,7 @@
     											if (headers.containsKey(PARAM_FILENAME)) {
     												FileParam fp = new FileParam(paramName);
     												if (createTempFiles)
-    												file = fp.createTempFile();
+    												fp.createTempFile();
     												fp.setContentType(headers
     														.get(PARAM_CONTENT_TYPE));
     												fp.setFilename(decodeFileName(headers
@@ -452,6 +454,9 @@
     						System.arraycopy(buffer, pos, buffer, 0, bytesNotRead);
     						read = input.read(buffer, bytesNotRead, buffer.length
     								- bytesNotRead);
+    						if (read <= 0) {
+    							loopCounter--;
+    						}
     						read += bytesNotRead;
     					} else {
     						read = input.read(buffer);




More information about the richfaces-svn-commits mailing list