Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2014-07-16 20:47:49 -0400
committerGreg Wilkins2014-07-16 20:47:49 -0400
commit591eedcb5965b0fc166d59fb7d8d840e94a2dd81 (patch)
treee9b5b8201976cbf126d82f5de02ba2d855440814 /jetty-servlet
parent0c66f3a68e4bd83a8f32c06d44a33852d9b6f55b (diff)
downloadorg.eclipse.jetty.project-591eedcb5965b0fc166d59fb7d8d840e94a2dd81.tar.gz
org.eclipse.jetty.project-591eedcb5965b0fc166d59fb7d8d840e94a2dd81.tar.xz
org.eclipse.jetty.project-591eedcb5965b0fc166d59fb7d8d840e94a2dd81.zip
[FindBugs] Include explicit typing whereever possible
+ No cleanup regarding unchecked types (yet)
Diffstat (limited to 'jetty-servlet')
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java4
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java14
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java13
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java6
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletTester.java4
-rw-r--r--jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java10
6 files changed, 27 insertions, 24 deletions
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java
index 2f690b17b5..9ee03cc88d 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Holder.java
@@ -89,7 +89,7 @@ public class Holder<T> extends BaseHolder<T>
}
/* ------------------------------------------------------------ */
- public Enumeration getInitParameterNames()
+ public Enumeration<String> getInitParameterNames()
{
if (_initParams==null)
return Collections.enumeration(Collections.EMPTY_LIST);
@@ -227,7 +227,7 @@ public class Holder<T> extends BaseHolder<T>
}
/* -------------------------------------------------------- */
- public Enumeration getInitParameterNames()
+ public Enumeration<String> getInitParameterNames()
{
return Holder.this.getInitParameterNames();
}
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java
index 4613144baf..62bd87ccef 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/Invoker.java
@@ -72,8 +72,8 @@ public class Invoker extends HttpServlet
private ContextHandler _contextHandler;
private ServletHandler _servletHandler;
- private Map.Entry _invokerEntry;
- private Map _parameters;
+ private Map.Entry<String, ServletHolder> _invokerEntry;
+ private Map<String, String> _parameters;
private boolean _nonContextServlets;
private boolean _verbose;
@@ -87,10 +87,10 @@ public class Invoker extends HttpServlet
while (handler!=null && !(handler instanceof ServletHandler) && (handler instanceof HandlerWrapper))
handler=((HandlerWrapper)handler).getHandler();
_servletHandler = (ServletHandler)handler;
- Enumeration e = getInitParameterNames();
+ Enumeration<String> e = getInitParameterNames();
while(e.hasMoreElements())
{
- String param=(String)e.nextElement();
+ String param=e.nextElement();
String value=getInitParameter(param);
String lvalue=value.toLowerCase(Locale.ENGLISH);
if ("nonContextServlets".equals(param))
@@ -104,7 +104,7 @@ public class Invoker extends HttpServlet
else
{
if (_parameters==null)
- _parameters=new HashMap();
+ _parameters=new HashMap<String, String>();
_parameters.put(param,value);
}
}
@@ -151,7 +151,7 @@ public class Invoker extends HttpServlet
ServletMapping mapping = new ServletMapping();
mapping.setServletName(servlet);
mapping.setPathSpec(URIUtil.addPaths(servlet_path,servlet)+"/*");
- _servletHandler.setServletMappings((ServletMapping[])ArrayUtil.addToArray(_servletHandler.getServletMappings(), mapping, ServletMapping.class));
+ _servletHandler.setServletMappings(ArrayUtil.addToArray(_servletHandler.getServletMappings(), mapping, ServletMapping.class));
}
else
{
@@ -171,7 +171,7 @@ public class Invoker extends HttpServlet
// Check for existing mapping (avoid threaded race).
String path=URIUtil.addPaths(servlet_path,servlet);
- Map.Entry entry = _servletHandler.getHolderEntry(path);
+ Map.Entry<String, ServletHolder> entry = _servletHandler.getHolderEntry(path);
if (entry!=null && !entry.equals(_invokerEntry))
{
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java
index 38edb727ec..371ed3021b 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHandler.java
@@ -125,9 +125,12 @@ public class ServletHandler extends ScopedHandler
private ListenerHolder[] _listeners=new ListenerHolder[0];
- protected final ConcurrentMap<?, ?> _chainCache[] = new ConcurrentMap[FilterMapping.ALL];
- protected final Queue<?>[] _chainLRU = new Queue[FilterMapping.ALL];
-
+ @SuppressWarnings("unchecked")
+ protected final ConcurrentMap<String, FilterChain> _chainCache[] = new ConcurrentMap[FilterMapping.ALL];
+
+ @SuppressWarnings("unchecked")
+ protected final Queue<String>[] _chainLRU = new Queue[FilterMapping.ALL];
+
/* ------------------------------------------------------------ */
@@ -745,8 +748,8 @@ public class ServletHandler extends ScopedHandler
if (filters.size() > 0)
chain= new CachedChain(filters, servletHolder);
- final Map<String,FilterChain> cache=(Map<String, FilterChain>)_chainCache[dispatch];
- final Queue<String> lru=(Queue<String>)_chainLRU[dispatch];
+ final Map<String,FilterChain> cache=_chainCache[dispatch];
+ final Queue<String> lru=_chainLRU[dispatch];
// Do we have too many cached chains?
while (_maxFilterChainsCacheSize>0 && cache.size()>=_maxFilterChainsCacheSize)
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java
index 6f11a4c970..32a6d3de6c 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java
@@ -795,7 +795,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
if (_servlet == null)
return false;
- Class c = _servlet.getClass();
+ Class<?> c = _servlet.getClass();
boolean result = false;
while (c != null && !result)
@@ -827,7 +827,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
jsp = jsp.substring(i);
try
{
- Class jspUtil = Loader.loadClass(Holder.class, "org.apache.jasper.compiler.JspUtil");
+ Class<?> jspUtil = Loader.loadClass(Holder.class, "org.apache.jasper.compiler.JspUtil");
Method makeJavaIdentifier = jspUtil.getMethod("makeJavaIdentifier", String.class);
return (String)makeJavaIdentifier.invoke(null, jsp);
}
@@ -853,7 +853,7 @@ public class ServletHolder extends Holder<Servlet> implements UserIdentity.Scope
return "";
try
{
- Class jspUtil = Loader.loadClass(Holder.class, "org.apache.jasper.compiler.JspUtil");
+ Class<?> jspUtil = Loader.loadClass(Holder.class, "org.apache.jasper.compiler.JspUtil");
Method makeJavaPackage = jspUtil.getMethod("makeJavaPackage", String.class);
return (String)makeJavaPackage.invoke(null, jsp.substring(0,i));
}
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletTester.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletTester.java
index 965dd18de4..5be08c2047 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletTester.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletTester.java
@@ -98,7 +98,7 @@ public class ServletTester extends ContainerLifeCycle
return _context.getAttribute(name);
}
- public Enumeration getAttributeNames()
+ public Enumeration<String> getAttributeNames()
{
return _context.getAttributeNames();
}
@@ -123,7 +123,7 @@ public class ServletTester extends ContainerLifeCycle
return _context.setInitParameter(name,value);
}
- public Enumeration getInitParameterNames()
+ public Enumeration<String> getInitParameterNames()
{
return _context.getInitParameterNames();
}
diff --git a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java
index 0880650199..df582ff8dc 100644
--- a/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java
+++ b/jetty-servlet/src/main/java/org/eclipse/jetty/servlet/listener/ELContextCleaner.java
@@ -52,7 +52,7 @@ public class ELContextCleaner implements ServletContextListener
try
{
//Check that the BeanELResolver class is on the classpath
- Class beanELResolver = Loader.loadClass(this.getClass(), "javax.el.BeanELResolver");
+ Class<?> beanELResolver = Loader.loadClass(this.getClass(), "javax.el.BeanELResolver");
//Get a reference via reflection to the properties field which is holding class references
Field field = getField(beanELResolver);
@@ -80,7 +80,7 @@ public class ELContextCleaner implements ServletContextListener
}
- protected Field getField (Class beanELResolver)
+ protected Field getField (Class<?> beanELResolver)
throws SecurityException, NoSuchFieldException
{
if (beanELResolver == null)
@@ -98,14 +98,14 @@ public class ELContextCleaner implements ServletContextListener
if (!properties.isAccessible())
properties.setAccessible(true);
- ConcurrentHashMap map = (ConcurrentHashMap) properties.get(null);
+ ConcurrentHashMap<Class<?>, Object> map = (ConcurrentHashMap<Class<?>, Object>) properties.get(null);
if (map == null)
return;
- Iterator<Class> itor = map.keySet().iterator();
+ Iterator<Class<?>> itor = map.keySet().iterator();
while (itor.hasNext())
{
- Class clazz = itor.next();
+ Class<?> clazz = itor.next();
if (LOG.isDebugEnabled())
LOG.debug("Clazz: "+clazz+" loaded by "+clazz.getClassLoader());
if (Thread.currentThread().getContextClassLoader().equals(clazz.getClassLoader()))

Back to the top