Re: 2.14pre1 null values as default parameter of macro

"Jonathan Revusky" <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On Tue, Dec 23, 2008 at 11:51 PM, Jonathan Revusky <[email protected]> wrote:
> Hi,
>
> Just offhand, I think you should be able to specify null as the
> default parameter for a macro. So, this must be a bug in the 2.4pre1
> release.
>
> However, I just checked this against the latest code from SVN and it
> seems to work as you want it to work. For example, the following
> template:
> ---
> [#macro foo bar=null]
>   [#if bar?is_null] baz [/#if]
> [/#macro]
>
> [@foo/]
> ---
>
> outputs:
>
>   baz
>
> So, basically, if you just do:
>
>  svn co https://freemarker.svn.sourceforge.net/svnroot/freemarker/trunk/freemarker:
>  co freemarker

The above line should of course be:

cd freemarker

And, by the way, thanks for the feedback. We'll appreciate any
feedback from using the 2.4 codebase.

Regards,

JR


>  ant
> from the command line, you will have a freemarker.jar that behaves as you want.
>
> JR
>
> On Tue, Dec 23, 2008 at 7:50 PM, Florian Falkner
> <[email protected]> wrote:
>> Hello!
>>
>> We're are running an application with an ancient prerelease of freemarker 2.4 (namely freemarker2.4.0_090807svn.jar). So far it really works well.
>>
>> Today I tried to upgrade the application to freemarker-2.4pre1.jar and now the following construct doesn't work anymore:
>>
>> [#macro mainLayout layout=null]
>>        <!--html here -->
>>        [#if layout??]
>>                ${layout}
>>        [/#if]
>>        <!--html also here-->
>> [/#macro]
>>
>> Exception is:
>>
>> freemarker.core.InvalidReferenceException: Expression null is undefined on line 71, column 27 in ilbi/admin/admin.ftl.
>>        at freemarker.core.helpers.DefaultReferenceChecker.assertNonNull(DefaultReferenceChecker.java:18)
>>
>> Is this the desired behaviour for 2.4? If so I'll update my parameter specifications.
>>
>> thanks,
>> Florian
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> FreeMarker-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/freemarker-user
>>
>

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.