Fix some Eclipse warnings in the examples webapp.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 17 May 2008 18:52:23 +0000 (18:52 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 17 May 2008 18:52:23 +0000 (18:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@657429 13f79535-47bb-0310-9956-ffa450edef68

webapps/examples/WEB-INF/classes/cal/Entries.java
webapps/examples/WEB-INF/classes/cal/TableBean.java
webapps/examples/WEB-INF/classes/colors/ColorGameBean.java
webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilter.java
webapps/examples/WEB-INF/classes/compressionFilters/CompressionFilterTestServlet.java
webapps/examples/WEB-INF/classes/jsp2/examples/simpletag/EchoAttributesTag.java
webapps/examples/jsp/colors/colrs.jsp

index 3836b23..9b5d587 100644 (file)
@@ -21,14 +21,14 @@ import javax.servlet.http.*;
 
 public class Entries {
 
-  private Hashtable entries;
+  private Hashtable<String, Entry> entries;
   private static final String[] time = {"8am", "9am", "10am", "11am", "12pm", 
                                        "1pm", "2pm", "3pm", "4pm", "5pm", "6pm",
                                        "7pm", "8pm" };
   public static final int rows = 12;
 
   public Entries () {   
-   entries = new Hashtable (rows);
+   entries = new Hashtable<String, Entry> (rows);
    for (int i=0; i < rows; i++) {
      entries.put (time[i], new Entry(time[i]));
    }
@@ -39,7 +39,7 @@ public class Entries {
   }
 
   public Entry getEntry (int index) {
-    return (Entry)this.entries.get(time[index]);
+    return this.entries.get(time[index]);
   }
 
   public int getIndex (String tm) {
@@ -52,7 +52,7 @@ public class Entries {
     int index = getIndex (tm);
     if (index >= 0) {
       String descr = request.getParameter ("description");
-      ((Entry)entries.get(time[index])).setDescription (descr);
+      entries.get(time[index]).setDescription (descr);
     }
   }
 
index f79d882..cddd92e 100644 (file)
@@ -21,7 +21,7 @@ import java.util.Hashtable;
 
 public class TableBean {
 
-  Hashtable table;
+  Hashtable<String, Entries> table;
   JspCalendar JspCal;
   Entries entries;
   String date;
@@ -30,7 +30,7 @@ public class TableBean {
   boolean processError = false;
 
   public TableBean () {
-    this.table = new Hashtable (10);
+    this.table = new Hashtable<String, Entries> (10);
     this.JspCal = new JspCalendar ();
     this.date = JspCal.getCurrentDate ();
   }
@@ -77,7 +77,7 @@ public class TableBean {
     else if (dateR.equalsIgnoreCase("next")) date = JspCal.getNextDate ();
     else if (dateR.equalsIgnoreCase("prev")) date = JspCal.getPrevDate ();
 
-    entries = (Entries) table.get (date);
+    entries = table.get (date);
     if (entries == null) {
       entries = new Entries ();
       table.put (date, entries);
index 0f9e159..8b1791e 100644 (file)
@@ -16,8 +16,6 @@
 */
 package colors;
 
-import javax.servlet.http.*;
-
 public class ColorGameBean {
 
     private String background = "yellow";
@@ -29,7 +27,7 @@ public class ColorGameBean {
        private int intval = 0;
     private boolean tookHints = false;
 
-    public void processRequest(HttpServletRequest request) {
+    public void processRequest() {
 
        // background = "yellow";
        // foreground = "red";
index a77487a..2ad8793 100644 (file)
@@ -146,7 +146,7 @@ public class CompressionFilter implements Filter{
             }
 
             // Are we allowed to compress ?
-            String s = (String) ((HttpServletRequest)request).getParameter("gzip");
+            String s = ((HttpServletRequest)request).getParameter("gzip");
             if ("false".equals(s)) {
                 if (debug > 0) {
                     System.out.println("got parameter gzip=false --> don't compress, just chain filter");
index 71ea631..80c61bb 100644 (file)
@@ -36,7 +36,7 @@ public class CompressionFilterTestServlet extends HttpServlet {
         ServletOutputStream out = response.getOutputStream();
         response.setContentType("text/plain");
 
-        Enumeration e = ((HttpServletRequest)request).getHeaders("Accept-Encoding");
+        Enumeration e = request.getHeaders("Accept-Encoding");
         while (e.hasMoreElements()) {
             String name = (String)e.nextElement();
             out.println(name);
index 9e7d201..232cf60 100644 (file)
@@ -32,13 +32,13 @@ public class EchoAttributesTag
     extends SimpleTagSupport
     implements DynamicAttributes
 {
-    private ArrayList keys = new ArrayList();
-    private ArrayList values = new ArrayList();
+    private ArrayList<String> keys = new ArrayList<String>();
+    private ArrayList<Object> values = new ArrayList<Object>();
 
     public void doTag() throws JspException, IOException {
        JspWriter out = getJspContext().getOut();
        for( int i = 0; i < keys.size(); i++ ) {
-           String key = (String)keys.get( i );
+           String key = keys.get( i );
            Object value = values.get( i );
            out.println( "<li>" + key + " = " + value + "</li>" );
         }
index 8fb0d93..bac3dc3 100644 (file)
@@ -20,7 +20,7 @@
 <jsp:setProperty name="cb" property="*" />
 
 <%
-       cb.processRequest(request);
+       cb.processRequest();
 %>
 
 <body bgcolor=<%= cb.getColor1() %>>