Author: tv
Date: Sun Oct  9 17:17:40 2011
New Revision: 1180658

URL: http://svn.apache.org/viewvc?rev=1180658&view=rev
Log:
- Move to JDK 1.5 minimum
- Introduce generics
- Get rid of the explicit commons-io dependency

Modified:
    turbine/fulcrum/trunk/upload/pom.xml
    
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java
    
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java

Modified: turbine/fulcrum/trunk/upload/pom.xml
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/pom.xml?rev=1180658&r1=1180657&r2=1180658&view=diff
==============================================================================
--- turbine/fulcrum/trunk/upload/pom.xml (original)
+++ turbine/fulcrum/trunk/upload/pom.xml Sun Oct  9 17:17:40 2011
@@ -95,11 +95,6 @@
       <artifactId>commons-fileupload</artifactId>
       <version>1.2.1</version>
     </dependency>
-    <dependency>
-      <groupId>commons-io</groupId>
-      <artifactId>commons-io</artifactId>
-      <version>1.4</version>
-    </dependency>
     
     <!-- testing dependencies -->
     <dependency>
@@ -136,6 +131,8 @@
   </profiles>
   
   <properties>
+    <maven.compile.source>1.5</maven.compile.source>
+    <maven.compile.target>1.5</maven.compile.target>
     <!-- This bits are used for the staging directory -->
     <fulcrum.release.version>1.0.4</fulcrum.release.version>
     <fulcrum.rc.version>RC1</fulcrum.rc.version>  

Modified: 
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java?rev=1180658&r1=1180657&r2=1180658&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java
 (original)
+++ 
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java
 Sun Oct  9 17:17:40 2011
@@ -34,6 +34,7 @@ import org.apache.avalon.framework.conte
 import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.service.ServiceException;
+import org.apache.commons.fileupload.FileItem;
 import org.apache.commons.fileupload.FileUploadException;
 import org.apache.commons.fileupload.disk.DiskFileItemFactory;
 import org.apache.commons.fileupload.servlet.ServletFileUpload;
@@ -105,11 +106,11 @@ public class DefaultUploadService
     /**
      * @return Returns the headerEncoding.
      */
-    public String getHeaderEncoding() 
+    public String getHeaderEncoding()
     {
         return headerEncoding;
     }
-    
+
     /**
      * <p>Parses a <a href="http://rf.cx/rfc1867.html";>RFC 1867</a>
      * compliant <code>multipart/form-data</code> stream.</p>
@@ -118,7 +119,7 @@ public class DefaultUploadService
      * @exception ServiceException Problems reading/parsing the
      * request or storing the uploaded file(s).
      */
-    public List parseRequest(HttpServletRequest req)
+    public List<FileItem> parseRequest(HttpServletRequest req)
         throws ServiceException
     {
         return parseRequest(req, this.sizeMax, this.itemFactory);
@@ -133,7 +134,7 @@ public class DefaultUploadService
      * @exception ServiceException Problems reading/parsing the
      * request or storing the uploaded file(s).
      */
-    public List parseRequest(HttpServletRequest req, String path)
+    public List<FileItem> parseRequest(HttpServletRequest req, String path)
         throws ServiceException
     {
         return parseRequest(req, this.sizeThreshold, this.sizeMax, path);
@@ -150,7 +151,7 @@ public class DefaultUploadService
      * @exception ServiceException Problems reading/parsing the
      * request or storing the uploaded file(s).
      */
-    public List parseRequest(HttpServletRequest req, int sizeThreshold,
+    public List<FileItem> parseRequest(HttpServletRequest req, int 
sizeThreshold,
                                   int sizeMax, String path)
             throws ServiceException
     {
@@ -164,11 +165,11 @@ public class DefaultUploadService
      * @param req The servlet request to be parsed.
      * @param sizeMax the maximum allowed upload size in bytes
      * @param factory the file item factory to use
-     * 
+     *
      * @exception ServiceException Problems reading/parsing the
      * request or storing the uploaded file(s).
      */
-    private List parseRequest(HttpServletRequest req, int sizeMax, 
DiskFileItemFactory factory)
+    protected List<FileItem> parseRequest(HttpServletRequest req, int sizeMax, 
DiskFileItemFactory factory)
             throws ServiceException
     {
         try
@@ -215,7 +216,7 @@ public class DefaultUploadService
         headerEncoding = conf.getAttribute(
                 UploadService.HEADER_ENCODING_KEY,
                 UploadService.HEADER_ENCODING_DEFAULT);
-        
+
         sizeMax = conf.getAttributeAsInteger(
                 UploadService.SIZE_MAX_KEY,
                 UploadService.SIZE_MAX_DEFAULT);

Modified: 
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java
URL: 
http://svn.apache.org/viewvc/turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java?rev=1180658&r1=1180657&r2=1180658&view=diff
==============================================================================
--- 
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java
 (original)
+++ 
turbine/fulcrum/trunk/upload/src/java/org/apache/fulcrum/upload/UploadService.java
 Sun Oct  9 17:17:40 2011
@@ -26,6 +26,7 @@ import java.util.List;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.avalon.framework.service.ServiceException;
+import org.apache.commons.fileupload.FileItem;
 
 /**
  * <p> This service handles parsing <code>multipart/form-data</code>
@@ -134,14 +135,14 @@ public interface UploadService
      * The key in UploadService properties in
      * TurbineResources.properties 'headerEncoding' property.
      */
-    String HEADER_ENCODING_KEY = "headerEncoding";    
+    String HEADER_ENCODING_KEY = "headerEncoding";
 
     /**
-     * <p> The default value of 'headerEncoding' property (.).  
+     * <p> The default value of 'headerEncoding' property (.).
      * The value has been decided by copying from DiskFileItem class
      */
     String HEADER_ENCODING_DEFAULT = "ISO-8859-1";
-    
+
     /**
      * <p>Parses a <a href="http://rf.cx/rfc1867.html";>RFC 1867</a>
      * compliant <code>multipart/form-data</code> stream.</p>
@@ -150,7 +151,7 @@ public interface UploadService
      * @exception ServiceException Problems reading/parsing the
      * request or storing the uploaded file(s).
      */
-    List parseRequest(HttpServletRequest req)
+    List<FileItem> parseRequest(HttpServletRequest req)
         throws ServiceException;
 
     /**
@@ -162,7 +163,7 @@ public interface UploadService
      * @exception ServiceException Problems reading/parsing the
      * request or storing the uploaded file(s).
      */
-    List parseRequest(HttpServletRequest req, String path)
+    List<FileItem> parseRequest(HttpServletRequest req, String path)
         throws ServiceException;
 
     /**
@@ -176,7 +177,7 @@ public interface UploadService
      * @exception ServiceException Problems reading/parsing the
      * request or storing the uploaded file(s).
      */
-    List parseRequest(HttpServletRequest req, int sizeThreshold,
+    List<FileItem> parseRequest(HttpServletRequest req, int sizeThreshold,
         int sizeMax, String path)
         throws ServiceException;
 
@@ -203,7 +204,7 @@ public interface UploadService
      * @return The repository.
      */
     String getRepository();
-    
+
     /**
      * <p> Retrieves the value of the <code>headerEncoding</code> property of
      * {@link org.apache.fulcrum.upload.UploadService}.


Reply via email to