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-2237 workaround 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);
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;
+
/**
*/
@@ -195,15 +196,29 @@
if (!folderFile.exists())
folderFile.mkdirs();
file = new File(folder, fileName);
+ 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)
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);