Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.6.1
-
Component/s: ICE-Components
-
Labels:None
-
Environment:jsf 1.2, jboss 4.2, windows
-
ICEsoft Forum Reference:
-
Support Case References:
-
Affects:Documentation (User Guide, Ref. Guide, etc.)
Description
44 bytes is the length of the delimiter between parts of the multi-part stream. It seems that if the contents of the file is less than the size of the stream delimiter, then the input stream returns 0 bytes from the stream.
Activity
- All
- Comments
- History
- Activity
- Remote Attachments
- Subversion
suggested fix:
Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/inputfile/InputFile.java
===================================================================
— D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/inputfile/InputFile.java (revision 15197)
+++ D:/Documents and Settings/pbreau/workspace/ICEfaces/component/src/com/icesoft/faces/component/inputfile/InputFile.java (working copy)
@@ -59,7 +59,7 @@
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.OutputStream;
+import java.io.FileWriter;
import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
@@ -67,6 +67,7 @@
import java.util.Iterator;
+
/**
- InputFile is a JSF component class representing an ICEfaces inputFile.
*/
@@ -195,15 +196,29 @@
if (!folderFile.exists())
folderFile.mkdirs();
file = new File(folder, fileName);
- OutputStream output = new FileOutputStream(file);
- Streams.copy(stream.openStream(), output, true);
- if (file.length() == 0) { - setProgress(0); - file.delete(); - throw new FileUploadBase.FileUploadIOException( - new FileUploadBase.InvalidContentTypeException()); - }
- status = SAVED;
+ FileOutputStream output = new FileOutputStream(file);
+ byte[] buff = new byte[8192];
+ Streams.copy(stream.openStream(), output, true, buff);
+
+ //ICE-2237workaround for Commons File Upload not properly
+ //uploading small files through SSL
+ if (file.length() == 0 && buff[0] != 0)Unknown macro: {+ StringBuffer strBuff = new StringBuffer(8192);+ byte b = buff[0];+ int i = 0;+ while (b != 0) { + strBuff.append(b); + i++; + b = buff[i]; + }+ FileWriter out = new FileWriter(file);+ out.write(strBuff.toString());+ }else if (file.length() == 0)
{ + setProgress(0); + file.delete(); + throw new FileUploadBase.FileUploadIOException( + new FileUploadBase.InvalidContentTypeException()); + }status = SAVED;
fileInfo.setPhysicalPath(file.getAbsolutePath());
updateFileValueBinding(context);
notifyDone(bfc);
QA successfully tested it on ICEfaces trunk subversion 18006 + tomcat 6 on FF2, IE6, IE7, and opera9.2
Test Steps: