You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by gi...@apache.org on 2002/12/15 17:46:12 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/acting LocaleAction.java

giacomo     2002/12/15 08:46:12

  Modified:    src/java/org/apache/cocoon/acting LocaleAction.java
  Log:
  added isDebugEnabled blocks arounf debug statements
  
  Revision  Changes    Path
  1.12      +36 -23    xml-cocoon2/src/java/org/apache/cocoon/acting/LocaleAction.java
  
  Index: LocaleAction.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/acting/LocaleAction.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -d -b -u -r1.11 -r1.12
  --- LocaleAction.java	10 Jul 2002 15:41:51 -0000	1.11
  +++ LocaleAction.java	15 Dec 2002 16:46:12 -0000	1.12
  @@ -221,42 +221,58 @@
               Configuration child = conf.getChild(STORE_REQUEST);
               storeInRequest = child.getValueAsBoolean(false);
   
  -            debug((storeInRequest ? "will" : "won't") + " set values in request");
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug((storeInRequest ? "will" : "won't") + " set values in request");
  +            }
   
               child = conf.getChild(CREATE_SESSION);
               createSession = child.getValueAsBoolean(false);
   
  -            debug((createSession ? "will" : "won't") + " create session");
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug((createSession ? "will" : "won't") + " create session");
  +            }
   
               child = conf.getChild(STORE_SESSION);
               storeInSession = child.getValueAsBoolean(false);
   
  -            debug((storeInSession ? "will" : "won't") + " set values in session");
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug((storeInSession ? "will" : "won't") + " set values in session");
  +            }
   
               child = conf.getChild(STORE_COOKIE);
               storeInCookie = child.getValueAsBoolean(false);
   
  -            debug((storeInCookie ? "will" : "won't") + " set values in cookies");
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug((storeInCookie ? "will" : "won't") + " set values in cookies");
  +            }
   
               child = conf.getChild(LANG_ATTR);
               langAttr = child.getValue(LANG);
   
  -            debug("global language attribute name is " + langAttr);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("global language attribute name is " + langAttr);
  +            }
   
               child = conf.getChild(COUNTRY_ATTR);
               countryAttr = child.getValue(COUNTRY);
   
  -            debug("global country attribute name is " + countryAttr);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("global country attribute name is " + countryAttr);
  +            }
   
               child = conf.getChild(VARIANT_ATTR);
               variantAttr = child.getValue(VARIANT);
   
  -            debug("global variant attribute name is " + variantAttr);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("global variant attribute name is " + variantAttr);
  +            }
   
               child = conf.getChild(LOCALE_ATTR);
               localeAttr = child.getValue(LOCALE);
   
  -            debug("global locale attribute name is " + localeAttr);
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("global locale attribute name is " + localeAttr);
  +            }
           }
       }
   
  @@ -277,7 +293,7 @@
   	Locale locale = I18nUtils.parseLocale(lc);
   
           if (getLogger().isDebugEnabled()) {
  -            debug("obtained locale information, locale = " + lc);
  +            getLogger().debug("obtained locale information, locale = " + lc);
               checkParams(par);
           }
   
  @@ -285,7 +301,9 @@
               Request request = ObjectModelHelper.getRequest(objectModel);
   
               request.setAttribute(localeAttr, lc);
  -            debug("updated request");
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("updated request");
  +            }
           }
   
           // store in session if so configured
  @@ -295,7 +313,9 @@
   
               if (session != null) {
                   session.setAttribute(localeAttr, lc);
  -                debug("updated session");
  +                if (getLogger().isDebugEnabled()) {
  +                    getLogger().debug("updated session");
  +                }
               }
           }
   
  @@ -304,7 +324,9 @@
               Response response = ObjectModelHelper.getResponse(objectModel);
   
               response.addCookie(response.createCookie(localeAttr, lc));
  -            debug("created cookies");
  +            if (getLogger().isDebugEnabled()) {
  +                getLogger().debug("created cookies");
  +            }
           }
   
           // set up a map for sitemap parameters
  @@ -379,7 +401,7 @@
           createSession = par.getParameterAsBoolean(CREATE_SESSION, createSession);
           storeInCookie = par.getParameterAsBoolean(STORE_COOKIE, storeInCookie);
   
  -        debug("checking for local overrides:\n" +
  +        getLogger().debug("checking for local overrides:\n" +
               "  " + LANG_ATTR + " = " + langAttr + ",\n" +
               "  " + COUNTRY_ATTR + " = " + countryAttr + ",\n" +
               "  " + VARIANT_ATTR + " = " + variantAttr + ",\n" +
  @@ -389,15 +411,6 @@
               "  " + CREATE_SESSION + " = " + createSession + ",\n" +
               "  " + STORE_COOKIE + " = " + storeInCookie + "\n"
           );
  -    }
  -
  -    /**
  -     * Helper debug method
  -     *
  -     * @param msg debugging message
  -     */
  -    private void debug(String msg) {
  -        getLogger().debug(msg);
       }
   
       // Store the lang in request. Default is not to do this.
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org