You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Michael Heinen (JIRA)" <de...@myfaces.apache.org> on 2010/02/26 13:54:28 UTC

[jira] Created: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

HtmlMessageRenderer evaluates value expressions of not rendered components
--------------------------------------------------------------------------

                 Key: TOMAHAWK-1494
                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Message(s)
    Affects Versions: 1.1.9
         Environment: tomahawk12_1.1.9, 
myfaces 1.2.8,
richfaces 3.3.3
jsp
            Reporter: Michael Heinen
            Priority: Critical


I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!

Sample content:
<t:div rendered="false">
  <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
  <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
</t:div>

Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false

proposed fix:
  if (root.isRendered()) 
should be added to method createOutputLabelMap.
Components should not be checked recursively if the root is not rendered at all.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

Posted by "Michael Heinen (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862123#action_12862123 ] 

Michael Heinen commented on TOMAHAWK-1494:
------------------------------------------

Leonardo, this sounds even better to me. Perfect.
Moreover this should also improve performance a little bit in cases of many outputLabels because the ValueExpressions are not evaluated if not needed.

Thumbs up ;-)

> HtmlMessageRenderer evaluates value expressions of not rendered components
> --------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1494
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.9
>         Environment: tomahawk12_1.1.9, 
> myfaces 1.2.8,
> richfaces 3.3.3
> jsp
>            Reporter: Michael Heinen
>            Assignee: Leonardo Uribe
>            Priority: Critical
>
> I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
> Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
> This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!
> Sample content:
> <t:div rendered="false">
>   <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
>   <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
> </t:div>
> Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false
> proposed fix:
>   if (root.isRendered()) 
> should be added to method createOutputLabelMap.
> Components should not be checked recursively if the root is not rendered at all.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862122#action_12862122 ] 

Leonardo Uribe commented on TOMAHAWK-1494:
------------------------------------------

One alternative I'm thinking is try to detect if ValueExpression instances are used by HtmlOutputLabel instances and save them on the map instead evaluate them when the map is build. Then, we only evaluate them "on demand". It will require some work but I think it is worth. What do you think?

> HtmlMessageRenderer evaluates value expressions of not rendered components
> --------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1494
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.9
>         Environment: tomahawk12_1.1.9, 
> myfaces 1.2.8,
> richfaces 3.3.3
> jsp
>            Reporter: Michael Heinen
>            Assignee: Leonardo Uribe
>            Priority: Critical
>
> I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
> Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
> This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!
> Sample content:
> <t:div rendered="false">
>   <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
>   <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
> </t:div>
> Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false
> proposed fix:
>   if (root.isRendered()) 
> should be added to method createOutputLabelMap.
> Components should not be checked recursively if the root is not rendered at all.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

Posted by "Michael Heinen (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862119#action_12862119 ] 

Michael Heinen commented on TOMAHAWK-1494:
------------------------------------------

Leonardo, I am of course not happy with closing this as invalid and I don't understand your scepticism. Every change in every class could lead to inconsistencies.
Why should someone need a message for an inner component if the parent is not rendered at all? In this case the component is also not rendered.

The current behavior is unpredictable for everyone in my eyes.
Developers must be aware of that simple messages could lead to initializations of not rendered components. This may not only have impact on performance if managed beans are initialized with a lot of state which shouldn't be initialized. 
This means furthermore that an app behaves in an other way if beans are initialized that way.

It is no alternative to add all rendered checks of all parents of an outputLabel to the label again, or? This is not maintainable.

What about adding a new boolean property to the messages tag, whether not rendered components should be evaluated?
The old behavior would be ensured and this bug could also be avoided.

> HtmlMessageRenderer evaluates value expressions of not rendered components
> --------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1494
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.9
>         Environment: tomahawk12_1.1.9, 
> myfaces 1.2.8,
> richfaces 3.3.3
> jsp
>            Reporter: Michael Heinen
>            Assignee: Leonardo Uribe
>            Priority: Critical
>
> I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
> Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
> This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!
> Sample content:
> <t:div rendered="false">
>   <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
>   <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
> </t:div>
> Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false
> proposed fix:
>   if (root.isRendered()) 
> should be added to method createOutputLabelMap.
> Components should not be checked recursively if the root is not rendered at all.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862962#action_12862962 ] 

Leonardo Uribe commented on TOMAHAWK-1494:
------------------------------------------

I have attached a patch of this one. If no objections I'll commit this patch soon.

