cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/acting DbXMLAuthenticatorAction.java
Date Sun, 28 Mar 2004 20:51:25 GMT
antonio     2004/03/28 12:51:24

  Modified:    src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp
                        AbstractEsqlConnection.java
               src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor
                        FormattingDecimalConvertor.java
               src/blocks/databases/java/org/apache/cocoon/acting
                        DatabaseAuthenticatorAction.java
                        DatabaseCookieAuthenticatorAction.java
               src/java/org/apache/cocoon/sitemap ContentAggregator.java
               src/java/org/apache/cocoon/reading ImageReader.java
               src/java/org/apache/cocoon/components/source/impl
                        DelayedRefreshSourceWrapper.java
               src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types
                        Attribute.java
               src/blocks/forms/java/org/apache/cocoon/forms/acting
                        HandleFormSubmitAction.java
                        AbstractFormsAction.java
               src/blocks/forms/java/org/apache/cocoon/forms/datatype
                        DefaultSelectionListBuilder.java
               src/blocks/fop/java/org/apache/cocoon/serialization
                        FOPSerializer.java
               src/java/org/apache/cocoon/transformation
                        SimpleFormTransformer.java
               src/blocks/databases/java/org/apache/cocoon/acting/modular
                        DatabaseAction.java
               src/java/org/apache/cocoon Main.java
               src/blocks/portal/java/org/apache/cocoon/portlet
                        CocoonPortlet.java
               src/java/org/apache/cocoon/servlet CocoonServlet.java
               src/blocks/axis/java/org/apache/cocoon/components/axis
                        SoapServerImpl.java
               src/blocks/lucene/java/org/apache/cocoon/transformation
                        LuceneIndexTransformer.java
               src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl
                        LengthValidationRule.java
                        ValueCountValidationRule.java
                        RangeValidationRule.java
               src/blocks/woody/java/org/apache/cocoon/woody/util
                        DomHelper.java
               src/java/org/apache/cocoon/bean/helpers
                        BeanConfigurator.java
               src/java/org/apache/cocoon/acting
                        AbstractValidatorAction.java
               src/blocks/forms/java/org/apache/cocoon/forms/binding
                        InsertNodeJXPathBindingBuilder.java
               src/blocks/forms/java/org/apache/cocoon/forms/util
                        DomHelper.java
               src/blocks/xsp/java/org/apache/cocoon/acting
                        InputModuleAction.java
               src/blocks/xmldb/java/org/apache/cocoon/acting
                        DbXMLAuthenticatorAction.java
  Log:
  Changing to use o.a.commons.lang.BooleanUtils
  
  Revision  Changes    Path
  1.8       +3 -2      cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/AbstractEsqlConnection.java
  
  Index: AbstractEsqlConnection.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/components/language/markup/xsp/AbstractEsqlConnection.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AbstractEsqlConnection.java	5 Mar 2004 13:01:53 -0000	1.7
  +++ AbstractEsqlConnection.java	28 Mar 2004 20:51:23 -0000	1.8
  @@ -16,6 +16,7 @@
   package org.apache.cocoon.components.language.markup.xsp;
   
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.commons.lang.BooleanUtils;
   
   import java.sql.Connection;
   import java.util.Properties;
  @@ -47,7 +48,7 @@
        * Hence we disable it per default.
        **/
       public void setMultipleResults(String value) {
  -        this.multipleResults = ("true".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value));
  +        this.multipleResults = BooleanUtils.toBoolean(value);
       }
   
       public boolean getMultipleResults() {
  
  
  
  1.2       +4 -4      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDecimalConvertor.java
  
  Index: FormattingDecimalConvertor.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/convertor/FormattingDecimalConvertor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FormattingDecimalConvertor.java	9 Mar 2004 10:34:06 -0000	1.1
  +++ FormattingDecimalConvertor.java	28 Mar 2004 20:51:23 -0000	1.2
  @@ -124,11 +124,11 @@
   
           String pattern = (String)localizedPatterns.get(locale);
   
  -        if (pattern != null)
  +        if (pattern != null) {
               decimalFormat.applyLocalizedPattern(pattern);
  -        else if (nonLocalizedPattern != null)
  +        } else if (nonLocalizedPattern != null) {
               decimalFormat.applyPattern(nonLocalizedPattern);
  -
  +        }
           return decimalFormat;
       }
   
  
  
  
  1.6       +3 -2      cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/acting/DatabaseAuthenticatorAction.java
  
  Index: DatabaseAuthenticatorAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/acting/DatabaseAuthenticatorAction.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DatabaseAuthenticatorAction.java	5 Mar 2004 13:01:50 -0000	1.5
  +++ DatabaseAuthenticatorAction.java	28 Mar 2004 20:51:23 -0000	1.6
  @@ -25,6 +25,7 @@
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Session;
   import org.apache.cocoon.environment.SourceResolver;
  +import org.apache.commons.lang.BooleanUtils;
   
   import java.sql.Connection;
   import java.sql.ResultSet;
  @@ -198,7 +199,7 @@
                       String nullstr = columns[i].getAttribute("nullable", null);
                       if (nullstr != null) {
                           nullstr = nullstr.trim();
  -                        nullable = "yes".equals(nullstr) || "true".equals(nullstr);
  +                        nullable = BooleanUtils.toBoolean(nullstr);
                       }
   
                       String constraintValue = req.getParameter(requestParameter);
  
  
  
  1.4       +5 -6      cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/acting/DatabaseCookieAuthenticatorAction.java
  
  Index: DatabaseCookieAuthenticatorAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/acting/DatabaseCookieAuthenticatorAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DatabaseCookieAuthenticatorAction.java	5 Mar 2004 13:01:50 -0000	1.3
  +++ DatabaseCookieAuthenticatorAction.java	28 Mar 2004 20:51:23 -0000	1.4
  @@ -26,6 +26,7 @@
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Session;
   import org.apache.cocoon.environment.SourceResolver;
  +import org.apache.commons.lang.BooleanUtils;
   
   import java.sql.Connection;
   import java.sql.ResultSet;
  @@ -111,12 +112,10 @@
                       append_session = parameters.getParameter("append-session",
                       (String) this.settings.get("append-session"));
   
  -            if (create_session != null &&
  -                    ("no".equals(create_session.trim()) || "false".equals(create_session.trim()))) {
  +            if (create_session != null && BooleanUtils.toBoolean(create_session.trim())) {
                   cs = false;
               }
  -            if (append_session != null &&
  -                    ("yes".equals(append_session.trim()) || "true".equals(append_session.trim()))) {
  +            if (append_session != null && BooleanUtils.toBoolean(append_session.trim())) {
                   as = true;
               }
   
  @@ -277,7 +276,7 @@
                       if (nullstr != null) {
                           nullstr = nullstr.trim();
                       }
  -                    if ("yes".equals(nullstr) || "true".equals(nullstr)) {
  +                    if (BooleanUtils.toBoolean(nullstr)) {
                           nullable = true;
                       }
                   } catch (Exception e1) {
  
  
  
  1.7       +3 -2      cocoon-2.1/src/java/org/apache/cocoon/sitemap/ContentAggregator.java
  
  Index: ContentAggregator.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/sitemap/ContentAggregator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ContentAggregator.java	5 Mar 2004 13:02:58 -0000	1.6
  +++ ContentAggregator.java	28 Mar 2004 20:51:24 -0000	1.7
  @@ -26,6 +26,7 @@
   import org.apache.cocoon.generation.Generator;
   import org.apache.cocoon.xml.ContentHandlerWrapper;
   import org.apache.cocoon.xml.XMLConsumer;
  +import org.apache.commons.lang.BooleanUtils;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
   import org.apache.excalibur.source.SourceValidity;
  @@ -82,7 +83,7 @@
           public Part(String uri, Element element, String stripRoot) {
               this.uri = uri;
               this.element = element;
  -            this.stripRootElement = (stripRoot.equals("yes") || stripRoot.equals("true"));
  +            this.stripRootElement = BooleanUtils.toBoolean(stripRoot);
           }
       }
   
  
  
  
  1.10      +4 -8      cocoon-2.1/src/java/org/apache/cocoon/reading/ImageReader.java
  
  Index: ImageReader.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/reading/ImageReader.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ImageReader.java	21 Mar 2004 03:49:48 -0000	1.9
  +++ ImageReader.java	28 Mar 2004 20:51:24 -0000	1.10
  @@ -30,6 +30,7 @@
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.environment.SourceResolver;
  +import org.apache.commons.lang.BooleanUtils;
   import org.xml.sax.SAXException;
   
   import com.sun.image.codec.jpeg.ImageFormatException;
  @@ -133,18 +134,13 @@
           }
   
           String grayscalePar = par.getParameter("grayscale", GRAYSCALE_DEFAULT);
  -        if ("true".equalsIgnoreCase(grayscalePar) || "yes".equalsIgnoreCase(grayscalePar)){            
  +        if (BooleanUtils.toBoolean(grayscalePar)){            
               grayscaleFilter = new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_GRAY), null);
           } else {
               grayscaleFilter = null;
           }   
  -
           String enlargePar = par.getParameter("allow-enlarging", ENLARGE_DEFAULT);
  -        if ("true".equalsIgnoreCase(enlargePar) || "yes".equalsIgnoreCase(enlargePar)){
  -            enlarge = true;
  -        } else {
  -            enlarge = false;
  -        }
  +        enlarge = BooleanUtils.toBoolean(enlargePar);
       }
   
       /** 
  
  
  
  1.5       +1 -2      cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/DelayedRefreshSourceWrapper.java
  
  Index: DelayedRefreshSourceWrapper.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/DelayedRefreshSourceWrapper.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DelayedRefreshSourceWrapper.java	5 Mar 2004 13:02:50 -0000	1.4
  +++ DelayedRefreshSourceWrapper.java	28 Mar 2004 20:51:24 -0000	1.5
  @@ -112,7 +112,6 @@
               // Yes
               this.refresh();
           }
  -
           return this.lastModified;
       }
   
  
  
  
  1.5       +18 -12    cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types/Attribute.java
  
  Index: Attribute.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types/Attribute.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Attribute.java	5 Mar 2004 13:02:07 -0000	1.4
  +++ Attribute.java	28 Mar 2004 20:51:24 -0000	1.5
  @@ -15,6 +15,8 @@
    */
   package org.apache.cocoon.components.elementprocessor.types;
   
  +import org.apache.commons.lang.BooleanUtils;
  +
   /**
    * Encapsulation of a single XML element attribute in a way that
    * shields the consumer from the data's XML origins.
  @@ -118,6 +120,7 @@
        *     <li>true/false
        *     <li>y/n
        *     <li>yes/no
  +     *      <li>on/off
        * </ul>
        *
        * @return the value of the Attribute as a boolean
  @@ -127,20 +130,23 @@
        */
   
       public boolean getValueAsBoolean() {
  -        boolean rvalue = false;
  -
  -        if (_value.equalsIgnoreCase("t") || _value.equalsIgnoreCase("y")
  -                || _value.equalsIgnoreCase("yes")
  -                || _value.equalsIgnoreCase("true")) {
  -            rvalue = true;
  -        } else if (_value.equalsIgnoreCase("f") || _value.equalsIgnoreCase("n")
  -                 || _value.equalsIgnoreCase("no")
  -                 || _value.equalsIgnoreCase("false")) {
  -            rvalue = false;
  +        // Match case for: true, false, yes, no, on, off.
  +        Boolean rvalue = BooleanUtils.toBooleanObject(_value);
  +        if (rvalue != null) {
  +            return rvalue.booleanValue();
  +        }
  +        // Lets try with "t", "f"
  +        rvalue = BooleanUtils.toBooleanObject(_value, "t", "f", null);
  +        if (rvalue != null) {
  +            return rvalue.booleanValue();
  +        }
  +        // Try now "y", "n"
  +        rvalue = BooleanUtils.toBooleanObject(_value, "y", "n", null);
  +        if (rvalue != null) {
  +            return rvalue.booleanValue();
           } else {
               throw new IllegalArgumentException(
                   "Value [" + _value + "] does not represent a boolean value");
           }
  -        return rvalue;
       }
   }   // end public class Attribute
  
  
  
  1.4       +6 -4      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/acting/HandleFormSubmitAction.java
  
  Index: HandleFormSubmitAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/acting/HandleFormSubmitAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HandleFormSubmitAction.java	18 Mar 2004 21:04:39 -0000	1.3
  +++ HandleFormSubmitAction.java	28 Mar 2004 20:51:24 -0000	1.4
  @@ -57,8 +57,9 @@
   
           Locale locale = Locale.getDefault();
           String localeStr = parameters.getParameter("locale", null);
  -        if (localeStr != null)
  +        if (localeStr != null) {
               locale = I18nUtils.parseLocale(localeStr, locale);
  +        }
   
           Source source = resolver.resolveURI(formSource);
           try {
  @@ -80,10 +81,11 @@
               boolean finished = form.process(formContext);
               request.setAttribute(formAttribute, form);
   
  -            if (finished)
  +            if (finished) {
                   return Collections.EMPTY_MAP;
  -            else
  +            } else {
                   return null;
  +            }
           } finally {
               resolver.release(source);
           }
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/acting/AbstractFormsAction.java
  
  Index: AbstractFormsAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/acting/AbstractFormsAction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractFormsAction.java	18 Mar 2004 21:04:39 -0000	1.3
  +++ AbstractFormsAction.java	28 Mar 2004 20:51:24 -0000	1.4
  @@ -41,7 +41,7 @@
       }
   
       public void dispose() {
  -        if ( this.manager != null ) {
  +        if (this.manager != null) {
               this.manager.release( this.formManager );
               this.manager = null;
               this.formManager = null;
  
  
  
  1.3       +5 -3      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java
  
  Index: DefaultSelectionListBuilder.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/DefaultSelectionListBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultSelectionListBuilder.java	9 Mar 2004 13:08:46 -0000	1.2
  +++ DefaultSelectionListBuilder.java	28 Mar 2004 20:51:24 -0000	1.3
  @@ -129,10 +129,12 @@
                   throw new Exception("Excepted a wd:selection-list element at " + DomHelper.getLocation(selectionListElement));
               return selectionListElement;
           } finally {
  -            if (source != null)
  +            if (source != null) {
                   resolver.release(source);
  -            if (resolver != null)
  +            }
  +            if (resolver != null) {
                   serviceManager.release(resolver);
  +            }
           }
       }
   }
  
  
  
  1.11      +2 -2      cocoon-2.1/src/blocks/fop/java/org/apache/cocoon/serialization/FOPSerializer.java
  
  Index: FOPSerializer.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/fop/java/org/apache/cocoon/serialization/FOPSerializer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- FOPSerializer.java	5 Mar 2004 13:01:56 -0000	1.10
  +++ FOPSerializer.java	28 Mar 2004 20:51:24 -0000	1.11
  @@ -155,7 +155,7 @@
               // New syntax: Element user-config contains URL
               configUrl = conf.getChild("user-config").getValue(null);
           }
  -        
  +
           if (configUrl != null) {
               Source configSource = null;
               SourceResolver resolver = null;
  
  
  
  1.14      +3 -2      cocoon-2.1/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java
  
  Index: SimpleFormTransformer.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SimpleFormTransformer.java	10 Mar 2004 15:19:32 -0000	1.13
  +++ SimpleFormTransformer.java	28 Mar 2004 20:51:24 -0000	1.14
  @@ -30,6 +30,7 @@
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.util.HashMap;
   import org.apache.cocoon.xml.dom.DOMStreamer;
  +import org.apache.commons.lang.BooleanUtils;
   
   import org.w3c.dom.DocumentFragment;
   import org.xml.sax.Attributes;
  @@ -959,7 +960,7 @@
        * @return true if string is one of "yes", true"
        */
       private static boolean parseBoolean(String aBoolean) {
  -        return "true".equalsIgnoreCase(aBoolean) || "yes".equalsIgnoreCase(aBoolean);
  +        return BooleanUtils.toBoolean(aBoolean);
       }
   
       /**
  
  
  
  1.7       +4 -4      cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/acting/modular/DatabaseAction.java
  
  Index: DatabaseAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/databases/java/org/apache/cocoon/acting/modular/DatabaseAction.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DatabaseAction.java	5 Mar 2004 13:01:52 -0000	1.6
  +++ DatabaseAction.java	28 Mar 2004 20:51:24 -0000	1.7
  @@ -41,6 +41,7 @@
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.util.HashMap;
   import org.apache.cocoon.util.JDBCTypeConversions;
  +import org.apache.commons.lang.BooleanUtils;
   
   /**
    * Abstract action for common function needed by database actions.
  @@ -213,7 +214,7 @@
                   }
               }
               tmp = (String) this.settings.get("fail-on-empty",String.valueOf(this.failOnEmpty));
  -            this.failOnEmpty = tmp.equalsIgnoreCase("true") || tmp.equalsIgnoreCase("yes");
  +            this.failOnEmpty = BooleanUtils.toBoolean(tmp);
           }
       }
   
  @@ -766,8 +767,7 @@
   
               String throwException = (String) this.settings.get( "throw-exception",
                                                                   param.getParameter( "throw-exception", null ) );
  -            if ( throwException != null &&
  -                 ( throwException.equalsIgnoreCase( "true" ) || throwException.equalsIgnoreCase( "yes" ) ) ) {
  +            if ( throwException != null && BooleanUtils.toBoolean(throwException)) {
                   throw new ProcessingException("Cannot process the requested SQL statement ",e);
               }
           } finally {
  
  
  
  1.25      +4 -8      cocoon-2.1/src/java/org/apache/cocoon/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/Main.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- Main.java	5 Mar 2004 13:02:42 -0000	1.24
  +++ Main.java	28 Mar 2004 20:51:24 -0000	1.25
  @@ -30,6 +30,7 @@
   import org.apache.commons.cli.Option;
   import org.apache.commons.cli.Options;
   import org.apache.commons.cli.PosixParser;
  +import org.apache.commons.lang.BooleanUtils;
   
   import org.w3c.dom.Document;
   
  @@ -295,10 +296,10 @@
               listener.setReportFile(line.getOptionValue(BROKEN_LINK_FILE_OPT));
           }
           if (line.hasOption(FOLLOW_LINKS_OPT)) {
  -            cocoon.setFollowLinks(yesno(line.getOptionValue(FOLLOW_LINKS_OPT)));
  +            cocoon.setFollowLinks(BooleanUtils.toBoolean(line.getOptionValue(FOLLOW_LINKS_OPT)));
           }
           if (line.hasOption(CONFIRM_EXTENSIONS_OPT)) {
  -            cocoon.setConfirmExtensions(yesno(line.getOptionValue(CONFIRM_EXTENSIONS_OPT, "yes")));
  +            cocoon.setConfirmExtensions(BooleanUtils.toBoolean(line.getOptionValue(CONFIRM_EXTENSIONS_OPT, "yes")));
           }
           if (line.hasOption(LOAD_CLASS_OPT)){
               cocoon.addLoadedClasses(Arrays.asList(line.getOptionValues(LOAD_CLASS_OPT)));
  @@ -322,10 +323,6 @@
           System.exit(exitCode);
       }
   
  -    private static boolean yesno(String in) {
  -        return "yes".equals(in) || "true".equals(in);
  -    }
  -
       private static String processXConf(CocoonBean cocoon, String filename, String destDir, String uriGroup) {
   
           try {
  @@ -336,7 +333,6 @@
               System.out.println("ERROR: " + e.getMessage());
               return destDir;
           }
  -
       }
   
       /**
  
  
  
  1.4       +4 -4      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java
  
  Index: CocoonPortlet.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portlet/CocoonPortlet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CocoonPortlet.java	11 Mar 2004 09:56:47 -0000	1.3
  +++ CocoonPortlet.java	28 Mar 2004 20:51:24 -0000	1.4
  @@ -31,6 +31,7 @@
   import org.apache.cocoon.util.IOUtils;
   import org.apache.cocoon.util.StringUtils;
   import org.apache.cocoon.util.log.CocoonLogFormatter;
  +import org.apache.commons.lang.BooleanUtils;
   
   import org.apache.avalon.excalibur.logger.LogKitLoggerManager;
   import org.apache.avalon.excalibur.logger.LoggerManager;
  @@ -440,8 +441,7 @@
           this.allowReload = getInitParameterAsBoolean("allow-reload", ALLOW_RELOAD);
   
           value = conf.getInitParameter("show-time");
  -        this.showTime = "yes".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value)
  -                || (this.hiddenShowTime = "hide".equals(value));
  +        this.showTime = BooleanUtils.toBoolean(value) || (this.hiddenShowTime = "hide".equals(value));
           if (value == null) {
               if (getLogger().isDebugEnabled()) {
                   getLogger().debug("show-time was not set - defaulting to false");
  @@ -1657,7 +1657,7 @@
               }
               return defaultValue;
           } else {
  -            return value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes");
  +            return BooleanUtils.toBoolean(value);
           }
       }
   
  
  
  
  1.25      +11 -13    cocoon-2.1/src/java/org/apache/cocoon/servlet/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/servlet/CocoonServlet.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- CocoonServlet.java	13 Mar 2004 15:01:24 -0000	1.24
  +++ CocoonServlet.java	28 Mar 2004 20:51:24 -0000	1.25
  @@ -73,6 +73,7 @@
   import org.apache.cocoon.util.IOUtils;
   import org.apache.cocoon.util.StringUtils;
   import org.apache.cocoon.util.log.CocoonLogFormatter;
  +import org.apache.commons.lang.BooleanUtils;
   
   import org.apache.excalibur.instrument.InstrumentManager;
   import org.apache.excalibur.instrument.manager.DefaultInstrumentManager;
  @@ -443,8 +444,7 @@
   		this.allowReload = getInitParameterAsBoolean("allow-reload", ALLOW_RELOAD);
   
           value = conf.getInitParameter("show-time");
  -        this.showTime = "yes".equalsIgnoreCase(value) || "true".equalsIgnoreCase(value)
  -            || (this.hiddenShowTime = "hide".equals(value));
  +        this.showTime = BooleanUtils.toBoolean(value) || (this.hiddenShowTime = "hide".equals(value));
           if (value == null) {
               if (getLogger().isDebugEnabled()) {
                   getLogger().debug("show-time was not set - defaulting to false");
  @@ -701,8 +701,7 @@
        *
        * @throws ServletException
        */
  -     protected String getExtraClassPath()
  -     throws ServletException {
  +     protected String getExtraClassPath() throws ServletException {
            String extraClassPath = this.getInitParameter("extra-classpath");
            if (extraClassPath != null) {
                StringBuffer sb = new StringBuffer();
  @@ -1498,14 +1497,13 @@
       /** Convenience method to access boolean servlet parameters */
       protected boolean getInitParameterAsBoolean(String name, boolean defaultValue) {
       	String value = getInitParameter(name);
  -    	if (value == null) {
  -			if (getLogger() != null && getLogger().isDebugEnabled()) {
  -				getLogger().debug(name + " was not set - defaulting to '" + defaultValue + "'");
  -			}
  -    		return defaultValue;
  -    	} else {
  -    		return value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes");
  -    	}
  +    	if (value != null) {
  +            return BooleanUtils.toBoolean(value);
  +        }
  +		if (getLogger() != null && getLogger().isDebugEnabled()) {
  +			getLogger().debug(name + " was not set - defaulting to '" + defaultValue + "'");
  +		}
  +		return defaultValue;
       }
   
       protected int getInitParameterAsInteger(String name, int defaultValue) {
  
  
  
  1.4       +3 -3      cocoon-2.1/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java
  
  Index: SoapServerImpl.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SoapServerImpl.java	5 Mar 2004 13:01:41 -0000	1.3
  +++ SoapServerImpl.java	28 Mar 2004 20:51:24 -0000	1.4
  @@ -57,6 +57,7 @@
   import org.apache.axis.utils.XMLUtils;
   import org.apache.cocoon.components.axis.providers.AvalonProvider;
   import org.apache.cocoon.util.IOUtils;
  +import org.apache.commons.lang.BooleanUtils;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceResolver;
   import org.apache.excalibur.xml.dom.DOMParser;
  @@ -307,8 +308,7 @@
           if (secProvider != null)
           {
               final String attr = secProvider.getAttribute("enabled");
  -            final boolean providerIsEnabled =
  -                "true".equalsIgnoreCase(attr) || "yes".equalsIgnoreCase(attr);
  +            final boolean providerIsEnabled = BooleanUtils.toBoolean(attr);
   
               if (providerIsEnabled)
                   m_securityProvider = new ServletSecurityProvider();
  
  
  
  1.13      +3 -3      cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/transformation/LuceneIndexTransformer.java
  
  Index: LuceneIndexTransformer.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/lucene/java/org/apache/cocoon/transformation/LuceneIndexTransformer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- LuceneIndexTransformer.java	5 Mar 2004 13:01:59 -0000	1.12
  +++ LuceneIndexTransformer.java	28 Mar 2004 20:51:24 -0000	1.13
  @@ -35,6 +35,7 @@
   import org.apache.cocoon.components.search.LuceneCocoonHelper;
   import org.apache.cocoon.components.search.LuceneXMLIndexer;
   import org.apache.cocoon.environment.SourceResolver;
  +import org.apache.commons.lang.BooleanUtils;
   import org.apache.excalibur.source.SourceValidity;
   import org.apache.excalibur.source.impl.validity.NOPValidity;
   
  @@ -234,8 +235,7 @@
           if (processing == STATE_GROUND) {
               if (LUCENE_URI.equals(namespaceURI) && LUCENE_QUERY_ELEMENT.equals(localName)){
                   String sCreate = atts.getValue(LUCENE_QUERY_CREATE_ATTRIBUTE);
  -                createIndex = sCreate != null &&
  -                    (sCreate.equalsIgnoreCase("yes") || sCreate.equalsIgnoreCase("true"));
  +                createIndex = BooleanUtils.toBoolean(sCreate);
   
                   String analyzerClassname = atts.getValue(LUCENE_QUERY_ANALYZER_ATTRIBUTE);
                   String indexDirectory  = atts.getValue(LUCENE_QUERY_DIRECTORY_ATTRIBUTE);
  
  
  
  1.3       +24 -15    cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/LengthValidationRule.java
  
  Index: LengthValidationRule.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/LengthValidationRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LengthValidationRule.java	9 Mar 2004 14:58:45 -0000	1.2
  +++ LengthValidationRule.java	28 Mar 2004 20:51:24 -0000	1.3
  @@ -59,51 +59,60 @@
   
           if (exactExpr != null) {
               Object result = evaluateNumeric(exactExpr, expressionContext, "exact", "length");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int length = ((BigDecimal)result).intValue();
  -            if (string.length() != length)
  +            if (string.length() != length) {
                   return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.exact-length", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
  +            }
               return null;
           } else if (minExpr != null && maxExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, "min", "length");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int minLength = ((BigDecimal)result).intValue();
   
               result = evaluateNumeric(maxExpr, expressionContext, "max", "length");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int maxLength = ((BigDecimal)result).intValue();
   
  -            if (string.length() < minLength || string.length() > maxLength)
  +            if (string.length() < minLength || string.length() > maxLength) {
                   return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.range-length", new String[] {String.valueOf(minLength), String.valueOf(maxLength)}, Constants.I18N_CATALOGUE));
  +            }
               return null;
           } else if (minExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, "min", "length");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int length = ((BigDecimal)result).intValue();
  -            if (string.length() < length)
  +            if (string.length() < length) {
                   return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.min-length", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
  +            }
               return null;
           } else if (maxExpr != null) {
               Object result = evaluateNumeric(maxExpr, expressionContext, "max", "length");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int length = ((BigDecimal)result).intValue();
  -            if (string.length() > length)
  +            if (string.length() > length) {
                   return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.string.max-length", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
  +            }
               return null;
           }
           return null;
  
  
  
  1.4       +24 -15    cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/ValueCountValidationRule.java
  
  Index: ValueCountValidationRule.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/ValueCountValidationRule.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ValueCountValidationRule.java	9 Mar 2004 14:58:45 -0000	1.3
  +++ ValueCountValidationRule.java	28 Mar 2004 20:51:24 -0000	1.4
  @@ -61,51 +61,60 @@
   
           if (exactExpr != null) {
               Object result = evaluateNumeric(exactExpr, expressionContext, "exact", "value-count");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int length = ((BigDecimal)result).intValue();
  -            if (array.length != length)
  +            if (array.length != length) {
                   return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.exact-valuecount", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
  +            }
               return null;
           } else if (minExpr != null && maxExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, "min", "value-count");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int minLength = ((BigDecimal)result).intValue();
   
               result = evaluateNumeric(maxExpr, expressionContext, "max", "value-count");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int maxLength = ((BigDecimal)result).intValue();
   
  -            if (array.length < minLength || array.length > maxLength)
  +            if (array.length < minLength || array.length > maxLength) {
                   return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.range-valuecount", new String[] {String.valueOf(minLength), String.valueOf(maxLength)}, Constants.I18N_CATALOGUE));
  +            }
               return null;
           } else if (minExpr != null) {
               Object result = evaluateNumeric(minExpr, expressionContext, "min", "value-count");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int length = ((BigDecimal)result).intValue();
  -            if (array.length < length)
  +            if (array.length < length) {
                   return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.min-valuecount", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
  +            }
               return null;
           } else if (maxExpr != null) {
               Object result = evaluateNumeric(maxExpr, expressionContext, "max", "value-count");
  -            if (result instanceof ValidationError)
  +            if (result instanceof ValidationError) {
                   return (ValidationError)result;
  -            else if (result instanceof CannotYetResolveWarning)
  +            } else if (result instanceof CannotYetResolveWarning) {
                   return null;
  +            }
               int length = ((BigDecimal)result).intValue();
  -            if (array.length > length)
  +            if (array.length > length) {
                   return hasFailMessage() ? getFailMessage() : new ValidationError(new I18nMessage("validation.array.max-valuecount", new String[] {String.valueOf(length)}, Constants.I18N_CATALOGUE));
  +            }
               return null;
           }
           return null;
  
  
  
  1.3       +1 -4      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/RangeValidationRule.java
  
  Index: RangeValidationRule.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/datatype/validationruleimpl/RangeValidationRule.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RangeValidationRule.java	9 Mar 2004 14:58:45 -0000	1.2
  +++ RangeValidationRule.java	28 Mar 2004 20:51:24 -0000	1.3
  @@ -106,7 +106,6 @@
                                                                                    new String[]{min.toString()},
                                                                                    Constants.I18N_CATALOGUE));
               }
  -
               return null;
           } else if (max != null) {
               if (decimal.compareTo(max) > 0) {
  @@ -114,10 +113,8 @@
                                                                                    new String[]{max.toString()},
                                                                                    Constants.I18N_CATALOGUE));
               }
  -
               return null;
           }
  -
           return null;
       }
   
  
  
  
  1.18      +10 -15    cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/DomHelper.java
  
  Index: DomHelper.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/util/DomHelper.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- DomHelper.java	9 Mar 2004 13:54:24 -0000	1.17
  +++ DomHelper.java	28 Mar 2004 20:51:24 -0000	1.18
  @@ -20,6 +20,7 @@
   
   import org.apache.cocoon.xml.SaxBuffer;
   import org.apache.cocoon.xml.dom.DOMStreamer;
  +import org.apache.commons.lang.BooleanUtils;
   import org.apache.excalibur.xml.sax.XMLizable;
   import org.apache.xerces.dom.NodeImpl;
   import org.apache.xerces.parsers.DOMParser;
  @@ -246,24 +247,18 @@
       }
   
       public static boolean getAttributeAsBoolean(Element element, 
  -            String attributeName, boolean defaultValue) throws Exception {
  +                String attributeName, boolean defaultValue) {
           String attrValue = element.getAttribute(attributeName);
  -        if (attrValue.equals("")) {
  -            return defaultValue;
  -        } else if (attrValue.equalsIgnoreCase("true")
  -                || attrValue.equalsIgnoreCase("yes")) {
  -            return true;
  -        } else if (attrValue.equalsIgnoreCase("false")
  -                || attrValue.equalsIgnoreCase("no")) {
  -            return false;
  +        Boolean result = BooleanUtils.toBooleanObject(attrValue, "true", "false", null);
  +        if (result == null) {
  +            result = BooleanUtils.toBooleanObject(attrValue, "yes", "no", null);
  +        }
  +        if (result != null) {
  +            return result.booleanValue();
           } else {
  -            throw new Exception("Cannot parse the value \"" + attrValue + 
  -                    "\" as a boolean in the attribute \"" + attributeName + 
  -                    "\" on the element \"" + element.getTagName() + 
  -                    "\" at " + getLocation(element));
  +            return defaultValue;
           }
       }
  -
       public static String getElementText(Element element) {
           StringBuffer value = new StringBuffer();
           NodeList nodeList = element.getChildNodes();
  
  
  
  1.8       +3 -3      cocoon-2.1/src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java
  
  Index: BeanConfigurator.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/bean/helpers/BeanConfigurator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- BeanConfigurator.java	5 Mar 2004 13:02:45 -0000	1.7
  +++ BeanConfigurator.java	28 Mar 2004 20:51:24 -0000	1.8
  @@ -22,6 +22,7 @@
   
   import org.apache.cocoon.bean.CocoonBean;
   import org.apache.cocoon.bean.helpers.OutputStreamListener;
  +import org.apache.commons.lang.BooleanUtils;
   
   import org.w3c.dom.Document;
   import org.w3c.dom.NamedNodeMap;
  @@ -449,8 +450,7 @@
   
               if (attribute != null) {
                   String value = attribute.getNodeValue();
  -                return "yes".equals(value)
  -                        || "true".equals(value);
  +                return BooleanUtils.toBoolean(value);
               }
           }
           return false;
  
  
  
  1.11      +6 -4      cocoon-2.1/src/java/org/apache/cocoon/acting/AbstractValidatorAction.java
  
  Index: AbstractValidatorAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/java/org/apache/cocoon/acting/AbstractValidatorAction.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AbstractValidatorAction.java	28 Mar 2004 14:28:04 -0000	1.10
  +++ AbstractValidatorAction.java	28 Mar 2004 20:51:24 -0000	1.11
  @@ -26,6 +26,7 @@
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.sitemap.SitemapParameters;
  +import org.apache.commons.lang.BooleanUtils;
   import org.apache.commons.lang.StringUtils;
   
   import org.apache.regexp.RE;
  @@ -814,12 +815,13 @@
           /* check nullability */
           try {
               String tmp = cons.getAttribute("nullable");
  -            return "yes".equals(tmp) || "true".equals(tmp);
  +            return BooleanUtils.toBoolean(tmp);
           } catch (Exception e) {
               String tmp = "no";
  -            if (conf != null)
  +            if (conf != null) {
                   tmp = conf.getAttribute("nullable", "no");
  -            return "yes".equals(tmp) || "true".equals(tmp);
  +            }
  +            return BooleanUtils.toBoolean(tmp);
           }
       }
   
  
  
  
  1.2       +3 -2      cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java
  
  Index: InsertNodeJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/binding/InsertNodeJXPathBindingBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InsertNodeJXPathBindingBuilder.java	9 Mar 2004 10:33:55 -0000	1.1
  +++ InsertNodeJXPathBindingBuilder.java	28 Mar 2004 20:51:24 -0000	1.2
  @@ -84,8 +84,9 @@
                       domTemplate = document.createDocumentFragment();
                       domTemplate.appendChild(element);
                   } finally {
  -                    if (source != null)
  +                    if (source != null) {
                           sourceResolver.release(source);
  +                    }
                       manager.release(sourceResolver);
                   }
               } else {
  
  
  
  1.3       +11 -15    cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java
  
  Index: DomHelper.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/forms/java/org/apache/cocoon/forms/util/DomHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DomHelper.java	11 Mar 2004 02:56:32 -0000	1.2
  +++ DomHelper.java	28 Mar 2004 20:51:24 -0000	1.3
  @@ -20,6 +20,7 @@
   
   import org.apache.cocoon.xml.SaxBuffer;
   import org.apache.cocoon.xml.dom.DOMStreamer;
  +import org.apache.commons.lang.BooleanUtils;
   import org.apache.excalibur.xml.sax.XMLizable;
   import org.apache.xerces.dom.NodeImpl;
   import org.apache.xerces.parsers.DOMParser;
  @@ -246,22 +247,17 @@
       }
   
       public static boolean getAttributeAsBoolean(Element element, 
  -            String attributeName, boolean defaultValue) throws Exception {
  +                String attributeName, boolean defaultValue) {
           String attrValue = element.getAttribute(attributeName);
  -        if (attrValue.equals("")) {
  -            return defaultValue;
  -        } else if (attrValue.equalsIgnoreCase("true")
  -                || attrValue.equalsIgnoreCase("yes")) {
  -            return true;
  -        } else if (attrValue.equalsIgnoreCase("false")
  -                || attrValue.equalsIgnoreCase("no")) {
  -            return false;
  -        } else {
  -            throw new Exception("Cannot parse the value \"" + attrValue + 
  -                    "\" as a boolean in the attribute \"" + attributeName + 
  -                    "\" on the element \"" + element.getTagName() + 
  -                    "\" at " + getLocation(element));
  +        Boolean result = BooleanUtils.toBooleanObject(attrValue, "true", "false", null);
  +        if (result != null) {
  +            return result.booleanValue();
  +        }
  +        result = BooleanUtils.toBooleanObject(attrValue, "yes", "no", null);
  +        if (result != null) {
  +            return result.booleanValue();
           }
  +        return defaultValue;
       }
   
       public static String getElementText(Element element) {
  
  
  
  1.2       +3 -2      cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/acting/InputModuleAction.java
  
  Index: InputModuleAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/xsp/java/org/apache/cocoon/acting/InputModuleAction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InputModuleAction.java	10 Mar 2004 12:58:04 -0000	1.1
  +++ InputModuleAction.java	28 Mar 2004 20:51:24 -0000	1.2
  @@ -22,6 +22,7 @@
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.components.language.markup.xsp.XSPModuleHelper;
  +import org.apache.commons.lang.BooleanUtils;
   
   import java.util.HashMap;
   import java.util.Map;
  @@ -121,7 +122,7 @@
           super.configure(conf);
           boolean result = false;
           String tmp = (String) this.settings.get("single-value", "false");
  -        result = tmp.equalsIgnoreCase("true") || tmp.equalsIgnoreCase("yes");
  +        result = BooleanUtils.toBoolean(tmp);
           this.settings.put("single-value", new Boolean(result));
       }
   
  
  
  
  1.7       +3 -2      cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/acting/DbXMLAuthenticatorAction.java
  
  Index: DbXMLAuthenticatorAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.1/src/blocks/xmldb/java/org/apache/cocoon/acting/DbXMLAuthenticatorAction.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DbXMLAuthenticatorAction.java	5 Mar 2004 13:02:36 -0000	1.6
  +++ DbXMLAuthenticatorAction.java	28 Mar 2004 20:51:24 -0000	1.7
  @@ -25,6 +25,7 @@
   import org.apache.cocoon.environment.Request;
   import org.apache.cocoon.environment.Session;
   import org.apache.cocoon.environment.SourceResolver;
  +import org.apache.commons.lang.BooleanUtils;
   
   import org.apache.xpath.XPathAPI;
   import org.apache.xpath.objects.XObject;
  @@ -205,7 +206,7 @@
   
               if (nullstr != null) nullstr = nullstr.trim ();
   
  -            if ("yes".equals (nullstr) || "true".equals (nullstr)) {
  +            if (BooleanUtils.toBoolean(nullstr)) {
                   nullable = true;
               }
   
  
  
  

Mime
View raw message