You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2013/04/22 12:33:43 UTC

svn commit: r1470435 - in /tomcat/trunk/java/org/apache/tomcat/util/http/fileupload: FileItem.java disk/DiskFileItem.java

Author: markt
Date: Mon Apr 22 10:33:43 2013
New Revision: 1470435

URL: http://svn.apache.org/r1470435
Log:
Clean-up: Remove unnecessary code.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java
    tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java?rev=1470435&r1=1470434&r2=1470435&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java Mon Apr 22 10:33:43 2013
@@ -20,7 +20,6 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 
 /**
@@ -46,7 +45,7 @@ import java.io.UnsupportedEncodingExcept
  * @version $Id$
  * @since 1.3 additionally implements FileItemHeadersSupport
  */
-public interface FileItem extends Serializable, FileItemHeadersSupport {
+public interface FileItem extends FileItemHeadersSupport {
 
     // ------------------------------- Methods from javax.activation.DataSource
 

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java?rev=1470435&r1=1470434&r2=1470435&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java Mon Apr 22 10:33:43 2013
@@ -24,8 +24,6 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
 import java.util.Map;
@@ -78,11 +76,6 @@ public class DiskFileItem
     // ----------------------------------------------------- Manifest constants
 
     /**
-     * The UID to use when serializing this instance.
-     */
-    private static final long serialVersionUID = 2237570099615271025L;
-
-    /**
      * Default content charset to be used when no explicit charset
      * parameter is provided by the sender. Media subtypes of the
      * "text" type are defined to have a default charset value of
@@ -157,11 +150,6 @@ public class DiskFileItem
     private transient File tempFile;
 
     /**
-     * File to allow for serialization of the content of this item.
-     */
-    private File dfosFile;
-
-    /**
      * The file items headers.
      */
     private FileItemHeaders headers;
@@ -638,55 +626,6 @@ public class DiskFileItem
                       Boolean.valueOf(isFormField()), getFieldName());
     }
 
-    // -------------------------------------------------- Serialization methods
-
-    /**
-     * Writes the state of this object during serialization.
-     *
-     * @param out The stream to which the state should be written.
-     *
-     * @throws IOException if an error occurs.
-     */
-    private void writeObject(ObjectOutputStream out) throws IOException {
-        // Read the data
-        if (dfos.isInMemory()) {
-            cachedContent = get();
-        } else {
-            cachedContent = null;
-            dfosFile = dfos.getFile();
-        }
-
-        // write out values
-        out.defaultWriteObject();
-    }
-
-    /**
-     * Reads the state of this object during deserialization.
-     *
-     * @param in The stream from which the state should be read.
-     *
-     * @throws IOException if an error occurs.
-     * @throws ClassNotFoundException if class cannot be found.
-     */
-    private void readObject(ObjectInputStream in)
-            throws IOException, ClassNotFoundException {
-        // read values
-        in.defaultReadObject();
-
-        OutputStream output = getOutputStream();
-        if (cachedContent != null) {
-            output.write(cachedContent);
-        } else {
-            FileInputStream input = new FileInputStream(dfosFile);
-            IOUtils.copy(input, output);
-            dfosFile.delete();
-            dfosFile = null;
-        }
-        output.close();
-
-        cachedContent = null;
-    }
-
     /**
      * Returns the file item headers.
      * @return The file items headers.



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