Maven 1.x SCM Plugin

Avoid use of jelly empty operator

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.5
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    1

Description

Teh empty operator seems broken, avoid it's use

Activity

Hide
Brett Porter added a comment -

can you elaborate, perhaps with a test case that is broken?

Show
Brett Porter added a comment - can you elaborate, perhaps with a test case that is broken?
Hide
Brett Porter added a comment -

from the dev list:

<j:if test="${context.getVariable('test') == ''}">
<!-- test is empty -->
<j:if test="${!empty(context.getVariable('test'))}">
<echo>ERROR1</echo>
</j:if>
</j:if>
<j:if test="${context.getVariable('test') == null}">
<!-- test is empty -->
<j:if test="${!empty(context.getVariable('test'))}">
<echo>ERROR2</echo>
</j:if>
</j:if>

and run maven without parameters or with "-Dtest=" I get ERROR2 and ERROR1 respectively.

Show
Brett Porter added a comment - from the dev list: <j:if test="${context.getVariable('test') == ''}"> <!-- test is empty --> <j:if test="${!empty(context.getVariable('test'))}"> <echo>ERROR1</echo> </j:if> </j:if> <j:if test="${context.getVariable('test') == null}"> <!-- test is empty --> <j:if test="${!empty(context.getVariable('test'))}"> <echo>ERROR2</echo> </j:if> </j:if> and run maven without parameters or with "-Dtest=" I get ERROR2 and ERROR1 respectively.
Hide
Brett Porter added a comment -

empty doesn't recognise null.
In the branch version, empty is always used on a variable coming from j:set which is not null (null vars are set to "")

Show
Brett Porter added a comment - empty doesn't recognise null. In the branch version, empty is always used on a variable coming from j:set which is not null (null vars are set to "")
Hide
dion gillard added a comment -

empty should handle null. from jexl:

Object o = sn.value(jc);

if (o == null)
return Boolean.TRUE;

And there's a test in JEXL 1.0 for empty with null.

Can you help me pinpoint why this isn't working?

Show
dion gillard added a comment - empty should handle null. from jexl: Object o = sn.value(jc); if (o == null) return Boolean.TRUE; And there's a test in JEXL 1.0 for empty with null. Can you help me pinpoint why this isn't working?
Hide
Brett Porter added a comment -

if htat's the case, it's probably fixed for Maven 1.1 then.

Show
Brett Porter added a comment - if htat's the case, it's probably fixed for Maven 1.1 then.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: