tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r764898 - in /tomcat/trunk/java/org/apache/catalina/core: ApplicationDispatcher.java ApplicationHttpRequest.java DummyRequest.java DummyResponse.java NamingContextListener.java StandardWrapper.java StandardWrapperValve.java
Date Tue, 14 Apr 2009 17:46:24 GMT
Author: markt
Date: Tue Apr 14 17:46:23 2009
New Revision: 764898

URL: http://svn.apache.org/viewvc?rev=764898&view=rev
Log:
Code clean up prompted by Eclipse:
 - mark unused parameters as unused
 - remove code that doesn't do anything

Modified:
    tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
    tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
    tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java
    tomcat/trunk/java/org/apache/catalina/core/DummyResponse.java
    tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java
    tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
    tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java?rev=764898&r1=764897&r2=764898&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java Tue Apr 14 17:46:23
2009
@@ -620,7 +620,6 @@
             wrapper.getLogger().error(sm.getString("applicationDispatcher.allocateException",
                              wrapper.getName()), StandardWrapper.getRootCause(e));
             servletException = e;
-            servlet = null;
         } catch (Throwable e) {
             wrapper.getLogger().error(sm.getString("applicationDispatcher.allocateException",
                              wrapper.getName()), e);

Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java?rev=764898&r1=764897&r2=764898&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java Tue Apr 14 17:46:23
2009
@@ -570,7 +570,7 @@
             try {
                 session = manager.findSession(requestedSessionId);
             } catch (IOException e) {
-                session = null;
+                // Ignore
             }
             if ((session != null) && session.isValid()) {
                 return (true);
@@ -819,9 +819,9 @@
 
         ArrayList<Object> results = new ArrayList<Object>();
 
-        if (values1 == null)
-            ;
-        else if (values1 instanceof String)
+        if (values1 == null) {
+            // Skip - nothing to merge
+        } else if (values1 instanceof String)
             results.add(values1);
         else if (values1 instanceof String[]) {
             String values[] = (String[]) values1;
@@ -830,9 +830,9 @@
         } else
             results.add(values1.toString());
 
-        if (values2 == null)
-            ;
-        else if (values2 instanceof String)
+        if (values2 == null) {
+            // Skip - nothing to merge
+        } else if (values2 instanceof String)
             results.add(values2);
         else if (values2 instanceof String[]) {
             String values[] = (String[]) values2;

Modified: tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java?rev=764898&r1=764897&r2=764898&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java Tue Apr 14 17:46:23 2009
@@ -163,41 +163,45 @@
     }
 
     public String getAuthorization() { return null; }
-    public void setAuthorization(String authorization) {}
+    public void setAuthorization(
+            @SuppressWarnings("unused") String authorization) {}
     public Connector getConnector() { return null; }
-    public void setConnector(Connector connector) {}
+    public void setConnector(@SuppressWarnings("unused") Connector connector) {}
     public Context getContext() { return null; }
-    public void setContext(Context context) {}
+    public void setContext(@SuppressWarnings("unused") Context context) {}
     public Host getHost() { return null; }
-    public void setHost(Host host) {}
+    public void setHost(@SuppressWarnings("unused") Host host) {}
     public String getInfo() { return null; }
     public Response getResponse() { return null; }
-    public void setResponse(Response response) {}
+    public void setResponse(@SuppressWarnings("unused") Response response) {}
     public Socket getSocket() { return null; }
-    public void setSocket(Socket socket) {}
+    public void setSocket(@SuppressWarnings("unused") Socket socket) {}
     public InputStream getStream() { return null; }
-    public void setStream(InputStream input) {}
-    public void addLocale(Locale locale) {}
+    public void setStream(@SuppressWarnings("unused") InputStream input) {}
+    public void addLocale(@SuppressWarnings("unused") Locale locale) {}
     public ServletInputStream createInputStream() throws IOException {
         return null;
     }
     public void finishRequest() throws IOException {}
-    public Object getNote(String name) { return null; }
+    public Object getNote(@SuppressWarnings("unused") String name) {
+        return null;
+    }
     public Iterator<String> getNoteNames() { return null; }
-    public void removeNote(String name) {}
-    public void setContentType(String type) {}
-    public void setNote(String name, Object value) {}
-    public void setProtocol(String protocol) {}
-    public void setRemoteAddr(String remoteAddr) {}
-    public void setRemoteHost(String remoteHost) {}
-    public void setScheme(String scheme) {}
-    public void setServerName(String name) {}
-    public void setServerPort(int port) {}
+    public void removeNote(@SuppressWarnings("unused") String name) {}
+    public void setContentType(@SuppressWarnings("unused") String type) {}
+    public void setNote(@SuppressWarnings("unused") String name,
+            @SuppressWarnings("unused") Object value) {}
+    public void setProtocol(@SuppressWarnings("unused") String protocol) {}
+    public void setRemoteAddr(@SuppressWarnings("unused") String remoteAddr) {}
+    public void setRemoteHost(@SuppressWarnings("unused") String remoteHost) {}
+    public void setScheme(@SuppressWarnings("unused") String scheme) {}
+    public void setServerName(@SuppressWarnings("unused") String name) {}
+    public void setServerPort(@SuppressWarnings("unused") int port) {}
     public Object getAttribute(String name) { return null; }
     public Enumeration<String> getAttributeNames() { return null; }
     public String getCharacterEncoding() { return null; }
     public int getContentLength() { return -1; }
-    public void setContentLength(int length) {}
+    public void setContentLength(@SuppressWarnings("unused") int length) {}
     public String getContentType() { return null; }
     public ServletInputStream getInputStream() throws IOException {
         return null;
@@ -218,23 +222,28 @@
     public void setAttribute(String name, Object value) {}
     public void setCharacterEncoding(String enc)
         throws UnsupportedEncodingException {}
-    public void addCookie(Cookie cookie) {}
-    public void addHeader(String name, String value) {}
-    public void addParameter(String name, String values[]) {}
+    public void addCookie(@SuppressWarnings("unused") Cookie cookie) {}
+    public void addHeader(@SuppressWarnings("unused") String name,
+            @SuppressWarnings("unused") String value) {}
+    public void addParameter(@SuppressWarnings("unused") String name,
+            @SuppressWarnings("unused") String values[]) {}
     public void clearCookies() {}
     public void clearHeaders() {}
     public void clearLocales() {}
     public void clearParameters() {}
     public void recycle() {}
-    public void setAuthType(String authType) {}
-    public void setContextPath(String path) {}
-    public void setMethod(String method) {}
-    public void setRequestedSessionCookie(boolean flag) {}
-    public void setRequestedSessionId(String id) {}
-    public void setRequestedSessionURL(boolean flag) {}
-    public void setRequestURI(String uri) {}
-    public void setSecure(boolean secure) {}
-    public void setUserPrincipal(Principal principal) {}
+    public void setAuthType(@SuppressWarnings("unused") String authType) {}
+    public void setContextPath(@SuppressWarnings("unused") String path) {}
+    public void setMethod(@SuppressWarnings("unused") String method) {}
+    public void setRequestedSessionCookie(
+            @SuppressWarnings("unused") boolean flag) {}
+    public void setRequestedSessionId(@SuppressWarnings("unused") String id) {}
+    public void setRequestedSessionURL(
+            @SuppressWarnings("unused") boolean flag) {}
+    public void setRequestURI(@SuppressWarnings("unused") String uri) {}
+    public void setSecure(@SuppressWarnings("unused") boolean secure) {}
+    public void setUserPrincipal(
+            @SuppressWarnings("unused") Principal principal) {}
     public String getParameter(String name) { return null; }
     public Map<String,String[]> getParameterMap() { return null; }
     public Enumeration<String> getParameterNames() { return dummyEnum; }
@@ -254,7 +263,7 @@
     public String getRemoteUser() { return null; }
     public String getRequestedSessionId() { return null; }
     public String getRequestURI() { return null; }
-    public void setDecodedRequestURI(String uri) {}
+    public void setDecodedRequestURI(@SuppressWarnings("unused") String uri) {}
     public StringBuffer getRequestURL() { return null; }
     public HttpSession getSession() { return null; }
     public HttpSession getSession(boolean create) { return null; }

Modified: tomcat/trunk/java/org/apache/catalina/core/DummyResponse.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/DummyResponse.java?rev=764898&r1=764897&r2=764898&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/DummyResponse.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/DummyResponse.java Tue Apr 14 17:46:23 2009
@@ -48,22 +48,23 @@
     }
 
 
-    public void setAppCommitted(boolean appCommitted) {}
+    public void setAppCommitted(
+            @SuppressWarnings("unused") boolean appCommitted) {}
     public boolean isAppCommitted() { return false; }
     public Connector getConnector() { return null; }
-    public void setConnector(Connector connector) {}
+    public void setConnector(@SuppressWarnings("unused") Connector connector) {}
     public int getContentCount() { return -1; }
     public Context getContext() { return null; }
-    public void setContext(Context context) {}
+    public void setContext(@SuppressWarnings("unused") Context context) {}
     public boolean getIncluded() { return false; }
-    public void setIncluded(boolean included) {}
+    public void setIncluded(@SuppressWarnings("unused") boolean included) {}
     public String getInfo() { return null; }
     public Request getRequest() { return null; }
-    public void setRequest(Request request) {}
+    public void setRequest(@SuppressWarnings("unused") Request request) {}
     public ServletResponse getResponse() { return null; }
     public OutputStream getStream() { return null; }
-    public void setStream(OutputStream stream) {}
-    public void setSuspended(boolean suspended) {}
+    public void setStream(@SuppressWarnings("unused") OutputStream stream) {}
+    public void setSuspended(@SuppressWarnings("unused") boolean suspended) {}
     public boolean isSuspended() { return false; }
     public void setError() {}
     public boolean isError() { return false; }
@@ -75,9 +76,12 @@
     public String getContentType() { return null; }
     public PrintWriter getReporter() { return null; }
     public void recycle() {}
-    public void write(int b) throws IOException {}
-    public void write(byte b[]) throws IOException {}
-    public void write(byte b[], int off, int len) throws IOException {}
+    public void write(@SuppressWarnings("unused") int b) throws IOException {}
+    public void write(@SuppressWarnings("unused") byte b[]) throws IOException {
+    }
+    public void write(@SuppressWarnings("unused") byte b[],
+            @SuppressWarnings("unused") int off,
+            @SuppressWarnings("unused") int len) throws IOException {}
     public void flushBuffer() throws IOException {}
     public int getBufferSize() { return -1; }
     public String getCharacterEncoding() { return null; }
@@ -96,12 +100,17 @@
     public void setLocale(Locale locale) {}
 
     public Cookie[] getCookies() { return null; }
-    public String getHeader(String name) { return null; }
+    public String getHeader(@SuppressWarnings("unused") String name) {
+        return null;
+    }
     public String[] getHeaderNames() { return null; }
-    public String[] getHeaderValues(String name) { return null; }
+    public String[] getHeaderValues(@SuppressWarnings("unused") String name) {
+        return null;
+    }
     public String getMessage() { return null; }
     public int getStatus() { return -1; }
-    public void reset(int status, String message) {}
+    public void reset(@SuppressWarnings("unused") int status,
+            @SuppressWarnings("unused") String message) {}
     public void addCookie(Cookie cookie) {}
     public void addDateHeader(String name, long value) {}
     public void addHeader(String name, String value) {}

Modified: tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java?rev=764898&r1=764897&r2=764898&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/NamingContextListener.java Tue Apr 14 17:46:23
2009
@@ -868,7 +868,7 @@
             try {
                 wsdlURL = new URL(service.getWsdlfile());
             } catch (MalformedURLException e) {
-                wsdlURL = null;
+                // Ignore and carry on
             }
             if (wsdlURL == null) {
                 try {
@@ -876,7 +876,7 @@
                                                     getServletContext().
                                                     getResource(service.getWsdlfile());
                 } catch (MalformedURLException e) {
-                    wsdlURL = null;
+                    // Ignore and carry on
                 }
             }
             if (wsdlURL == null) {
@@ -902,7 +902,7 @@
             try {
                 jaxrpcURL = new URL(service.getJaxrpcmappingfile());
             } catch (MalformedURLException e) {
-                jaxrpcURL = null;
+                // Ignore and carry on
             }
             if (jaxrpcURL == null) {
                 try {
@@ -910,7 +910,7 @@
                                                     getServletContext().
                                                     getResource(service.getJaxrpcmappingfile());
                 } catch (MalformedURLException e) {
-                    jaxrpcURL = null;
+                    // Ignore and carry on
                 }
             }
             if (jaxrpcURL == null) {

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java?rev=764898&r1=764897&r2=764898&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapper.java Tue Apr 14 17:46:23 2009
@@ -1482,7 +1482,8 @@
      *
      * @param mapperClass Java class name of the default Mapper
      */
-    protected void addDefaultMapper(String mapperClass) {
+    protected void addDefaultMapper(
+            @SuppressWarnings("unused") String mapperClass) {
 
         // No need for a default Mapper on a Wrapper
 

Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java?rev=764898&r1=764897&r2=764898&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapperValve.java Tue Apr 14 17:46:23
2009
@@ -148,7 +148,6 @@
                              wrapper.getName()), StandardWrapper.getRootCause(e));
             throwable = e;
             exception(request, response, e);
-            servlet = null;
         } catch (Throwable e) {
             container.getLogger().error(sm.getString("standardWrapper.allocateException",
                              wrapper.getName()), e);
@@ -181,10 +180,7 @@
             exception(request, response, e);
             servlet = null;
         }
-        MessageBytes requestPathMB = null;
-        if (request != null) {
-            requestPathMB = request.getRequestPathMB();
-        }
+        MessageBytes requestPathMB = request.getRequestPathMB();
         request.setAttribute
             (ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
              ApplicationFilterFactory.REQUEST_INTEGER);
@@ -374,7 +370,6 @@
                              wrapper.getName()), StandardWrapper.getRootCause(e));
             throwable = e;
             exception(request, response, e);
-            servlet = null;
         } catch (Throwable e) {
             container.getLogger().error(sm.getString("standardWrapper.allocateException",
                              wrapper.getName()), e);
@@ -383,10 +378,7 @@
             servlet = null;
         }
 
-        MessageBytes requestPathMB = null;
-        if (request != null) {
-            requestPathMB = request.getRequestPathMB();
-        }
+        MessageBytes requestPathMB = request.getRequestPathMB();
         request.setAttribute
             (ApplicationFilterFactory.DISPATCHER_TYPE_ATTR,
              ApplicationFilterFactory.REQUEST_INTEGER);



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


Mime
View raw message