You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Andrew Redman (JIRA)" <de...@myfaces.apache.org> on 2007/08/30 19:00:51 UTC

[jira] Created: (MYFACES-1712) FacesListeners get added to components twice causing event to be raised twice.

FacesListeners get added to components twice causing event to be raised twice.
------------------------------------------------------------------------------

                 Key: MYFACES-1712
                 URL: https://issues.apache.org/jira/browse/MYFACES-1712
             Project: MyFaces Core
          Issue Type: Bug
          Components: General
    Affects Versions:  1.2.0
         Environment: Windows XP, Tomcat 6.0, jdk6, MyFaces 1.2.0, Tomahawk 1.1.5
            Reporter: Andrew Redman


On components that have an actionListener set or valueChangeListener, these listeners are added to the component instance twice. At runtime this causes the method to be called with the event twice. For example I have the following component

<h:selectOneMenu id="Applications" onchange="submit()" valueChangeListener="#{EditPage.processApplicationChange}">

my processApplicationChange method is invoke twice.

I have tracked this down the UIComponentELTag and UIComponentClassicTagBase classes. The UIComponentClassicTagBase calls createComponent in the findComponent method and then calls setProperties. However the createComponent method that is implemented in UIComponentELTag also calls setProperties. The setProperties routine is what adds any listeners to a collection. Therefore they get added twice. By removing the setProperties in UIComponentELTag createComponent and leaving it up to the findComponent method fixes the issue. I'm not sure however if this will have other implications although as yet I have found no issues.

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


[jira] Updated: (MYFACES-1712) FacesListeners get added to components twice causing event to be raised twice.

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

Martin Marinschek updated MYFACES-1712:
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.1-SNAPSHOT
         Assignee: Martin Marinschek
           Status: Resolved  (was: Patch Available)

> FacesListeners get added to components twice causing event to be raised twice.
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-1712
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1712
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>         Environment: Windows XP, Tomcat 6.0, jdk6, MyFaces 1.2.0, Tomahawk 1.1.5
>            Reporter: Andrew Redman
>            Assignee: Martin Marinschek
>             Fix For: 1.2.1-SNAPSHOT
>
>
> On components that have an actionListener set or valueChangeListener, these listeners are added to the component instance twice. At runtime this causes the method to be called with the event twice. For example I have the following component
> <h:selectOneMenu id="Applications" onchange="submit()" valueChangeListener="#{EditPage.processApplicationChange}">
> my processApplicationChange method is invoke twice.
> I have tracked this down the UIComponentELTag and UIComponentClassicTagBase classes. The UIComponentClassicTagBase calls createComponent in the findComponent method and then calls setProperties. However the createComponent method that is implemented in UIComponentELTag also calls setProperties. The setProperties routine is what adds any listeners to a collection. Therefore they get added twice. By removing the setProperties in UIComponentELTag createComponent and leaving it up to the findComponent method fixes the issue. I'm not sure however if this will have other implications although as yet I have found no issues.

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


[jira] Reopened: (MYFACES-1712) FacesListeners get added to components twice causing event to be raised twice.

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

Thomas Fischer reopened MYFACES-1712:
-------------------------------------


Although the supplied patch solves the described problem, it violates the contract of UIComponentClassicTagBase.html#createComponent [1]. The spec says, the method should
<quote>
initialize the components id and other properties
</quote>
which it does not.
I'll attach a patch which solve this problem and respects the specs.

[1]http://java.sun.com/javaee/5/docs/api/javax/faces/webapp/UIComponentClassicTagBase.html#createComponent(javax.faces.context.FacesContext,%20java.lang.String)

> FacesListeners get added to components twice causing event to be raised twice.
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-1712
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1712
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>         Environment: Windows XP, Tomcat 6.0, jdk6, MyFaces 1.2.0, Tomahawk 1.1.5
>            Reporter: Andrew Redman
>            Assignee: Martin Marinschek
>             Fix For: 1.2.1-SNAPSHOT
>
>
> On components that have an actionListener set or valueChangeListener, these listeners are added to the component instance twice. At runtime this causes the method to be called with the event twice. For example I have the following component
> <h:selectOneMenu id="Applications" onchange="submit()" valueChangeListener="#{EditPage.processApplicationChange}">
> my processApplicationChange method is invoke twice.
> I have tracked this down the UIComponentELTag and UIComponentClassicTagBase classes. The UIComponentClassicTagBase calls createComponent in the findComponent method and then calls setProperties. However the createComponent method that is implemented in UIComponentELTag also calls setProperties. The setProperties routine is what adds any listeners to a collection. Therefore they get added twice. By removing the setProperties in UIComponentELTag createComponent and leaving it up to the findComponent method fixes the issue. I'm not sure however if this will have other implications although as yet I have found no issues.

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


[jira] Commented: (MYFACES-1712) FacesListeners get added to components twice causing event to be raised twice.

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-1712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12530926 ] 

Martin Marinschek commented on MYFACES-1712:
--------------------------------------------

Here a patch by Bernhard Huemer:

Index: myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/webapp/UIComponentELTag.java
===================================================================
--- myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/webapp/UIComponentELTag.java      (revision 570151)
+++ myfaces/core/branches/1_2_1/api/src/main/java/javax/faces/webapp/UIComponentELTag.java      (working copy)
@@ -97,7 +97,6 @@
        }

        component.setId(newId);
-        setProperties(component);

        return component;
    }

