Forum Stats

  • 3,854,212 Users
  • 2,264,340 Discussions
  • 7,905,609 Comments

Discussions

Error Handler in page Fragment render response

santiago_nc
santiago_nc Member Posts: 91
edited Jun 14, 2016 5:13AM in JDeveloper and ADF

I want to add a global error handler for Bounded TaskFlows which is page fragments based, to prevent runtime exception for common runtime errors (NullPointerException)

In this case, I will redirect the page Fragment to error pageFragment activity.

To test the Error Handler i put in a managed bean a get method with:

public String getValueFireNullPonterException() {
  List<String> list = null;
  System.out.println("Element: "+list.get(0));
  return "ERROR";
}

Which is referenced in a inputText:

<af:inputText label="Getter error NullPointer"
  value="#{backingBeanScope.testPageFragmentBean.valueFireNullPonterException}" id="it6"/>

PS: Another test is with f:event of prerenderComponent.

I have checked this post already:

Bounded Taskflow Exception Handler not working with Page Fragements

I have tried with declarative component but I couldn't catch the exception.

https://blogs.oracle.com/jdevotnharvest/entry/extending_the_adf_controller_exception_handler

If I extends Adf Controller Exception Handler, is too late, since Exception is out of Region, then I only could redirect all page.

I am searching another alternative, like put a common method to catch all methods of Java Class but I don't found it.

Log exception

<UIXRegionTemplate> <UIXRegionTemplate> <_warn> <Error al procesar viewId: /test_common.jsf URI: /test_common.jsf URI real: /fragments_testers/test_menu.jsff.> 
javax.el.ELException: //C:/Oracle/AppData_122100/system12.2.1.0.42.151011.0031/o.j2ee/drs/Common/ViewControllerWebApp.war/fragments_testers/test_menu.jsff @96,106 listener="#{backingBeanScope.testPageFragmentBean.onPageLoad}": java.lang.NullPointerException

In this log can check that exception is queue from page fragment, but I cant get real context to do navigation outcome.

jdeveloper: 12.2.1.0.0

Tagged:

Answers

  • codigoadf
    codigoadf Member Posts: 667
    edited Jun 13, 2016 5:05PM

    Hi,

    this article is useful Oracle ADF

    santiago_nc
  • santiago_nc
    santiago_nc Member Posts: 91
    edited Jun 14, 2016 5:13AM

    Hi,

    Errors that occur in a context outside of the Oracle ADF Model or during the JavaServer Faces (JSF) “render response” 
    phase must be handled manually by developers, who can use a try/catch block in Java or implement a custom 
    Oracle ADF Controller exception handler class.
    

    I can't expect that any section of java code has try|catch sentences, then It fires a runtime exception in render response of PageFragment the application will shutdown for user session.

    I have tried with ADF Controller Handler Class, but It is late, since It is catched at Unbounded TaskFlow level, then I only could redirect al page, when I only want redirect the TaskFlow(based in pageFragments) rendered as Region or simply show a FacesMessages.

This discussion has been closed.