Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Is anyone else having issues with boolean parameters in user macros not working?

Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2016

I have come across a bug in the more recent versions of Confluence ( 5.5.1, 5.6.5, 5.7.3, 5.9.4. 5.9.5), where Boolean parameters always evaluate as true when used in user macros (or the user-macro module for plugins).

Is anyone else having this issue, or needing this functionality? If so, please vote for this bug: https://jira.atlassian.com/browse/CONF-40831

1 answer

1 accepted

1 vote
Answer accepted
Davin Studer
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2016

I do it this way to avoid issues.

## @param bool:title=Test|type=boolean|desc=Test|default=false
#if ($parambool == true)
    true
#end
#if ($parambool == false)
    false
#end
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 4, 2016

Yeah, I just discovered that earlier today when trying to find a workaround. Booleans in user macros were actually evaluating as true/null in earlier versions, but now evaluate as true/false. So the classic construct used below (which should work per Velocity docs), is actually only testing not_null/null:

## @param debug:title=Debug Mode|type=boolean|default=false
 
## Print default set
#if($paramdebug)
BOOLEAN VARIABLE IS TRUE 
#end
#if(!$paramdebug)
BOOLEAN VARIABLE IS FALSE
#end

So the result is that it worked in early versions, but now always evaluates as not_null.

So I am going to rewrite my macros using the explicit syntax you suggested.

Thanks

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events