martinc     2003/07/01 21:42:10

  Modified:    fileupload/src/java/org/apache/commons/fileupload
                        DefaultFileItem.java
  Log:
  Check for null before attempting to close streams in write().
  
  PR: 21221
  Submitted by: Peter Chase
  
  Revision  Changes    Path
  1.22      +22 -16    
jakarta-commons/fileupload/src/java/org/apache/commons/fileupload/DefaultFileItem.java
  
  Index: DefaultFileItem.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/fileupload/src/java/org/apache/commons/fileupload/DefaultFileItem.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- DefaultFileItem.java      24 Jun 2003 05:45:15 -0000      1.21
  +++ DefaultFileItem.java      2 Jul 2003 04:42:10 -0000       1.22
  @@ -429,21 +429,27 @@
                       }
                       finally
                       {
  -                        try
  +                        if (in != null)
                           {
  -                            in.close();
  +                            try
  +                            {
  +                                in.close();
  +                            }
  +                            catch (IOException e)
  +                            {
  +                                // ignore
  +                            }
                           }
  -                        catch (IOException e)
  +                        if (out != null)
                           {
  -                            // ignore
  -                        }
  -                        try
  -                        {
  -                            out.close();
  -                        }
  -                        catch (IOException e)
  -                        {
  -                            // ignore
  +                            try
  +                            {
  +                                out.close();
  +                            }
  +                            catch (IOException e)
  +                            {
  +                                // ignore
  +                            }
                           }
                       }
                   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to