> HtmlMessageRenderer evaluates value expressions of not rendered components
> --------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1494
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.9
>         Environment: tomahawk12_1.1.9, 
> myfaces 1.2.8,
> richfaces 3.3.3
> jsp
>            Reporter: Michael Heinen
>            Assignee: Leonardo Uribe
>            Priority: Critical
>         Attachments: TOMAHAWK-1494.patch
>
>
> I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
> Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
> This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!
> Sample content:
> <t:div rendered="false">
>   <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
>   <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
> </t:div>
> Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false
> proposed fix:
>   if (root.isRendered()) 
> should be added to method createOutputLabelMap.
> Components should not be checked recursively if the root is not rendered at all.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

Posted by "Michael Heinen (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12838857#action_12838857 ] 

Michael Heinen commented on TOMAHAWK-1494:
------------------------------------------

exact class is org.apache.myfaces.renderkit.html.ext.HtmlMessageRenderer

> HtmlMessageRenderer evaluates value expressions of not rendered components
> --------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1494
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.9
>         Environment: tomahawk12_1.1.9, 
> myfaces 1.2.8,
> richfaces 3.3.3
> jsp
>            Reporter: Michael Heinen
>            Priority: Critical
>
> I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
> Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
> This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!
> Sample content:
> <t:div rendered="false">
>   <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
>   <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
> </t:div>
> Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false
> proposed fix:
>   if (root.isRendered()) 
> should be added to method createOutputLabelMap.
> Components should not be checked recursively if the root is not rendered at all.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TOMAHAWK-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe updated TOMAHAWK-1494:
-------------------------------------

    Status: Patch Available  (was: Open)

> HtmlMessageRenderer evaluates value expressions of not rendered components
> --------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1494
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.9
>         Environment: tomahawk12_1.1.9, 
> myfaces 1.2.8,
> richfaces 3.3.3
> jsp
>            Reporter: Michael Heinen
>            Assignee: Leonardo Uribe
>            Priority: Critical
>         Attachments: TOMAHAWK-1494.patch
>
>
> I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
> Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
> This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!
> Sample content:
> <t:div rendered="false">
>   <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
>   <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
> </t:div>
> Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false
> proposed fix:
>   if (root.isRendered()) 
> should be added to method createOutputLabelMap.
> Components should not be checked recursively if the root is not rendered at all.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/TOMAHAWK-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe updated TOMAHAWK-1494:
-------------------------------------

           Status: Resolved  (was: Patch Available)
    Fix Version/s: 1.1.10-SNAPSHOT
       Resolution: Fixed

> HtmlMessageRenderer evaluates value expressions of not rendered components
> --------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1494
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.9
>         Environment: tomahawk12_1.1.9, 
> myfaces 1.2.8,
> richfaces 3.3.3
> jsp
>            Reporter: Michael Heinen
>            Assignee: Leonardo Uribe
>            Priority: Critical
>             Fix For: 1.1.10-SNAPSHOT
>
>         Attachments: TOMAHAWK-1494.patch
>
>
> I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
> Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
> This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!
> Sample content:
> <t:div rendered="false">
>   <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
>   <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
> </t:div>
> Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false
> proposed fix:
>   if (root.isRendered()) 
> should be added to method createOutputLabelMap.
> Components should not be checked recursively if the root is not rendered at all.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (TOMAHAWK-1494) HtmlMessageRenderer evaluates value expressions of not rendered components

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/TOMAHAWK-1494?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12862080#action_12862080 ] 

Leonardo Uribe commented on TOMAHAWK-1494:
------------------------------------------

Change HtmlMessageRenderer could lead to inconsistencies. Suppose the parent t:div renderer property is tied to a value expression and by some reason a message is output for the inner components. Since they are skipped, the id will not be correctly replaced. It is preferred to keep things as is to introduce this inconsistency.

If no objections, I'll close this issue as invalid.

> HtmlMessageRenderer evaluates value expressions of not rendered components
> --------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1494
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1494
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>          Components: Message(s)
>    Affects Versions: 1.1.9
>         Environment: tomahawk12_1.1.9, 
> myfaces 1.2.8,
> richfaces 3.3.3
> jsp
>            Reporter: Michael Heinen
>            Priority: Critical
>
> I produced a validation error in an inputText field. This field ha a corresponding outputLabel component.
> Now HtmlMessageRenderer creates a Map with all inputLabels, even if they are not rendered at all.
> This can result in exceptions because the value attribute of not rendered and not initialized components is evaluated!
> Sample content:
> <t:div rendered="false">
>   <t:outputLabel id="abcabcLbl"  for="abcabc" value="#{MyController.testme} "/>
>   <t:inputText id="abcabc" value="#{requestScope['test222']}"/>
> </t:div>
> Method MyController.getTestme() is called if messages are rendered although the parent div component has attribute rendered=false
> proposed fix:
>   if (root.isRendered()) 
> should be added to method createOutputLabelMap.
> Components should not be checked recursively if the root is not rendered at all.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.