You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by lh...@apache.org on 2009/06/05 02:30:03 UTC

svn commit: r781880 - /incubator/jsecurity/trunk/web/src/main/java/org/apache/ki/web/attr/CookieAttribute.java

Author: lhazlewood
Date: Fri Jun  5 00:30:03 2009
New Revision: 781880

URL: http://svn.apache.org/viewvc?rev=781880&view=rev
Log:
KI-80: minor logging cleanup

Modified:
    incubator/jsecurity/trunk/web/src/main/java/org/apache/ki/web/attr/CookieAttribute.java

Modified: incubator/jsecurity/trunk/web/src/main/java/org/apache/ki/web/attr/CookieAttribute.java
URL: http://svn.apache.org/viewvc/incubator/jsecurity/trunk/web/src/main/java/org/apache/ki/web/attr/CookieAttribute.java?rev=781880&r1=781879&r2=781880&view=diff
==============================================================================
--- incubator/jsecurity/trunk/web/src/main/java/org/apache/ki/web/attr/CookieAttribute.java (original)
+++ incubator/jsecurity/trunk/web/src/main/java/org/apache/ki/web/attr/CookieAttribute.java Fri Jun  5 00:30:03 2009
@@ -200,7 +200,7 @@
      * Sets the Cookie's {@link Cookie#getPath() path} setting.  If the argument is <tt>null</tt>, the <tt>request</tt>'s
      * {@link javax.servlet.http.HttpServletRequest#getContextPath() context path} will be used.
      * <p/>
-     * <p>The default is <code>null</code>.</p>
+     * The default is <code>null</code>.
      *
      * @param path the Cookie's path, or <tt>null</tt> if the request's context path should be used as the path when the
      *             cookie is created.
@@ -213,7 +213,7 @@
      * Returns the Cookie's {@link Cookie#setMaxAge(int) maxAge} setting.  Please see that JavaDoc for the semantics on
      * the repercussions of negative, zero, and positive values for the maxAge.
      * <p/>
-     * <p>The default value is <code>-1</code>, meaning the cookie will expire when the browser is closed.</p>
+     * The default value is <code>-1</code>, meaning the cookie will expire when the browser is closed.
      *
      * @return the Cookie's {@link Cookie#setMaxAge(int) maxAge}
      */
@@ -225,7 +225,7 @@
      * Sets the Cookie's {@link Cookie#setMaxAge(int) maxAge} setting.  Please see that JavaDoc for the semantics on
      * the repercussions of negative, zero, and positive values for the maxAge.
      * <p/>
-     * <p>The default value is <code>-1</code>, meaning the cookie will expire when the browser is closed.</p>
+     * The default value is <code>-1</code>, meaning the cookie will expire when the browser is closed.
      *
      * @param maxAge the Cookie's {@link Cookie#setMaxAge(int) maxAge}
      */
@@ -273,18 +273,15 @@
     public T onRetrieveValue(ServletRequest request, ServletResponse response) {
         T value = null;
 
+        String cookieName = getName();
         String stringValue;
-        Cookie cookie = getCookie(toHttp(request), getName());
+        Cookie cookie = getCookie(toHttp(request), cookieName);
         if (cookie != null && cookie.getMaxAge() != 0) {
             stringValue = cookie.getValue();
-            if (log.isDebugEnabled()) {
-                log.debug("Found string value [" + stringValue + "] from HttpServletRequest Cookie [" + getName() + "]");
-            }
+            log.debug("Found string value [{}] from Cookie [{}]", stringValue, cookieName);
             value = fromStringValue(stringValue);
         } else {
-            if (log.isDebugEnabled()) {
-                log.debug("No value found in request Cookies under cookie name [" + getName() + "]");
-            }
+            log.debug("Not value found in request Cookies under cookie name [{}]", cookieName);
         }
 
         return value;
@@ -295,7 +292,7 @@
      * <tt>request</tt>'s {@link javax.servlet.http.HttpServletRequest#getContextPath() context path}
      * will be returned. If getContextPath() is the empty string or null then the ROOT_PATH constant is returned.
      * <p/>
-     * <p>The default is <code>null</code>.</p>
+     * The default is <code>null</code>.
      *
      * @return the path to be used as the path when the cookie is created or removed.
      */
@@ -307,7 +304,7 @@
         if (calculatePath == null) {
             calculatePath = ROOT_PATH;
         }
-        log.trace("calculatePath: returning=" + calculatePath);
+        log.trace("calculated path: {}", calculatePath);
         return calculatePath;
     }
 
@@ -351,8 +348,8 @@
         response.addCookie(cookie);
 
         if (log.isTraceEnabled()) {
-            log.trace("Added Cookie [" + name + "] to path [" + path + "] with value [" +
-                    stringValue + "] to the HttpServletResponse.");
+            log.trace("Added Cookie [{}] to path [{}] with value [{}] to the HttpServletResponse",
+                    new Object[]{name, path, stringValue});
         }
     }