Bug 824863 - groovy template should not print "null" string when variable is null
Summary: groovy template should not print "null" string when variable is null
Keywords:
Status: VERIFIED
Alias: None
Product: JBoss Enterprise Portal Platform 5
Classification: JBoss
Component: Portal
Version: 5.2.2.ER01
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 5.2.2.ER04
Assignee: Nobody
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-05-24 13:12 UTC by hfnukal@redhat.com
Modified: 2023-06-02 07:29 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
If a GateIn Template file (*.gtmpl) contained an <input> directive that declared a variable as a value, and that variable resolved to null, the word "null" would be substituted for the value instead of the value parameter being present, but undefined. For example, <input class="key" type="text" name="key" value="${key}"/> resolved to <input class="key" type="text" name="key" value="null"/>, instead of <input class="key" type="text" name="key" value/>. The fix corrects the way null values are handled, and now prints undefined parameters, instead of printing null as the parameter value.
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker GTNPORTAL-2373 0 Minor Resolved groovy template should not print "null" string when variable is null 2018-03-22 19:03:22 UTC

Description hfnukal@redhat.com 2012-05-24 13:12:50 UTC
In .gtmpl file, I use: <input class="key" type="text" name="key" value="${key}"/>
And if "key" variable is null, I will get "null" string in input like: <input type="text" name="key" value="null">
I think it should not be, we should print nothing when variable is null, for example: <input type="text" name="key" value>

Comment 1 hfnukal@redhat.com 2012-06-07 15:34:28 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
C: GTMPL template prints null, when key was not definned
C: Non valid string shown on page
R: Use empty string
F: Returning empty string instead of null.

Comment 2 Viliam Rockai 2012-07-10 15:59:57 UTC
xercesImpl-2.9.1-patch-01.jar are now used. any ideas how to check if this version has the right patch in it?

Comment 3 JBoss JIRA Server 2012-07-27 14:44:15 UTC
Boleslaw Dawidowicz <boleslaw.dawidowicz> made a comment on jira GTNPORTAL-2373

Kien is the patch commited in gatein? Could you confirm and resolve?

Comment 4 Trang Vu 2012-07-30 06:56:34 UTC
There is a side effect on EPP-SP 5.2.2-ER02, see https://jira.exoplatform.org/browse/SPUB-191 for the detail.

Comment 5 Michal Vanco 2012-07-30 12:46:25 UTC
Needs be updated based on https://jira.exoplatform.org/browse/SPUB-191

Comment 6 hfnukal@redhat.com 2012-07-30 14:01:26 UTC
Updated Signin.xml in branding script.

Comment 7 JBoss JIRA Server 2012-08-01 03:00:32 UTC
kien nguyen <nguyenanhkien2a> made a comment on jira GTNPORTAL-2373

@Trang Vu: how to verify side effect of https://jira.exoplatform.org/browse/SPUB-191 because the patch has not yet commited on gatein?

Comment 8 JBoss JIRA Server 2012-08-01 03:55:25 UTC
kien nguyen <nguyenanhkien2a> made a comment on jira GTNPORTAL-2373

It seems to the patch had committed on EPP. And now, Groovy engine will render "" instead of "null", so side effect will occur if your javascript is only processing by based on "null" value

Comment 9 Trang Vu 2012-08-14 11:03:26 UTC
Customers whose sites are based on ACME portal template will have to update their Signin.xml manually. We should revert the commit 8713 to avoid such kind of impact.

Comment 10 Jared MORGAN 2012-08-21 04:28:38 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,4 +1 @@
-C: GTMPL template prints null, when key was not definned
+If a GateIn Template file (*.gtmpl) contained an <input> directive that declared a variable as a value, and that variable resolved to null, the word "null" would be substituted for the value instead of the value parameter being present, but undefined. For example, &lt;input class="key" type="text" name="key" value="${key}"/&gt; resolved to &lt;input class="key" type="text" name="key" value="null"/&gt;, instead of &lt;input class="key" type="text" name="key" value/&gt;.  The fix corrects the way null values are handled, and now prints undefined parameters, instead of printing null as the parameter value.-C: Non valid string shown on page
-R: Use empty string
-F: Returning empty string instead of null.

Comment 11 Jared MORGAN 2012-08-21 06:19:09 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-If a GateIn Template file (*.gtmpl) contained an <input> directive that declared a variable as a value, and that variable resolved to null, the word "null" would be substituted for the value instead of the value parameter being present, but undefined. For example, &lt;input class="key" type="text" name="key" value="${key}"/&gt; resolved to &lt;input class="key" type="text" name="key" value="null"/&gt;, instead of &lt;input class="key" type="text" name="key" value/&gt;.  The fix corrects the way null values are handled, and now prints undefined parameters, instead of printing null as the parameter value.+If a GateIn Template file (*.gtmpl) contained an &lt;input&gt; directive that declared a variable as a value, and that variable resolved to null, the word "null" would be substituted for the value instead of the value parameter being present, but undefined. For example, &lt;input class="key" type="text" name="key" value="${key}"/&gt; resolved to &lt;input class="key" type="text" name="key" value="null"/&gt;, instead of &lt;input class="key" type="text" name="key" value/&gt;.  The fix corrects the way null values are handled, and now prints undefined parameters, instead of printing null as the parameter value.

Comment 12 JBoss JIRA Server 2012-09-04 04:19:38 UTC
kien nguyen <nguyenanhkien2a> made a comment on jira GTNPORTAL-2373

Some side effect of https://jira.exoplatform.org/browse/SPUB-191 are resolved and patch was committed in EPP. The patch need to be committed in GateIn

Comment 13 JBoss JIRA Server 2012-09-04 08:06:47 UTC
Vu Viet Phuong <vstorm83> made a comment on jira GTNPORTAL-2373

Backport from https://bugzilla.redhat.com/show_bug.cgi?id=824863

Comment 14 JBoss JIRA Server 2012-10-11 09:40:23 UTC
Trong Tran <trongtt> made a comment on jira GTNPORTAL-2373

printing "null" is an expected behavior from Groovy template engine world. I don't really like to change this default behavior ( And I can see that JSP syntax does the same. )

For me, the proper fix is to check non-NULL value before printing if we don't want to write "null". So I prefer to take "Won't Fix" for this.

WDYT ?

Comment 15 JBoss JIRA Server 2012-10-11 11:44:38 UTC
Trong Tran <trongtt> updated the status of jira GTNPORTAL-2373 to Resolved


Note You need to log in before you can comment on or make changes to this bug.