seade       2003/01/27 17:30:07

  Modified:    src/java/org/apache/turbine/util ValueParser.java
               src/java/org/apache/turbine/util/parser BaseValueParser.java
               xdocs    changes.xml
  Log:
  getInteger(name), getBool(name) and getBigDecimal(name) now return null when the key 
name is not found.
  PR: TRQS122
  
  Revision  Changes    Path
  1.4       +4 -4      
jakarta-turbine-2/src/java/org/apache/turbine/util/ValueParser.java
  
  Index: ValueParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/ValueParser.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ValueParser.java  11 Jan 2003 18:42:35 -0000      1.3
  +++ ValueParser.java  28 Jan 2003 01:30:07 -0000      1.4
  @@ -232,7 +232,7 @@
   
       /**
        * Return a boolean for the given name.  If the name does not
  -     * exist, return false.
  +     * exist, return <code>null</code>.
        *
        * @param name A String with the name.
        * @return A boolean.
  @@ -312,7 +312,7 @@
   
       /**
        * Return a BigDecimal for the given name.  If the name does not
  -     * exist, return 0.0.
  +     * exist, return <code>null</code>.
        *
        * @param name A String with the name.
        * @return A BigDecimal.
  @@ -373,7 +373,7 @@
   
       /**
        * Return an Integer for the given name.  If the name does not
  -     * exist, return 0.
  +     * exist, return <code>null</code>.
        *
        * @param name A String with the name.
        * @return An Integer.
  
  
  
  1.6       +16 -7     
jakarta-turbine-2/src/java/org/apache/turbine/util/parser/BaseValueParser.java
  
  Index: BaseValueParser.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-2/src/java/org/apache/turbine/util/parser/BaseValueParser.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BaseValueParser.java      11 Jul 2002 07:16:43 -0000      1.5
  +++ BaseValueParser.java      28 Jan 2003 01:30:07 -0000      1.6
  @@ -111,6 +111,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jon S. Stevens</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sean Legassick</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Scott Eade</a>
    * @version $Id$
    */
   public class BaseValueParser
  @@ -457,14 +458,18 @@
   
       /**
        * Return a Boolean for the given name.  If the name does not
  -     * exist, return false.
  +     * exist, return <code>null</code>.
        *
        * @param name A String with the name.
        * @return A Boolean.
        */
       public Boolean getBool(String name)
       {
  -        return new Boolean(getBoolean(name, false));
  +        if (containsKey(name))
  +        {
  +            return new Boolean(getBoolean(name));
  +        }
  +        return null;
       }
   
       /**
  @@ -572,14 +577,14 @@
   
       /**
        * Return a BigDecimal for the given name.  If the name does not
  -     * exist, return 0.0.
  +     * exist, return <code>null</code>.
        *
        * @param name A String with the name.
        * @return A BigDecimal.
        */
       public BigDecimal getBigDecimal(String name)
       {
  -        return getBigDecimal(name, new BigDecimal(0.0));
  +        return getBigDecimal(name, null);
       }
   
       /**
  @@ -670,14 +675,18 @@
   
       /**
        * Return an Integer for the given name.  If the name does not
  -     * exist, return 0.
  +     * exist, return <code>null</code>.
        *
        * @param name A String with the name.
        * @return An Integer.
        */
       public Integer getInteger(String name)
       {
  -        return new Integer(getInt(name, 0));
  +        if (containsKey(name))
  +        {
  +            return new Integer(getInt(name));
  +        }
  +        return null;
       }
   
       /**
  
  
  
  1.31      +6 -0      jakarta-turbine-2/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-turbine-2/xdocs/changes.xml,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- changes.xml       22 Jan 2003 22:09:43 -0000      1.30
  +++ changes.xml       28 Jan 2003 01:30:07 -0000      1.31
  @@ -87,6 +87,12 @@
          is deprecated and might be removed later. If you're using the supplied
          services, you shouldn't notice any change.
       </li>
  +    <li>
  +       TTWS38: BaseValueParser.getInteger(String name) now returns null if the 
  +       key name is not found - the old behaviour was to return new Integer(0).
  +       For consistency a similar change was made to getBool() and 
  +       getBigInteger().
  +    </li>
     </ul>
   </p>
   </subsection>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to