From 76f6ed97c4a867626b268ad373bf4157a85d5ed3 Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 7 Feb 2010 21:12:03 +0000 Subject: [PATCH] Get javax.servlet.http passing TCK API check Removing use of @Deprecated Use better comment for this in java.servlet git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@907493 13f79535-47bb-0310-9956-ffa450edef68 --- java/javax/servlet/ServletContext.java | 8 ++--- java/javax/servlet/ServletRequest.java | 2 +- java/javax/servlet/ServletRequestWrapper.java | 2 +- java/javax/servlet/SingleThreadModel.java | 2 +- java/javax/servlet/UnavailableException.java | 6 ++-- java/javax/servlet/http/HttpServletRequest.java | 3 +- .../servlet/http/HttpServletRequestWrapper.java | 2 +- java/javax/servlet/http/HttpServletResponse.java | 29 +++++++--------- .../servlet/http/HttpServletResponseWrapper.java | 6 ++-- java/javax/servlet/http/HttpSession.java | 40 ++++++++-------------- java/javax/servlet/http/HttpSessionContext.java | 10 ++---- java/javax/servlet/http/HttpUtils.java | 7 ++-- 12 files changed, 47 insertions(+), 70 deletions(-) diff --git a/java/javax/servlet/ServletContext.java b/java/javax/servlet/ServletContext.java index 71042bca7..14448b6d0 100644 --- a/java/javax/servlet/ServletContext.java +++ b/java/javax/servlet/ServletContext.java @@ -356,7 +356,7 @@ public interface ServletContext { * * @deprecated */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public Servlet getServlet(String name) throws ServletException; @@ -377,7 +377,7 @@ public interface ServletContext { * * @deprecated */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public Enumeration getServlets(); @@ -397,7 +397,7 @@ public interface ServletContext { * * @deprecated */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public Enumeration getServletNames(); @@ -433,7 +433,7 @@ public interface ServletContext { * * @deprecated */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public void log(Exception exception, String msg); diff --git a/java/javax/servlet/ServletRequest.java b/java/javax/servlet/ServletRequest.java index eca0106b6..6f3c63348 100644 --- a/java/javax/servlet/ServletRequest.java +++ b/java/javax/servlet/ServletRequest.java @@ -543,7 +543,7 @@ public interface ServletRequest { * @deprecated As of Version 2.1 of the Java Servlet API, * use {@link ServletContext#getRealPath} instead. */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public String getRealPath(String path); diff --git a/java/javax/servlet/ServletRequestWrapper.java b/java/javax/servlet/ServletRequestWrapper.java index 037195203..a0e133e6f 100644 --- a/java/javax/servlet/ServletRequestWrapper.java +++ b/java/javax/servlet/ServletRequestWrapper.java @@ -351,7 +351,7 @@ public class ServletRequestWrapper implements ServletRequest { * on the wrapped request object. * @deprecated As of Version 3.0 of the Java Servlet API */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public String getRealPath(String path) { return this.request.getRealPath(path); } diff --git a/java/javax/servlet/SingleThreadModel.java b/java/javax/servlet/SingleThreadModel.java index 3cec4c2e0..60ac99f46 100644 --- a/java/javax/servlet/SingleThreadModel.java +++ b/java/javax/servlet/SingleThreadModel.java @@ -44,7 +44,7 @@ package javax.servlet; * @deprecated As of Java Servlet API 2.4, with no direct * replacement. */ -@SuppressWarnings("dep-ann") // Spec API does not use dep-ann +@SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public interface SingleThreadModel { // No methods } diff --git a/java/javax/servlet/UnavailableException.java b/java/javax/servlet/UnavailableException.java index f3353effa..88efff761 100644 --- a/java/javax/servlet/UnavailableException.java +++ b/java/javax/servlet/UnavailableException.java @@ -65,7 +65,7 @@ extends ServletException { * @deprecated As of Java Servlet API 2.2, use {@link * #UnavailableException(String)} instead. */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public UnavailableException(Servlet servlet, String msg) { super(msg); this.servlet = servlet; @@ -88,7 +88,7 @@ extends ServletException { * @deprecated As of Java Servlet API 2.2, use {@link * #UnavailableException(String, int)} instead. */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public UnavailableException(int seconds, Servlet servlet, String msg) { super(msg); this.servlet = servlet; @@ -175,7 +175,7 @@ extends ServletException { * * @deprecated As of Java Servlet API 2.2, with no replacement. */ - @SuppressWarnings("dep-ann") // Spec API does not use dep-ann + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public Servlet getServlet() { return servlet; } diff --git a/java/javax/servlet/http/HttpServletRequest.java b/java/javax/servlet/http/HttpServletRequest.java index a0808262b..0b592835e 100644 --- a/java/javax/servlet/http/HttpServletRequest.java +++ b/java/javax/servlet/http/HttpServletRequest.java @@ -657,8 +657,7 @@ public interface HttpServletRequest extends ServletRequest { * instead. * */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public boolean isRequestedSessionIdFromUrl(); diff --git a/java/javax/servlet/http/HttpServletRequestWrapper.java b/java/javax/servlet/http/HttpServletRequestWrapper.java index 2d9454aee..139093dd3 100644 --- a/java/javax/servlet/http/HttpServletRequestWrapper.java +++ b/java/javax/servlet/http/HttpServletRequestWrapper.java @@ -259,7 +259,7 @@ public class HttpServletRequestWrapper extends ServletRequestWrapper implements * on the wrapped request object. * @deprecated As of Version 3.0 of the Java Servlet API */ - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public boolean isRequestedSessionIdFromUrl() { return this._getHttpServletRequest().isRequestedSessionIdFromUrl(); } diff --git a/java/javax/servlet/http/HttpServletResponse.java b/java/javax/servlet/http/HttpServletResponse.java index 3695631d9..22c3e3c2c 100644 --- a/java/javax/servlet/http/HttpServletResponse.java +++ b/java/javax/servlet/http/HttpServletResponse.java @@ -111,26 +111,24 @@ public interface HttpServletResponse extends ServletResponse { public String encodeRedirectURL(String url); /** - * @deprecated As of version 2.1, use encodeURL(String url) instead - * * @param url the url to be encoded. * @return the encoded URL if encoding is needed; * the unchanged URL otherwise. + * + * @deprecated As of version 2.1, use encodeURL(String url) instead */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public String encodeUrl(String url); /** - * @deprecated As of version 2.1, use - * encodeRedirectURL(String url) instead - * * @param url the url to be encoded. * @return the encoded URL if encoding is needed; * the unchanged URL otherwise. + * + * @deprecated As of version 2.1, use + * encodeRedirectURL(String url) instead */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public String encodeRedirectUrl(String url); /** @@ -311,18 +309,17 @@ public interface HttpServletResponse extends ServletResponse { public void setStatus(int sc); /** - * @deprecated As of version 2.1, due to ambiguous meaning of the - * message parameter. To set a status code - * use setStatus(int), to send an error with a description - * use sendError(int, String). - * * Sets the status code and message for this response. * * @param sc the status code * @param sm the status message + * + * @deprecated As of version 2.1, due to ambiguous meaning of the + * message parameter. To set a status code + * use setStatus(int), to send an error with a description + * use sendError(int, String). */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public void setStatus(int sc, String sm); diff --git a/java/javax/servlet/http/HttpServletResponseWrapper.java b/java/javax/servlet/http/HttpServletResponseWrapper.java index b3a1942db..283cca852 100644 --- a/java/javax/servlet/http/HttpServletResponseWrapper.java +++ b/java/javax/servlet/http/HttpServletResponseWrapper.java @@ -90,7 +90,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper implement * on the wrapped response object. * @deprecated As of Version 3.0 of the Java Servlet API */ - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public String encodeUrl(String url) { return this._getHttpServletResponse().encodeUrl(url); } @@ -100,7 +100,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper implement * on the wrapped response object. * @deprecated As of Version 3.0 of the Java Servlet API */ - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public String encodeRedirectUrl(String url) { return this._getHttpServletResponse().encodeRedirectUrl(url); } @@ -194,7 +194,7 @@ public class HttpServletResponseWrapper extends ServletResponseWrapper implement * on the wrapped response object. * @deprecated As of Version 3.0 of the Java Servlet API */ - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public void setStatus(int sc, String sm) { this._getHttpServletResponse().setStatus(sc, sm); } diff --git a/java/javax/servlet/http/HttpSession.java b/java/javax/servlet/http/HttpSession.java index 535513425..6c0b35625 100644 --- a/java/javax/servlet/http/HttpSession.java +++ b/java/javax/servlet/http/HttpSession.java @@ -198,8 +198,7 @@ public interface HttpSession { * version of the Java Servlet API. * */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public HttpSessionContext getSessionContext(); @@ -225,10 +224,6 @@ public interface HttpSession { /** - * - * @deprecated As of Version 2.2, this method is - * replaced by {@link #getAttribute}. - * * @param name a string specifying the name of the object * * @return the object with the specified name @@ -236,9 +231,10 @@ public interface HttpSession { * @exception IllegalStateException if this method is called on an * invalidated session * + * @deprecated As of Version 2.2, this method is + * replaced by {@link #getAttribute}. */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public Object getValue(String name); @@ -265,10 +261,6 @@ public interface HttpSession { /** - * - * @deprecated As of Version 2.2, this method is - * replaced by {@link #getAttributeNames} - * * @return an array of String * objects specifying the * names of all the objects bound to @@ -277,9 +269,10 @@ public interface HttpSession { * @exception IllegalStateException if this method is called on an * invalidated session * + * @deprecated As of Version 2.2, this method is + * replaced by {@link #getAttributeNames} */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public String[] getValueNames(); @@ -322,10 +315,6 @@ public interface HttpSession { /** - * - * @deprecated As of Version 2.2, this method is - * replaced by {@link #setAttribute} - * * @param name the name to which the object is bound; * cannot be null * @@ -334,9 +323,10 @@ public interface HttpSession { * @exception IllegalStateException if this method is called on an * invalidated session * + * @deprecated As of Version 2.2, this method is + * replaced by {@link #setAttribute} */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public void putValue(String name, Object value); @@ -372,18 +362,16 @@ public interface HttpSession { /** - * - * @deprecated As of Version 2.2, this method is - * replaced by {@link #removeAttribute} - * * @param name the name of the object to * remove from this session * * @exception IllegalStateException if this method is called on an * invalidated session + * + * @deprecated As of Version 2.2, this method is + * replaced by {@link #removeAttribute} */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public void removeValue(String name); diff --git a/java/javax/servlet/http/HttpSessionContext.java b/java/javax/servlet/http/HttpSessionContext.java index 405a4a913..f73097aba 100644 --- a/java/javax/servlet/http/HttpSessionContext.java +++ b/java/javax/servlet/http/HttpSessionContext.java @@ -35,9 +35,7 @@ import java.util.Enumeration; * @see HttpSessionBindingListener * */ - - -@Deprecated +@SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public interface HttpSessionContext { /** @@ -48,8 +46,7 @@ public interface HttpSessionContext { * a future version of this API. * */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public HttpSession getSession(String sessionId); @@ -63,8 +60,7 @@ public interface HttpSessionContext { * in a future version of this API. * */ - - @Deprecated + @SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public Enumeration getIds(); } diff --git a/java/javax/servlet/http/HttpUtils.java b/java/javax/servlet/http/HttpUtils.java index 9af119244..35794868c 100644 --- a/java/javax/servlet/http/HttpUtils.java +++ b/java/javax/servlet/http/HttpUtils.java @@ -28,11 +28,8 @@ import java.io.IOException; * These methods were only useful * with the default encoding and have been moved * to the request interfaces. - * -*/ - - -@Deprecated + */ +@SuppressWarnings("dep-ann") // Spec API does not use @Deprecated public class HttpUtils { private static final String LSTRING_FILE = -- 2.11.0