Tuesday, August 27, 2013

How to handles exceptions in ADF Taskflow ?


This blog explains about handling unexpected exceptions in ADF Task flow, There might be several reasons to occur exceptions in Taskflow , for eg : Any activity associated to taskflow may contribute to any type of exception, We can handle all these kind of exceptions in a single method.



- Assume, This taskflow has one initializer method, which is default activity and this method generating 'NullPointerException'.
- Define another method activity as shown below 'ExceptionHandler' , bind this method to backing bean. Mark this method activity as 'Exception Handler' by clicking on '!' component in the toolbar.

- Below is the source code for 'initialize' method activity

- Below is source code for 'ExceptionHandler' method activity



- Here is backing bean code for 'ExceptionHandler' method activity, Here you can define what ever error/exception message you want to display.

- Below is source code for 'initialize' method activity, Resulting 'NullPointerException'

- Below is how warning message displayed while loading this page.



No comments:

Post a Comment