You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2007/12/19 17:18:37 UTC

svn commit: r605604 - in /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon: servlet/multipart/MultipartParser.java util/

Author: cziegeler
Date: Wed Dec 19 08:18:37 2007
New Revision: 605604

URL: http://svn.apache.org/viewvc?rev=605604&view=rev
Log:
Remove empty directory and remove unnecessary casts.

Removed:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/util/
Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java?rev=605604&r1=605603&r2=605604&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/servlet/multipart/MultipartParser.java Wed Dec 19 08:18:37 2007
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -52,7 +52,7 @@
     private final static int FILE_BUFFER_SIZE = 4096;
 
     private static final int MAX_BOUNDARY_SIZE = 128;
-    
+
     private boolean saveUploadedFilesToDisk;
 
     private File uploadDirectory = null;
@@ -60,23 +60,23 @@
     private boolean allowOverwrite;
 
     private boolean silentlyRename;
-    
+
     private int maxUploadSize;
 
     private String characterEncoding;
-    
+
     private Hashtable parts;
-    
+
     private boolean oversized = false;
-    
+
     private int contentLength;
-    
+
     private HttpSession session;
-    
+
     private boolean hasSession;
-    
+
     private Hashtable uploadStatus;
-    
+
     /**
      * Constructor, parses given request
      *
@@ -117,17 +117,17 @@
         parseMultiPart(stream, getBoundary(contentType));
 
     }
-    
+
     public Hashtable getParts(int contentLength, String contentType, InputStream requestStream)
     throws IOException, MultipartException {
         this.parts = new Hashtable();
         parseParts(contentLength, contentType, requestStream);
         return this.parts;
     }
-    
+
     public Hashtable getParts(HttpServletRequest request) throws IOException, MultipartException {
         this.parts = new Hashtable();
-        
+
         // Copy all parameters coming from the request URI to the parts table.
         // This happens when a form's action attribute has some parameters
         Enumeration names = request.getParameterNames();
@@ -156,15 +156,15 @@
             this.session.setAttribute(UPLOAD_STATUS_SESSION_ATTR, this.uploadStatus);
         }
 
-        parseParts(request.getContentLength(), request.getContentType(), request.getInputStream());    
+        parseParts(request.getContentLength(), request.getContentType(), request.getInputStream());
 
         if (this.hasSession) {
             this.uploadStatus.put("finished", Boolean.TRUE);
         }
 
-        return this.parts;    
+        return this.parts;
     }
-    
+
     /**
      * Parse a multipart block
      *
@@ -213,7 +213,7 @@
                     // empty upload fields. Just parse away the part
                     byte[] buf = new byte[32];
                     while(ts.getState() == TokenStream.STATE_READING)
-                        ts.read(buf);  
+                        ts.read(buf);
                 }
             } else if (((String) headers.get("content-disposition"))
                     .toLowerCase().equals("form-data")) {
@@ -283,14 +283,14 @@
 
             out = new FileOutputStream(file);
         }
-        
+
         if (hasSession) { // upload widget support
             this.uploadStatus.put("finished", Boolean.FALSE);
             this.uploadStatus.put("started", Boolean.TRUE);
-            this.uploadStatus.put("widget", (String)headers.get("name"));
-            this.uploadStatus.put("filename", (String)headers.get("filename"));
+            this.uploadStatus.put("widget", headers.get("name"));
+            this.uploadStatus.put("filename", headers.get("filename"));
         }
-        
+
         int length = 0; // Track length for OversizedPart
         try {
             int read = 0;
@@ -299,15 +299,15 @@
                 read = in.read(buf);
                 length += read;
                 out.write(buf, 0, read);
-                
+
                 if (this.hasSession) {
-                    this.uploadStatus.put("sent", 
+                    this.uploadStatus.put("sent",
                         new Integer(((Integer)this.uploadStatus.get("sent")).intValue() + read)
                     );
                 }
             }
             if (this.hasSession) { // upload widget support
-                this.uploadStatus.put("uploadsdone", 
+                this.uploadStatus.put("uploadsdone",
                     new Integer(((Integer)this.uploadStatus.get("uploadsdone")).intValue() + 1)
                 );
                 this.uploadStatus.put("error", Boolean.FALSE);
@@ -325,7 +325,7 @@
         } finally {
             if ( out!=null ) out.close();
         }
-        
+
         String name = (String)headers.get("name");
         if (oversized || canceled) {
             this.parts.put(name, new RejectedPart(headers, length, this.contentLength, this.maxUploadSize));
@@ -355,7 +355,7 @@
             int c = in.read();
             if (c != -1) bos.write(c);
         }
-        
+
         String field = (String) headers.get("name");
         Vector v = (Vector) this.parts.get(field);
 
@@ -422,9 +422,9 @@
      * @throws IOException
      */
     private String readln(TokenStream in) throws IOException {
-        
+
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
-        
+
         int b = in.read();
 
         while ((b != -1) && (b != '\r')) {