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.2/src/java/org/apache/cocoon/reading ImageReader.java
Date Sun, 28 Mar 2004 21:49:44 GMT
antonio     2004/03/28 13:49:44

  Modified:    src/java/org/apache/cocoon/servlet CocoonServlet.java
               src/java/org/apache/cocoon/acting
                        AbstractValidatorAction.java
               src/java/org/apache/cocoon/transformation
                        SimpleFormTransformer.java
               src/java/org/apache/cocoon/reading ImageReader.java
  Log:
  Changing to use o.a.commons.lang.BooleanUtils
  
  Revision  Changes    Path
  1.31      +4 -4      cocoon-2.2/src/java/org/apache/cocoon/servlet/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.2/src/java/org/apache/cocoon/servlet/CocoonServlet.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- CocoonServlet.java	13 Mar 2004 15:06:04 -0000	1.30
  +++ CocoonServlet.java	28 Mar 2004 21:49:44 -0000	1.31
  @@ -66,6 +66,7 @@
   import org.apache.cocoon.util.ClassUtils;
   import org.apache.cocoon.util.IOUtils;
   import org.apache.cocoon.util.StringUtils;
  +import org.apache.commons.lang.BooleanUtils;
   
   /**
    * This is the entry point for Cocoon execution as an HTTP Servlet.
  @@ -413,8 +414,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");
  @@ -1393,7 +1393,7 @@
   			}
       		return defaultValue;
       	} else {
  -    		return value.equalsIgnoreCase("true") || value.equalsIgnoreCase("yes");
  +    		return BooleanUtils.toBoolean(value);
       	}
       }
   
  
  
  
  1.12      +6 -4      cocoon-2.2/src/java/org/apache/cocoon/acting/AbstractValidatorAction.java
  
  Index: AbstractValidatorAction.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.2/src/java/org/apache/cocoon/acting/AbstractValidatorAction.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- AbstractValidatorAction.java	28 Mar 2004 21:01:21 -0000	1.11
  +++ AbstractValidatorAction.java	28 Mar 2004 21:49:44 -0000	1.12
  @@ -33,6 +33,7 @@
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.SourceResolver;
   import org.apache.cocoon.sitemap.SitemapParameters;
  +import org.apache.commons.lang.BooleanUtils;
   import org.apache.commons.lang.StringUtils;
   import org.apache.regexp.RE;
   import org.apache.regexp.RESyntaxException;
  @@ -813,12 +814,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.12      +7 -15     cocoon-2.2/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java
  
  Index: SimpleFormTransformer.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.2/src/java/org/apache/cocoon/transformation/SimpleFormTransformer.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SimpleFormTransformer.java	10 Mar 2004 17:58:05 -0000	1.11
  +++ SimpleFormTransformer.java	28 Mar 2004 21:49:44 -0000	1.12
  @@ -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;
  @@ -563,7 +564,7 @@
           if (getLogger().isDebugEnabled())
               getLogger().debug(
                   "startInputElement " + name + " attributes " + this.printAttributes(attr));
  -        if (aName == null || this.fixed || (fixed != null && parseBoolean(fixed)))
{
  +        if (aName == null || this.fixed || (fixed != null && BooleanUtils.toBoolean(fixed)))
{
               this.relayStartElement(uri, name, raw, attr);
   
           } else {
  @@ -607,7 +608,7 @@
           if (getLogger().isDebugEnabled())
               getLogger().debug(
                   "startSelectElement " + name + " attributes " + this.printAttributes(attr));
  -        if (aName != null && !(this.fixed || (fixed != null && parseBoolean(fixed))))
{
  +        if (aName != null && !(this.fixed || (fixed != null && BooleanUtils.toBoolean(fixed))))
{
               if (attr.getIndex("multiple") > -1) {
                   this.values = this.getValues(aName);
               } else {
  @@ -685,7 +686,7 @@
           if (aName != null) {
               value = this.getNextValue(aName);
           }
  -        if (value == null || this.fixed || (fixed != null && parseBoolean(fixed)))
{
  +        if (value == null || this.fixed || (fixed != null && BooleanUtils.toBoolean(fixed)))
{
               this.relayStartElement(uri, name, raw, attributes);
           } else {
               if (getLogger().isDebugEnabled())
  @@ -772,7 +773,7 @@
           if (fixed == null) {
               this.relayStartElement(uri, name, raw, attr);
           } else {
  -            if (!this.fixed && parseBoolean(fixed)) {
  +            if (!this.fixed && BooleanUtils.toBoolean(fixed)) {
                   this.fixed = true;
               }
               // remove attributes not meant for client
  @@ -802,7 +803,7 @@
           throws SAXException {
   
           if (this.recordingCount == 0) {
  -            if (!(this.fixed || parseBoolean(attr.getValue(this.fixedName)))) {
  +            if (!(this.fixed || BooleanUtils.toBoolean(attr.getValue(this.fixedName))))
{
                   RepeaterStatus status =
                       new RepeaterStatus("${" + attr.getValue("using") + "}", 0, attr.getValue("on"));
                   this.repeater.add(status);
  @@ -951,15 +952,6 @@
                       this.relayEndElement(uri, name, raw);
               }
           }
  -    }
  -
  -    /**
  -     * Check if a string is one of "yes", "true" ignoring case.
  -     * @param aBoolean
  -     * @return true if string is one of "yes", true"
  -     */
  -    private static boolean parseBoolean(String aBoolean) {
  -        return "true".equalsIgnoreCase(aBoolean) || "yes".equalsIgnoreCase(aBoolean);
       }
   
       /**
  
  
  
  1.9       +4 -7      cocoon-2.2/src/java/org/apache/cocoon/reading/ImageReader.java
  
  Index: ImageReader.java
  ===================================================================
  RCS file: /home/cvs//cocoon-2.2/src/java/org/apache/cocoon/reading/ImageReader.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ImageReader.java	11 Mar 2004 18:46:25 -0000	1.8
  +++ ImageReader.java	28 Mar 2004 21:49:44 -0000	1.9
  @@ -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;
  @@ -127,18 +128,14 @@
           }
   
           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);
       }
   
       /** 
  
  
  

Mime
View raw message