[jboss-cvs] jboss-seam/src/main/org/jboss/seam/web ...

Shane Bryzak sbryzak at redhat.com
Fri Mar 9 01:36:00 EST 2007


  User: sbryzak2
  Date: 07/03/09 01:36:00

  Modified:    src/main/org/jboss/seam/web  MultipartRequest.java
  Log:
  JBSEAM-965
  
  Revision  Changes    Path
  1.6       +57 -26    jboss-seam/src/main/org/jboss/seam/web/MultipartRequest.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: MultipartRequest.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/web/MultipartRequest.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- MultipartRequest.java	21 Feb 2007 16:33:31 -0000	1.5
  +++ MultipartRequest.java	9 Mar 2007 06:35:59 -0000	1.6
  @@ -175,6 +175,7 @@
            if (fOut != null)
            {
               fOut.write(data, start, length);
  +            fOut.flush();
            }
            else
            {
  @@ -187,6 +188,16 @@
         
         public byte[] getData()
         {
  +         if (fOut != null)
  +         {
  +            try
  +            {
  +               fOut.close();
  +            }
  +            catch (IOException ex) {}
  +            fOut = null;
  +         }
  +         
           if (bOut != null)
           {
              return bOut.toByteArray();
  @@ -207,6 +218,9 @@
                       read = fIn.read(buf);
                    }
                    bOut.flush();                 
  +
  +                  fIn.close();
  +                  tempFile.delete();
                    return bOut.toByteArray();
                 }
                 catch (IOException ex) { /* too bad? */}
  @@ -218,6 +232,16 @@
         
         public InputStream getInputStream()
         {
  +         if (fOut != null)
  +         {
  +            try
  +            {
  +               fOut.close();
  +            }
  +            catch (IOException ex) {}
  +            fOut = null;
  +         }
  +         
            if (bOut!=null)
            {
               return new ByteArrayInputStream(bOut.toByteArray());
  @@ -226,7 +250,14 @@
            {
               try
               {
  -               return new FileInputStream(tempFile);
  +               return new FileInputStream(tempFile) {
  +                  @Override
  +                  public void close() throws IOException
  +                  {
  +                     super.close();
  +                     tempFile.delete();
  +                  }
  +               };
               }
               catch (FileNotFoundException ex) { }
            }
  
  
  



More information about the jboss-cvs-commits mailing list