You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Lionel Touati (JIRA)" <de...@tapestry.apache.org> on 2007/06/18 23:10:26 UTC

[jira] Reopened: (TAPESTRY-1556) EventConnectionVisitor is sometimes not wired properly

     [ https://issues.apache.org/jira/browse/TAPESTRY-1556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lionel Touati reopened TAPESTRY-1556:
-------------------------------------


My fix was incomplete. The method should rather be

    void wireElementFormEvents(EventBoundListener listener, IComponent component, IComponentSpecification spec)
    {
        if (listener.getFormId() == null)
            return;

        if (_forms.size() < 1)
            discoverPageForms(component.getPage());

        IForm form = null;
        for (int i=0; i < _forms.size(); i++)
        {
            IForm f = (IForm) _forms.get(i);
            if (listener.getFormId().equals(f.getExtendedId()) || listener.getFormId().equals(f.getId()))
            {
                form = f;
                break;
            }
        }

        // couldn't find the form they specified

       if(form == null) {
            if(listener.getFormId().indexOf('.') != -1)  {
                String tmp = listener.getFormId().substring(listener.getFormId().lastIndexOf('.') + 1);
                listener.setFormId(tmp);
                wireElementFormEvents(listener, component, spec);
                return;
            }  else {
                throw new ApplicationRuntimeException(PageloadMessages.componentNotFound(listener.getFormId()), component, component.getLocation(), null);
            }
        } else  {
            String idPath = form.getExtendedId();
            listener.setFormId(idPath);
            _invoker.addFormEventListener(idPath, spec);
            return;
        }
    }


> EventConnectionVisitor is sometimes not wired properly
> ------------------------------------------------------
>
>                 Key: TAPESTRY-1556
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-1556
>             Project: Tapestry
>          Issue Type: Bug
>    Affects Versions: 4.1.1
>            Reporter: Lionel Touati
>            Assignee: Jesse Kuhnert
>             Fix For: 4.1.2
>
>
> The method wireElementFormEvents is sometimes broken. When comparing listener.getFormId() to f.getId(), get different results. Sometimes the ids for the same page, same component the id match, but after a tomcat restart, the ids won't match as getFormId returns the form extended id rather than the local one.
> I've changed the method to :
>  void wireElementFormEvents(EventBoundListener listener, IComponent component, IComponentSpecification spec)
>     {
>         if (listener.getFormId() == null)
>             return;
>         if (_forms.size() < 1)
>             discoverPageForms(component.getPage());
>         IForm form = null;
>         for (int i=0; i < _forms.size(); i++) {
>             IForm f = (IForm) _forms.get(i);
>             if (listener.getFormId().equals(f.getExtendedId()) || listener.getFormId().equals(f.getId())) {
>                 form = f;
>                 break;
>             }
>         }
>         // couldn't find the form they specified
>         if (form == null)
>             throw new ApplicationRuntimeException(PageloadMessages.componentNotFound(listener.getFormId()), component, component.getLocation(), null);
>         String idPath = form.getExtendedId();
>         
>         listener.setFormId(idPath);
>         _invoker.addFormEventListener(idPath, spec);
>     }

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org