Author: markt Date: Mon Jan 12 07:02:23 2009 New Revision: 733775 URL: http://svn.apache.org/viewvc?rev=733775&view=rev Log: 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.
Modified: tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java tomcat/trunk/java/org/apache/catalina/connector/Request.java tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpResponse.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/StandardWrapperFacade.java tomcat/trunk/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java tomcat/trunk/java/org/apache/catalina/session/StandardSession.java tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java Modified: tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java (original) +++ tomcat/trunk/java/org/apache/catalina/ant/jmx/JMXAccessorTask.java Mon Jan 12 07:02:23 2009 @@ -621,7 +621,7 @@ for (Iterator<String> 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 @@ 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); Modified: tomcat/trunk/java/org/apache/catalina/connector/Request.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Request.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/Request.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/Request.java Mon Jan 12 07:02:23 2009 @@ -1090,7 +1090,7 @@ /** * Return the names of all defined request parameters for this request. */ - public Enumeration getParameterNames() { + public Enumeration<String> getParameterNames() { if (!parametersParsed) parseParameters(); @@ -1932,7 +1932,7 @@ * * @param name Name of the requested header */ - public Enumeration getHeaders(String name) { + public Enumeration<String> getHeaders(String name) { return coyoteRequest.getMimeHeaders().values(name); } @@ -1940,7 +1940,7 @@ /** * Return the names of all headers received with this request. */ - public Enumeration getHeaderNames() { + public Enumeration<String> getHeaderNames() { return coyoteRequest.getMimeHeaders().names(); } Modified: tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/RequestFacade.java Mon Jan 12 07:02:23 2009 @@ -269,7 +269,7 @@ } - public Enumeration getAttributeNames() { + public Enumeration<String> getAttributeNames() { if (request == null) { throw new IllegalStateException( @@ -362,7 +362,7 @@ } - public Enumeration getParameterNames() { + public Enumeration<String> getParameterNames() { if (request == null) { throw new IllegalStateException( @@ -405,7 +405,7 @@ } - public Map getParameterMap() { + public Map<String,String[]> getParameterMap() { if (request == null) { throw new IllegalStateException( @@ -536,7 +536,7 @@ } - public Enumeration getLocales() { + public Enumeration<Locale> getLocales() { if (request == null) { throw new IllegalStateException( @@ -649,7 +649,7 @@ } - public Enumeration getHeaders(String name) { + public Enumeration<String> getHeaders(String name) { if (request == null) { throw new IllegalStateException( @@ -665,7 +665,7 @@ } - public Enumeration getHeaderNames() { + public Enumeration<String> getHeaderNames() { if (request == null) { throw new IllegalStateException( Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Mon Jan 12 07:02:23 2009 @@ -117,10 +117,18 @@ /** - * Empty collection to serve as the basis for empty enumerations. + * Empty String collection to serve as the basis for empty enumerations. * <strong>DO NOT ADD ANY ELEMENTS TO THIS COLLECTION!</strong> */ - private static final ArrayList<Object> empty = new ArrayList<Object>(); + private static final ArrayList<String> emptyString = + new ArrayList<String>(); + + /** + * Empty Servlet collection to serve as the basis for empty enumerations. + * <strong>DO NOT ADD ANY ELEMENTS TO THIS COLLECTION!</strong> + */ + private static final ArrayList<Servlet> emptyServlet = + new ArrayList<Servlet>(); /** @@ -201,7 +209,7 @@ * Return an enumeration of the names of the context attributes * associated with this context. */ - public Enumeration getAttributeNames() { + public Enumeration<String> getAttributeNames() { return new Enumerator<String>(attributes.keySet(), true); @@ -283,7 +291,7 @@ * 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<String> getInitParameterNames() { mergeParameters(); return (new Enumerator<String>(parameters.keySet())); @@ -562,7 +570,7 @@ * * @param path Collection path */ - public Set getResourcePaths(String path) { + public Set<String> getResourcePaths(String path) { // Validate the path argument if (path == null) { @@ -640,16 +648,16 @@ /** * @deprecated As of Java Servlet API 2.1, with no direct replacement. */ - public Enumeration getServletNames() { - return (new Enumerator<Object>(empty)); + public Enumeration<String> getServletNames() { + return (new Enumerator<String>(emptyString)); } /** * @deprecated As of Java Servlet API 2.1, with no direct replacement. */ - public Enumeration getServlets() { - return (new Enumerator<Object>(empty)); + public Enumeration<Servlet> getServlets() { + return (new Enumerator<Servlet>(emptyServlet)); } Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContextFacade.java Mon Jan 12 07:02:23 2009 @@ -159,9 +159,10 @@ } - public Set getResourcePaths(String path) { + public Set<String> getResourcePaths(String path) { if (SecurityUtil.isPackageProtectionEnabled()){ - return (Set)doPrivileged("getResourcePaths", new Object[]{path}); + return (Set<String>)doPrivileged("getResourcePaths", + new Object[]{path}); } else { return context.getResourcePaths(path); } @@ -216,6 +217,9 @@ } + /** + * @deprecated + */ public Servlet getServlet(String name) throws ServletException { if (SecurityUtil.isPackageProtectionEnabled()) { @@ -234,18 +238,24 @@ } - public Enumeration getServlets() { + /** + * @deprecated + */ + public Enumeration<Servlet> getServlets() { if (SecurityUtil.isPackageProtectionEnabled()) { - return (Enumeration) doPrivileged("getServlets", null); + return (Enumeration<Servlet>) doPrivileged("getServlets", null); } else { return context.getServlets(); } } - public Enumeration getServletNames() { + /** + * @deprecated + */ + public Enumeration<String> getServletNames() { if (SecurityUtil.isPackageProtectionEnabled()) { - return (Enumeration) doPrivileged("getServletNames", null); + return (Enumeration<String>) doPrivileged("getServletNames", null); } else { return context.getServletNames(); } @@ -261,6 +271,9 @@ } + /** + * @deprecated + */ public void log(Exception exception, String msg) { if (SecurityUtil.isPackageProtectionEnabled()) { doPrivileged("log", new Class[]{Exception.class, String.class}, @@ -309,9 +322,10 @@ } - public Enumeration getInitParameterNames() { + public Enumeration<String> getInitParameterNames() { if (SecurityUtil.isPackageProtectionEnabled()) { - return (Enumeration) doPrivileged("getInitParameterNames", null); + return (Enumeration<String>) doPrivileged( + "getInitParameterNames", null); } else { return context.getInitParameterNames(); } @@ -327,9 +341,10 @@ } - public Enumeration getAttributeNames() { + public Enumeration<String> getAttributeNames() { if (SecurityUtil.isPackageProtectionEnabled()) { - return (Enumeration) doPrivileged("getAttributeNames", null); + return (Enumeration<String>) doPrivileged( + "getAttributeNames", null); } else { return context.getAttributeNames(); } Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/ApplicationFilterConfig.java Mon Jan 12 07:02:23 2009 @@ -153,7 +153,7 @@ * Return an <code>Enumeration</code> of the names of the initialization * parameters for this Filter. */ - public Enumeration getInitParameterNames() { + public Enumeration<String> getInitParameterNames() { Map<String,String> map = filterDef.getParameterMap(); if (map == null) 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=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpRequest.java Mon Jan 12 07:02:23 2009 @@ -239,7 +239,7 @@ * Override the <code>getAttributeNames()</code> method of the wrapped * request. */ - public Enumeration getAttributeNames() { + public Enumeration<String> getAttributeNames() { return (new AttributeNamesEnumerator()); } Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpResponse.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpResponse.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpResponse.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/ApplicationHttpResponse.java Mon Jan 12 07:02:23 2009 @@ -335,6 +335,7 @@ * * @param sc The new status code * @param msg The new message + * @deprecated */ public void setStatus(int sc, String msg) { 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=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/DummyRequest.java Mon Jan 12 07:02:23 2009 @@ -81,11 +81,11 @@ protected FilterChain filterChain = null; - private static Enumeration<Object> dummyEnum = new Enumeration<Object>(){ + private static Enumeration<String> dummyEnum = new Enumeration<String>(){ public boolean hasMoreElements(){ return false; } - public Object nextElement(){ + public String nextElement(){ return null; } }; @@ -194,7 +194,7 @@ public void setServerName(String name) {} public void setServerPort(int port) {} public Object getAttribute(String name) { return null; } - public Enumeration getAttributeNames() { return null; } + public Enumeration<String> getAttributeNames() { return null; } public String getCharacterEncoding() { return null; } public int getContentLength() { return -1; } public void setContentLength(int length) {} @@ -203,9 +203,10 @@ return null; } public Locale getLocale() { return null; } - public Enumeration getLocales() { return null; } + public Enumeration<Locale> 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 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<String,String[]> getParameterMap() { return null; } + public Enumeration<String> getParameterNames() { return dummyEnum; } public String[] getParameterValues(String name) { return null; } public RequestDispatcher getRequestDispatcher(String path) { return null; @@ -245,8 +246,8 @@ 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<String> getHeaders(String name) { return null; } + public Enumeration<String> 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 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; } 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=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/DummyResponse.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/DummyResponse.java Mon Jan 12 07:02:23 2009 @@ -108,8 +108,10 @@ 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 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) {} Modified: tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java (original) +++ tomcat/trunk/java/org/apache/catalina/core/StandardWrapperFacade.java Mon Jan 12 07:02:23 2009 @@ -88,7 +88,7 @@ } - public Enumeration getInitParameterNames() { + public Enumeration<String> getInitParameterNames() { return config.getInitParameterNames(); } Modified: tomcat/trunk/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java (original) +++ tomcat/trunk/java/org/apache/catalina/ha/jmx/ClusterJmxHelper.java Mon Jan 12 07:02:23 2009 @@ -52,7 +52,7 @@ 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(); } Modified: tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java (original) +++ tomcat/trunk/java/org/apache/catalina/ha/session/DeltaSession.java Mon Jan 12 07:02:23 2009 @@ -779,7 +779,7 @@ final class StandardSessionContext implements HttpSessionContext { - private HashMap dummy = new HashMap(); + private HashMap<?,String> dummy = new HashMap<String,String>(); /** * Return the session identifiers of all sessions defined within this @@ -789,8 +789,8 @@ * must return an empty <code>Enumeration</code> and will be * removed in a future version of the API. */ - public Enumeration getIds() { - return (new Enumerator(dummy)); + public Enumeration<String> getIds() { + return (new Enumerator<String>(dummy)); } /** Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSession.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSession.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/session/StandardSession.java (original) +++ tomcat/trunk/java/org/apache/catalina/session/StandardSession.java Mon Jan 12 07:02:23 2009 @@ -1740,7 +1740,7 @@ final class StandardSessionContext implements HttpSessionContext { - protected HashMap dummy = new HashMap(); + protected HashMap<?,String> dummy = new HashMap<String,String>(); /** * Return the session identifiers of all sessions defined @@ -1750,9 +1750,9 @@ * This method must return an empty <code>Enumeration</code> * and will be removed in a future version of the API. */ - public Enumeration getIds() { + public Enumeration<String> getIds() { - return (new Enumerator(dummy)); + return (new Enumerator<String>(dummy)); } Modified: tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java?rev=733775&r1=733774&r2=733775&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java (original) +++ tomcat/trunk/java/org/apache/catalina/session/StandardSessionFacade.java Mon Jan 12 07:02:23 2009 @@ -122,7 +122,7 @@ } - public Enumeration getAttributeNames() { + public Enumeration<String> getAttributeNames() { return session.getAttributeNames(); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org