commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mart...@apache.org
Subject cvs commit: jakarta-commons/fileupload/src/java/org/apache/commons/fileupload FileUploadBase.java
Date Fri, 23 Jan 2004 06:51:10 GMT
martinc     2004/01/22 22:51:10

  Modified:    fileupload/src/java/org/apache/commons/fileupload
                        FileUploadBase.java
  Log:
  Collapse some all but duplicated code.
  
  Revision  Changes    Path
  1.5       +12 -30    jakarta-commons/fileupload/src/java/org/apache/commons/fileupload/FileUploadBase.java
  
  Index: FileUploadBase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/fileupload/src/java/org/apache/commons/fileupload/FileUploadBase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FileUploadBase.java	9 Oct 2003 21:15:47 -0000	1.4
  +++ FileUploadBase.java	23 Jan 2004 06:51:10 -0000	1.5
  @@ -384,36 +384,18 @@
                       }
                       else
                       {
  -                        if (getFileName(headers) != null)
  +                        FileItem item = createItem(headers,
  +                                getFileName(headers) == null);
  +                        OutputStream os = item.getOutputStream();
  +                        try
                           {
  -                            // A single file.
  -                            FileItem item = createItem(headers, false);
  -                            OutputStream os = item.getOutputStream();
  -                            try
  -                            {
  -                                multi.readBodyData(os);
  -                            }
  -                            finally
  -                            {
  -                                os.close();
  -                            }
  -                            items.add(item);
  +                            multi.readBodyData(os);
                           }
  -                        else
  +                        finally
                           {
  -                            // A form field.
  -                            FileItem item = createItem(headers, true);
  -                            OutputStream os = item.getOutputStream();
  -                            try
  -                            {
  -                                multi.readBodyData(os);
  -                            }
  -                            finally
  -                            {
  -                                os.close();
  -                            }
  -                            items.add(item);
  +                            os.close();
                           }
  +                        items.add(item);
                       }
                   }
                   else
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message