Databases Reference
In-Depth Information
Exception handling
Excepion handling in Java is a very common pracice for handling the excepions and errors
occurring in the applicaion. Some of the excepion-handling processes are as follows:
Try-catch
: A Java developer uses the
try
-
catch
statement to gracefully handle
an applicaion's excepion. We can use the
finally
statement to include closing
operaions ater the occurrence of the excepion.
Task low excepion handler
: We can have an excepion handler for the task low
that will navigate to the error page, or display an error message or process the error
low for the page. You can mark an acivity in the task low as error-handler.
Databindings (DCErrorHandler)
: In the
Databindings.cpx
file, you can add an
error handling class for handling errors in the ADF controller layer. You will have to
use the
ErrorHandlerClass
property to specify the
ErrorHandlerImpl
class
that extends the
DCErrorHandlerImpl
class. In this way, you can handle the
excepion at the controller layer. The following code snippet explains this:
import oracle.adf.model
.binding.DCBindingContainer;
import oracle.adf.model
.binding.DCErrorHandlerImpl;
class ErrorHandlerImpl
extends DCErrorHandlerImpl {
public ErrorHandlerImpl()
{ super(true); }
@Override
public void reportException
(DCBindingContainer dCBindingContainer,
Exception exception) {
super.reportException
(dCBindingContainer, exception);
}
}
You can also create a text file of the name
oracle.adf.view.rich.context.
ExceptionHandler
in the
.adf/META-INF/services
folder. In this file, provide
the fully qualiied class that will deine your excepion handler. The handler class
should extend the
ExceptionHandler
class as shown in the following code snippet:
import oracle.adf.view
.rich.context.ExceptionHandler;
public class CustomExceptionHandler
extends ExceptionHandler {
Search WWH ::
Custom Search