Re: Error message

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Tuesday, September 6, 2011, 12:50:52 PM, Shervin Asgari wrote:

>
>
> On 09/06/2011 11:38 AM, Shervin Asgari wrote:
>>
>> On 09/05/2011 05:15 PM, Daniel Dekany wrote:
>> Well everything was on one line, I auto formated it so it was more
>> readable.
>> That is strange. I don't have a variable called any.
>> I will try only the ${motorferdsel.applicant.epost} part and see what
>> happens.
>> The error message was just a snippet. There are tons more with the same
>> stuff. Some keys work, some don't. Which is pretty strange.
>>
> Alright, I got same behavior with only that line, but I found out 
> something useful. This behavior happens only when the value is null.
>
> my motoferdsel.getApplicant().getEpost() returns null, thus this error:
>
> ${motorferdsel.applicant.epost} escaped 
> ${motorferdsel.applicant.epost?xml?replace("
> ","<text:line-break />")} [on line 4, column 3438 in content.xml]

That's more like it... assuming the error message states that
motorferdsel.applicant.epost was undefined. Is that what it says? (The
in what situation does it say the "any" nonsense?)

> However, when I put something other than null in this object, I don't 
> get any errors.
>
> Is this a bug/feature in Freemarker? Or is it something JODReports / 
> OpenOffice.org doing?

It's a feature... As I said, non-existent variables and null-s count
as undefined values. FreeMarker will not make guess, like something
that's undefined is surely like an empty string or 0 or anything like
that. You have to provide a default explicitly, like
${maybenull!"N/A"} or even ${maybenull!} which is similar to
${maybenull!""}.

> Shervin

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
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.