This discussion is archived
10 Replies Latest reply: Dec 11, 2012 1:12 PM by Jan Vervecken RSS

DCErrorHandlerImpl sub-class super(true) or super(false)

Jan Vervecken Journeyer
Currently Being Moderated
hi

In the Developers Guide for ADF ...
- "Example 28-26 Custom Error Handler" suggests to pass true to the base class constructor
- "Example 28-27 Default Constructor" suggests to pass true to the base class constructor
- "Example 28-28 Custom Error Handler Class with getDetailDisplayMessage Method" suggests to pass false to the base class constructor

The constructor DCErrorHandlerImpl(boolean setToThrow) does not seem to document its parameter
at http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e10653/oracle/adf/model/binding/DCErrorHandlerImpl.html#DCErrorHandlerImpl(boolean)

question:
- (q1) Should true or false be passed in the constructor for DCErrorHandlerImpl, and why?

many thanks
Jan Vervecken
  • 1. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Timo Hahn Oracle ACE
    Currently Being Moderated
    Jan,

    while the parameter is not documented in the constructor, the class documentation says:
    Implements a default error handling class for the ADF framework. This handler caches the exception in the bindingContainer and then if 'Throw' flag is set, throws exceptions it receives as JboExceptions (by creating a JboException if required).
    As far as I understand this the handler re throws the exception is you pass true to the base constructor, otherwise it only processes the exception.

    Timo
  • 2. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Jan Vervecken Journeyer
    Currently Being Moderated
    Thanks for your reply Timo.

    Yes, indeed, the class documentation mentions the " 'Throw' flag ", but I don't think I understand which "throwing behaviour" it configures, because I have not seen any difference.
    ... As far as I understand this the handler re throws the exception is you pass true to the base constructor, otherwise it only processes the exception.
    Do you know of a scenario where this will make a difference, and how or where this difference can be seen?

    regards
    Jan
  • 3. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Frank Nimphius Employee ACE
    Currently Being Moderated
    Jan,

    I think that using "false" is the correct implementation to use. When you follow the JavaDocs - and I am not saying this is an excuse for not documenting the flag - on http://download.oracle.com/docs/cd/E14571_01/apirefs.1111/e10653/oracle/adf/model/binding/DCErrorHandlerImpl.html#DCErrorHandlerImpl%28boolean%29 you see that setThrowFlag() is mentioned for internal framework use only.

    If the flag is set to false, then it depends on the client what the behavior is. If the client is ADF Swing, then the exception is thrown. If it is a web client, then the exception is cached if it is associated with an Attribute binding and sent to the client with the http response. If the flag is set to true then an exception is thrown in addition - as Timo mentions. I don't have a use case for this, but in effect what happens is that you would change the behavior from reporting errors to the user to an exception handled by the developer (e.g. forcing a redirect)

    Frank
  • 4. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Jan Vervecken Journeyer
    Currently Being Moderated
    Thanks for your reply Frank.
    I think that using "false" is the correct implementation to use. ...
    So, would you consider "Example 28-26 Custom Error Handler" and "Example 28-27 Default Constructor", both suggesting to pass true, to be a documentation bug?
    ... I don't have a use case for this, but in effect what happens is that you would change the behavior from reporting errors to the user to an exception handled by the developer (e.g. forcing a redirect)
    Because I don't see any difference in behaviour, I still don't understand the difference. Maybe you can post a scenario or some code (not necessarily a "use-case") that can illustrate the difference in behaviour?

    regards
    Jan
  • 5. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Jan Vervecken Journeyer
    Currently Being Moderated
    fyi

    Because Re: af:table filter date format : task-flow navigation issue to get feedback, I created service request 3-2362392698 using My Oracle Support about (q1).

    regards
    Jan
  • 6. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Jan Vervecken Journeyer
    Currently Being Moderated
    hi

    In service request 3-2362392698 I got this feedback (and basic example code on how to extend DCErrorHandlerImpl and override reportException()):
    "Passing true or false to the constructor changing the behavior from reporting errors to the user to an exception handled by the developer.
    If the flag is set to true then an exception is thrown and you can report it by overriding the method "reportException". ...
    If the flag is set to falsethen an exception is cached if it is associated with an Attribute binding and sent to the client with the http response.
    "

    Because I still have not seen any difference in behaviour, I created an example application using JDeveloper 11.1.1.3.0 to illustrate this
    at http://www.consideringred.com/files/oracle/2010/SuperTrueOrSuperFalseApp-v0.01.zip

    With "super(false);" in MyDCErrorHandler it behaves as in scenario (sc1) shown in the screencast at http://screencast.com/t/TfhVIbLvyb1
    resulting in the message "wrapping message in reportException(), isThrowFlag() = false, pException = oracle.jbo.JboException: JBO-29000: Unexpected exception caught: supertrueorsuperfalseapp.model.exception.MyServiceException, msg=unable to work with [err first value] as pFirstParam ".
    For scenario (sc2), commenting "super(false);" and uncommenting "super(true);" in MyDCErrorHandler, the same steps as in the scenario (sc1) result in the exact same message, yes also the "... isThrowFlag() = false ..." part.

    So question (q1) currently remains as no difference in behaviour has been demonstrated yet.

    regards
    Jan
  • 7. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Jan Vervecken Journeyer
    Currently Being Moderated
    fyi

    In the context of service request 3-2362392698 a (documentation?) bug 11674731, "DCERRORHANDLERIMPL SUB-CLASS SUPER(TRUE) OR SUPER(FALSE)", has been created.

    A minor modification to the example application shows the BindingContext DCErrorHandler class on the page
    at http://www.consideringred.com/files/oracle/2011/SuperTrueOrSuperFalseApp-v0.02.zip

    As in JDeveloper 11.1.1.3.0 also in JDeveloper 11.1.1.4.0 there does not seem to be a difference in behaviour when true or false be passed in the constructor for DCErrorHandlerImpl:
    - similar to (sc1), with "super(false);", scenario (sc3) results in a message as shown in the screencast at http://screencast.com/t/dBeByhMZ
    - similar to (sc2), with "super(true);", scenario (sc4) results in exactly the same behaviour as (sc3)

    In the example application the class SuggestedInSR32362392698DCErrorHandler implements a recent suggestion I got in service request 3-2362392698:
    - using this SuggestedInSR32362392698DCErrorHandler with "super(false);", scenario (sc5) results in a message as shown in the screencast at http://screencast.com/t/HW67tapvykF
    - using this SuggestedInSR32362392698DCErrorHandler with "super(true);", scenario (sc6) results in exactly the same behaviour as (sc5)

    So question (q1) currently remains as no difference in behaviour has been demonstrated yet.

    regards
    Jan
  • 8. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Jan Vervecken Journeyer
    Currently Being Moderated
    fyi

    Some more feedback I got in service request 3-2362392698 :
    The flag simply affects how this error handler will honour the exception. Ifthe throw flag is on, reportException will 'additionally' throw the exceptionat the end of the method while if false, then reportException simply cachesthe exception in the bindingContainer and returns letting the frameworkcodepath to complete it's lifecycle and potentially perform all the updatesor steps in the page lifecycle.

    In web scenario, throw=false prevents the pageLifecycle from aborting at thefirst exception.
    Somehow this is still not very clear to me, hence the following questions:
    - (q2) Why is there no difference in behaviour in scenario (sc3) compared to scenario (sc4), although false and true are passed in the constructor for DCErrorHandlerImpl respectively?
    - (q3) Which specific scenarios would illustrate a difference in behaviour when false or true are passed in the constructor for DCErrorHandlerImpl?

    regards
    Jan
  • 9. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Jan Vervecken Journeyer
    Currently Being Moderated
    fyi

    Recent feedback in service request 3-2362392698 suggested not to expect further feedback on the questions and to monitor bug 11674731.
    So, I have requested to close SR 3-2362392698.

    regards
    Jan
  • 10. Re: DCErrorHandlerImpl sub-class super(true) or super(false)
    Jan Vervecken Journeyer
    Currently Being Moderated
    fyi

    see ADFEMG JIRA issue ADFEMG-76, "bug 11674731 : DCERRORHANDLERIMPL SUB-CLASS SUPER(TRUE) OR SUPER(FALSE)"
    at http://java.net/jira/browse/ADFEMG-76

    regards
    Jan Vervecken

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points