0 Replies Latest reply on Dec 8, 2009 9:49 AM by trossmy

    Exception handling render response phase

    trossmy

      I'm a bit confused concerning exception handling in seam.The documentation states that:




      It is important to note that Seam cannot handle exceptions that occur during JSFs RENDER_RESPONSE
      phase, as it is not possible to perform a redirect once the response has started being written to





      Now we got the following situation: On a page we have an h:inputText component with an associated rich:suggestionBox like this:
                            


                            <h:inputText id="contractNo" value="#{accountHistoryAction.contractNo}"/>
                             <rich:suggestionbox for="contractNo" minChars="4" 
                                                  suggestionAction="#{accountHistoryAction.getHistoryContractSuggestions}"
                                                  var="contractNo" height="100" width="150">
                                  <h:column>
                                      <h:outputText value="#{contractNo}"/>
                                  </h:column>
                              </rich:suggestionbox>     




      If a user types the input and submits the form very fast, it leads to following exception:





      08.12.2009 09:08:24 com.sun.faces.lifecycle.LifecycleImpl phase
      WARNUNG: executePhase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@10d5c0c) threw exception
      
      javax.el.PropertyNotFoundException: /jspx/accountHistory/accountHistoryForm.jspx @20,87 
      suggestionAction="#{accountHistoryAction.getHistoryContractSuggestions}": Target Unreachable, 
      identifier 'accountHistoryAction' resolved to null



      and since we have a wildcard exception-handling configured in pages.xml




         <exception class="java.lang.Exception">
              <end-conversation/>
              <redirect view-id="/jspx/error/error.jspx"/>
          </exception>



      the error view is rendered. But since the exception happened in the render response phase, it shouldn't have been handled at all, right?


      If I come up with this (not at all sincere) workaround


         


         <exception class="javax.el.PropertyNotFoundException" >
              <http-error error-code="200"/>
          </exception>



      the exception is swallowed as intended.


      But since we don't want all javax.el.PropertyNotFoundException to be swallowed, what would be the correct approach?