From be3ad627d770f01eeafa28a6e3862638a7560faf Mon Sep 17 00:00:00 2001 From: Gregor Zurowski Date: Sat, 13 Aug 2016 23:59:03 -0400 Subject: [PATCH] Consistently use @Override annotation across all classes --- .../java/com/netflix/zuul/filters/ZuulServletFilter.java | 4 +++- .../java/com/netflix/zuul/groovy/GroovyCompiler.java | 2 ++ .../java/com/netflix/zuul/groovy/GroovyFileFilter.java | 2 ++ .../com/netflix/zuul/http/HttpServletRequestWrapper.java | 9 +++++++++ .../java/com/netflix/zuul/context/NFRequestContext.java | 1 + .../zuul/dependency/cassandra/DefaultCassandraCache.java | 2 ++ .../zuul/scriptManager/ZuulFilterDAOCassandra.java | 8 +++++++- 7 files changed, 26 insertions(+), 2 deletions(-) diff --git a/zuul-core/src/main/java/com/netflix/zuul/filters/ZuulServletFilter.java b/zuul-core/src/main/java/com/netflix/zuul/filters/ZuulServletFilter.java index 54deddfee9..8be26dfe49 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/filters/ZuulServletFilter.java +++ b/zuul-core/src/main/java/com/netflix/zuul/filters/ZuulServletFilter.java @@ -51,6 +51,7 @@ public class ZuulServletFilter implements Filter { private ZuulRunner zuulRunner; + @Override public void init(FilterConfig filterConfig) throws ServletException { String bufferReqsStr = filterConfig.getInitParameter("buffer-requests"); @@ -59,6 +60,7 @@ public void init(FilterConfig filterConfig) throws ServletException { zuulRunner = new ZuulRunner(bufferReqs); } + @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { try { init((HttpServletRequest) servletRequest, (HttpServletResponse) servletResponse); @@ -117,8 +119,8 @@ void error(ZuulException e) { zuulRunner.error(); } + @Override public void destroy() { - } diff --git a/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java b/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java index 3938b9b666..1c75e55bff 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java +++ b/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java @@ -49,6 +49,7 @@ public class GroovyCompiler implements DynamicCodeCompiler { * @param sName * @return */ + @Override public Class compile(String sCode, String sName) { GroovyClassLoader loader = getGroovyClassLoader(); LOG.warn("Compiling filter: " + sName); @@ -70,6 +71,7 @@ GroovyClassLoader getGroovyClassLoader() { * @return * @throws java.io.IOException */ + @Override public Class compile(File file) throws IOException { GroovyClassLoader loader = getGroovyClassLoader(); Class groovyClass = loader.parseClass(file); diff --git a/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyFileFilter.java b/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyFileFilter.java index e6e51c2350..656ae46793 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyFileFilter.java +++ b/zuul-core/src/main/java/com/netflix/zuul/groovy/GroovyFileFilter.java @@ -38,6 +38,8 @@ * */ public class GroovyFileFilter implements FilenameFilter { + + @Override public boolean accept(File dir, String name) { return name.endsWith(".groovy"); } diff --git a/zuul-core/src/main/java/com/netflix/zuul/http/HttpServletRequestWrapper.java b/zuul-core/src/main/java/com/netflix/zuul/http/HttpServletRequestWrapper.java index 573f156963..190e3aa9eb 100755 --- a/zuul-core/src/main/java/com/netflix/zuul/http/HttpServletRequestWrapper.java +++ b/zuul-core/src/main/java/com/netflix/zuul/http/HttpServletRequestWrapper.java @@ -90,6 +90,7 @@ public HttpServletRequestWrapper(HttpServletRequest request) { * * @return The wrapped HttpServletRequest. */ + @Override public HttpServletRequest getRequest() { try { parseRequest(); @@ -262,6 +263,7 @@ public long getBodyBufferingTimeNs() * * @return A new ServletInputStream. */ + @Override public ServletInputStream getInputStream() throws IOException { parseRequest(); @@ -275,6 +277,7 @@ public ServletInputStream getInputStream() throws IOException { * * @return A new BufferedReader with the wrapped request's character encoding (or UTF-8 if null). */ + @Override public BufferedReader getReader() throws IOException { parseRequest(); @@ -289,6 +292,7 @@ public BufferedReader getReader() throws IOException { * * @see javax.servlet.ServletRequest#getParameter(java.lang.String) */ + @Override public String getParameter(String name) { try { parseRequest(); @@ -309,6 +313,7 @@ public String getParameter(String name) { * @see javax.servlet.ServletRequest#getParameterMap() */ @SuppressWarnings("unchecked") + @Override public Map getParameterMap() { try { parseRequest(); @@ -324,6 +329,7 @@ public Map getParameterMap() { * @see javax.servlet.ServletRequest#getParameterNames() */ @SuppressWarnings("unchecked") + @Override public Enumeration getParameterNames() { try { parseRequest(); @@ -334,10 +340,12 @@ public Enumeration getParameterNames() { private String[] arr = getParameters().keySet().toArray(new String[0]); private int idx = 0; + @Override public boolean hasMoreElements() { return idx < arr.length; } + @Override public String nextElement() { return arr[idx++]; } @@ -351,6 +359,7 @@ public String nextElement() { * * @see javax.servlet.ServletRequest#getParameterValues(java.lang.String) */ + @Override public String[] getParameterValues(String name) { try { parseRequest(); diff --git a/zuul-netflix/src/main/java/com/netflix/zuul/context/NFRequestContext.java b/zuul-netflix/src/main/java/com/netflix/zuul/context/NFRequestContext.java index f9865fcb8c..1c8d940de7 100644 --- a/zuul-netflix/src/main/java/com/netflix/zuul/context/NFRequestContext.java +++ b/zuul-netflix/src/main/java/com/netflix/zuul/context/NFRequestContext.java @@ -95,6 +95,7 @@ public boolean hasRouteVIPOrHost() { /** * unsets the requestContextVariables */ + @Override public void unset() { if (getZuulResponse() != null) { getZuulResponse().close(); //check this? diff --git a/zuul-netflix/src/main/java/com/netflix/zuul/dependency/cassandra/DefaultCassandraCache.java b/zuul-netflix/src/main/java/com/netflix/zuul/dependency/cassandra/DefaultCassandraCache.java index 18cba9aa96..748487a150 100644 --- a/zuul-netflix/src/main/java/com/netflix/zuul/dependency/cassandra/DefaultCassandraCache.java +++ b/zuul-netflix/src/main/java/com/netflix/zuul/dependency/cassandra/DefaultCassandraCache.java @@ -71,6 +71,7 @@ private DefaultCassandraCache(ConcurrentMap cacheMap) { * @param keys * @return */ + @Override public K fetchQuery(String... keys) { final String key = buildKey(keys); final K result = cacheMap.get(key); @@ -92,6 +93,7 @@ public K fetchQuery(String... keys) { * @param response * @param keys */ + @Override public void storeQuery(K response, String... keys) { final String key = buildKey(keys); diff --git a/zuul-netflix/src/main/java/com/netflix/zuul/scriptManager/ZuulFilterDAOCassandra.java b/zuul-netflix/src/main/java/com/netflix/zuul/scriptManager/ZuulFilterDAOCassandra.java index 3edff9cbbf..9222adc0df 100644 --- a/zuul-netflix/src/main/java/com/netflix/zuul/scriptManager/ZuulFilterDAOCassandra.java +++ b/zuul-netflix/src/main/java/com/netflix/zuul/scriptManager/ZuulFilterDAOCassandra.java @@ -108,6 +108,7 @@ public void addFilterIdToIndex(String index, String filter_id) { cassandraGateway.updateFilterIndex(index, filterIds); } + @Override public String getFilterIdsRaw(String index) { Rows result = cassandraGateway.select("select filter_ids from zuul_filter_indices where index_name = '" + index + "'"); if (result == null || result.isEmpty()) { @@ -129,7 +130,7 @@ public String getFilterIdsRaw(String index) { } } - + @Override public List getFilterIdsIndex(String index) { String filter_ids = getFilterIdsRaw(index); @@ -174,6 +175,7 @@ public List getAllFilterIDs() { return getFilterIdsIndex(FILTER_ID + ZuulApplicationInfo.getApplicationName()); } + @Override public FilterInfo getFilterInfo(String filter_id, int revision) { List filters = getZuulFiltersForFilterId(filter_id); if (filters == null) return null; @@ -509,6 +511,7 @@ public CassandraGatewayProd(Keyspace keyspace) { this.keyspace = keyspace; } + @Override public void updateFilterIndex(String rowKey, String filter_ids) { HashMap attributes = new HashMap(); @@ -523,6 +526,7 @@ public void updateFilterIndex(String rowKey, String filter_ids) { * @param rowKey * @param attributes */ + @Override public void upsert(String rowKey, Map attributes) { new HystrixCassandraPut(keyspace, COLUMN_FAMILY, rowKey, attributes).execute(); } @@ -533,10 +537,12 @@ public void upsert(String rowKey, Map attributes) { * @param cql * @return */ + @Override public Rows select(String cql) { return new HystrixCassandraGetRowsByQuery(keyspace, COLUMN_FAMILY, String.class, cql).execute(); } + @Override public Rows getByFilterIds(List filterIds) { String[] list = new String[filterIds.size()]; for (int i = 0; i < filterIds.size(); i++) {