ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Erik Hatcher" <jakarta-...@ehatchersolutions.com>
Subject Re: cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional PropertyFile.java
Date Tue, 19 Feb 2002 03:45:30 GMT
Ok!  I'm working on this.... there are too many strange logic issues going
on so I'm refactoring at least to isolate the weirdnesses to a single
method.


----- Original Message -----
From: <holtdl@apache.org>
To: <jakarta-ant-cvs@apache.org>
Sent: Monday, February 18, 2002 10:26 PM
Subject: cvs commit:
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional
PropertyFile.java


> holtdl      02/02/18 19:26:30
>
>   Modified:    src/main/org/apache/tools/ant/taskdefs/optional
>                         PropertyFile.java
>   Log:
>   Only use "value" in reference to the 'value' attr; use "oldIntValue" for
>   the old value from the prop file (0, if none); fix the comments as well.
>   (Oh right, and fix the damn copyright!)
>
>   Revision  Changes    Path
>   1.14      +21 -21
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/PropertyFile.jav
a
>
>   Index: PropertyFile.java
>   ===================================================================
>   RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/Proper
tyFile.java,v
>   retrieving revision 1.13
>   retrieving revision 1.14
>   diff -u -r1.13 -r1.14
>   --- PropertyFile.java 19 Feb 2002 02:52:54 -0000 1.13
>   +++ PropertyFile.java 19 Feb 2002 03:26:30 -0000 1.14
>   @@ -1,7 +1,7 @@
>    /*
>     * The Apache Software License, Version 1.1
>     *
>   - * Copyright (c) 2000-2001 The Apache Software Foundation.  All rights
>   + * Copyright (c) 2000-2002 The Apache Software Foundation.  All rights
>     * reserved.
>     *
>     * Redistribution and use in source and binary forms, with or without
>   @@ -516,9 +516,9 @@
>            */
>            private void executeInteger(String oldValue) throws
BuildException
>            {
>   -            int value = 0;
>   -            int newValue  = 0;
>   -            int oldIntValue  = 0;
>   +            int value = 0;          // the value given in the 'value'
attr
>   +            int newValue  = 0;      // the new value, after the
operation
>   +            int oldIntValue  = 0;   // the old value from the prop file
>
>                DecimalFormat fmt = (m_pattern != null) ? new
DecimalFormat(m_pattern)
>                                                        : new
DecimalFormat();
>   @@ -526,7 +526,6 @@
>                if (oldValue != null) {
>                    try {
>                        oldIntValue = fmt.parse(oldValue).intValue();
>   -                    value = fmt.parse(oldValue).intValue();
>                    }
>                    catch (NumberFormatException nfe) { /* swollow */ }
>                    catch (ParseException pe)  { /* swollow */ }
>   @@ -540,36 +539,37 @@
>                }
>                if (m_default != null && oldValue == null) {
>                    try {
>   -                    value = fmt.parse(m_default).intValue();
>   +                    oldIntValue = fmt.parse(m_default).intValue();
>                    }
>                    catch (NumberFormatException nfe) { /* swollow */ }
>                    catch (ParseException pe)  { /* swollow */ }
>                }
>
>                if (m_operation == Operation.EQUALS_OPER) {
>   -                newValue = value;
>   +                newValue = oldIntValue;
>                }
>                else if (m_operation == Operation.INCREMENT_OPER) {
>   -                if (this.m_value == "") {
>   -                    // No value attr was given, so just increment
"value"
>   -                    // (which is the old value from the prop file, 0 by
>   -                    // assignment above, if none) by 1.
>   -                    newValue = ++value;
>   +                if (m_value == "") {
>   +                    // No value attr was given, so just increment the
>   +                    // old value from the prop file (0 by assignment
above,
>   +                    // if none).
>   +                    newValue = ++oldIntValue;
>                    } else {
>   -                    // A value attr was given, so add it to "value",
which
>   -                    // is the old value from the prop file (0, if
none).
>   +                    // A value attr was given, so add the old value
from
>   +                    // the prop file (0, if none) to the specified
value.
>                        newValue = (oldIntValue + value) ;
>                    }
>                }
>                else if (m_operation == Operation.DECREMENT_OPER) {
>   -                if (this.m_value == "") {
>   -                    // No value attr was given, so just decrement
"value"
>   -                    // (which is the old value from the prop file, 0 by
>   -                    // assignment above, if none) by 1.
>   -                    newValue = --value;
>   +                if (m_value == "") {
>   +                    // No value attr was given, so just decrement the
>   +                    // old value from the prop file (0 by assignment
above,
>   +                    // if none).
>   +                    newValue = --oldIntValue;
>                    } else {
>   -                    // A value attr was given, so subtract from it
"value",
>   -                    // which is the old value from the prop file (0, if
none).
>   +                    // A value attr was given, so subtract from the
>   +                    // old value from the prop file (0, if none) the
>   +                    // specified value.
>                        newValue = (oldIntValue - value);
>                    }
>                }
>
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>
>
>


--
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