VIVO-235 Reduce "deprecation" messages in the build

It's OK for these stub classes to implement deprecated methods in the interfaces, as long as they declare those methods with @Override and @Deprecated.
This commit is contained in:
j2blake 2013-08-01 16:06:59 -04:00
parent 56b963d8bc
commit c75c0d0f9f
3 changed files with 54 additions and 11 deletions

View file

@ -200,6 +200,7 @@ public class ServletContextStub implements ServletContext {
} }
@Override @Override
@Deprecated
public Servlet getServlet(String arg0) throws ServletException { public Servlet getServlet(String arg0) throws ServletException {
throw new RuntimeException( throw new RuntimeException(
"ServletContextStub.getServlet() not implemented."); "ServletContextStub.getServlet() not implemented.");
@ -213,6 +214,7 @@ public class ServletContextStub implements ServletContext {
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Deprecated
public Enumeration getServletNames() { public Enumeration getServletNames() {
throw new RuntimeException( throw new RuntimeException(
"ServletContextStub.getServletNames() not implemented."); "ServletContextStub.getServletNames() not implemented.");
@ -220,6 +222,7 @@ public class ServletContextStub implements ServletContext {
@Override @Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
@Deprecated
public Enumeration getServlets() { public Enumeration getServlets() {
throw new RuntimeException( throw new RuntimeException(
"ServletContextStub.getServlets() not implemented."); "ServletContextStub.getServlets() not implemented.");
@ -231,6 +234,7 @@ public class ServletContextStub implements ServletContext {
} }
@Override @Override
@Deprecated
public void log(Exception arg0, String arg1) { public void log(Exception arg0, String arg1) {
throw new RuntimeException("ServletContextStub.log() not implemented."); throw new RuntimeException("ServletContextStub.log() not implemented.");
} }

View file

@ -60,8 +60,8 @@ public class HttpServletRequestStub implements HttpServletRequest {
/** /**
* Supply the request URL as a single URL. We will parse it on the * Supply the request URL as a single URL. We will parse it on the
* assumption that the contextPath and the pathInfo are empty. * assumption that the contextPath and the pathInfo are empty. Don't include
* Don't include a query string. Instead, set parameters. * a query string. Instead, set parameters.
*/ */
public void setRequestUrl(URL url) { public void setRequestUrl(URL url) {
this.contextPath = ""; this.contextPath = "";
@ -81,8 +81,7 @@ public class HttpServletRequestStub implements HttpServletRequest {
/** /**
* Supply the pieces of the request URL, so we can respond correctly when * Supply the pieces of the request URL, so we can respond correctly when
* asked for a piece. * asked for a piece. Don't include a query string. Instead, set parameters.
* Don't include a query string. Instead, set parameters.
*/ */
public void setRequestUrlByParts(String shemeHostPort, String contextPath, public void setRequestUrlByParts(String shemeHostPort, String contextPath,
String servletPath, String pathInfo) { String servletPath, String pathInfo) {
@ -102,7 +101,8 @@ public class HttpServletRequestStub implements HttpServletRequest {
} }
this.servletPath = servletPath; this.servletPath = servletPath;
this.requestUri = contextPath + servletPath + ((pathInfo == null) ? "" : pathInfo); this.requestUri = contextPath + servletPath
+ ((pathInfo == null) ? "" : pathInfo);
if (shemeHostPort == null) { if (shemeHostPort == null) {
throw new NullPointerException("shemeHostPort may not be null."); throw new NullPointerException("shemeHostPort may not be null.");
@ -196,8 +196,8 @@ public class HttpServletRequestStub implements HttpServletRequest {
} }
String qs = ""; String qs = "";
for (String key:parameters.keySet()) { for (String key : parameters.keySet()) {
for (String value: parameters.get(key)) { for (String value : parameters.get(key)) {
qs += "&" + key + "=" + URLEncoder.encode(value); qs += "&" + key + "=" + URLEncoder.encode(value);
} }
} }
@ -302,167 +302,202 @@ public class HttpServletRequestStub implements HttpServletRequest {
// Un-implemented methods // Un-implemented methods
// ---------------------------------------------------------------------- // ----------------------------------------------------------------------
@Override
public String getAuthType() { public String getAuthType() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getAuthType() not implemented."); "HttpServletRequestStub.getAuthType() not implemented.");
} }
@Override
public Cookie[] getCookies() { public Cookie[] getCookies() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getCookies() not implemented."); "HttpServletRequestStub.getCookies() not implemented.");
} }
@Override
public long getDateHeader(String arg0) { public long getDateHeader(String arg0) {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getDateHeader() not implemented."); "HttpServletRequestStub.getDateHeader() not implemented.");
} }
@Override
public int getIntHeader(String arg0) { public int getIntHeader(String arg0) {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getIntHeader() not implemented."); "HttpServletRequestStub.getIntHeader() not implemented.");
} }
@Override
public String getPathTranslated() { public String getPathTranslated() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getPathTranslated() not implemented."); "HttpServletRequestStub.getPathTranslated() not implemented.");
} }
@Override
public String getRemoteUser() { public String getRemoteUser() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getRemoteUser() not implemented."); "HttpServletRequestStub.getRemoteUser() not implemented.");
} }
@Override
public String getRequestedSessionId() { public String getRequestedSessionId() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getRequestedSessionId() not implemented."); "HttpServletRequestStub.getRequestedSessionId() not implemented.");
} }
@Override
public Principal getUserPrincipal() { public Principal getUserPrincipal() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getUserPrincipal() not implemented."); "HttpServletRequestStub.getUserPrincipal() not implemented.");
} }
@Override
public boolean isRequestedSessionIdFromCookie() { public boolean isRequestedSessionIdFromCookie() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.isRequestedSessionIdFromCookie() not implemented."); "HttpServletRequestStub.isRequestedSessionIdFromCookie() not implemented.");
} }
@Override
public boolean isRequestedSessionIdFromURL() { public boolean isRequestedSessionIdFromURL() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.isRequestedSessionIdFromURL() not implemented."); "HttpServletRequestStub.isRequestedSessionIdFromURL() not implemented.");
} }
@Override
@Deprecated
public boolean isRequestedSessionIdFromUrl() { public boolean isRequestedSessionIdFromUrl() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.isRequestedSessionIdFromUrl() not implemented."); "HttpServletRequestStub.isRequestedSessionIdFromUrl() not implemented.");
} }
@Override
public boolean isRequestedSessionIdValid() { public boolean isRequestedSessionIdValid() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.isRequestedSessionIdValid() not implemented."); "HttpServletRequestStub.isRequestedSessionIdValid() not implemented.");
} }
@Override
public boolean isUserInRole(String arg0) { public boolean isUserInRole(String arg0) {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.isUserInRole() not implemented."); "HttpServletRequestStub.isUserInRole() not implemented.");
} }
@Override
public String getCharacterEncoding() { public String getCharacterEncoding() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getCharacterEncoding() not implemented."); "HttpServletRequestStub.getCharacterEncoding() not implemented.");
} }
@Override
public int getContentLength() { public int getContentLength() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getContentLength() not implemented."); "HttpServletRequestStub.getContentLength() not implemented.");
} }
@Override
public String getContentType() { public String getContentType() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getContentType() not implemented."); "HttpServletRequestStub.getContentType() not implemented.");
} }
@Override
public ServletInputStream getInputStream() throws IOException { public ServletInputStream getInputStream() throws IOException {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getInputStream() not implemented."); "HttpServletRequestStub.getInputStream() not implemented.");
} }
@Override
public String getLocalAddr() { public String getLocalAddr() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getLocalAddr() not implemented."); "HttpServletRequestStub.getLocalAddr() not implemented.");
} }
@Override
public String getLocalName() { public String getLocalName() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getLocalName() not implemented."); "HttpServletRequestStub.getLocalName() not implemented.");
} }
@Override
public int getLocalPort() { public int getLocalPort() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getLocalPort() not implemented."); "HttpServletRequestStub.getLocalPort() not implemented.");
} }
@Override
public Locale getLocale() { public Locale getLocale() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getLocale() not implemented."); "HttpServletRequestStub.getLocale() not implemented.");
} }
@Override
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public Enumeration getLocales() { public Enumeration getLocales() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getLocales() not implemented."); "HttpServletRequestStub.getLocales() not implemented.");
} }
@Override
public String getProtocol() { public String getProtocol() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getProtocol() not implemented."); "HttpServletRequestStub.getProtocol() not implemented.");
} }
@Override
public BufferedReader getReader() throws IOException { public BufferedReader getReader() throws IOException {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getReader() not implemented."); "HttpServletRequestStub.getReader() not implemented.");
} }
@Override
@Deprecated
public String getRealPath(String arg0) { public String getRealPath(String arg0) {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getRealPath() not implemented."); "HttpServletRequestStub.getRealPath() not implemented.");
} }
@Override
public String getRemoteHost() { public String getRemoteHost() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getRemoteHost() not implemented."); "HttpServletRequestStub.getRemoteHost() not implemented.");
} }
@Override
public int getRemotePort() { public int getRemotePort() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getRemotePort() not implemented."); "HttpServletRequestStub.getRemotePort() not implemented.");
} }
@Override
public RequestDispatcher getRequestDispatcher(String arg0) { public RequestDispatcher getRequestDispatcher(String arg0) {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getRequestDispatcher() not implemented."); "HttpServletRequestStub.getRequestDispatcher() not implemented.");
} }
@Override
public String getScheme() { public String getScheme() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getScheme() not implemented."); "HttpServletRequestStub.getScheme() not implemented.");
} }
@Override
public String getServerName() { public String getServerName() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getServerName() not implemented."); "HttpServletRequestStub.getServerName() not implemented.");
} }
@Override
public int getServerPort() { public int getServerPort() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.getServerPort() not implemented."); "HttpServletRequestStub.getServerPort() not implemented.");
} }
@Override
public boolean isSecure() { public boolean isSecure() {
throw new RuntimeException( throw new RuntimeException(
"HttpServletRequestStub.isSecure() not implemented."); "HttpServletRequestStub.isSecure() not implemented.");
} }
@Override
public void setCharacterEncoding(String arg0) public void setCharacterEncoding(String arg0)
throws UnsupportedEncodingException { throws UnsupportedEncodingException {
throw new RuntimeException( throw new RuntimeException(

View file

@ -126,12 +126,14 @@ public class HttpSessionStub implements HttpSession {
} }
@Override @Override
@Deprecated
public Object getValue(String arg0) { public Object getValue(String arg0) {
throw new RuntimeException( throw new RuntimeException(
"HttpSessionStub.getValue() not implemented."); "HttpSessionStub.getValue() not implemented.");
} }
@Override @Override
@Deprecated
public String[] getValueNames() { public String[] getValueNames() {
throw new RuntimeException( throw new RuntimeException(
"HttpSessionStub.getValueNames() not implemented."); "HttpSessionStub.getValueNames() not implemented.");
@ -149,12 +151,14 @@ public class HttpSessionStub implements HttpSession {
} }
@Override @Override
@Deprecated
public void putValue(String arg0, Object arg1) { public void putValue(String arg0, Object arg1) {
throw new RuntimeException( throw new RuntimeException(
"HttpSessionStub.putValue() not implemented."); "HttpSessionStub.putValue() not implemented.");
} }
@Override @Override
@Deprecated
public void removeValue(String arg0) { public void removeValue(String arg0) {
throw new RuntimeException( throw new RuntimeException(
"HttpSessionStub.removeValue() not implemented."); "HttpSessionStub.removeValue() not implemented.");