Author: andrei_exadel
Date: 2008-04-14 09:25:56 -0400 (Mon, 14 Apr 2008)
New Revision: 7796
Modified:
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
Log:
RF-3063
Modified: trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java
===================================================================
---
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-04-14
13:12:22 UTC (rev 7795)
+++
trunk/framework/impl/src/main/java/org/ajax4jsf/request/MultipartRequest.java 2008-04-14
13:25:56 UTC (rev 7796)
@@ -127,12 +127,19 @@
}
public Object getFile() {
- if (null != tempFile) {
- return tempFile;
- }else if (null != bOut) {
- return bOut.toByteArray();
- }
- return null;
+ if (null != tempFile) {
+ if (fOut != null) {
+ try {
+ fOut.close();
+ } catch (IOException ex) {
+ }
+ fOut = null;
+ }
+ return tempFile;
+ } else if (null != bOut) {
+ return bOut.toByteArray();
+ }
+ return null;
}
public String getFilename() {
@@ -160,7 +167,7 @@
tempFile = File.createTempFile(new UID().toString().replace(
":", "-"), ".upload");
- tempFile.deleteOnExit();
+ //tempFile.deleteOnExit();
fOut = new FileOutputStream(tempFile);
} catch (IOException ex) {
throw new FileUploadException("Could not create temporary file");
@@ -298,7 +305,7 @@
parameters = new HashMap<String, Param>();
File file = null;
- this.percentMap = getProgressData();
+ this.percentMap = getProgressData();
try {
byte[] buffer = new byte[BUFFER_SIZE];
@@ -429,7 +436,7 @@
return false;
}
}
-
+
return true;
} else {
if (file != null) {
@@ -579,8 +586,7 @@
return (p != null && p instanceof FileParam) ? ((FileParam) p)
.getFile() : null;
}
-
-
+
public String getFileName(String name) {
Param p = getParam(name);
return (p != null && p instanceof FileParam) ? ((FileParam) p)
Show replies by date