tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r696402 - /tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java
Date Wed, 17 Sep 2008 19:10:01 GMT
Author: markt
Date: Wed Sep 17 12:10:01 2008
New Revision: 696402

URL: http://svn.apache.org/viewvc?rev=696402&view=rev
Log:
Add generics to default servlet and fix other Eclipse warnings. No functional change.

Modified:
    tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java

Modified: tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java?rev=696402&r1=696401&r2=696402&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java (original)
+++ tomcat/trunk/java/org/apache/catalina/servlets/DefaultServlet.java Wed Sep 17 12:10:01
2008
@@ -158,7 +158,7 @@
     /**
      * Full range marker.
      */
-    protected static ArrayList FULL = new ArrayList();
+    protected static ArrayList<Range> FULL = new ArrayList<Range>();
     
     
     // ----------------------------------------------------- Static Initializer
@@ -464,7 +464,7 @@
             if (obj instanceof Resource)
                 oldResource = (Resource) obj;
         } catch (NamingException e) {
-            ;
+            // Ignore
         }
 
         // Copy data in oldRevisionContent to contentFile
@@ -702,7 +702,7 @@
             cacheEntry.attributes.setMimeType(contentType);
         }
 
-        ArrayList ranges = null;
+        ArrayList<Range> ranges = null;
         long contentLength = -1L;
 
         if (cacheEntry.context != null) {
@@ -823,7 +823,7 @@
 
             if (ranges.size() == 1) {
 
-                Range range = (Range) ranges.get(0);
+                Range range = ranges.get(0);
                 response.addHeader("Content-Range", "bytes "
                                    + range.start
                                    + "-" + range.end + "/"
@@ -952,10 +952,9 @@
      * @param response The servlet response we are creating
      * @return Vector of ranges
      */
-    protected ArrayList parseRange(HttpServletRequest request,
-                                HttpServletResponse response,
-                                ResourceAttributes resourceAttributes)
-        throws IOException {
+    protected ArrayList<Range> parseRange(HttpServletRequest request,
+            HttpServletResponse response,
+            ResourceAttributes resourceAttributes) throws IOException {
 
         // Checking If-Range
         String headerValue = request.getHeader("If-Range");
@@ -966,7 +965,7 @@
             try {
                 headerValueTime = request.getDateHeader("If-Range");
             } catch (IllegalArgumentException e) {
-                ;
+                // Ignore
             }
 
             String eTag = getETag(resourceAttributes);
@@ -1132,14 +1131,15 @@
         try {
 
             // Render the directory entries within this directory
-            NamingEnumeration enumeration = resources.list(cacheEntry.name);
+            NamingEnumeration<NameClassPair> enumeration =
+                resources.list(cacheEntry.name);
             
             // rewriteUrl(contextPath) is expensive. cache result for later reuse
             String rewrittenContextPath =  rewriteUrl(contextPath);
 
             while (enumeration.hasMoreElements()) {
 
-                NameClassPair ncPair = (NameClassPair) enumeration.nextElement();
+                NameClassPair ncPair = enumeration.nextElement();
                 String resourceName = ncPair.getName();
                 String trimmed = resourceName/*.substring(trim)*/;
                 if (trimmed.equalsIgnoreCase("WEB-INF") ||
@@ -1303,11 +1303,12 @@
         try {
 
             // Render the directory entries within this directory
-            NamingEnumeration enumeration = resources.list(cacheEntry.name);
+            NamingEnumeration<NameClassPair> enumeration =
+                resources.list(cacheEntry.name);
             boolean shade = false;
             while (enumeration.hasMoreElements()) {
 
-                NameClassPair ncPair = (NameClassPair) enumeration.nextElement();
+                NameClassPair ncPair = enumeration.nextElement();
                 String resourceName = ncPair.getName();
                 String trimmed = resourceName/*.substring(trim)*/;
                 if (trimmed.equalsIgnoreCase("WEB-INF") ||
@@ -1853,7 +1854,7 @@
      * @exception IOException if an input/output error occurs
      */
     protected void copy(CacheEntry cacheEntry, ServletOutputStream ostream,
-                      Iterator ranges, String contentType)
+                      Iterator<Range> ranges, String contentType)
         throws IOException {
 
         IOException exception = null;
@@ -1864,7 +1865,7 @@
             InputStream istream =
                 new BufferedInputStream(resourceInputStream, input);
 
-            Range currentRange = (Range) ranges.next();
+            Range currentRange = ranges.next();
 
             // Writing MIME header.
             ostream.println();
@@ -1906,7 +1907,7 @@
      * @exception IOException if an input/output error occurs
      */
     protected void copy(CacheEntry cacheEntry, PrintWriter writer,
-                      Iterator ranges, String contentType)
+                      Iterator<Range> ranges, String contentType)
         throws IOException {
 
         IOException exception = null;
@@ -1923,7 +1924,7 @@
                                                fileEncoding);
             }
 
-            Range currentRange = (Range) ranges.next();
+            Range currentRange = ranges.next();
 
             // Writing MIME header.
             writer.println();



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


Mime
View raw message