You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2011/08/03 18:38:50 UTC
svn commit: r1153571 -
/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/DebugFilter.java
Author: anathaniel
Date: Wed Aug 3 16:38:50 2011
New Revision: 1153571
URL: http://svn.apache.org/viewvc?rev=1153571&view=rev
Log:
Use generic Enumerations and limit scope of @SuppressWarnings("unchecked") to calls to non-generic servlet API methods
Modified:
cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/DebugFilter.java
Modified: cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/DebugFilter.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/DebugFilter.java?rev=1153571&r1=1153570&r2=1153571&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/DebugFilter.java (original)
+++ cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/DebugFilter.java Wed Aug 3 16:38:50 2011
@@ -64,7 +64,6 @@ public class DebugFilter implements Filt
* @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
* javax.servlet.FilterChain)
*/
- @SuppressWarnings("unchecked")
public void doFilter(ServletRequest req, ServletResponse res, FilterChain filterChain) throws IOException,
ServletException {
// we don't do debug msgs if this is not a http servlet request
@@ -101,12 +100,13 @@ public class DebugFilter implements Filt
msg.append("CURRENT ACTIVE REQUESTS: ").append(this.activeRequestCount).append(lineSeparator);
// log all of the request parameters
- final Enumeration e = request.getParameterNames();
+ @SuppressWarnings("unchecked")
+ final Enumeration<String> e = request.getParameterNames();
msg.append("REQUEST PARAMETERS:").append(lineSeparator).append(lineSeparator);
while (e.hasMoreElements()) {
- String p = (String) e.nextElement();
+ String p = e.nextElement();
msg.append("PARAM: '").append(p).append("' ").append("VALUES: '");
String[] params = request.getParameterValues(p);
@@ -121,15 +121,17 @@ public class DebugFilter implements Filt
}
// log all of the header parameters
- final Enumeration e2 = request.getHeaderNames();
+ @SuppressWarnings("unchecked")
+ final Enumeration<String> e2 = request.getHeaderNames();
msg.append("HEADER PARAMETERS:").append(lineSeparator).append(lineSeparator);
while (e2.hasMoreElements()) {
- String p = (String) e2.nextElement();
+ String p = e2.nextElement();
msg.append("PARAM: '").append(p).append("' ").append("VALUES: '");
- Enumeration e3 = request.getHeaders(p);
+ @SuppressWarnings("unchecked")
+ final Enumeration<String> e3 = request.getHeaders(p);
while (e3.hasMoreElements()) {
msg.append("[" + e3.nextElement() + "]");
if (e3.hasMoreElements()) {
@@ -148,9 +150,10 @@ public class DebugFilter implements Filt
// Fix bug #12139: Session can be modified while still
// being enumerated here
synchronized (session) {
- final Enumeration se = session.getAttributeNames();
+ @SuppressWarnings("unchecked")
+ final Enumeration<String> se = session.getAttributeNames();
while (se.hasMoreElements()) {
- String p = (String) se.nextElement();
+ String p = se.nextElement();
msg.append("PARAM: '").append(p).append("' ").append("VALUE: '").append(
session.getAttribute(p)).append("'").append(lineSeparator);
}