Author: markt
Date: Tue Mar 13 13:04:38 2012
New Revision: 1300110

URL: http://svn.apache.org/viewvc?rev=1300110&view=rev
Log:
Fix more Eclipse warnings:
- generics
- @Override
- unnecessary casts
- unnecessary code
- static field access

Modified:
    tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
    tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java
    tomcat/trunk/java/org/apache/coyote/spdy/SpdyProxyProtocol.java
    tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocket.java
    tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocketContext.java
    tomcat/trunk/java/org/apache/tomcat/spdy/SpdyConnection.java
    tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextJni.java
    tomcat/trunk/java/org/apache/tomcat/spdy/SpdyFrame.java
    
tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProtocol.java Tue Mar 
13 13:04:38 2012
@@ -187,7 +187,7 @@ public class Http11AprProtocol extends A
     // TODO: map of protocols
     public void setNpnHandler(String impl) {
         try {
-            Class c = Class.forName(impl);
+            Class<?> c = Class.forName(impl);
             npnHandler = (NpnHandler) c.newInstance();
         } catch (Exception ex) {
             getLog().warn("Failed to init light protocol " + impl, ex);

Modified: tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/spdy/SpdyProcessor.java Tue Mar 13 
13:04:38 2012
@@ -32,6 +32,7 @@ import org.apache.coyote.RequestInfo;
 import org.apache.coyote.Response;
 import org.apache.coyote.http11.upgrade.UpgradeInbound;
 import org.apache.tomcat.spdy.SpdyConnection;
+import org.apache.tomcat.spdy.SpdyContext;
 import org.apache.tomcat.spdy.SpdyFrame;
 import org.apache.tomcat.spdy.SpdyStream;
 import org.apache.tomcat.util.ExceptionUtils;
@@ -220,7 +221,7 @@ public class SpdyProcessor extends Abstr
 
     @Override
     public void action(ActionCode actionCode, Object param) {
-        if (spdy.getSpdyContext().debug) {
+        if (SpdyContext.debug) {
             // System.err.println(actionCode);
         }
 
@@ -473,7 +474,8 @@ public class SpdyProcessor extends Abstr
     }
 
     @Override
-    public SocketState process(SocketWrapper socket) throws IOException {
+    public SocketState process(SocketWrapper<Object> socket)
+            throws IOException {
         throw new IOException("Unimplemented");
     }
 
@@ -533,7 +535,7 @@ public class SpdyProcessor extends Abstr
                     throw new IOException("Name too long");
                 }
                 request.requestURI().setBytes(frame.data, frame.off, valueLen);
-                if (spdy.getSpdyContext().debug) {
+                if (SpdyContext.debug) {
                     System.err.println("URL= " + request.requestURI());
                 }
                 frame.advance(valueLen);

Modified: tomcat/trunk/java/org/apache/coyote/spdy/SpdyProxyProtocol.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/spdy/SpdyProxyProtocol.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/spdy/SpdyProxyProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/spdy/SpdyProxyProtocol.java Tue Mar 13 
13:04:38 2012
@@ -81,6 +81,7 @@ public class SpdyProxyProtocol extends A
         return cHandler;
     }
 
+    @Override
     public void start() throws Exception {
         super.start();
         spdyContext = new SpdyContextProxy() {

Modified: tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocket.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocket.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocket.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocket.java Tue Mar 13 
13:04:38 2012
@@ -117,6 +117,7 @@ public class AprSocket implements Runnab
         poller = null;
     }
 
+    @Override
     public String toString() {
         return (context.isServer() ? "AprSrv-" : "AprCli-") +
                 Long.toHexString(socket) + " " + Integer.toHexString(status);
@@ -285,7 +286,7 @@ public class AprSocket implements Runnab
                 log.warning("apr.send(): Failed to send, closing " + sent);
             }
             reset();
-            throw new IOException("Error sending " + sent + " " + 
Error.strerror((int) -sent));
+            throw new IOException("Error sending " + sent + " " + 
Error.strerror(-sent));
         } else {
             off += sent;
             len -= sent;
@@ -337,7 +338,7 @@ public class AprSocket implements Runnab
         }
         // abrupt close
         reset();
-        throw new IOException("apr.read(): " + read + " " + 
Error.strerror((int) -read));
+        throw new IOException("apr.read(): " + read + " " + 
Error.strerror(-read));
     }
 
     public int readNB(byte[] data, int off, int len) throws IOException {
@@ -799,13 +800,13 @@ public class AprSocket implements Runnab
                 log.info(this + " StartSSL");
             }
 
-            AprSocketContext aprCon = (AprSocketContext) context;
+            AprSocketContext aprCon = context;
             SSLSocket.attach(aprCon.getSslCtx(), socket);
 
             if (context.debugSSL) {
                 SSLExt.debug(socket);
             }
-            if (!((AprSocketContext) getContext()).isServer()) {
+            if (!getContext().isServer()) {
                 if (context.USE_TICKETS && hostInfo.ticketLen > 0) {
                     SSLExt.setTicket(socket, hostInfo.ticket,
                             hostInfo.ticketLen);

Modified: tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocketContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocketContext.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocketContext.java 
(original)
+++ tomcat/trunk/java/org/apache/tomcat/jni/socket/AprSocketContext.java Tue 
Mar 13 13:04:38 2012
@@ -508,6 +508,7 @@ public class AprSocketContext {
      * To clean the pools - we could track if all channels are
      * closed, but this seems simpler and safer.
      */
+    @Override
     protected void finalize() {
         if (rootPool != 0) {
             log.warning(this + " GC without stop()");
@@ -860,6 +861,7 @@ public class AprSocketContext {
             setDaemon(true);
         }
 
+        @Override
         public void run() {
             while(running) {
                 try {
@@ -972,6 +974,7 @@ public class AprSocketContext {
 
         private List<AprSocket> updates = new ArrayList<AprSocket>();
 
+        @Override
         public void run() {
             if (!running) {
                 return;
@@ -1286,7 +1289,7 @@ public class AprSocketContext {
             }
             if (failed) {
                 up.reset();
-                throw new IOException("poll add error " +  rv + " " + up + " " 
+ Error.strerror((int)rv));
+                throw new IOException("poll add error " +  rv + " " + up + " " 
+ Error.strerror(rv));
             }
         }
 
@@ -1303,7 +1306,7 @@ public class AprSocketContext {
             up.clearStatus(AprSocket.POLL);
 
             if (rv != Status.APR_SUCCESS) {
-                log.severe("poll remove error " +  Error.strerror((int)rv) + " 
" + up);
+                log.severe("poll remove error " +  Error.strerror(rv) + " " + 
up);
             } else {
                 polledCount.decrementAndGet();
             }

Modified: tomcat/trunk/java/org/apache/tomcat/spdy/SpdyConnection.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/spdy/SpdyConnection.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/spdy/SpdyConnection.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/spdy/SpdyConnection.java Tue Mar 13 
13:04:38 2012
@@ -147,6 +147,7 @@ public abstract class SpdyConnection { /
         outCondition = framerLock.newCondition();
     }
 
+    @Override
     public String toString() {
         return "SpdyCon open=" + channels.size();
     }
@@ -278,7 +279,7 @@ public abstract class SpdyConnection { /
                 framerLock.unlock();
             }
 
-            if (getSpdyContext().debug) {
+            if (SpdyContext.debug) {
                 trace("> " + out);
             }
 
@@ -335,6 +336,7 @@ public abstract class SpdyConnection { /
     static int drainCnt = 0;
 
     Runnable nbDrain = new Runnable() {
+        @Override
         public void run() {
             drain();
         }
@@ -381,12 +383,12 @@ public abstract class SpdyConnection { /
      */
     public int onBlockingSocket() {
         try {
-            if (getSpdyContext().debug) {
+            if (SpdyContext.debug) {
                 trace("< onConnection() " + lastChannel);
             }
             int rc = processInput();
 
-            if (getSpdyContext().debug) {
+            if (SpdyContext.debug) {
                 trace("< onConnection() " + rc + " " + lastChannel);
             }
             return rc;
@@ -494,7 +496,7 @@ public abstract class SpdyConnection { /
                 inFrame.nvCount = inFrame.read16();
             }
 
-            if (getSpdyContext().debug) {
+            if (SpdyContext.debug) {
                 trace("< " + inFrame);
             }
 

Modified: tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextJni.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextJni.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextJni.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/spdy/SpdyContextJni.java Tue Mar 13 
13:04:38 2012
@@ -73,8 +73,10 @@ public class SpdyContextJni extends Spdy
         handler.process(s, true, true, false);
     }
 
+    @Override
     public void listen(final int port, String cert, String key) throws 
IOException {
         con = new AprSocketContext() {
+            @Override
             protected void onSocket(AprSocket s) throws IOException {
                 SpdyConnectionAprSocket spdy = new 
SpdyConnectionAprSocket(SpdyContextJni.this);
                 spdy.setSocket(s);
@@ -90,6 +92,7 @@ public class SpdyContextJni extends Spdy
         con.listen(port);
     }
 
+    @Override
     public void stop() throws IOException {
         con.stop();
     }

Modified: tomcat/trunk/java/org/apache/tomcat/spdy/SpdyFrame.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/spdy/SpdyFrame.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/spdy/SpdyFrame.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/spdy/SpdyFrame.java Tue Mar 13 13:04:38 
2012
@@ -83,6 +83,7 @@ public class SpdyFrame {
         endData = 0;
     }
 
+    @Override
     public String toString() {
         if (c) {
             if (type == 6) {

Modified: 
tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java?rev=1300110&r1=1300109&r2=1300110&view=diff
==============================================================================
--- 
tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java
 (original)
+++ 
tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug51582.java
 Tue Mar 13 13:04:38 2012
@@ -110,7 +110,7 @@ public class Bug51582
               e.printStackTrace();
             }
 
-          };
+          }
 
         };
         threadList.add(thread);



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

Reply via email to