javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-135

RuntimeException thrown in decode() swallowed.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform:

    • Issuezilla Id:
      135

      Description

      If a RuntimeException is thrown during decode, it appears to be logged but
      ultimately swallowed. Is this correct behavior? A RuntimeException thrown in
      decode() ends up hitting the finally {} block in LifecycleImpl.java. There is
      no catch for the try to which the finally is attached.

        Activity

        Hide
        jayashri added a comment -

        It think we can add a "catch" for the try block that enclose the
        phase.execute() call and then add a separate try and catch block for 'after
        phase' listener processing.

        Show
        jayashri added a comment - It think we can add a "catch" for the try block that enclose the phase.execute() call and then add a separate try and catch block for 'after phase' listener processing.
        Hide
        jayashri added a comment -

        Here is the fix for this bug.

        Index: src/com/sun/faces/lifecycle/LifecycleImpl.java
        ===================================================================
        RCS file:
        /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/lifecycle/LifecycleImpl.java,v
        retrieving revision 1.50
        diff -u -r1.50 LifecycleImpl.java
        — src/com/sun/faces/lifecycle/LifecycleImpl.java 23 Jun 2005 20:29:33
        -0000 1.50
        +++ src/com/sun/faces/lifecycle/LifecycleImpl.java 1 Jul 2005 23:18:34 -0000
        @@ -242,32 +242,36 @@
        if (!skipping(phaseId, context))

        { phase.execute(context); }
        • }
        • finally {
        • try {
        • // Notify the "afterPhase" method of interested listeners
        • // (descending)
        • if (tempListeners.size() > 0) {
        • PhaseEvent event = new PhaseEvent(context, phaseId, this);
        • for (i = maxBefore; i >= 0; i--) {
        • PhaseListener listener = (PhaseListener)
        • tempListeners.get;
        • if (phaseId.equals(listener.getPhaseId()) ||
        • PhaseId.ANY_PHASE.equals(listener.getPhaseId())) { - listener.afterPhase(event); - }

          + } catch (Exception e)

          Unknown macro: {+ // Log the problem, but continue+ if (logger.isLoggable(Level.WARNING)) { + logger.warning("executePhase(" + phaseId.toString() + "," + + context + ") threw exception", e); + }+ }

          +
          + try {
          + // Notify the "afterPhase" method of interested listeners
          + // (descending)
          + if (tempListeners.size() > 0) {
          + PhaseEvent event = new PhaseEvent(context, phaseId, this);
          + for (i = maxBefore; i >= 0; i--)

          Unknown macro: {+ PhaseListener listener = (PhaseListener)+ tempListeners.get(i);+ if (phaseId.equals(listener.getPhaseId()) ||+ PhaseId.ANY_PHASE.equals(listener.getPhaseId())) { + listener.afterPhase(event); } }
        • }
        • catch (Throwable e) {
        • if (logger.isLoggable(Level.WARNING)) { - logger.warning("phase(" + phaseId.toString() + "," + context + - ") threw exception: " + e + " " + e.getMessage() + - "\n" + Util.getStackTraceString(e)); - }
        • }
        • }
          -
          + }
          + }
          + catch (Throwable e)
          Unknown macro: {+ if (logger.isLoggable(Level.WARNING)) { + logger.warning("phase(" + phaseId.toString() + "," + context + + ") threw exception: " + e + " " + e.getMessage() + + "\n" + Util.getStackTraceString(e)); + }+ }

          }

        Show
        jayashri added a comment - Here is the fix for this bug. Index: src/com/sun/faces/lifecycle/LifecycleImpl.java =================================================================== RCS file: /cvs/javaserverfaces-sources/jsf-ri/src/com/sun/faces/lifecycle/LifecycleImpl.java,v retrieving revision 1.50 diff -u -r1.50 LifecycleImpl.java — src/com/sun/faces/lifecycle/LifecycleImpl.java 23 Jun 2005 20:29:33 -0000 1.50 +++ src/com/sun/faces/lifecycle/LifecycleImpl.java 1 Jul 2005 23:18:34 -0000 @@ -242,32 +242,36 @@ if (!skipping(phaseId, context)) { phase.execute(context); } } finally { try { // Notify the "afterPhase" method of interested listeners // (descending) if (tempListeners.size() > 0) { PhaseEvent event = new PhaseEvent(context, phaseId, this); for (i = maxBefore; i >= 0; i--) { PhaseListener listener = (PhaseListener) tempListeners.get ; if (phaseId.equals(listener.getPhaseId()) || PhaseId.ANY_PHASE.equals(listener.getPhaseId())) { - listener.afterPhase(event); - } + } catch (Exception e) Unknown macro: {+ // Log the problem, but continue+ if (logger.isLoggable(Level.WARNING)) { + logger.warning("executePhase(" + phaseId.toString() + "," + + context + ") threw exception", e); + }+ } + + try { + // Notify the "afterPhase" method of interested listeners + // (descending) + if (tempListeners.size() > 0) { + PhaseEvent event = new PhaseEvent(context, phaseId, this); + for (i = maxBefore; i >= 0; i--) Unknown macro: {+ PhaseListener listener = (PhaseListener)+ tempListeners.get(i);+ if (phaseId.equals(listener.getPhaseId()) ||+ PhaseId.ANY_PHASE.equals(listener.getPhaseId())) { + listener.afterPhase(event); } } } catch (Throwable e) { if (logger.isLoggable(Level.WARNING)) { - logger.warning("phase(" + phaseId.toString() + "," + context + - ") threw exception: " + e + " " + e.getMessage() + - "\n" + Util.getStackTraceString(e)); - } } } - + } + } + catch (Throwable e) Unknown macro: {+ if (logger.isLoggable(Level.WARNING)) { + logger.warning("phase(" + phaseId.toString() + "," + context + + ") threw exception: " + e + " " + e.getMessage() + + "\n" + Util.getStackTraceString(e)); + }+ } }
        Hide
        jayashri added a comment -

        Created an attachment (id=78)
        last part of changes for this issue

        Show
        jayashri added a comment - Created an attachment (id=78) last part of changes for this issue
        Hide
        jayashri added a comment -

        M LifecycleImpl.java

        • add a finally block to exceute the after phase listeners regardless
          of exceptions thrown during phase execution.
        Show
        jayashri added a comment - M LifecycleImpl.java add a finally block to exceute the after phase listeners regardless of exceptions thrown during phase execution.
        Hide
        Ed Burns added a comment -

        r=edburns

        Show
        Ed Burns added a comment - r=edburns
        Hide
        jayashri added a comment -

        Fix checked in

        Show
        jayashri added a comment - Fix checked in
        Hide
        Manfred Riem added a comment -

        Closing issue out

        Show
        Manfred Riem added a comment - Closing issue out

          People

          • Assignee:
            jayashri
            Reporter:
            Ed Burns
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: