ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ehatc...@apache.org
Subject cvs commit: jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional PropertyFileTest.java
Date Tue, 28 May 2002 20:44:48 GMT
ehatcher    02/05/28 13:44:48

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional Tag:
                        ANT_15_BRANCH PropertyFile.java
               src/etc/testcases/taskdefs/optional Tag: ANT_15_BRANCH
                        propertyfile.xml
               src/testcases/org/apache/tools/ant/taskdefs/optional Tag:
                        ANT_15_BRANCH PropertyFileTest.java
  Log:
  Fix for issue #8780 - int type with no value now works as expected
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.21.2.1  +9 -7      jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java
  
  Index: PropertyFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.java,v
  retrieving revision 1.21
  retrieving revision 1.21.2.1
  diff -u -r1.21 -r1.21.2.1
  --- PropertyFile.java	15 Apr 2002 14:56:30 -0000	1.21
  +++ PropertyFile.java	28 May 2002 20:44:48 -0000	1.21.2.1
  @@ -437,14 +437,16 @@
                   newValue = currentValue;
               } else {
                   int operationValue = 1;
  -                try {
  -                    operationValue = fmt.parse(value).intValue();
  -                } catch (NumberFormatException nfe) { 
  -                    // swallow
  -                } catch (ParseException pe)  { 
  -                    // swallow
  +                if (value != null) {
  +                    try {
  +                        operationValue = fmt.parse(value).intValue();
  +                    } catch (NumberFormatException nfe) {
  +                        // swallow
  +                    } catch (ParseException pe)  {
  +                        // swallow
  +                    }
                   }
  -                
  +
                   if (operation == Operation.INCREMENT_OPER) {
                       newValue = currentValue + operationValue;
                   } else if (operation == Operation.DECREMENT_OPER) {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.1   +8 -4      jakarta-ant/src/etc/testcases/taskdefs/optional/propertyfile.xml
  
  Index: propertyfile.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/etc/testcases/taskdefs/optional/propertyfile.xml,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- propertyfile.xml	22 Feb 2002 01:53:36 -0000	1.2
  +++ propertyfile.xml	28 May 2002 20:44:48 -0000	1.2.2.1
  @@ -3,14 +3,14 @@
   <project name="propertyfile-test" default="main" basedir=".">
   
      <property file="propertyfile.build.properties"/>
  -   
  +
      <target name="main">
         <fail>
            This file is for testing purposes only...
            @see PropertyFileTest.java for more info.
         </fail>
      </target>
  -   
  +
      <target name="update-existing-properties">
         <propertyfile
             file="${test.propertyfile}"
  @@ -22,9 +22,9 @@
           <entry  key="age"       default="${age}" type="int"/>
           <entry  key="date"      default="${date}" type="date"/>
         </propertyfile>
  -      
  +
      </target>
  -   
  +
      <target name="exercise">
        <propertyfile file="${test.propertyfile}">
           <entry key="existing.prop"
  @@ -43,6 +43,10 @@
           <entry key="int.with.default"
                  value="1"
                  default="2"
  +               operation="+"
  +               type="int"/>
  +        <entry key="int.without.value"
  +               default="5"
                  operation="+"
                  type="int"/>
           <entry key="int.without.default"
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.1   +1 -0      jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java
  
  Index: PropertyFileTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/testcases/org/apache/tools/ant/taskdefs/optional/PropertyFileTest.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- PropertyFileTest.java	22 Feb 2002 09:20:34 -0000	1.5
  +++ PropertyFileTest.java	28 May 2002 20:44:48 -0000	1.5.2.1
  @@ -131,6 +131,7 @@
           assertEquals("2003/01/21", project.getProperty("first.birthday"));
           assertEquals("0124", project.getProperty("olderThanAWeek"));
           assertEquals("37", project.getProperty("existing.prop"));
  +        assertEquals("6",project.getProperty("int.without.value"));
       }
   
   /*
  
  
  

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message