11 Replies Latest reply: Dec 11, 2012 1:34 PM by Jan Vervecken RSS

    multiple callbacks to DCErrorHandlerImpl

    Jan Vervecken
      hi

      Please consider this example application created using JDeveloper 11.1.1.3.0
      at http://www.consideringred.com/files/oracle/2010/ErrorHandlerCallbacksApp-v0.01.zip

      It has a class extending DCErrorHandlerImpl configured as ErrorHandlerClass in DataBindings.cpx .
      Running the trySomeFailingMethod.jspx page and entering a value starting with "err" will result in an exception being thrown and a message shown.
      For such scenario the "IntegratedWebLogicServer - Log" panel shows
      MyServiceImpl.someFailingMethod() : pFirstParam = err not ok value
      MyLoggingDCErrorHandler.reportException() : pException = oracle.jbo.JboException: JBO-29000: Unexpected exception caught: errorhandlercallbacksapp.model.exception.MyRuntimeException, msg=unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.getDisplayMessage() : pException = oracle.jbo.JboException: JBO-29000: Unexpected exception caught: errorhandlercallbacksapp.model.exception.MyRuntimeException, msg=unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.skipException() : pException = oracle.jbo.JboException: JBO-29000: Unexpected exception caught: errorhandlercallbacksapp.model.exception.MyRuntimeException, msg=unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.getDisplayMessage() : pException = errorhandlercallbacksapp.model.exception.MyRuntimeException: unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.skipException() : pException = errorhandlercallbacksapp.model.exception.MyRuntimeException: unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.getDetailedDisplayMessage() : pException = errorhandlercallbacksapp.model.exception.MyRuntimeException: unable to work with [err not ok value] as pFirstParam
      <Utils><buildFacesMessage> ADF: Adding the following JSF error message: unable to work with [err not ok value] as pFirstParam
      errorhandlercallbacksapp.model.exception.MyRuntimeException: unable to work with [err not ok value] as pFirstParam
           at errorhandlercallbacksapp.model.MyServiceImpl.someFailingMethod(MyServiceImpl.java:29)
      [...]
      MyLoggingDCErrorHandler.getDisplayMessage() : pException = oracle.jbo.JboException: JBO-29000: Unexpected exception caught: errorhandlercallbacksapp.model.exception.MyRuntimeException, msg=unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.skipException() : pException = oracle.jbo.JboException: JBO-29000: Unexpected exception caught: errorhandlercallbacksapp.model.exception.MyRuntimeException, msg=unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.getDisplayMessage() : pException = errorhandlercallbacksapp.model.exception.MyRuntimeException: unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.skipException() : pException = errorhandlercallbacksapp.model.exception.MyRuntimeException: unable to work with [err not ok value] as pFirstParam
      MyLoggingDCErrorHandler.getDetailedDisplayMessage() : pException = errorhandlercallbacksapp.model.exception.MyRuntimeException: unable to work with [err not ok value] as pFirstParam
      <Utils><buildFacesMessage> ADF: Adding the following JSF error message: unable to work with [err not ok value] as pFirstParam
      errorhandlercallbacksapp.model.exception.MyRuntimeException: unable to work with [err not ok value] as pFirstParam
           at errorhandlercallbacksapp.model.MyServiceImpl.someFailingMethod(MyServiceImpl.java:29)
      [...]
      question:
      - (q1) Why are DCErrorHandlerImpl methods being called more than once for a single exception?

      many thanks
      Jan Vervecken
        • 1. Re: multiple callbacks to DCErrorHandlerImpl
          cgayraud
          Jan,
          The process of creating Faces error message from the tree of exception is repeated at several point of the ADF Lifecycle in order to catch all errors. Most likely you will see it being called once before and once during the Render Response phase. Before adding the Faces error message duplicates are eliminated ensuring that the same error message is only displayed once.
          • 2. Re: multiple callbacks to DCErrorHandlerImpl
            Jan Vervecken
            Thanks for your reply cgayraud.

            Your user profile suggests you work for Oracle.
            cgayraud wrote:
            Jan,
            The process of creating Faces error message from the tree of exception is repeated at several point of the ADF Lifecycle in order to catch all errors. Most likely you will see it being called once before and once during the Render Response phase. Before adding the Faces error message duplicates are eliminated ensuring that the same error message is only displayed once.
            That sounds like a strange approach (e.g. why not collect the exceptions and ask for display messages only for each unique exception).
            So, you say this is intended behaviour and not a bug?

            regards
            Jan
            • 3. Re: multiple callbacks to DCErrorHandlerImpl
              cgayraud
              It is not a bug. The design is very simple, instead of holding a parallel list of errors we depend on the Faces error messages list and keep checking for dups against that. Also, only the error handler has the logic to format the message, we can't look at an exception and safely check for dups before it is formatted. It could be optimized but after all, the error handler is only called when an exception is detected.
              • 4. Re: multiple callbacks to DCErrorHandlerImpl
                Jan Vervecken
                Thanks for your reply cgayraud.
                It is not a bug. ...
                Thank you for confirming that the multiple callbacks to DCErrorHandlerImpl are not a bug.
                ... we depend on the Faces error messages list ...
                Somewhat strange that your explanation involves "Faces error messages" as the DCErrorHandlerImpl class API documentation does not mention anything Faces (JSF) related (which can be expected as it is in the "oracle.adf.model.binding" package) ... although the context of a related question in forum thread "DCErrorHandlerImpl.processMessage() method" suggests differently.
                ... we can't look at an exception and safely check for dups before it is formatted ...
                How does that require calling the error handler to format a message multiple times for the same exception ?
                ... the error handler is only called when an exception is detected ...
                And apparently multiple times for the same exception.

                regards
                Jan
                • 5. Re: multiple callbacks to DCErrorHandlerImpl
                  Jan Vervecken
                  hi cgayraud

                  Has there been a "fix" in JDeveloper 11.1.1.3.0 (compared to JDeveloper 11.1.1.2.0) related to these "multiple callbacks"?

                  In thread "how to show multiple messages for a single exception" there Re: how to show multiple messages for a single exception between JDeveloper 11.1.1.3.0 versus JDeveloper 11.1.1.2.0 .
                  see http://www.consideringred.com/files/oracle/img/2010/MultipleMessages-111130versus111120.png

                  Also, some more feedback on the "Faces error messages" aspect of your reply is still welcome.

                  regards
                  Jan
                  • 6. Re: multiple callbacks to DCErrorHandlerImpl
                    cgayraud
                    Jan, here are more answers:
                    ... we depend on the Faces error messages list ...
                    Somewhat strange that your explanation involves "Faces error messages" as the DCErrorHandlerImpl class API documentation does not mention anything Faces (JSF) related (which can be expected as it is in the "oracle.adf.model.binding" package) ... although the context of a related question in forum thread "DCErrorHandlerImpl.processMessage() method" suggests differently.
                    It involves Faces error message because we are dealing with an ADF Web Application which by definition is using Faces to display the error message. The ErrorHandler is used to format the message but Faces is use to display it and to do that, a FacesMessage is built and added to the FacesContext.
                    ... we can't look at an exception and safely check for dups before it is formatted ...
                    How does that require calling the error handler to format a message multiple times for the same exception ?
                    We don't have the exception anymore, we only have the formatted message and that is what we compare. The routine that builds the Faces error message is called at several point of the ADF page lifecycle, between each point we only keep the formatted message.

                    There hasn't been any change in the way the DCErrorHandler can be called multiple time during the ADF page lifecycle in 11.1.1.3 but there has been some improvement in removing redundant details. Most of this is done in the base implementation of the DCErrorHandler and someone working in ADFm should comment on it.

                    Charles.

                    Edited by: cgayraud on Nov 15, 2010 11:17 AM
                    • 7. Re: multiple callbacks to DCErrorHandlerImpl
                      Jan Vervecken
                      Thanks for your reply Charles.

                      I am trying to understand your explanation, but I must be missing something.
                      ... we are dealing with an ADF Web Application ...
                      Yes, that is true for the example application in ErrorHandlerCallbacksApp-v0.01.zip.
                      Not sure if I understand who "we" is where you write "... we depend on ... " or "... we are dealing with ... ", must be something "Faces related".
                      If you could be specific about what it is that makes a DCErrorHandlerImpl implementation/sub-class "Faces specific", that could explain things.

                      Also because, if you look at it from the standpoint of someone implementing a DCErrorHandlerImpl sub-class, there does not seem to be a (documented) reason to expect multiple callbacks for the same exception, or that such an implementation should be able to handle multiple callbacks for the same exception.
                      ... we can't look at an exception and safely check for dups before it is formatted ...
                      How does that require calling the error handler to format a message multiple times for the same exception ?
                      We don't have the exception anymore, we only have the formatted message and that is what we compare. ...
                      But the DCErrorHandlerImpl methods get the exception passed-in as a parameter.
                      ... between each point we only keep the formatted message.
                      But what is kept could have been the exception, which would allow to avoid multiple callbacks for the same exception, not?
                      ... but there has been some improvement in removing redundant details ...
                      Which could explain the difference shown in MultipleMessages-111130versus111120.png.
                      ... Most of this is done in the base implementation of the DCErrorHandler and someone working in ADFm should comment on it.
                      Could you point such "someone working in ADFm" to this forum thread please?

                      thanks
                      Jan
                      • 8. Re: multiple callbacks to DCErrorHandlerImpl
                        Jan Vervecken
                        fyi

                        Recently I stumbled upon bug 12977108, "GETDISPLAYMESSAGE METHOD IS CALLED MULTIPLE TIMES WHEN THERE IS EXCEPTION", that seems to be related to the discussion in this forum thread. But I can not see many details in the bug. (There also does not seem to be an easy option to contribute to the bug by referring to this forum thread.)
                        The bug currently says "Product Version 11.1.1.5.0", but I have not reviewed this with that version (yet).

                        regards
                        Jan
                        • 9. Re: multiple callbacks to DCErrorHandlerImpl
                          Frank Nimphius-Oracle
                          Jan,

                          bug 12977108 is not fixed but passed on to QA for verification. I updated the bug with a reference to this thread

                          Frank
                          • 10. Re: multiple callbacks to DCErrorHandlerImpl
                            Jan Vervecken
                            Thanks for your reply Frank.
                            Frank Nimphius wrote:
                            bug 12977108 is not fixed but passed on to QA for verification.
                            If a bug says "Product Version 11.1.1.5.0" it is about the version where the bug is reported, right?
                            For "Fixed in Product Version " bug 12977108 currently has no value.
                            ... I updated the bug with a reference to this thread
                            Thank you for that.

                            regards
                            Jan
                            • 11. Re: multiple callbacks to DCErrorHandlerImpl
                              Jan Vervecken
                              fyi

                              see ADFEMG JIRA issue ADFEMG-75, "bug 12977108 : GETDISPLAYMESSAGE METHOD IS CALLED MULTIPLE TIMES WHEN THERE IS EXCEPTION"
                              at http://java.net/jira/browse/ADFEMG-75

                              regards
                              Jan Vervecken