ICEfaces
  1. ICEfaces
  2. ICE-1133

Unchecked exceptions are eaten by Blocking Servlet and bypass declarative exception handling rules

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.5.1
    • Fix Version/s: 1.6DR#6, 1.6
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: PC

      Description

      Not sure if the Servlet exception handling rules are still supposed to apply in
      JSF, but setting the following in web.xml doesn't have any effect in ICEfaces as
      exceptions are eaten:

      <error-page>
      <exception-type>java.lang.IllegalArgumentException</exception-type>
      <location>/error.jsp</location>
      </error-page>

      Several people in the forum
      (http://www.icefaces.org/JForum/posts/list/0/2893.page#15494) have requested
      some solution for a global error handling mechanism in ICEfaces.

        Issue Links

          Activity

          Philip Breau created issue -
          Hide
          Ken Fyten added a comment -

          Raised priority based on Philip's input.

          Show
          Ken Fyten added a comment - Raised priority based on Philip's input.
          Hide
          Ted Goddard added a comment -

          Some aspects of this may be fixed by ICE-1010. In general, however, errors during ICEfaces processing
          occur too late for the standard web.xml error-page to take effect (i.e. the HTTP header has already been
          modified).

          Show
          Ted Goddard added a comment - Some aspects of this may be fixed by ICE-1010 . In general, however, errors during ICEfaces processing occur too late for the standard web.xml error-page to take effect (i.e. the HTTP header has already been modified).
          Hide
          Ted Goddard added a comment -

          Accommodating generic error pages is difficult as described above. Recommend that we re-target this to
          1.6 or close as wontfix.

          Show
          Ted Goddard added a comment - Accommodating generic error pages is difficult as described above. Recommend that we re-target this to 1.6 or close as wontfix.
          Icefaces Administrator made changes -
          Field Original Value New Value
          issue.field.bugzillaimportkey 1177 12402
          Ken Fyten made changes -
          Priority Major [ 3 ] Critical [ 2 ]
          Ken Fyten made changes -
          Fix Version/s 1.6 [ 10031 ]
          Ken Fyten made changes -
          Assignee Ted Goddard [ ted.goddard ]
          Hide
          Patrick Corless added a comment -

          This used to work out of the box with 1.5 and several of our professional service application use this technique as well as the webmail project. If memory serves me correctly JSF handled the error page handling correctly once exception handling was improved in ICEfaces prior to the 1.5 release.

          I just did some testing with 1.5.3 and 1.6 dr 5 and had no problems getting the error handling to work. There are however a few quirks which I'm assuming are do the AJAX bridge. If your loading a page for the first time and an application initialization or component error occurs the error page will be shown as expected. However if an error is thrown via a bean accessor method or event, then the connection monitor will just spin away. A full page refresh will cause the error redirect to occur as normal.

          The preferred behavior would be for the bridge to respect the the error-page rules defined in the web.xml without having to refresh the page.

          Show
          Patrick Corless added a comment - This used to work out of the box with 1.5 and several of our professional service application use this technique as well as the webmail project. If memory serves me correctly JSF handled the error page handling correctly once exception handling was improved in ICEfaces prior to the 1.5 release. I just did some testing with 1.5.3 and 1.6 dr 5 and had no problems getting the error handling to work. There are however a few quirks which I'm assuming are do the AJAX bridge. If your loading a page for the first time and an application initialization or component error occurs the error page will be shown as expected. However if an error is thrown via a bean accessor method or event, then the connection monitor will just spin away. A full page refresh will cause the error redirect to occur as normal. The preferred behavior would be for the bridge to respect the the error-page rules defined in the web.xml without having to refresh the page.
          Hide
          Patrick Corless added a comment -

          Here is a simple web.xml snippet which will catch some commen application errors and forward a user to a friendly error page.

          This code can be added to any application to test the current error handling behavior, assuming error.html is created.

          <!-- All errors should jump back to the login screen -->
          <error-page>
          <exception-type>java.lang.ClassNotFoundException</exception-type>
          <location>/error.html</location>
          </error-page>
          <error-page>
          <exception-type>javax.servlet.jsp.JspException</exception-type>
          <location>/error.html</location>
          </error-page>
          <error-page>
          <exception-type>java.lang.NullPointerException</exception-type>
          <location>/error.html</location>
          </error-page>
          <error-page>
          <exception-type>javax.faces.FacesException</exception-type>
          <location>/error.html</location>
          </error-page>
          <error-page>
          <error-code>500</error-code>
          <location>/error.html</location>
          </error-page>

          Show
          Patrick Corless added a comment - Here is a simple web.xml snippet which will catch some commen application errors and forward a user to a friendly error page. This code can be added to any application to test the current error handling behavior, assuming error.html is created. <!-- All errors should jump back to the login screen --> <error-page> <exception-type>java.lang.ClassNotFoundException</exception-type> <location>/error.html</location> </error-page> <error-page> <exception-type>javax.servlet.jsp.JspException</exception-type> <location>/error.html</location> </error-page> <error-page> <exception-type>java.lang.NullPointerException</exception-type> <location>/error.html</location> </error-page> <error-page> <exception-type>javax.faces.FacesException</exception-type> <location>/error.html</location> </error-page> <error-page> <error-code>500</error-code> <location>/error.html</location> </error-page>
          Hide
          Patrick Corless added a comment -

          Mircea can you take a look at this. If you have any question please swing by.

          Show
          Patrick Corless added a comment - Mircea can you take a look at this. If you have any question please swing by.
          Patrick Corless made changes -
          Assignee Mircea Toma [ mircea.toma ]
          Hide
          Mircea Toma added a comment -

          The solution for this issue would be to also interpret HTTP standard messages (such as 404, 500 or 302) for the XMLHTTPRequest responses (right now the responses expect XML (UTF-8) valid bodies).

          Show
          Mircea Toma added a comment - The solution for this issue would be to also interpret HTTP standard messages (such as 404, 500 or 302) for the XMLHTTPRequest responses (right now the responses expect XML (UTF-8) valid bodies).
          Mircea Toma made changes -
          Fix Version/s 1.6 [ 10031 ]
          Philip Breau made changes -
          Support Case References https://www.icesoft.ca:4443/supportilla/show_bug.cgi?id=4077
          Support Customer Ref. #s 738
          Ken Fyten made changes -
          Assignee Priority P1
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #14021 Wed May 30 17:13:47 MDT 2007 mircea.toma Handle HTTP 500 errors -- ICE-1133.
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/ViewBoundAdaptingServlet.java
          Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/connection.async.js
          Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/connection.js
          Commit graph MODIFY /icefaces/trunk/icefaces/bridge/src/application.js
          Commit graph MODIFY /icefaces/trunk/icefaces/bridge/lib/ajax.js
          Hide
          Mircea Toma added a comment -

          Handle HTTP 500 errors to enable servlet exception handling mechanism.
          Note:
          Depending were the exception occurs it may or may not propagate to the servlet container. For example if an exception will occur in a bean property modifier method the exception will be translated into an error message by the underlying JSF implementation.

          Show
          Mircea Toma added a comment - Handle HTTP 500 errors to enable servlet exception handling mechanism. Note: Depending were the exception occurs it may or may not propagate to the servlet container. For example if an exception will occur in a bean property modifier method the exception will be translated into an error message by the underlying JSF implementation.
          Mircea Toma made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Summary Unchecked excpetions are eaten by Blocking Servlet and bypass declarative exception handling rules Unchecked exceptions are eaten by Blocking Servlet and bypass declarative exception handling rules
          Hide
          Ken Fyten added a comment -

          If possible, we should extend this fix to extract any nested exceptions, as per the comment below from ICE-595:

          Which brings us to ICE-1133, which addresses catching Exceptions, and forwarding/redirecting to application developer specified pages. The problem is, if I catch the FileNotFoundException to send out the 404, then that will circumvent the Exception/500 code mechanism. To complicate matters, the FileNotFoundException is being wrapped in a FacesException, and the code is not pulling out the causing exception, so application developers can't, as of right now, actually specifically trap FileNotFoundException with the ICE-1133 method.

          Show
          Ken Fyten added a comment - If possible, we should extend this fix to extract any nested exceptions, as per the comment below from ICE-595 : Which brings us to ICE-1133 , which addresses catching Exceptions, and forwarding/redirecting to application developer specified pages. The problem is, if I catch the FileNotFoundException to send out the 404, then that will circumvent the Exception/500 code mechanism. To complicate matters, the FileNotFoundException is being wrapped in a FacesException, and the code is not pulling out the causing exception, so application developers can't, as of right now, actually specifically trap FileNotFoundException with the ICE-1133 method.
          Ken Fyten made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Hide
          Ken Fyten added a comment -

          Existing behavior described in ICE-595 would be sufficient if we can extract nested exceptions.

          Show
          Ken Fyten added a comment - Existing behavior described in ICE-595 would be sufficient if we can extract nested exceptions.
          Ken Fyten made changes -
          Link This issue blocks ICE-595 [ ICE-595 ]
          Hide
          Mircea Toma added a comment -

          So how to decide when to let the exception propagate to the servlet container, or extract the exception and re-throw it, and also what do we do when exceptions are nested multiple levels?
          In other words I'm not sure if extracting exceptions is the right thing to do, it is too late to make a decision of this kind at the framework level.

          Show
          Mircea Toma added a comment - So how to decide when to let the exception propagate to the servlet container, or extract the exception and re-throw it, and also what do we do when exceptions are nested multiple levels? In other words I'm not sure if extracting exceptions is the right thing to do, it is too late to make a decision of this kind at the framework level.
          Hide
          Mircea Toma added a comment -

          Closing this again. The previous comment explains why we cannot make the error handling mechanism work for all use cases.

          Show
          Mircea Toma added a comment - Closing this again. The previous comment explains why we cannot make the error handling mechanism work for all use cases.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Mark Collette added a comment -

          I'm not saying that we should always follow the getCause() chain for every Exception, just when it's a generic FacesException, which is inherently a wrapper exception.

          Show
          Mark Collette added a comment - I'm not saying that we should always follow the getCause() chain for every Exception, just when it's a generic FacesException, which is inherently a wrapper exception.
          Mark Collette made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #14163 Fri Jun 15 11:35:44 MDT 2007 mircea.toma Apply "workaround" for exceptions zealously captured & wrapped by the JSF implementations -- ICE-1133.
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/webapp/http/servlet/ViewBoundAdaptingServlet.java
          Hide
          Mircea Toma added a comment -

          Apply "workaround" for the exceptions that are zealously captured & wrapped by the JSF implementations.

          Show
          Mircea Toma added a comment - Apply "workaround" for the exceptions that are zealously captured & wrapped by the JSF implementations.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Issue Type Bug [ 1 ] Improvement [ 4 ]
          Ken Fyten made changes -
          Fix Version/s 1.6DR#6 [ 10090 ]
          Fix Version/s 1.6 [ 10031 ]
          Ken Fyten made changes -
          Fix Version/s 1.6 [ 10031 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Priority P1
          Assignee Mircea Toma [ mircea.toma ]
          Mircea Toma made changes -
          Link This issue is duplicated by ICE-3332 [ ICE-3332 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Philip Breau
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: