You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jm...@apache.org on 2002/05/16 19:22:34 UTC

cvs commit: jakarta-turbine-2/src/java/org/apache/turbine/util/upload FileItem.java

jmcnally    02/05/16 10:22:33

  Modified:    src/java/org/apache/turbine/util/upload FileItem.java
  Log:
  patch by "Kelvin Tan" <ke...@relevanz.com>
  to remove the temp files on jvm exit
  
  patch by Will Glass-Husain" <wg...@forio.com> to use an
  output stream instead of writer.
  
  Revision  Changes    Path
  1.5       +7 -6      jakarta-turbine-2/src/java/org/apache/turbine/util/upload/FileItem.java
  
  Index: FileItem.java
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/upload/FileItem.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileItem.java	13 Apr 2002 17:08:20 -0000	1.4
  +++ FileItem.java	16 May 2002 17:22:33 -0000	1.5
  @@ -95,7 +95,7 @@
    * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
    * @author <a href="mailto:sean@informage.net">Sean Legassick</a>
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
  - * @version $Id: FileItem.java,v 1.4 2002/04/13 17:08:20 jmcnally Exp $
  + * @version $Id: FileItem.java,v 1.5 2002/05/16 17:22:33 jmcnally Exp $
    */
   public class FileItem implements DataSource
   {
  @@ -387,6 +387,7 @@
               fileName = instanceName + "_upload_" + fileName + ".tmp";
               fileName = path + "/" + fileName;
               item.storeLocation = new File(fileName);
  +            item.storeLocation.deleteOnExit();
           }
           else
           {
  @@ -409,17 +410,17 @@
       {
           if (inMemory())
           {
  -            FileWriter writer = null;
  +            FileOutputStream fout = null;
               try
               {
  -                writer = new FileWriter(file);
  -                writer.write(getString());
  +                fout = new FileOutputStream(file);
  +                fout.write(get());
               }
               finally
               {
  -                if (writer != null)
  +                if (fout != null)
                   {
  -                    writer.close();
  +                    fout.close();
                   }
               }
           }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>