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/forms/java/org/apache/cocoon/forms/util DomHelper.java
Date Sun, 28 Mar 2004 21:29:37 GMT
antonio     2004/03/28 13:29:37

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/util
                        DomHelper.java
               src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/types
                        Attribute.java
               src/blocks/forms/java/org/apache/cocoon/forms/util
                        DomHelper.java
  Log:
  Fixing error
  
  Revision  Changes    Path
  1.19      +15 -5     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.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- DomHelper.java	28 Mar 2004 20:51:24 -0000	1.18
  +++ DomHelper.java	28 Mar 2004 21:29:37 -0000	1.19
  @@ -249,16 +249,26 @@
       public static boolean getAttributeAsBoolean(Element element, 
                   String attributeName, boolean defaultValue) {
           String attrValue = element.getAttribute(attributeName);
  -        Boolean result = BooleanUtils.toBooleanObject(attrValue, "true", "false", null);
  -        if (result == null) {
  +        Boolean result;
  +        try {
  +            result = BooleanUtils.toBooleanObject(attrValue, "true", "false", null);
  +        } catch (IllegalArgumentException iae) {
  +            result = null;
  +        }
  +        if (result != null) {
  +            return result.booleanValue();
  +        }
  +        try {
               result = BooleanUtils.toBooleanObject(attrValue, "yes", "no", null);
  +        } catch (IllegalArgumentException iae) {
  +            result = null;
           }
           if (result != null) {
               return result.booleanValue();
  -        } else {
  -            return defaultValue;
           }
  +        return defaultValue;    
       }
  +
       public static String getElementText(Element element) {
           StringBuffer value = new StringBuffer();
           NodeList nodeList = element.getChildNodes();
  
  
  
  1.6       +11 -3     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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Attribute.java	28 Mar 2004 20:51:24 -0000	1.5
  +++ Attribute.java	28 Mar 2004 21:29:37 -0000	1.6
  @@ -136,12 +136,20 @@
               return rvalue.booleanValue();
           }
           // Lets try with "t", "f"
  -        rvalue = BooleanUtils.toBooleanObject(_value, "t", "f", null);
  +        try {
  +            rvalue = BooleanUtils.toBooleanObject(_value, "t", "f", null);
  +        } catch (IllegalArgumentException iae) {
  +            rvalue = null;
  +        }
           if (rvalue != null) {
               return rvalue.booleanValue();
           }
           // Try now "y", "n"
  -        rvalue = BooleanUtils.toBooleanObject(_value, "y", "n", null);
  +        try {
  +            rvalue = BooleanUtils.toBooleanObject(_value, "y", "n", null);
  +        } catch (IllegalArgumentException iae) {
  +            rvalue = null;
  +        }
           if (rvalue != null) {
               return rvalue.booleanValue();
           } else {
  
  
  
  1.4       +13 -4     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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DomHelper.java	28 Mar 2004 20:51:24 -0000	1.3
  +++ DomHelper.java	28 Mar 2004 21:29:37 -0000	1.4
  @@ -249,15 +249,24 @@
       public static boolean getAttributeAsBoolean(Element element, 
                   String attributeName, boolean defaultValue) {
           String attrValue = element.getAttribute(attributeName);
  -        Boolean result = BooleanUtils.toBooleanObject(attrValue, "true", "false", null);
  +        Boolean result;
  +        try {
  +            result = BooleanUtils.toBooleanObject(attrValue, "true", "false", null);
  +        } catch (IllegalArgumentException iae) {
  +            result = null;
  +        }
           if (result != null) {
               return result.booleanValue();
           }
  -        result = BooleanUtils.toBooleanObject(attrValue, "yes", "no", null);
  +        try {
  +            result = BooleanUtils.toBooleanObject(attrValue, "yes", "no", null);
  +        } catch (IllegalArgumentException iae) {
  +            result = null;
  +        }
           if (result != null) {
               return result.booleanValue();
           }
  -        return defaultValue;
  +        return defaultValue;    
       }
   
       public static String getElementText(Element element) {
  
  
  

Mime
View raw message