ADF DC Error handling using DCErrorHandlerImpl
This section, I have explained about handling error throws in the ADF application. Default, exception thrown by the application are caught by the binding container, which is routed to the error handler DCErrorHandlerImpl. We will extend this class to create our own custom exception class by overriding the method reportException().
Download Project ADF DC Error handling
Let’s begin to start the ADF DC Error Handling example:
ADF DC Exceptional Handline – Example started
I have created Employee EO and VO object from HR schema in my ADF Fusion web application. Created a JSF page which holds Employee as editable table and a create button which creates a employee
Under the viewController, Create a java class that extends DCErrorHandlerImpl. Ensure the super constructor argument is true as shown below
Right click on the Java class, Go to Source, Select Override Methods
Select the method reportException and click Ok
Here I have overrided the reportException method. If the methods receives JBO-25013 error then I set the error message to ‘duplicate employee ID’
Finally, Register the custom exception in the DataBindings.cpx as shown below. The custom exception class should be value of argument ‘ErrorHandlerClass’
After running the application on the browser, it displays the employee table with create button. If any duplicate employee ID presents during the creation then the reportException() sets the error message and displays it like below.
The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.
Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