Code clean up. Remove unused methods, unnecessary casts/code, fix generics warnings...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 2 May 2008 21:25:56 +0000 (21:25 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 2 May 2008 21:25:56 +0000 (21:25 +0000)
No functional change.

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@652918 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/coyote/http11/Http11AprProcessor.java
java/org/apache/coyote/http11/Http11NioProcessor.java
java/org/apache/coyote/http11/Http11Processor.java

index d1a8ead..250dc8e 100644 (file)
@@ -470,7 +470,7 @@ public class Http11AprProcessor implements ActionHook {
      */
     protected void addFilter(String className) {
         try {
-            Class clazz = Class.forName(className);
+            Class<?> clazz = Class.forName(className);
             Object obj = clazz.newInstance();
             if (obj instanceof InputFilter) {
                 inputBuffer.addFilter((InputFilter) obj);
@@ -530,22 +530,6 @@ public class Http11AprProcessor implements ActionHook {
 
 
     /**
-     * General use method
-     *
-     * @param sArray the StringArray
-     * @param value string
-     */
-    private boolean inStringArray(String sArray[], String value) {
-        for (int i = 0; i < sArray.length; i++) {
-            if (sArray[i].equals(value)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
-    /**
      * Checks if any entry in the string array starts with the specified value
      *
      * @param sArray the StringArray
@@ -1144,9 +1128,8 @@ public class Http11AprProcessor implements ActionHook {
                     }
                     // User key size
                     sslO = new Integer(SSLSocket.getInfoI(socket, SSL.SSL_INFO_CIPHER_USEKEYSIZE));
-                    if (sslO != null) {
-                        request.setAttribute(AprEndpoint.KEY_SIZE_KEY, sslO);
-                    }
+                    request.setAttribute(AprEndpoint.KEY_SIZE_KEY, sslO);
+
                     // SSL session ID
                     sslO = SSLSocket.getInfoS(socket, SSL.SSL_INFO_SESSION_ID);
                     if (sslO != null) {
@@ -1474,7 +1457,7 @@ public class Http11AprProcessor implements ActionHook {
             int port = 0;
             int mult = 1;
             for (int i = valueL - 1; i > colonPos; i--) {
-                int charValue = HexUtils.DEC[(int) valueB[i + valueS]];
+                int charValue = HexUtils.DEC[valueB[i + valueS]];
                 if (charValue == -1) {
                     // Invalid character
                     error = true;
index 86df02a..008e348 100644 (file)
@@ -89,7 +89,6 @@ public class Http11NioProcessor implements ActionHook {
         this.endpoint = endpoint;
 
         request = new Request();
-        int readTimeout = endpoint.getSoTimeout();
         inputBuffer = new InternalNioInputBuffer(request, maxHttpHeaderSize);
         request.setInputBuffer(inputBuffer);
 
@@ -478,7 +477,7 @@ public class Http11NioProcessor implements ActionHook {
      */
     protected void addFilter(String className) {
         try {
-            Class clazz = Class.forName(className);
+            Class<?> clazz = Class.forName(className);
             Object obj = clazz.newInstance();
             if (obj instanceof InputFilter) {
                 inputBuffer.addFilter((InputFilter) obj);
@@ -538,22 +537,6 @@ public class Http11NioProcessor implements ActionHook {
 
 
     /**
-     * General use method
-     *
-     * @param sArray the StringArray
-     * @param value string
-     */
-    private boolean inStringArray(String sArray[], String value) {
-        for (int i = 0; i < sArray.length; i++) {
-            if (sArray[i].equals(value)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
-    /**
      * Checks if any entry in the string array starts with the specified value
      *
      * @param sArray the StringArray
@@ -811,8 +794,6 @@ public class Http11NioProcessor implements ActionHook {
         int keepAliveLeft = maxKeepAliveRequests;
         long soTimeout = endpoint.getSoTimeout();
 
-        int limit = 0;
-
         boolean keptAlive = false;
         boolean openSocket = false;
         boolean recycle = true;
@@ -840,7 +821,7 @@ public class Http11NioProcessor implements ActionHook {
                 }
                 request.setStartTime(System.currentTimeMillis());
                 if (!disableUploadTimeout) { //only for body, not for request headers
-                    socket.getIOChannel().socket().setSoTimeout((int)timeout);
+                    socket.getIOChannel().socket().setSoTimeout(timeout);
                 }
             } catch (IOException e) {
                 if (log.isDebugEnabled()) {
@@ -1507,7 +1488,7 @@ public class Http11NioProcessor implements ActionHook {
             int port = 0;
             int mult = 1;
             for (int i = valueL - 1; i > colonPos; i--) {
-                int charValue = HexUtils.DEC[(int) valueB[i + valueS]];
+                int charValue = HexUtils.DEC[valueB[i + valueS]];
                 if (charValue == -1) {
                     // Invalid character
                     error = true;
index b886c48..6ac15ad 100644 (file)
@@ -460,7 +460,7 @@ public class Http11Processor implements ActionHook {
      */
     protected void addFilter(String className) {
         try {
-            Class clazz = Class.forName(className);
+            Class<?> clazz = Class.forName(className);
             Object obj = clazz.newInstance();
             if (obj instanceof InputFilter) {
                 inputBuffer.addFilter((InputFilter) obj);
@@ -520,22 +520,6 @@ public class Http11Processor implements ActionHook {
 
 
     /**
-     * General use method
-     *
-     * @param sArray the StringArray
-     * @param value string
-     */
-    private boolean inStringArray(String sArray[], String value) {
-        for (int i = 0; i < sArray.length; i++) {
-            if (sArray[i].equals(value)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-
-    /**
      * Checks if any entry in the string array starts with the specified value
      *
      * @param sArray the StringArray
@@ -1386,7 +1370,7 @@ public class Http11Processor implements ActionHook {
             int port = 0;
             int mult = 1;
             for (int i = valueL - 1; i > colonPos; i--) {
-                int charValue = HexUtils.DEC[(int) valueB[i + valueS]];
+                int charValue = HexUtils.DEC[valueB[i + valueS]];
                 if (charValue == -1) {
                     // Invalid character
                     error = true;
@@ -1555,9 +1539,9 @@ public class Http11Processor implements ActionHook {
         // Add date header
         String date = null;
         if (org.apache.coyote.Constants.IS_SECURITY_ENABLED){
-            date = (String)AccessController.doPrivileged(
-                    new PrivilegedAction() {
-                        public Object run(){
+            date = AccessController.doPrivileged(
+                    new PrivilegedAction<String>() {
+                        public String run(){
                             return FastHttpDateFormat.getCurrentDate();
                         }
                     }