> FacesListeners get added to components twice causing event to be raised twice.
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-1712
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1712
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>         Environment: Windows XP, Tomcat 6.0, jdk6, MyFaces 1.2.0, Tomahawk 1.1.5
>            Reporter: Andrew Redman
>
> On components that have an actionListener set or valueChangeListener, these listeners are added to the component instance twice. At runtime this causes the method to be called with the event twice. For example I have the following component
> <h:selectOneMenu id="Applications" onchange="submit()" valueChangeListener="#{EditPage.processApplicationChange}">
> my processApplicationChange method is invoke twice.
> I have tracked this down the UIComponentELTag and UIComponentClassicTagBase classes. The UIComponentClassicTagBase calls createComponent in the findComponent method and then calls setProperties. However the createComponent method that is implemented in UIComponentELTag also calls setProperties. The setProperties routine is what adds any listeners to a collection. Therefore they get added twice. By removing the setProperties in UIComponentELTag createComponent and leaving it up to the findComponent method fixes the issue. I'm not sure however if this will have other implications although as yet I have found no issues.

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


[jira] Updated: (MYFACES-1712) FacesListeners get added to components twice causing event to be raised twice.

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

Martin Marinschek updated MYFACES-1712:
---------------------------------------

    Status: Patch Available  (was: Open)

> FacesListeners get added to components twice causing event to be raised twice.
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-1712
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1712
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>         Environment: Windows XP, Tomcat 6.0, jdk6, MyFaces 1.2.0, Tomahawk 1.1.5
>            Reporter: Andrew Redman
>
> On components that have an actionListener set or valueChangeListener, these listeners are added to the component instance twice. At runtime this causes the method to be called with the event twice. For example I have the following component
> <h:selectOneMenu id="Applications" onchange="submit()" valueChangeListener="#{EditPage.processApplicationChange}">
> my processApplicationChange method is invoke twice.
> I have tracked this down the UIComponentELTag and UIComponentClassicTagBase classes. The UIComponentClassicTagBase calls createComponent in the findComponent method and then calls setProperties. However the createComponent method that is implemented in UIComponentELTag also calls setProperties. The setProperties routine is what adds any listeners to a collection. Therefore they get added twice. By removing the setProperties in UIComponentELTag createComponent and leaving it up to the findComponent method fixes the issue. I'm not sure however if this will have other implications although as yet I have found no issues.

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


[jira] Updated: (MYFACES-1712) FacesListeners get added to components twice causing event to be raised twice.

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

Martin Marinschek updated MYFACES-1712:
---------------------------------------

    Resolution: Fixed
        Status: Resolved  (was: Patch Available)

Thanks to Thomas Fischer for this fix - and special thanks for reading the spec very carefully. 

We need contributors like you!

regards,

Martin

> FacesListeners get added to components twice causing event to be raised twice.
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-1712
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1712
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>         Environment: Windows XP, Tomcat 6.0, jdk6, MyFaces 1.2.0, Tomahawk 1.1.5
>            Reporter: Andrew Redman
>            Assignee: Martin Marinschek
>             Fix For: 1.2.1-SNAPSHOT
>
>         Attachments: myfaces-1712-patch.txt
>
>
> On components that have an actionListener set or valueChangeListener, these listeners are added to the component instance twice. At runtime this causes the method to be called with the event twice. For example I have the following component
> <h:selectOneMenu id="Applications" onchange="submit()" valueChangeListener="#{EditPage.processApplicationChange}">
> my processApplicationChange method is invoke twice.
> I have tracked this down the UIComponentELTag and UIComponentClassicTagBase classes. The UIComponentClassicTagBase calls createComponent in the findComponent method and then calls setProperties. However the createComponent method that is implemented in UIComponentELTag also calls setProperties. The setProperties routine is what adds any listeners to a collection. Therefore they get added twice. By removing the setProperties in UIComponentELTag createComponent and leaving it up to the findComponent method fixes the issue. I'm not sure however if this will have other implications although as yet I have found no issues.

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


[jira] Updated: (MYFACES-1712) FacesListeners get added to components twice causing event to be raised twice.

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

Thomas Fischer updated MYFACES-1712:
------------------------------------

    Status: Patch Available  (was: Reopened)

> FacesListeners get added to components twice causing event to be raised twice.
> ------------------------------------------------------------------------------
>
>                 Key: MYFACES-1712
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1712
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General
>    Affects Versions:  1.2.0
>         Environment: Windows XP, Tomcat 6.0, jdk6, MyFaces 1.2.0, Tomahawk 1.1.5
>            Reporter: Andrew Redman
>            Assignee: Martin Marinschek
>             Fix For: 1.2.1-SNAPSHOT
>
>         Attachments: myfaces-1712-patch.txt
>
>
> On components that have an actionListener set or valueChangeListener, these listeners are added to the component instance twice. At runtime this causes the method to be called with the event twice. For example I have the following component
> <h:selectOneMenu id="Applications" onchange="submit()" valueChangeListener="#{EditPage.processApplicationChange}">
> my processApplicationChange method is invoke twice.
> I have tracked this down the UIComponentELTag and UIComponentClassicTagBase classes. The UIComponentClassicTagBase calls createComponent in the findComponent method and then calls setProperties. However the createComponent method that is implemented in UIComponentELTag also calls setProperties. The setProperties routine is what adds any listeners to a collection. Therefore they get added twice. By removing the setProperties in UIComponentELTag createComponent and leaving it up to the findComponent method fixes the issue. I'm not sure however if this will have other implications although as yet I have found no issues.

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