jvanzyl 01/05/13 17:50:09
Modified: src/java/org/apache/turbine/util/upload FileItem.java
Log:
- heeding fedor's advice :-) write() throws an Exception now.
Revision Changes Path
1.11 +13 -20
jakarta-turbine/src/java/org/apache/turbine/util/upload/FileItem.java
Index: FileItem.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine/src/java/org/apache/turbine/util/upload/FileItem.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- FileItem.java 2001/05/14 00:41:05 1.10
+++ FileItem.java 2001/05/14 00:50:09 1.11
@@ -93,7 +93,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rafal Krzewski</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sean Legassick</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
- * @version $Id: FileItem.java,v 1.10 2001/05/14 00:41:05 jvanzyl Exp $
+ * @version $Id: FileItem.java,v 1.11 2001/05/14 00:50:09 jvanzyl Exp $
*/
public class FileItem implements DataSource
{
@@ -403,20 +403,12 @@
* @param String full path to location where uploaded
* should be stored.
*/
- public boolean write(String file)
+ public void write(String file) throws Exception
{
if (inMemory())
{
- try
- {
- FileWriter writer = new FileWriter(file);
- writer.write(getString());
- return true;
- }
- catch (IOException ioe)
- {
- return false;
- }
+ FileWriter writer = new FileWriter(file);
+ writer.write(getString());
}
else if (storeLocation != null)
{
@@ -425,18 +417,19 @@
* in a temporary location so move it to the
* desired file.
*/
- if (storeLocation.renameTo(new File(file)))
- {
- return true;
- }
- else
+ if (storeLocation.renameTo(new File(file)) == false)
{
- return false;
+ throw new Exception(
+ "Cannot write uploaded file to disk!");
}
}
else
{
- return false;
- }
+ /*
+ * For whatever reason we cannot write the
+ * file to disk.
+ */
+ throw new Exception("Cannot write uploaded file to disk!");
+ }
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]