Author: markt
Date: Tue Jun 23 11:38:05 2009
New Revision: 787641

URL: http://svn.apache.org/viewvc?rev=787641&view=rev
Log:
Clean up the debug logging impl

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java?rev=787641&r1=787640&r2=787641&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/http/Parameters.java Tue Jun 23 
11:38:05 2009
@@ -67,12 +67,16 @@
 
     public void setEncoding( String s ) {
         encoding=s;
-        if(debug>0) log( "Set encoding to " + s );
+        if(log.isDebugEnabled()) {
+            log.debug( "Set encoding to " + s );
+        }
     }
 
     public void setQueryStringEncoding( String s ) {
         queryStringEncoding=s;
-        if(debug>0) log( "Set query string encoding to " + s );
+        if(log.isDebugEnabled()) {
+            log.debug( "Set query string encoding to " + s );
+        }
     }
 
     public void recycle() {
@@ -141,8 +145,10 @@
         if( queryMB==null || queryMB.isNull() )
             return;
         
-        if( debug > 0  )
-            log( "Decoding query " + decodedQuery + " " + queryStringEncoding);
+        if(log.isDebugEnabled()) {
+            log.debug("Decoding query " + decodedQuery + " " +
+                    queryStringEncoding);
+        }
 
         try {
             decodedQuery.duplicate( queryMB );
@@ -196,8 +202,9 @@
         int end=start+len;
         int pos=start;
         
-        if( debug>0 ) 
-            log( "Bytes: " + new String( bytes, start, len ));
+        if(log.isDebugEnabled()) { 
+            log.debug("Bytes: " + new String( bytes, start, len ));
+        }
 
         do {
             boolean noEq=false;
@@ -214,7 +221,10 @@
                 noEq=true;
                 valStart=nameEnd;
                 valEnd=nameEnd;
-                if( debug>0) log("no equal " + nameStart + " " + nameEnd + " " 
+ new String(bytes, nameStart, nameEnd-nameStart) );
+                if(log.isDebugEnabled()) {
+                    log.debug("no equal " + nameStart + " " + nameEnd + " " +
+                            new String(bytes, nameStart, nameEnd-nameStart) );
+                }
             }
             if( nameEnd== -1 ) 
                 nameEnd=end;
@@ -345,10 +355,4 @@
         return sb.toString();
     }
 
-    private static int debug=0;
-    private void log(String s ) {
-        if (log.isDebugEnabled())
-            log.debug("Parameters: " + s );
-    }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to