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 2018/04/19 05:08:18 UTC

[Bug 62313] New: LoadProperties + LineContains filter automatically defaults to AND operation

https://bz.apache.org/bugzilla/show_bug.cgi?id=62313

            Bug ID: 62313
           Summary: LoadProperties + LineContains filter automatically
                    defaults to AND operation
           Product: Ant
           Version: 1.10.3
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks
          Assignee: notifications@ant.apache.org
          Reporter: r17list+apache@gmail.com
  Target Milestone: ---

Created attachment 35883
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=35883&action=edit
sample build script and property file

This is based on the discussion in the Ant User list[1] wherein it is not
immediately apparent in the documentation that specifying multiple LineContains
entries in the FilterChain used in the LoadProperties task meant that all
entries are being searched inclusively.

Instead of relying on LineContainsRegexp filter, can the LineContains filter be
enhanced to support "OR" operations so that users can use something like

      <filterchain>
        <linecontains>
          <contains value="xws.user" />
          <contains value="xws.password" />
          <contains value="wl.user" />
          <contains value="wl.password" />
        </linecontains>

      </filterchain>

instead of 

      <filterchain>
        <linecontainsregexp>
          <regexp pattern=".*w[sl]\.[(user|password)]*" />
        </linecontainsregexp>
      </filterchain>

?

The latter looks elegant but can get pretty complex if there are less
similarities on the properties that the user wants to read in one go. Since
LoadProperties seem to combine all contained filterchains the other feasible
option I can think of is to do sequential load of the same property file with
different contained filterchains which increases the length of the build file.


[1]
https://mail-archives.apache.org/mod_mbox/ant-user/201804.mbox/%3CCAH5zQ53qhVdjmbO1xF-xEd26qhOu5GiwQbXDEVY14JC34k83nQ%40mail.gmail.com%3E

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62313] LoadProperties + LineContains filter automatically defaults to AND operation

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

Erin <r1...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |All

--- Comment #1 from Erin <r1...@gmail.com> ---
The proposed format should have been
      <filterchain>
        <linecontains logic="OR">
          <contains value="xws.user" />
          <contains value="xws.password" />
          <contains value="wl.user" />
          <contains value="wl.password" />
        </linecontains>

      </filterchain>


wherein the  attribute logic (or whatever it will be called) has a default
value of "AND".

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 62313] LoadProperties + LineContains filter automatically defaults to AND operation

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

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |1.10.4

--- Comment #2 from Jaikiran Pai <ja...@apache.org> ---
linecontains has now been enhanced to allow a "matchAny" attribute which when
set to true will match any (instead of all) of the specified strings. By
default the value of this attribute is false which means it will retain the
current behaviour of expecting the line to contains all of the specified
strings.

-- 
You are receiving this mail because:
You are the assignee for the bug.