Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1887

Print Multiple exceptions information thrown on update model

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.6-SNAPSHOT, 1.2.3
    • 1.1.6
    • None
    • None

    Description

      When update model phase is executed, if multiple error occur when setting the values (could occur when a value is set to a EL expression), the errors should be added to the org.apache.myfaces.errorHandling.exceptionList, so the FacesServlet can manage it properly like this:

      Exception while ...............message 1..........
      Exception while ...............message 2..........

      Caused by:
      ........cause 1.......
      ........cause 2.......

      .....stackTrace 1.....
      .....stackTrace 2.....

      Checking the code there is some errors like this (class UIInput myfaces core 1.1.5):

      private void queueExceptionInRequest(FacesContext context, ValueBinding binding, Exception e) {
      List li = (List) context.getExternalContext().getRequestMap().get(ERROR_HANDLING_EXCEPTION_LIST);
      if(null==li)

      { li = new ArrayList(); context.getExternalContext().getRequestMap().put(ERROR_HANDLING_EXCEPTION_LIST, li); li.add(new FacesException("Exception while setting value for expression : "+ binding.getExpressionString()+" of component with path : " + _ComponentUtils.getPathToComponent(this),e)); }

      }

      Note the bad closing '}', it causes that previous errors be lost.

      The idea is add a method to be called from FacesServlet like this:

      class _ErrorPageWriter

      public static void handleExceptionList(FacesContext facesContext, List exceptionList) throws ServletException, IOException

      { ...........handle it.......... }

      if no method on custom ErrorPageWriter is defined, the old way is used (just show the first exception).

      Attachments

        1. patchHandleErrorListUpdatePhase12.patch
          38 kB
          Leonardo Uribe
        2. patchHandleErrorListUpdatePhase11.patch
          10 kB
          Leonardo Uribe

        Activity

          People

            lu4242 Leonardo Uribe
            lu4242 Leonardo Uribe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: