Author: markt
Date: Fri Mar 15 12:42:03 2013
New Revision: 1456934

URL: http://svn.apache.org/r1456934
Log:
Backport Commons FileUpload changes from trunk

Added:
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/disk/package-info.java
      - copied unchanged from r1456844, 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/disk/package-info.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/package-info.java
      - copied unchanged from r1456844, 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/package-info.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/servlet/package-info.java
      - copied unchanged from r1456844, 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/servlet/package-info.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/util/package-info.java
      - copied unchanged from r1456844, 
tomcat/trunk/java/org/apache/tomcat/util/http/fileupload/util/package-info.java
Removed:
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/package.html
Modified:
    tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/   (props 
changed)
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ProgressListener.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/RequestContext.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/servlet/ServletFileUpload.java
    
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java

Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Mar 15 12:42:03 2013
@@ -0,0 +1,2 @@
+/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload:605690-1453202
+/tomcat/trunk/java/org/apache/tomcat/util/http/fileupload:1156115-1157160,1157162-1157859,1157862-1157942,1157945-1160347,1160349-1163716,1163718-1166689,1166691-1174340,1174342-1175596,1175598-1175611,1175613-1175932,1175934-1177783,1177785-1177980,1178006-1180720,1180722-1183094,1183096-1187753,1187755,1187775,1187801,1187806,1187809,1187826-1188312,1188314-1188401,1188646-1188840,1188842-1190176,1190178-1195223,1195225-1195953,1195955,1195957-1201238,1201240-1203345,1203347-1206623,1206625-1208046,1208073,1208096,1208114,1208145,1208772,1209194-1212125,1212127-1220291,1220293,1220295-1221321,1221323-1222328,1222332-1222401,1222405-1222795,1222850-1222950,1222969-1225326,1225328-1225463,1225465,1225627,1225629-1226534,1226536-1228908,1228911-1228923,1228927-1229532,1229534-1230766,1230768-1231625,1231627-1233414,1233419-1235207,1235209-1237425,1237427,1237429-1237977,1237981,1237985,1237995,1238070,1238073,1239024-1239048,1239050-1239062,1239135,1239256,1239258-1239485,123
 
9785-1240046,1240101,1240106,1240109,1240112,1240114,1240116,1240118,1240121,1240329,1240474-1240850,1240857,1241087,1241160,1241408-1241822,1241908-1241909,1241912-1242110,1242371-1292130,1292134-1292458,1292464-1292670,1292672-1292776,1292780-1293392,1293397-1297017,1297019-1297963,1297965-1299820,1300108,1300111-1300460,1300520-1300948,1300997,1301006,1301280,1302332,1302348,1302608-1302610,1302649,1302837,1303138,1303163,1303338,1303521,1303587,1303698,1303803,1303852,1304011,1304035,1304037,1304135,1304249,1304253,1304260,1304271,1304275,1304468,1304895,1304930-1304932,1305194,1305943,1305965,1306556,1306579-1306580,1307084,1307310,1307511-1307512,1307579,1307591,1307597,1310636,1310639-1310640,1310642,1310701,1311212,1311995,1327617,1327670,1331766,1333161,1333173,1333827,1334787,1335026,1335257,1335547,1335692,1335711,1335731,1336515,1336813,1336864,1336868,1336884,1337419,1337426,1337546,1337572,1337591-1337595,1337643,1337707,1337719,1337734,1337741,1337745,1338151-
 
1338154,1338178,1342027,1342029,1342315,1342320,1342476,1342498,1342503,1342717,1342795,1342805,1343044-1343046,1343335,1343394,1343400,1343629,1343708,1343718,1343895,1344063,1344068,1344250,1344266,1344515,1344528,1344612,1344629,1344725,1344868,1344890,1344893,1344896,1344901,1345020,1345029,1345039,1345287-1345290,1345294,1345309,1345325,1345357,1345367,1345579-1345580,1345582,1345688,1345699,1345704,1345731-1345732,1345737,1345744,1345752,1345754,1345779,1345781,1345846,1346107,1346376,1346404,1346510,1346514,1346519,1346581,1346635,1346644,1346683,1346794,1346885,1346932,1347034,1347047,1347087,1347108-1347109,1347583,1347737,1348105,1348357,1348398,1348425,1348461-1348495,1348498,1348752,1348762,1348772,1348776,1348859,1348968,1348973,1348989,1349007,1349237,1349298,1349317,1349410,1349473,1349539,1349879,1349887,1349893,1349922,1349984,1350124,1350241,1350243,1350294-1350295,1350299,1350864,1350900,1351010,1351054,1351056,1351068,1351134-1351135,1351148,1351259,13516
 
04,1351636-1351640,1351991,1351993,1352011,1352056,1352059,1352661,1352663,1352788,1352799,1353087,1353125,1353240,1353261,1353414,1353468,1353501,1353581,1353708,1354137,1354170,1354197,1354255,1354362,1354375,1354469,1354664,1354685,1354817,1354847,1354856,1355726,1355810,1356006-1356007,1356014,1356045,1356125,1356422,1356505,1356898,1357042,1357401,1357407,1358586,1358590,1358612-1358613,1359102,1359340,1359981,1360059,1360455,1360460,1360838,1360847,1360892,1360942,1361263,1361430,1361754-1361755,1361762,1361769,1361772,1361962,1361982,1361985,1361991,1364141,1364149,1364411-1364412,1364448,1366708,1366720,1366729,1366734,1366910,1366945,1366953,1366959,1367214,1370346,1370364,1370373,1370386,1370473,1370537,1370549,1370553,1370879,1370916,1370958,1370960,1370973,1371017,1371283,1371336,1371620,1371812,1371823,1371896,1371976,1371978,1371995,1371999,1372131,1372152,1372156,1372390,1373003,1373080,1373142,1373488,1373578,1373618,1373622,1373666,1373985,1373987,1373990,13
 
73993,1374000,1374019,1374823,1376994,1377078,1377292,1377311,1377342,1377433,1377444,1377516,1377518-1377519,1377532,1377535,1377544,1377689,1377785,1377794,1377811,1377824,1377827,1377831,1377852-1377853,1377887,1377900,1378322,1378361,1378394,1378699,1378715,1378818,1378868,1378918,1379047,1379090,1379178,1379206,1379213,1379418,1379580,1379590,1379639,1379647,1379649,1379665,1379733,1379735,1380066,1380073,1380075,1380635,1380637,1380838,1381411,1381623,1382314,1382343,1382366,1382515,1382832,1382842,1385336,1387937,1388709,1390882,1392098,1392619,1393071,1393115,1396615,1396723,1397086,1397464,1397466,1397472,1397482,1397484,1397839,1397868,1397944,1399022,1401472,1401792,1401808,1401814,1402113,1402122,1402345,1402348,1402350,1402428,1402573,1402576,1402600-1402601,1402622,1402643,1402837,1402855,1403099,1403468,1404374,1404658,1404704,1404773,1404917-1404918,1405133,1405168,1405321,1405353,1405357,1405364,1405397,1405399-1405400,1405415,1405435,1405676,1405681,1406456
 
,1406481,1406526,1407595,1407619,1408043,1408148,1408154,1408156,1408159,1408163-1408165,1408248,1408438,1408504,1408513-1408517,1408562-1408565,1408714,1408721,1408739,1408750,1408774,1408792,1408872-1408876,1408906,1408934,1409007,1409030,1410466,1410545,1410609,1410611,1410632,1410714,1410763-1410764,1410766,1411585,1411993,1412575,1413552,1413556,1413562,1414053,1414113,1414215,1414889,1415177-1415179,1415186,1416458,1416481,1416501,1416529,1416534-1416535,1416658,1417201,1417224,1417282,1417347-1417348,1417353,1417363,1417365,1417370-1417372,1417463,1417465,1417467,1417469,1417476,1424894,1425502,1427013,1427757,1427784,1427804,1427846,1428010,1428079,1428283,1428355,1428403,1428643,1428869,1428959,1428993,1429123,1429153,1429167,1429173,1429179-1429180,1429182,1429356,1429687,1429745,1429784,1429836,1429863,1429946,1429969,1430079,1430147,1430165,1430445,1430448,1430481,1430487,1430508,1430550,1430567,1430771,1430773,1430775,1430791,1430799,1430806,1430809,1430921,1431
 
164,1431171,1431206,1431221,1431293,1431298,1431302,1431308,1431310,1431320,1431661,1431920,1431990,1434660,1434685,1434882,1435606,1435636,1435642,1435767,1437317,1437337,1437505,1437637,1437649,1437743,1437891,1437897,1437903,1438411,1438463,1439054,1439334,1439434,1439442,1439445,1439667,1440095,1440622,1440911,1441342,1441348,1441403,1441416,1441428,1441895,1443350,1443405,1443427,1445111,1445125,1445190,1445208,1445212,1445328,1445337,1445520,1446108,1446137,1446357,1446612,1446640,1446650,1447012,1447178,1447791,1447817-1447818,1448117,1448121,1448125,1448826,1449225,1449406,1450990,1451053,1451061,1451105,1451408,1451434,1451769,1451938-1451939,1451947,1451955-1451956,1452295,1452501,1452707,1452719,1452721,1452752,1453105,1453112,1453435,1453439,1453490,1453544,1453549,1453621,1454828,1454832,1454953,1455854,1455973,1456083,1456440,1456453,1456491,1456494,1456657,1456666,1456678,1456706,1456713,1456716,1456721,1456740,1456762,1456766,1456822,1456844,1456863

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java 
(original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItem.java 
Fri Mar 15 12:42:03 2013
@@ -50,7 +50,7 @@ import java.io.UnsupportedEncodingExcept
  *
  * @version $Id$
  */
-public interface FileItem extends Serializable {
+public interface FileItem extends Serializable, FileItemHeadersSupport {
 
 
     // ------------------------------- Methods from javax.activation.DataSource

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileItemHeaders.java
 Fri Mar 15 12:42:03 2013
@@ -44,34 +44,29 @@ public interface FileItemHeaders {
     /**
      * <p>
      * Returns all the values of the specified item header as an
-     * <code>Enumeration</code> of <code>String</code> objects.
+     * <code>Iterator</code> of <code>String</code> objects.
      * </p>
      * <p>
      * If the item did not include any headers of the specified name, this
-     * method returns an empty <code>Enumeration</code>. The header name is
+     * method returns an empty <code>Iterator</code>. The header name is
      * case insensitive.
      * </p>
      *
      * @param name a <code>String</code> specifying the header name
-     * @return an <code>Enumeration</code> containing the values of the
+     * @return an <code>Iterator</code> containing the values of the
      *         requested header. If the item does not have any headers of
-     *         that name, return an empty <code>Enumeration</code>
+     *         that name, return an empty <code>Iterator</code>
      */
     Iterator<String> getHeaders(String name);
 
     /**
      * <p>
-     * Returns an <code>Enumeration</code> of all the header names.
-     * </p>
-     * <p>
-     * If the item did not include any headers of the specified name, this
-     * method returns an empty <code>Enumeration</code>. The header name is
-     * case insensitive.
+     * Returns an <code>Iterator</code> of all the header names.
      * </p>
      *
-     * @return an <code>Enumeration</code> containing the values of the
-     *         requested header. If the item does not have any headers of
-     *         that name return an empty <code>Enumeration</code>
+     * @return an <code>Iterator</code> containing all of the names of
+     *         headers provided with this file item. If the item does not have
+     *         any headers return an empty <code>Iterator</code>
      */
     Iterator<String> getHeaderNames();
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/FileUploadBase.java
 Fri Mar 15 12:42:03 2013
@@ -20,7 +20,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.Charset;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -327,7 +326,7 @@ public abstract class FileUploadBase {
                 }
                 if (fileItem instanceof FileItemHeadersSupport) {
                     final FileItemHeaders fih = item.getHeaders();
-                    ((FileItemHeadersSupport) fileItem).setHeaders(fih);
+                    fileItem.setHeaders(fih);
                 }
             }
             successful = true;
@@ -338,8 +337,7 @@ public abstract class FileUploadBase {
             throw new FileUploadException(e.getMessage(), e);
         } finally {
             if (!successful) {
-                for (Iterator<FileItem> iterator = items.iterator(); 
iterator.hasNext();) {
-                    FileItem fileItem = iterator.next();
+                for (FileItem fileItem : items) {
                     try {
                         fileItem.delete();
                     } catch (Exception e) {
@@ -367,7 +365,7 @@ public abstract class FileUploadBase {
         parser.setLowerCaseNames(true);
         // Parameter parser can handle null input
         Map<String,String> params =
-            parser.parse(contentType, new char[] {';', ','});
+                parser.parse(contentType, new char[] {';', ','});
         String boundaryStr = params.get("boundary");
 
         if (boundaryStr == null) {
@@ -448,8 +446,7 @@ public abstract class FileUploadBase {
             ParameterParser parser = new ParameterParser();
             parser.setLowerCaseNames(true);
             // Parameter parser can handle null input
-            Map<String,String> params =
-                parser.parse(pContentDisposition, ';');
+            Map<String,String> params = parser.parse(pContentDisposition, ';');
             fieldName = params.get("name");
             if (fieldName != null) {
                 fieldName = fieldName.trim();

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/MultipartStream.java
 Fri Mar 15 12:42:03 2013
@@ -86,25 +86,36 @@ import org.apache.tomcat.util.http.fileu
  * @version $Id$
  */
 public class MultipartStream {
+
     /**
      * Internal class, which is used to invoke the
      * {@link ProgressListener}.
      */
     public static class ProgressNotifier {
-        /** The listener to invoke.
+        /**
+         * The listener to invoke.
          */
         private final ProgressListener listener;
-        /** Number of expected bytes, if known, or -1.
+
+        /**
+         * Number of expected bytes, if known, or -1.
          */
         private final long contentLength;
-        /** Number of bytes, which have been read so far.
+
+        /**
+         * Number of bytes, which have been read so far.
          */
         private long bytesRead;
-        /** Number of items, which have been read so far.
+
+        /**
+         * Number of items, which have been read so far.
          */
         private int items;
-        /** Creates a new instance with the given listener
+
+        /**
+         * Creates a new instance with the given listener
          * and content length.
+         *
          * @param pListener The listener to invoke.
          * @param pContentLength The expected content length.
          */
@@ -112,7 +123,10 @@ public class MultipartStream {
             listener = pListener;
             contentLength = pContentLength;
         }
-        /** Called to indicate that bytes have been read.
+
+        /**
+         * Called to indicate that bytes have been read.
+         *
          * @param pBytes Number of bytes, which have been read.
          */
         void noteBytesRead(int pBytes) {
@@ -122,126 +136,110 @@ public class MultipartStream {
             bytesRead += pBytes;
             notifyListener();
         }
-        /** Called to indicate, that a new file item has been detected.
+
+        /**
+         * Called to indicate, that a new file item has been detected.
          */
         void noteItem() {
             ++items;
             notifyListener();
         }
-        /** Called for notifying the listener.
+
+        /**
+         * Called for notifying the listener.
          */
         private void notifyListener() {
             if (listener != null) {
                 listener.update(bytesRead, contentLength, items);
             }
         }
+
     }
 
     // ----------------------------------------------------- Manifest constants
 
-
     /**
      * The Carriage Return ASCII character value.
      */
     public static final byte CR = 0x0D;
 
-
     /**
      * The Line Feed ASCII character value.
      */
     public static final byte LF = 0x0A;
 
-
     /**
      * The dash (-) ASCII character value.
      */
     public static final byte DASH = 0x2D;
 
-
     /**
      * The maximum length of <code>header-part</code> that will be
      * processed (10 kilobytes = 10240 bytes.).
      */
     public static final int HEADER_PART_SIZE_MAX = 10240;
 
-
     /**
      * The default length of the buffer used for processing a request.
      */
     protected static final int DEFAULT_BUFSIZE = 4096;
 
-
     /**
      * A byte sequence that marks the end of <code>header-part</code>
      * (<code>CRLFCRLF</code>).
      */
-    protected static final byte[] HEADER_SEPARATOR = {
-        CR, LF, CR, LF };
-
+    protected static final byte[] HEADER_SEPARATOR = { CR, LF, CR, LF };
 
     /**
      * A byte sequence that that follows a delimiter that will be
      * followed by an encapsulation (<code>CRLF</code>).
      */
-    protected static final byte[] FIELD_SEPARATOR = {
-        CR, LF};
-
+    protected static final byte[] FIELD_SEPARATOR = { CR, LF};
 
     /**
      * A byte sequence that that follows a delimiter of the last
      * encapsulation in the stream (<code>--</code>).
      */
-    protected static final byte[] STREAM_TERMINATOR = {
-        DASH, DASH};
-
+    protected static final byte[] STREAM_TERMINATOR = { DASH, DASH};
 
     /**
      * A byte sequence that precedes a boundary (<code>CRLF--</code>).
      */
-    protected static final byte[] BOUNDARY_PREFIX = {
-        CR, LF, DASH, DASH};
-
+    protected static final byte[] BOUNDARY_PREFIX = { CR, LF, DASH, DASH};
 
     // ----------------------------------------------------------- Data members
 
-
     /**
      * The input stream from which data is read.
      */
     private final InputStream input;
 
-
     /**
      * The length of the boundary token plus the leading <code>CRLF--</code>.
      */
     private int boundaryLength;
 
-
     /**
      * The amount of data, in bytes, that must be kept in the buffer in order
      * to detect delimiters reliably.
      */
     private int keepRegion;
 
-
     /**
      * The byte sequence that partitions the stream.
      */
     private byte[] boundary;
 
-
     /**
      * The length of the buffer used for processing the request.
      */
     private final int bufSize;
 
-
     /**
      * The buffer used for processing the request.
      */
     private final byte[] buffer;
 
-
     /**
      * The index of first valid character in the buffer.
      * <br>
@@ -249,7 +247,6 @@ public class MultipartStream {
      */
     private int head;
 
-
     /**
      * The index of last valid character in the buffer + 1.
      * <br>
@@ -257,13 +254,11 @@ public class MultipartStream {
      */
     private int tail;
 
-
     /**
      * The content encoding to use when reading headers.
      */
     private String headerEncoding;
 
-
     /**
      * The progress notifier, if any, or null.
      */
@@ -312,7 +307,6 @@ public class MultipartStream {
         tail = 0;
     }
 
-
     /**
      * <p> Constructs a <code>MultipartStream</code> with a default size 
buffer.
      *
@@ -333,12 +327,10 @@ public class MultipartStream {
 
     // --------------------------------------------------------- Public methods
 
-
     /**
      * Retrieves the character encoding used when reading the headers of an
      * individual part. When not specified, or <code>null</code>, the platform
      * default encoding is used.
-
      *
      * @return The encoding used to read part headers.
      */
@@ -346,7 +338,6 @@ public class MultipartStream {
         return headerEncoding;
     }
 
-
     /**
      * Specifies the character encoding to be used when reading the headers of
      * individual parts. When not specified, or <code>null</code>, the platform
@@ -358,7 +349,6 @@ public class MultipartStream {
         headerEncoding = encoding;
     }
 
-
     /**
      * Reads a byte from the <code>buffer</code>, and refills it as
      * necessary.
@@ -384,7 +374,6 @@ public class MultipartStream {
         return buffer[head++];
     }
 
-
     /**
      * Skips a <code>boundary</code> token, and checks whether more
      * <code>encapsulations</code> are contained in the stream.
@@ -428,7 +417,6 @@ public class MultipartStream {
         return nextChunk;
     }
 
-
     /**
      * <p>Changes the boundary token used for partitioning the stream.
      *
@@ -458,7 +446,6 @@ public class MultipartStream {
                 boundary.length);
     }
 
-
     /**
      * <p>Reads the <code>header-part</code> of the current
      * <code>encapsulation</code>.
@@ -474,8 +461,7 @@ public class MultipartStream {
      *
      * @throws MalformedStreamException if the stream ends unexpecetedly.
      */
-    public String readHeaders()
-    throws MalformedStreamException {
+    public String readHeaders() throws MalformedStreamException {
         int i = 0;
         byte b;
         // to support multi-byte characters
@@ -516,7 +502,6 @@ public class MultipartStream {
         return headers;
     }
 
-
     /**
      * <p>Reads <code>body-data</code> from the current
      * <code>encapsulation</code> and writes its contents into the
@@ -562,13 +547,10 @@ public class MultipartStream {
      * @throws MalformedStreamException if the stream ends unexpectedly.
      * @throws IOException              if an i/o error occurs.
      */
-    public int discardBodyData()
-    throws MalformedStreamException,
-    IOException {
+    public int discardBodyData() throws MalformedStreamException, IOException {
         return readBodyData(null);
     }
 
-
     /**
      * Finds the beginning of the first <code>encapsulation</code>.
      *
@@ -577,8 +559,7 @@ public class MultipartStream {
      *
      * @throws IOException if an i/o error occurs.
      */
-    public boolean skipPreamble()
-    throws IOException {
+    public boolean skipPreamble() throws IOException {
         // First delimiter may be not preceeded with a CRLF.
         System.arraycopy(boundary, 2, boundary, 0, boundary.length - 2);
         boundaryLength = boundary.length - 2;
@@ -600,7 +581,6 @@ public class MultipartStream {
         }
     }
 
-
     /**
      * Compares <code>count</code> first bytes in the arrays
      * <code>a</code> and <code>b</code>.
@@ -623,7 +603,6 @@ public class MultipartStream {
         return true;
     }
 
-
     /**
      * Searches for a byte of specified value in the <code>buffer</code>,
      * starting at the specified <code>position</code>.
@@ -645,7 +624,6 @@ public class MultipartStream {
         return -1;
     }
 
-
     /**
      * Searches for the <code>boundary</code> in the <code>buffer</code>
      * region delimited by <code>head</code> and <code>tail</code>.
@@ -681,10 +659,12 @@ public class MultipartStream {
      * Thrown to indicate that the input stream fails to follow the
      * required syntax.
      */
-    public static class MalformedStreamException
-            extends IOException {
+    public static class MalformedStreamException extends IOException {
 
-        private static final long serialVersionUID = 1L;
+        /**
+         * The UID to use when serializing this instance.
+         */
+        private static final long serialVersionUID = 6466926458059796677L;
 
         /**
          * Constructs a <code>MalformedStreamException</code> with no
@@ -703,16 +683,19 @@ public class MultipartStream {
         public MalformedStreamException(String message) {
             super(message);
         }
-    }
 
+    }
 
     /**
      * Thrown upon attempt of setting an invalid boundary token.
      */
-    public static class IllegalBoundaryException
-            extends IOException {
+    public static class IllegalBoundaryException extends IOException {
 
-        private static final long serialVersionUID = 1L;
+
+        /**
+         * The UID to use when serializing this instance.
+         */
+        private static final long serialVersionUID = -161533165102632918L;
 
         /**
          * Constructs an <code>IllegalBoundaryException</code> with no
@@ -731,23 +714,32 @@ public class MultipartStream {
         public IllegalBoundaryException(String message) {
             super(message);
         }
+
     }
 
     /**
      * An {@link InputStream} for reading an items contents.
      */
     public class ItemInputStream extends InputStream implements Closeable {
-        /** The number of bytes, which have been read so far.
+
+        /**
+         * The number of bytes, which have been read so far.
          */
         private long total;
-        /** The number of bytes, which must be hold, because
+
+        /**
+         * The number of bytes, which must be hold, because
          * they might be a part of the boundary.
          */
         private int pad;
-        /** The current offset in the buffer.
+
+        /**
+         * The current offset in the buffer.
          */
         private int pos;
-        /** Whether the stream is already closed.
+
+        /**
+         * Whether the stream is already closed.
          */
         private boolean closed;
 
@@ -775,6 +767,7 @@ public class MultipartStream {
         /**
          * Returns the number of bytes, which have been read
          * by the stream.
+         *
          * @return Number of bytes, which have been read so far.
          */
         public long getBytesRead() {
@@ -784,6 +777,7 @@ public class MultipartStream {
         /**
          * Returns the number of bytes, which are currently
          * available, without blocking.
+         *
          * @throws IOException An I/O error occurs.
          * @return Number of bytes in the buffer.
          */
@@ -795,12 +789,14 @@ public class MultipartStream {
             return pos - head;
         }
 
-        /** Offset when converting negative bytes to integers.
+        /**
+         * Offset when converting negative bytes to integers.
          */
         private static final int BYTE_POSITIVE_OFFSET = 256;
 
         /**
          * Returns the next byte in the stream.
+         *
          * @return The next byte in the stream, as a non-negative
          *   integer, or -1 for EOF.
          * @throws IOException An I/O error occurred.
@@ -825,6 +821,7 @@ public class MultipartStream {
 
         /**
          * Reads bytes into the given buffer.
+         *
          * @param b The destination buffer, where to write to.
          * @param off Offset of the first byte in the buffer.
          * @param len Maximum number of bytes to read.
@@ -856,6 +853,7 @@ public class MultipartStream {
 
         /**
          * Closes the input stream.
+         *
          * @throws IOException An I/O error occurred.
          */
         @Override
@@ -865,6 +863,7 @@ public class MultipartStream {
 
         /**
          * Closes the input stream.
+         *
          * @param pCloseUnderlying Whether to close the underlying stream
          *   (hard close)
          * @throws IOException An I/O error occurred.
@@ -893,6 +892,7 @@ public class MultipartStream {
 
         /**
          * Skips the given number of bytes.
+         *
          * @param bytes Number of bytes to skip.
          * @return The number of bytes, which have actually been
          *   skipped.
@@ -917,6 +917,7 @@ public class MultipartStream {
 
         /**
          * Attempts to read more data.
+         *
          * @return Number of available bytes
          * @throws IOException An I/O error occurred.
          */
@@ -958,11 +959,14 @@ public class MultipartStream {
 
         /**
          * Returns, whether the stream is closed.
+         *
          * @return True, if the stream is closed, otherwise false.
          */
         @Override
         public boolean isClosed() {
             return closed;
         }
+
     }
+
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ParameterParser.java
 Fri Mar 15 12:42:03 2013
@@ -22,7 +22,8 @@ import java.util.Map;
 
 /**
  * A simple parser intended to parse sequences of name/value pairs.
- * Parameter values are exptected to be enclosed in quotes if they
+ *
+ * Parameter values are expected to be enclosed in quotes if they
  * contain unsafe characters, such as '=' characters or separators.
  * Parameter values are optional and can be omitted.
  *
@@ -32,8 +33,8 @@ import java.util.Map;
  *
  * @author <a href="mailto:o...@ural.ru";>Oleg Kalnichevski</a>
  */
-
 public class ParameterParser {
+
     /**
      * String to be parsed.
      */
@@ -327,4 +328,5 @@ public class ParameterParser {
         }
         return params;
     }
+
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ProgressListener.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ProgressListener.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ProgressListener.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/ProgressListener.java
 Fri Mar 15 12:42:03 2013
@@ -16,13 +16,15 @@
  */
 package org.apache.tomcat.util.http.fileupload;
 
-
 /**
  * The {@link ProgressListener} may be used to display a progress bar
  * or do stuff like that.
  */
 public interface ProgressListener {
-    /** Updates the listeners status information.
+
+    /**
+     * Updates the listeners status information.
+     *
      * @param pBytesRead The total number of bytes, which have been read
      *   so far.
      * @param pContentLength The total number of bytes, which are being
@@ -31,4 +33,5 @@ public interface ProgressListener {
      *   read. (0 = no item so far, 1 = first item is being read, ...)
      */
     void update(long pBytesRead, long pContentLength, int pItems);
+
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/RequestContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/RequestContext.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/RequestContext.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/RequestContext.java
 Fri Mar 15 12:42:03 2013
@@ -61,4 +61,5 @@ public interface RequestContext {
      * @throws IOException if a problem occurs.
      */
     InputStream getInputStream() throws IOException;
+
 }

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/disk/DiskFileItem.java
 Fri Mar 15 12:42:03 2013
@@ -33,7 +33,6 @@ import java.util.Map;
 import org.apache.tomcat.util.http.fileupload.DeferredFileOutputStream;
 import org.apache.tomcat.util.http.fileupload.FileItem;
 import org.apache.tomcat.util.http.fileupload.FileItemHeaders;
-import org.apache.tomcat.util.http.fileupload.FileItemHeadersSupport;
 import org.apache.tomcat.util.http.fileupload.FileUploadException;
 import org.apache.tomcat.util.http.fileupload.IOUtils;
 import org.apache.tomcat.util.http.fileupload.ParameterParser;
@@ -80,7 +79,7 @@ import org.apache.tomcat.util.http.fileu
  * @version $Id$
  */
 public class DiskFileItem
-    implements FileItem, FileItemHeadersSupport {
+    implements FileItem {
 
     // ----------------------------------------------------- Manifest constants
 

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/servlet/ServletFileUpload.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/servlet/ServletFileUpload.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/servlet/ServletFileUpload.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/servlet/ServletFileUpload.java
 Fri Mar 15 12:42:03 2013
@@ -17,12 +17,10 @@
 package org.apache.tomcat.util.http.fileupload.servlet;
 
 import java.io.IOException;
-import java.util.List;
 import java.util.Locale;
 
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.tomcat.util.http.fileupload.FileItem;
 import org.apache.tomcat.util.http.fileupload.FileItemFactory;
 import org.apache.tomcat.util.http.fileupload.FileItemIterator;
 import org.apache.tomcat.util.http.fileupload.FileUpload;
@@ -35,9 +33,9 @@ import org.apache.tomcat.util.http.fileu
  * <p>This class handles multiple files per single HTML widget, sent using
  * <code>multipart/mixed</code> encoding type, as specified by
  * <a href="http://www.ietf.org/rfc/rfc1867.txt";>RFC 1867</a>.  Use {@link
- * #parseRequest(HttpServletRequest)} to acquire a list of {@link
- * org.apache.tomcat.util.http.fileupload.FileItem}s associated with a given 
HTML
- * widget.</p>
+ * #parseRequest(org.apache.tomcat.util.http.fileupload.RequestContext)} to
+ * acquire a list of {@link org.apache.tomcat.util.http.fileupload.FileItem}s
+ * associated with a given HTML widget.</p>
  *
  * <p>How the data for individual parts is stored is determined by the factory
  * used to create them; a given part may be in memory, on disk, or somewhere
@@ -118,24 +116,6 @@ public class ServletFileUpload extends F
      *
      * @param request The servlet request to be parsed.
      *
-     * @return A list of <code>FileItem</code> instances parsed from the
-     *         request, in the order that they were transmitted.
-     *
-     * @throws FileUploadException if there are problems reading/parsing
-     *                             the request or storing files.
-     */
-    public List<FileItem> parseRequest(HttpServletRequest request)
-    throws FileUploadException {
-        return parseRequest(new ServletRequestContext(request));
-    }
-
-
-    /**
-     * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt";>RFC 1867</a>
-     * compliant <code>multipart/form-data</code> stream.
-     *
-     * @param request The servlet request to be parsed.
-     *
      * @return An iterator to instances of <code>FileItemStream</code>
      *         parsed from the request, in the order that they were
      *         transmitted.

Modified: 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java?rev=1456934&r1=1456933&r2=1456934&view=diff
==============================================================================
--- 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java
 (original)
+++ 
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/http/fileupload/util/FileItemHeadersImpl.java
 Fri Mar 15 12:42:03 2013
@@ -19,8 +19,8 @@ package org.apache.tomcat.util.http.file
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -42,14 +42,7 @@ public class FileItemHeadersImpl impleme
      * <code>String</code> instances.
      */
     private final Map<String,List<String>> headerNameToValueListMap =
-        new HashMap<String,List<String>>();
-
-    /**
-     * List to preserve order of headers as added.  This would not be
-     * needed if a <code>LinkedHashMap</code> could be used, but don't
-     * want to depend on 1.4.
-     */
-    private final List<String> headerNameList = new ArrayList<String>();
+            new LinkedHashMap<String,List<String>>();
 
     @Override
     public String getHeader(String name) {
@@ -63,7 +56,7 @@ public class FileItemHeadersImpl impleme
 
     @Override
     public Iterator<String> getHeaderNames() {
-        return headerNameList.iterator();
+        return headerNameToValueListMap.keySet().iterator();
     }
 
     @Override
@@ -71,7 +64,7 @@ public class FileItemHeadersImpl impleme
         String nameLower = name.toLowerCase(Locale.ENGLISH);
         List<String> headerValueList = headerNameToValueListMap.get(nameLower);
         if (null == headerValueList) {
-            return Collections.<String>emptyList().iterator();
+            headerValueList = Collections.emptyList();
         }
         return headerValueList.iterator();
     }
@@ -88,7 +81,6 @@ public class FileItemHeadersImpl impleme
         if (null == headerValueList) {
             headerValueList = new ArrayList<String>();
             headerNameToValueListMap.put(nameLower, headerValueList);
-            headerNameList.add(nameLower);
         }
         headerValueList.add(value);
     }



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

Reply via email to