Fix Findbugs and Eclipse warnings
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 18 Jan 2011 21:33:14 +0000 (21:33 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Tue, 18 Jan 2011 21:33:14 +0000 (21:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1060586 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/core/ApplicationDispatcher.java
java/org/apache/catalina/loader/WebappClassLoader.java
java/org/apache/catalina/realm/LockOutRealm.java
java/org/apache/catalina/ssi/SSIServletExternalResolver.java
java/org/apache/jasper/runtime/JspFactoryImpl.java
java/org/apache/juli/ClassLoaderLogManager.java
java/org/apache/naming/resources/FileDirContext.java
java/org/apache/tomcat/util/net/NioBlockingSelector.java
java/org/apache/tomcat/util/threads/DedicatedThreadExecutor.java
test/org/apache/catalina/connector/TestMaxConnections.java

index 583b8dc..73c1f9f 100644 (file)
@@ -130,7 +130,7 @@ final class ApplicationDispatcher
      * variables causes threading issues and state is too complex to pass and
      * return single ServletRequest or ServletResponse objects.
      */
-    private class State {
+    private static class State {
         State(ServletRequest request, ServletResponse response,
                 boolean including) {
             this.outerRequest = request;
index 39e10b9..7fbc043 100644 (file)
@@ -156,7 +156,7 @@ public class WebappClassLoader
     }
 
     
-    protected final class PrivilegedGetClassLoader
+    protected static final class PrivilegedGetClassLoader
         implements PrivilegedAction<ClassLoader> {
 
         public Class<?> clazz;
index 957c06b..bd06929 100644 (file)
@@ -379,7 +379,7 @@ public class LockOutRealm extends CombinedRealm {
     }
 
 
-    protected class LockRecord {
+    protected static class LockRecord {
         private AtomicInteger failures = new AtomicInteger(0);
         private long lastFailureTime = 0;
         
index 74a1799..b358094 100644 (file)
@@ -74,6 +74,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
     }
 
 
+    @Override
     public void log(String message, Throwable throwable) {
         //We can't assume that Servlet.log( message, null )
         //is the same as Servlet.log( message ), since API
@@ -86,6 +87,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
     }
 
 
+    @Override
     public void addVariableNames(Collection<String> variableNames) {
         for (int i = 0; i < VARIABLE_NAMES.length; i++) {
             String variableName = VARIABLE_NAMES[i];
@@ -132,6 +134,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
     }
 
 
+    @Override
     public void setVariableValue(String name, String value) {
         if (!isNameReserved(name)) {
             req.setAttribute(name, value);
@@ -139,6 +142,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
     }
 
 
+    @Override
     public String getVariableValue(String name) {
         String retVal = null;
         Object object = getReqAttributeIgnoreCase(name);
@@ -331,6 +335,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
             return retVal;
     }
 
+    @Override
     public Date getCurrentDate() {
         return new Date();
     }
@@ -480,6 +485,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
     }
 
 
+    @Override
     public long getFileLastModified(String path, boolean virtual)
             throws IOException {
         long lastModified = 0;
@@ -493,6 +499,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
     }
 
 
+    @Override
     public long getFileSize(String path, boolean virtual) throws IOException {
         long fileSize = -1;
         try {
@@ -508,6 +515,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
     //We are making lots of unnecessary copies of the included data here. If
     //someone ever complains that this is slow, we should connect the included
     // stream to the print writer that SSICommand uses.
+    @Override
     public String getFileText(String originalPath, boolean virtual)
             throws IOException {
         try {
@@ -552,7 +560,7 @@ public class SSIServletExternalResolver implements SSIExternalResolver {
         }
     }
 
-    protected class ServletContextAndPath {
+    protected static class ServletContextAndPath {
         protected ServletContext servletContext;
         protected String path;
 
index 7855abc..74a1431 100644 (file)
@@ -126,7 +126,7 @@ public class JspFactoryImpl extends JspFactory {
         }
     }
 
-    private class PrivilegedGetPageContext
+    private static class PrivilegedGetPageContext
             implements PrivilegedAction<PageContext> {
 
         private JspFactoryImpl factory;
@@ -158,7 +158,7 @@ public class JspFactoryImpl extends JspFactory {
         }
     }
 
-    private class PrivilegedReleasePageContext
+    private static class PrivilegedReleasePageContext
             implements PrivilegedAction<Void> {
 
         private JspFactoryImpl factory;
index ad6c0ff..d7b9e93 100644 (file)
@@ -679,7 +679,7 @@ public class ClassLoaderLogManager extends LogManager {
      * This class is needed to instantiate the root of each per classloader 
      * hierarchy.
      */
-    protected class RootLogger extends Logger {
+    protected static class RootLogger extends Logger {
         public RootLogger() {
             super("", null);
         }
index 20ad012..eff0f30 100644 (file)
@@ -894,7 +894,7 @@ public class FileDirContext extends BaseDirContext {
      * This specialized resource implementation avoids opening the InputStream
      * to the file right away (which would put a lock on the file).
      */
-    protected class FileResource extends Resource {
+    protected static class FileResource extends Resource {
 
 
         // -------------------------------------------------------- Constructor
@@ -914,12 +914,6 @@ public class FileDirContext extends BaseDirContext {
         protected File file;
 
 
-        /**
-         * File length.
-         */
-        protected long length = -1L;
-
-
         // --------------------------------------------------- Resource Methods
 
 
@@ -951,7 +945,7 @@ public class FileDirContext extends BaseDirContext {
      * reading (to speed up simple checks, like checking the last modified
      * date).
      */
-    protected class FileResourceAttributes extends ResourceAttributes {
+    protected static class FileResourceAttributes extends ResourceAttributes {
 
         private static final long serialVersionUID = 1L;
 
index 8a97571..192120b 100644 (file)
@@ -194,7 +194,7 @@ public class NioBlockingSelector {
     }
 
     
-    protected class BlockPoller extends Thread {
+    protected static class BlockPoller extends Thread {
         protected volatile boolean run = true;
         protected Selector selector = null;
         protected ConcurrentLinkedQueue<Runnable> events = new ConcurrentLinkedQueue<Runnable>();
@@ -202,6 +202,7 @@ public class NioBlockingSelector {
         protected AtomicInteger wakeupCounter = new AtomicInteger(0);
         public void cancelKey(final SelectionKey key) {
             Runnable r = new Runnable() {
+                @Override
                 public void run() {
                     key.cancel();
                 }
@@ -225,6 +226,7 @@ public class NioBlockingSelector {
         
         public void add(final KeyAttachment key, final int ops, final KeyReference ref) {
             Runnable r = new Runnable() {
+                @Override
                 public void run() {
                     if ( key == null ) return;
                     NioChannel nch = key.getChannel();
@@ -254,6 +256,7 @@ public class NioBlockingSelector {
         
         public void remove(final KeyAttachment key, final int ops) {
             Runnable r = new Runnable() {
+                @Override
                 public void run() {
                     if ( key == null ) return;
                     NioChannel nch = key.getChannel();
@@ -380,7 +383,7 @@ public class NioBlockingSelector {
         }
     }
     
-    public class KeyReference {
+    public static class KeyReference {
         SelectionKey key = null;
         
         @Override
index 574140e..43e4411 100644 (file)
@@ -119,7 +119,7 @@ public class DedicatedThreadExecutor {
     // This can lead to false alarms about potential memory leaks because the
     // thread may have a web application class loader for its context class
     // loader.
-    private class SingleThreadFactory implements ThreadFactory {
+    private static class SingleThreadFactory implements ThreadFactory {
         private volatile Thread singleThread;
 
         @Override
index 135b165..15963ce 100644 (file)
@@ -59,7 +59,7 @@ public class TestMaxConnections extends TomcatBaseTest{
         
     }
 
-    private class ConnectThread extends Thread {
+    private static class ConnectThread extends Thread {
         public boolean passed = true;
         public boolean connectfailed = false;
         @Override
@@ -91,7 +91,7 @@ public class TestMaxConnections extends TomcatBaseTest{
         tomcat.start();
     }
 
-    private class TestClient extends SimpleHttpClient {
+    private static class TestClient extends SimpleHttpClient {
 
         private void doHttp10Request() throws Exception {