From: markt Date: Mon, 12 Jan 2009 15:02:23 +0000 (+0000) Subject: Generics changes after updating the spec api and also those enabled by the min 1... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3c8eb8a378e996bb08e06ebc0452569899ca2444;p=tomcat7.0 Generics changes after updating the spec api and also those enabled by the min 1.6 JDK requirement. Add deprecation to the internal Tomcta methods that implement deprecated methods. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@733775 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java b/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java index 3f118a7ef..ce2164e99 100644 --- a/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java +++ b/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java @@ -621,7 +621,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask { for (Iterator iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); Object value = data.get(key); - OpenType type = compositeType.getType(key); + OpenType type = compositeType.getType(key); if (type instanceof SimpleType) { setProperty(propertyPrefix + "." + key, value); } else { @@ -636,7 +636,7 @@ public class JMXAccessorTask extends BaseRedirectorHelperTask { Object key1 = iter1.next(); CompositeData valuedata = data.get(new Object[] { key1 }); Object value = valuedata.get("value"); - OpenType type = valuedata.getCompositeType().getType( + OpenType type = valuedata.getCompositeType().getType( "value"); if (type instanceof SimpleType) { setProperty(propertyPrefix + "." + key1, value); diff --git a/java/org/apache/catalina/connector/Request.java b/java/org/apache/catalina/connector/Request.java index 6f5699ac4..4438bf43f 100644 --- a/java/org/apache/catalina/connector/Request.java +++ b/java/org/apache/catalina/connector/Request.java @@ -1090,7 +1090,7 @@ public class Request /** * Return the names of all defined request parameters for this request. */ - public Enumeration getParameterNames() { + public Enumeration getParameterNames() { if (!parametersParsed) parseParameters(); @@ -1932,7 +1932,7 @@ public class Request * * @param name Name of the requested header */ - public Enumeration getHeaders(String name) { + public Enumeration getHeaders(String name) { return coyoteRequest.getMimeHeaders().values(name); } @@ -1940,7 +1940,7 @@ public class Request /** * Return the names of all headers received with this request. */ - public Enumeration getHeaderNames() { + public Enumeration getHeaderNames() { return coyoteRequest.getMimeHeaders().names(); } diff --git a/java/org/apache/catalina/connector/RequestFacade.java b/java/org/apache/catalina/connector/RequestFacade.java index 825c0aa13..387a2e6db 100644 --- a/java/org/apache/catalina/connector/RequestFacade.java +++ b/java/org/apache/catalina/connector/RequestFacade.java @@ -269,7 +269,7 @@ public class RequestFacade implements HttpServletRequest { } - public Enumeration getAttributeNames() { + public Enumeration getAttributeNames() { if (request == null) { throw new IllegalStateException( @@ -362,7 +362,7 @@ public class RequestFacade implements HttpServletRequest { } - public Enumeration getParameterNames() { + public Enumeration getParameterNames() { if (request == null) { throw new IllegalStateException( @@ -405,7 +405,7 @@ public class RequestFacade implements HttpServletRequest { } - public Map getParameterMap() { + public Map getParameterMap() { if (request == null) { throw new IllegalStateException( @@ -536,7 +536,7 @@ public class RequestFacade implements HttpServletRequest { } - public Enumeration getLocales() { + public Enumeration getLocales() { if (request == null) { throw new IllegalStateException( @@ -649,7 +649,7 @@ public class RequestFacade implements HttpServletRequest { } - public Enumeration getHeaders(String name) { + public Enumeration getHeaders(String name) { if (request == null) { throw new IllegalStateException( @@ -665,7 +665,7 @@ public class RequestFacade implements HttpServletRequest { } - public Enumeration getHeaderNames() { + public Enumeration getHeaderNames() { if (request == null) { throw new IllegalStateException( diff --git a/java/org/apache/catalina/core/ApplicationContext.java b/java/org/apache/catalina/core/ApplicationContext.java index 29bc2c869..81ae804e4 100644 --- a/java/org/apache/catalina/core/ApplicationContext.java +++ b/java/org/apache/catalina/core/ApplicationContext.java @@ -117,10 +117,18 @@ public class ApplicationContext /** - * Empty collection to serve as the basis for empty enumerations. + * Empty String collection to serve as the basis for empty enumerations. * DO NOT ADD ANY ELEMENTS TO THIS COLLECTION! */ - private static final ArrayList empty = new ArrayList(); + private static final ArrayList emptyString = + new ArrayList(); + + /** + * Empty Servlet collection to serve as the basis for empty enumerations. + * DO NOT ADD ANY ELEMENTS TO THIS COLLECTION! + */ + private static final ArrayList emptyServlet = + new ArrayList(); /** @@ -201,7 +209,7 @@ public class ApplicationContext * Return an enumeration of the names of the context attributes * associated with this context. */ - public Enumeration getAttributeNames() { + public Enumeration getAttributeNames() { return new Enumerator(attributes.keySet(), true); @@ -283,7 +291,7 @@ public class ApplicationContext * Return the names of the context's initialization parameters, or an * empty enumeration if the context has no initialization parameters. */ - public Enumeration getInitParameterNames() { + public Enumeration getInitParameterNames() { mergeParameters(); return (new Enumerator(parameters.keySet())); @@ -562,7 +570,7 @@ public class ApplicationContext * * @param path Collection path */ - public Set getResourcePaths(String path) { + public Set getResourcePaths(String path) { // Validate the path argument if (path == null) { @@ -640,16 +648,16 @@ public class ApplicationContext /** * @deprecated As of Java Servlet API 2.1, with no direct replacement. */ - public Enumeration getServletNames() { - return (new Enumerator(empty)); + public Enumeration getServletNames() { + return (new Enumerator(emptyString)); } /** * @deprecated As of Java Servlet API 2.1, with no direct replacement. */ - public Enumeration getServlets() { - return (new Enumerator(empty)); + public Enumeration getServlets() { + return (new Enumerator(emptyServlet)); } diff --git a/java/org/apache/catalina/core/ApplicationContextFacade.java b/java/org/apache/catalina/core/ApplicationContextFacade.java index b88792f9e..7e90c8f36 100644 --- a/java/org/apache/catalina/core/ApplicationContextFacade.java +++ b/java/org/apache/catalina/core/ApplicationContextFacade.java @@ -159,9 +159,10 @@ public final class ApplicationContextFacade } - public Set getResourcePaths(String path) { + public Set getResourcePaths(String path) { if (SecurityUtil.isPackageProtectionEnabled()){ - return (Set)doPrivileged("getResourcePaths", new Object[]{path}); + return (Set)doPrivileged("getResourcePaths", + new Object[]{path}); } else { return context.getResourcePaths(path); } @@ -216,6 +217,9 @@ public final class ApplicationContextFacade } + /** + * @deprecated + */ public Servlet getServlet(String name) throws ServletException { if (SecurityUtil.isPackageProtectionEnabled()) { @@ -234,18 +238,24 @@ public final class ApplicationContextFacade } - public Enumeration getServlets() { + /** + * @deprecated + */ + public Enumeration getServlets() { if (SecurityUtil.isPackageProtectionEnabled()) { - return (Enumeration) doPrivileged("getServlets", null); + return (Enumeration) doPrivileged("getServlets", null); } else { return context.getServlets(); } } - public Enumeration getServletNames() { + /** + * @deprecated + */ + public Enumeration getServletNames() { if (SecurityUtil.isPackageProtectionEnabled()) { - return (Enumeration) doPrivileged("getServletNames", null); + return (Enumeration) doPrivileged("getServletNames", null); } else { return context.getServletNames(); } @@ -261,6 +271,9 @@ public final class ApplicationContextFacade } + /** + * @deprecated + */ public void log(Exception exception, String msg) { if (SecurityUtil.isPackageProtectionEnabled()) { doPrivileged("log", new Class[]{Exception.class, String.class}, @@ -309,9 +322,10 @@ public final class ApplicationContextFacade } - public Enumeration getInitParameterNames() { + public Enumeration getInitParameterNames() { if (SecurityUtil.isPackageProtectionEnabled()) { - return (Enumeration) doPrivileged("getInitParameterNames", null); + return (Enumeration) doPrivileged( + "getInitParameterNames", null); } else { return context.getInitParameterNames(); } @@ -327,9 +341,10 @@ public final class ApplicationContextFacade } - public Enumeration getAttributeNames() { + public Enumeration getAttributeNames() { if (SecurityUtil.isPackageProtectionEnabled()) { - return (Enumeration) doPrivileged("getAttributeNames", null); + return (Enumeration) doPrivileged( + "getAttributeNames", null); } else { return context.getAttributeNames(); } diff --git a/java/org/apache/catalina/core/ApplicationFilterConfig.java b/java/org/apache/catalina/core/ApplicationFilterConfig.java index 4cb4b9e6c..f06cf2ed6 100644 --- a/java/org/apache/catalina/core/ApplicationFilterConfig.java +++ b/java/org/apache/catalina/core/ApplicationFilterConfig.java @@ -153,7 +153,7 @@ final class ApplicationFilterConfig implements FilterConfig, Serializable { * Return an Enumeration of the names of the initialization * parameters for this Filter. */ - public Enumeration getInitParameterNames() { + public Enumeration getInitParameterNames() { Map map = filterDef.getParameterMap(); if (map == null) diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java index 4d7712e4d..4088e4d5c 100644 --- a/java/org/apache/catalina/core/ApplicationHttpRequest.java +++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java @@ -239,7 +239,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper { * Override the getAttributeNames() method of the wrapped * request. */ - public Enumeration getAttributeNames() { + public Enumeration getAttributeNames() { return (new AttributeNamesEnumerator()); } diff --git a/java/org/apache/catalina/core/ApplicationHttpResponse.java b/java/org/apache/catalina/core/ApplicationHttpResponse.java index ce24523a7..b2d61fc68 100644 --- a/java/org/apache/catalina/core/ApplicationHttpResponse.java +++ b/java/org/apache/catalina/core/ApplicationHttpResponse.java @@ -335,6 +335,7 @@ class ApplicationHttpResponse extends HttpServletResponseWrapper { * * @param sc The new status code * @param msg The new message + * @deprecated */ public void setStatus(int sc, String msg) { diff --git a/java/org/apache/catalina/core/DummyRequest.java b/java/org/apache/catalina/core/DummyRequest.java index 5e3959064..f108203de 100644 --- a/java/org/apache/catalina/core/DummyRequest.java +++ b/java/org/apache/catalina/core/DummyRequest.java @@ -81,11 +81,11 @@ public class DummyRequest protected FilterChain filterChain = null; - private static Enumeration dummyEnum = new Enumeration(){ + private static Enumeration dummyEnum = new Enumeration(){ public boolean hasMoreElements(){ return false; } - public Object nextElement(){ + public String nextElement(){ return null; } }; @@ -194,7 +194,7 @@ public class DummyRequest public void setServerName(String name) {} public void setServerPort(int port) {} public Object getAttribute(String name) { return null; } - public Enumeration getAttributeNames() { return null; } + public Enumeration getAttributeNames() { return null; } public String getCharacterEncoding() { return null; } public int getContentLength() { return -1; } public void setContentLength(int length) {} @@ -203,9 +203,10 @@ public class DummyRequest return null; } public Locale getLocale() { return null; } - public Enumeration getLocales() { return null; } + public Enumeration getLocales() { return null; } public String getProtocol() { return null; } public BufferedReader getReader() throws IOException { return null; } + /** @deprecated */ public String getRealPath(String path) { return null; } public String getRemoteAddr() { return null; } public String getRemoteHost() { return null; } @@ -235,8 +236,8 @@ public class DummyRequest public void setSecure(boolean secure) {} public void setUserPrincipal(Principal principal) {} public String getParameter(String name) { return null; } - public Map getParameterMap() { return null; } - public Enumeration getParameterNames() { return dummyEnum; } + public Map getParameterMap() { return null; } + public Enumeration getParameterNames() { return dummyEnum; } public String[] getParameterValues(String name) { return null; } public RequestDispatcher getRequestDispatcher(String path) { return null; @@ -245,8 +246,8 @@ public class DummyRequest public Cookie[] getCookies() { return null; } public long getDateHeader(String name) { return -1; } public String getHeader(String name) { return null; } - public Enumeration getHeaders(String name) { return null; } - public Enumeration getHeaderNames() { return null; } + public Enumeration getHeaders(String name) { return null; } + public Enumeration getHeaderNames() { return null; } public int getIntHeader(String name) { return -1; } public String getMethod() { return null; } public String getPathTranslated() { return null; } @@ -259,6 +260,7 @@ public class DummyRequest public HttpSession getSession(boolean create) { return null; } public boolean isRequestedSessionIdFromCookie() { return false; } public boolean isRequestedSessionIdFromURL() { return false; } + /** @deprecated */ public boolean isRequestedSessionIdFromUrl() { return false; } public boolean isRequestedSessionIdValid() { return false; } public boolean isUserInRole(String role) { return false; } diff --git a/java/org/apache/catalina/core/DummyResponse.java b/java/org/apache/catalina/core/DummyResponse.java index f4f3667dc..c16768728 100644 --- a/java/org/apache/catalina/core/DummyResponse.java +++ b/java/org/apache/catalina/core/DummyResponse.java @@ -108,8 +108,10 @@ public class DummyResponse public void addIntHeader(String name, int value) {} public boolean containsHeader(String name) { return false; } public String encodeRedirectURL(String url) { return null; } + /** @deprecated */ public String encodeRedirectUrl(String url) { return null; } public String encodeURL(String url) { return null; } + /** @deprecated */ public String encodeUrl(String url) { return null; } public void sendAcknowledgement() throws IOException {} public void sendError(int status) throws IOException {} @@ -119,6 +121,7 @@ public class DummyResponse public void setHeader(String name, String value) {} public void setIntHeader(String name, int value) {} public void setStatus(int status) {} + /** @deprecated */ public void setStatus(int status, String message) {} diff --git a/java/org/apache/catalina/core/StandardWrapperFacade.java b/java/org/apache/catalina/core/StandardWrapperFacade.java index c36c8edbe..26282b2a3 100644 --- a/java/org/apache/catalina/core/StandardWrapperFacade.java +++ b/java/org/apache/catalina/core/StandardWrapperFacade.java @@ -88,7 +88,7 @@ public final class StandardWrapperFacade } - public Enumeration getInitParameterNames() { + public Enumeration getInitParameterNames() { return config.getInitParameterNames(); } diff --git a/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java b/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java index ab4ed73f8..cfcb1493d 100644 --- a/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java +++ b/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java @@ -52,7 +52,7 @@ public class ClusterJmxHelper { public static MBeanServer getMBeanServer() throws Exception { if (mbeanServer == null) { if (MBeanServerFactory.findMBeanServer(null).size() > 0) { - mbeanServer = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0); + mbeanServer = MBeanServerFactory.findMBeanServer(null).get(0); } else { mbeanServer = MBeanServerFactory.createMBeanServer(); } diff --git a/java/org/apache/catalina/ha/session/DeltaSession.java b/java/org/apache/catalina/ha/session/DeltaSession.java index 63437874e..3eeeab845 100644 --- a/java/org/apache/catalina/ha/session/DeltaSession.java +++ b/java/org/apache/catalina/ha/session/DeltaSession.java @@ -779,7 +779,7 @@ public class DeltaSession extends StandardSession implements Externalizable,Clus final class StandardSessionContext implements HttpSessionContext { - private HashMap dummy = new HashMap(); + private HashMap dummy = new HashMap(); /** * Return the session identifiers of all sessions defined within this @@ -789,8 +789,8 @@ final class StandardSessionContext * must return an empty Enumeration and will be * removed in a future version of the API. */ - public Enumeration getIds() { - return (new Enumerator(dummy)); + public Enumeration getIds() { + return (new Enumerator(dummy)); } /** diff --git a/java/org/apache/catalina/session/StandardSession.java b/java/org/apache/catalina/session/StandardSession.java index 135a67f91..09cafd2e6 100644 --- a/java/org/apache/catalina/session/StandardSession.java +++ b/java/org/apache/catalina/session/StandardSession.java @@ -1740,7 +1740,7 @@ public class StandardSession final class StandardSessionContext implements HttpSessionContext { - protected HashMap dummy = new HashMap(); + protected HashMap dummy = new HashMap(); /** * Return the session identifiers of all sessions defined @@ -1750,9 +1750,9 @@ final class StandardSessionContext implements HttpSessionContext { * This method must return an empty Enumeration * and will be removed in a future version of the API. */ - public Enumeration getIds() { + public Enumeration getIds() { - return (new Enumerator(dummy)); + return (new Enumerator(dummy)); } diff --git a/java/org/apache/catalina/session/StandardSessionFacade.java b/java/org/apache/catalina/session/StandardSessionFacade.java index eafb499ef..2d659c561 100644 --- a/java/org/apache/catalina/session/StandardSessionFacade.java +++ b/java/org/apache/catalina/session/StandardSessionFacade.java @@ -122,7 +122,7 @@ public class StandardSessionFacade } - public Enumeration getAttributeNames() { + public Enumeration getAttributeNames() { return session.getAttributeNames(); }