You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2011/06/28 10:50:56 UTC

DO NOT REPLY [Bug 51442] New: available task: Deprecated code breaks contract if folder exists

https://issues.apache.org/bugzilla/show_bug.cgi?id=51442

             Bug #: 51442
           Summary: available task: Deprecated code breaks contract if
                    folder exists
           Product: Ant
           Version: unspecified
          Platform: PC
        OS/Version: Windows Server 2003
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: mw-mw@gmx.net
    Classification: Unclassified


<property name="folder" value="some-location" />
.... 

<!-- property 'folder' could be set here - in case not use some default -->
<available file="W:\in\dows" type="dir" property="folder" value="W:\in\dows" />
<available file="/lin/ux"    type="dir" property="folder" value="/lin/ux" />

In case the folder named 'W:\in\dows' does not exist, the code works as
expected. The the value of 'folder' is not modified.

In case the folder named 'W:\in\dows' exists the available task complains about
using a DEPRECATED feature and overwrites the property value of 'folder'. I'd
expected not to modify 'folder' because its value has already been set before.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

DO NOT REPLY [Bug 51442] available task: Deprecated code breaks contract if folder exists

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=51442

Stefan Bodewig <bo...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WONTFIX

--- Comment #1 from Stefan Bodewig <bo...@apache.org> 2011-06-28 10:00:00 UTC ---
Properties used to be mutable in Ant before Ant 1.1 was released (eleven years
ago, I know) and not all tasks had been tidied up to honor the new immutability
rule.  One of them was <available>.

Some people already used Ant before its first release and relied on properties
being mutable - not only did they complain about the change, they also
discovered
the backdoor that was <available> and it was shared as a "workaround" among
users.

Since the Ant developers had by then become very sensitive to backwards
compatibility issues (the mutable -> immutable change did a lot to make
them, errm, us sensitive) the non-regular behavior of <available> was kept
but now created a big deprecation warning.  Many other tasks have been
changed as nobody had discovered they could be used as backdoors as well before
they were fixed.

So much for background, the usual "historical reasons".

In your case, you should wrap the available task into a <condition>
since condition will do the right thing.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.