Uploaded image for project: 'MyFaces Portlet Bridge'
  1. MyFaces Portlet Bridge
  2. PORTLETBRIDGE-214

BridgeImpl incorrectly cleans up after exceptions; retains contexts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.1
    • Impl
    • None

    Description

      The exception handling of BridgeImpl.doFacesRequest() is incorrect, which leads to contexts not being released after an exception.

      When an exception is thrown to the doFacesRequest() method, it ends up in this code:

      try {
      ...
      } catch (Exception e) {
      ...
      context.getExternalContext().log("Exception thrown in doFacesRequest:resource", e); // line 1168
      ...
      } finally {
      ...
      context.release();
      ...
      }

      The first problem is that whatever error is getting thrown to us is lost because line 1168 is generated a NullPointerException from context.getExternalContext().log(). So that NPE gets thrown from the exception block and the original, actual root-cause, exception is lost.

      The reason that this code fails is that context.getExternalContext() returns null – the processing has been redirected, and this context has already been released in redirectRender(). Which leads to the much more serious issue – the new context established by redirectRender() is never released in the exception handling: the context.release() call in the finally block of doFacesRequest() is the original, already released context.

      Attachments

        1. stack.txt
          14 kB
          Scott Oaks

        Activity

          People

            mike_freedman Michael Freedman
            soaks Scott Oaks
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: