0 Replies Latest reply on May 15, 2007 5:43 PM by Ben Catherall

    Seam mail does not restore FacesContext properly

    Ben Catherall Newbie

      I noticed that after rendering a Seam mail which failed (email address not entered), redirects - using Redirect.instance() - had the string 'null' stuck on the front of them.

      It turns out to be two problems:

      1) UIMessage does not call MailFacesContextImpl.stop() if an exception is thrown in UIMessage.renderChildren

      Fix:

       @Override
       public void encodeChildren(FacesContext context) throws IOException
       {
       try {
       JSF.renderChildren(FacesContext.getCurrentInstance(), this);
       } catch (Exception e){
       MailFacesContextImpl.stop();
       throw new FacesException(e);
       }
       }
      


      2) MailExternalContextImpl.getRequestContextPath can return null. Further I don't understand the need for this to return anything other than the delegate's context path, as it doesn't appear to be used anywhere.

      Anyhooo... the fix in (1) is all that is required to resume service as normal, mail can do what it likes as long as it gives me back my original FacesContext :)

      Cheers - Ben