9 Replies Latest reply on Aug 4, 2011 1:45 PM by 855645

    How to Catch Exception out of ContentPresenter Taskflow

    855645
      Design
      -------------------
      In one of my usecase, i have a wrapper tasfkflow called MyContentPresenterTF which wraps Webcenter ContentPresenter Taskflow in it and have the same or less properties exposed.

      MyContentPresenterTF has MyContentPresentPF.jsff. MyContentPresentPF is designated as both default and exception activity.

      MyContentPresenterPF.jsff has some title elements with a dynamic region. The taskflowId for this dynamic region comes from a bean and that points to either ExceptionTF or Webcenter Content presenter Taskflow. ("/oracle/webcenter/doclib/view/jsf/taskflows/presenter/contentPresenter.xml#doclib-content-presenter";)

      Issue :
      --------------------
      I create a page from Webcenter Administration and click Add Content and Add MyContentPresenterTF from resource catalog. I pass the correct parameters for DataSource.
      The page renders the MyContentPresenterTF without issues.

      But in cases like, where i edit the page content and pass the incorrect content id or datasource, then we get a popup with ADF FACES error Please specify a valid ID object. Make sure the repository name is not null. After that whatever action i perform on that page, the same error message appears.

      I want to handle all unhandled exceptions from Webcenter Taskflows if any of the input parameters are wrong or any runtime exception invoked from it and render some exception view region in the same page with some user read able information with some stack trace without disturbing the rest of the page.

      Solutions tried:
      --------------------------
      To avoid this, i have created a Exception Taskflow with exception page fragment. I have a bean with method getDynamicTaskFlowId which should switch between MyContentPresenterTF and ExceptionTF depending upon the exception. In case of exception, the exception taskflow region should be rendered with some readable error message and the other parts of the page should be working as before. (note i also want to clear the exception from viewport )

      But in order to do this, i need to switch the taskflows and clear the exception on Viewport if the exception was caught in the first place. But in this case, i always get the exception object null (ex, exceptionData always null).

      public TaskFlowId getDynamicTaskFlowId() {
      ControllerContext context =
      ControllerContext.getInstance(); //context.getCurrentViewPort()
      ViewPortContext currentRootViewPort = context.getCurrentRootViewPort();
      ViewPortContext currentViewPort = context.getCurrentViewPort();
      Exception ex = currentViewPort.getExceptionData();
      Exception exceptionData = currentRootViewPort.getExceptionData();
      FacesContext facesContext = FacesContext.getCurrentInstance();
      facesContext.getMessages();
      // facesContext.getMessages(arg0)

      if (currentRootViewPort.isExceptionPresent()) {   //not going inside
      exceptionData.printStackTrace();

      currentRootViewPort.clearException();


      return TaskFlowId.parse(taskFlowIdError);
      }

      return TaskFlowId.parse(taskFlowId);
      }
      }


      I also tried creating CustomErrorHandler class extending DCErrorHanlder and overriding reportException and registering it in databindings.cpx. But the control is not stopped at reportException in debug mode. As i think, the DCErrorHandler might work only for Model or service Layer exceptons (like JBO and not for ADF Faces).

      Whats the best way to go with the problem?


      <handleError> ADF_FACES-60096:Server Exception during PPR, #2
      javax.servlet.ServletException: oracle.webcenter.content.integration.RepositoryException: 03-Aug-2011 11:40:58 oracle.webcenter.content.integration.federated.internal.ContentValidator validateId
      SEVERE: Please specify a valid ID object. Make sure the repository name is not null.

           at weblogic.servlet.jsp.PageContextImpl.handlePageException(PageContextImpl.java:417)
           at oracle.jsp.runtimev2.ShortCutServlet._jspService(ShortCutServlet.java:101)
           at oracle.jsp.runtime.OracleJspBase.service(OracleJspBase.java:29)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:422)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:802)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:726)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
           at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
           at java.security.AccessController.doPrivileged(Native Method)
           at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
           at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
           at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
           at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
           at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)
           at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:444)
           at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:163)
           at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:184)
           at oracle.adfinternal.view.faces.taglib.region.IncludeTag.__include(IncludeTag.java:440)
           at oracle.adfinternal.view.faces.taglib.region.RegionTag$1.call(RegionTag.java:153)
           at oracle.adfinternal.view.faces.taglib.region.RegionTag$1.call(RegionTag.java:128)
           at oracle.adf.view.rich.component.fragment.UIXRegion.processRegion(UIXRegion.java:503)
           at oracle.adfinternal.view.faces.taglib.region.RegionTag.doStartTag(RegionTag.java:127)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspNode.execute(OracleJspNode.java:89)
           at oracle.jsp.runtimev2.ShortCutServlet._jspService(ShortCutServlet.java:89)
           at oracle.jsp.runtime.OracleJspBase.service(OracleJspBase.java:29)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:422)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:802)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:726)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
           at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
           at java.security.AccessController.doPrivileged(Native Method)
           at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
           at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
           at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
           at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
           at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)
           at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:444)
           at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:163)
           at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:184)
           at oracle.adfinternal.view.faces.taglib.region.IncludeTag.__include(IncludeTag.java:440)
           at oracle.adfinternal.view.faces.taglib.region.RegionTag$1.call(RegionTag.java:153)
           at oracle.adfinternal.view.faces.taglib.region.RegionTag$1.call(RegionTag.java:128)
           at oracle.adf.view.rich.component.fragment.UIXRegion.processRegion(UIXRegion.java:503)
           at oracle.adfinternal.view.faces.taglib.region.RegionTag.doStartTag(RegionTag.java:127)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:50)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspNode.execute(OracleJspNode.java:89)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspIterationTagNode.executeHandler(OracleJspIterationTagNode.java:45)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspNode.execute(OracleJspNode.java:89)
           at oracle.jsp.runtimev2.ShortCutServlet._jspService(ShortCutServlet.java:89)
           at oracle.jsp.runtime.OracleJspBase.service(OracleJspBase.java:29)
           at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:422)
           at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:802)
           at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:726)
           at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
           at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:524)
           at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)
           at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:410)
           at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
           at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
           at oracle.adfinternal.view.faces.config.rich.RecordRequestAttributesDuringDispatch.dispatch(RecordRequestAttributesDuringDispatch.java:44)
           at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
           at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
           at org.apache.myfaces.trinidad.context.ExternalContextDecorator.dispatch(ExternalContextDecorator.java:44)
           at org.apache.myfaces.trinidadinternal.context.FacesContextFactoryImpl$OverrideDispatch.dispatch(FacesContextFactoryImpl.java:267)
           at com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:469)
           at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:140)
           at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:189)
           at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:193)
           at oracle.webcenter.portalframework.sitestructure.handler.CustomViewHandler.renderView(CustomViewHandler.java:279)
           at com.baesystems.portal.navigation.handler.ApplicationViewHandler.renderView(ApplicationViewHandler.java:71)
           at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._renderResponse(LifecycleImpl.java:777)
           at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:293)
           at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:213)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
           at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
           at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
           at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
           at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.portlet.client.adapter.adf.ADFPortletFilter.doFilter(ADFPortletFilter.java:32)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.webcenter.framework.events.dispatcher.EventDispatcherFilter.doFilter(EventDispatcherFilter.java:44)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:205)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
           at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
           at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
           at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:446)
           at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:271)
           at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:177)
           at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.wcps.client.PersonalizationFilter.doFilter(PersonalizationFilter.java:75)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.webcenter.content.integration.servlets.ContentServletFilter.doFilter(ContentServletFilter.java:168)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.webcenter.lifecycle.filter.LifecycleLockFilter.doFilter(LifecycleLockFilter.java:151)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:175)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
           at java.security.AccessController.doPrivileged(Native Method)
           at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
           at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
           at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
           at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
           at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
           at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
           at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
           at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
           at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
           at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
           at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
           at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
           at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
           at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
           at weblogic.work.ExecuteThread.run(ExecuteThread.java:176)
      Caused by: oracle.webcenter.content.integration.RepositoryException: 03-Aug-2011 11:40:58 oracle.webcenter.content.integration.federated.internal.ContentValidator validateId
      SEVERE: Please specify a valid ID object. Make sure the repository name is not null.

           at oracle.webcenter.content.integration.federated.internal.ContentValidator.validateId(ContentValidator.java:49)
           at oracle.webcenter.content.integration.federated.internal.ContentValidator.validateFullId(ContentValidator.java:55)
           at oracle.webcenter.content.integration.federated.internal.NodeManagerImpl.getNodeByUUID(NodeManagerImpl.java:238)
           at oracle.webcenter.content.internal.view.template.ContentTemplateTag.include(ContentTemplateTag.java:275)
           at oracle.webcenter.content.internal.view.template.AbstractTemplateTag.doEndTag(AbstractTemplateTag.java:66)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:62)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspClassicTagNode.evalBody(OracleJspClassicTagNode.java:87)
           at oracle.jsp.runtime.tree.OracleJspBodyTagNode.executeHandler(OracleJspBodyTagNode.java:58)
           at oracle.jsp.runtime.tree.OracleJspCustomTagNode.execute(OracleJspCustomTagNode.java:261)
           at oracle.jsp.runtime.tree.OracleJspNode.execute(OracleJspNode.java:89)
           at oracle.jsp.runtimev2.ShortCutServlet._jspService(ShortCutServlet.java:89)

      Edited by: Prasath C on 03-Aug-2011 05:22
        • 1. Re: How to Catch Exception out of ContentPresenter Taskflow
          Yannick Ongena
          Does this help you: http://andrejusb.blogspot.com/2010/05/handling-exceptions-in-oracle-ui-shell.html

          SO basiclly you want to catch the exception from thecontent presenter in case the parameter of your taskflows are not correct?
          Is it an option to write some code that checks these parameters before calling the content presenter taskflow? This way you can provide the error instead catching it from the content presenter?
          • 2. Re: How to Catch Exception out of ContentPresenter Taskflow
            855645
            Thanks Yannick. I checked the link ...it is the same pattern i have had in my case..but the exception is not caught.

            Yes, there's one way to have some additional method and validate all the input parameters before invoking Content presenter taskflow ...But i wont prefer this, as i just want to have one generic Exception handler taskflow which catches all unhandled Webcenter Taskflow exceptions which would be resuable for my project. So i want to know the correct way of doing this.
            • 3. Re: How to Catch Exception out of ContentPresenter Taskflow
              Yannick Ongena
              I'll do some testing when i get home thie evening and see if i can find something to help you.
              • 4. Re: How to Catch Exception out of ContentPresenter Taskflow
                Yannick Ongena
                I've done some testing and for everything i do it seems that the error activity is not triggered when the content presenter causes an error. It seems that the CP handles their own event and just outputs the stacktrace but the error does not bubble up to the actual page that consumes the CP.

                I have created the taskflow in another way.
                Instead of working with a dynamic region, my taskflow works with a method call as default activity. This method call is also the error activity. The code for that method call is:
                  public String handleError() {
                      System.out.println("In handle");
                  ControllerContext context =
                  ControllerContext.getInstance(); //context.getCurrentViewPort()
                  ViewPortContext currentRootViewPort = context.getCurrentRootViewPort();
                  ViewPortContext currentViewPort = context.getCurrentViewPort();
                  Exception ex = currentViewPort.getExceptionData();
                  Exception exceptionData = currentRootViewPort.getExceptionData();
                  FacesContext facesContext = FacesContext.getCurrentInstance();
                  facesContext.getMessages();
                  // facesContext.getMessages(arg0)
                
                  if (currentRootViewPort.isExceptionPresent()) { //not going inside
                      System.out.println("error triggered");
                      exceptionData.printStackTrace();
                      currentRootViewPort.clearException();
                      return "ERROR";
                
                  }
                  return "OK";
                  }
                When the call returns ERROR it will show the error.jsff, otherwhise it will show the cp.jsff which contains a content presenter. When i don't provide the correct parameters for the CP, i see the complete stacktrace in my console but it does not call the handleError method again so it will also not redirect to the error.jsff.

                So unless i am doing something wrong, i believe that the content presenter does not bubble the error up so that we can handle it by using the error exception.

                Edited by: Yannick Ongena on Aug 3, 2011 6:14 PM
                • 5. Re: How to Catch Exception out of ContentPresenter Taskflow
                  855645
                  Thanks yannick for your replies.

                  1) I think you must have created a JSF page(jspx) and consumed your wrapper taskflow(MyContentPresenterTF) which has the default method or exception activity (that directs to either error.jsff or MyContentPresenterPF.jsff view activities). MyContentPresenterPF.jsff contains the static region of Webcenter Content PresenterTF. Keeping this assumption in place,

                  You mentioned...
                  /*When i don't provide the correct parameters for the CP, i see the complete stacktrace in my console but it does not call the handleError method again so it will also not redirect to the error.jsff. */ ..

                  In this standalone test case, the error or stack trace appears in console but nothing pops up in Ui. Also as said in my previous post, the control is not getting inside
                  if (currentRootViewPort.isExceptionPresent()) -- This condition is always false, as the exception object is null in first place irrespctive of incorrect parameters in Content presenter taskflow. So its never going to error.jsff for me...

                  Also the error is only appearing in console, it doesnot disturb the JSF page anymore...


                  2)That is for standalone page. But try this scenario...

                  Deploy the taskflow as shared library to Resource catalog and create the page from Webcenter Administration. Open the page.

                  Go to edit mode (ctrl + shift + E) . Consume the wrapper taskflow in the page created by clicking Add content > taskflow.

                  Edit the properties and pass the correct parameter. Observe the page rendered correctly.

                  Go to edit mode again and change the parameter to incorrect value. You will see a popup appearing with error message UCM content invalid ...Even if you try to change it back to correct value and click ok..the same error appears and appears again....if you click close and try to edit some other properties in the same portal page (say edit some page parameters etc)...Still you see the same exception poped up here and there....We stuck at here and we want to get rid of these errors and show a empty region where the wrapper taskflow was consumed..
                  • 6. Re: How to Catch Exception out of ContentPresenter Taskflow
                    Yannick Ongena
                    Ok, thanks for the clarification on the use case. It's a bit late now. I went out with a friend :)
                    I'll try to test it tomorrow.

                    Can you perhaps try to create a taskflow like i described?
                    Use a method call to distribute to the correct view instead of a default activity and a dynamic region.
                    • 7. Re: How to Catch Exception out of ContentPresenter Taskflow
                      855645
                      Hi Yannick,
                      Yes , i tried the method activity approach that routes to either one of the other view activities. But the same issue persists. Also as said before, the exception Data is coming as null from the currentViewPort or currentRootViewPort.

                      Another thing i figured out with this method is, only in the first time the method activity is called. But after that what ever actions you perform on the taskflow like editing the properties and changing it to proper value ...it doesnot invoke this methodActivity again , but the error appears in a popup again and again...

                      https://lh4.googleusercontent.com/xx6H1kykz9AZQDmoe965icdL60GZZUBFptVfaS0cANSK0avbyGQL4O1vMnFYi-3PVyKdwhd3TuIArumdBdL92hYGOg=s512

                      Regards
                      Prasath.C

                      Edited by: Prasath C on 04-Aug-2011 05:10
                      • 8. Re: How to Catch Exception out of ContentPresenter Taskflow
                        Yannick Ongena
                        Prasath,

                        I think it's like i said in another post. The content presenter does not present the error to its conuming page. It handles the error internally and prints out the stacktrace.

                        I made a small example to replicate this behavior: http://www.yonaweb.be/ErrorHandling.zip
                        The app contains 2 taskflows:
                        1) someTaskflow which can be seen as the content presenter
                        2) WrapperTF is the wrapper that will consume the first taskflow on a fragment.

                        The second taskflow has a default activity which also handles the error.
                        When you run the index.jspx you'll notice that the first taskflow actualy outputs a value although an error has been generated. I believe that it's the same case for the content presenter...

                        So i'm not sure if it's possible to catch that error because the taskflow has a try catch inside and does not throw the error so it's normal behavior that the wrapper taskflow does not now that an error occured because it is handles gracefuly by the content presenter...

                        You know what i mean? I could be wrong but everything points into that direction.
                        • 9. Re: How to Catch Exception out of ContentPresenter Taskflow
                          855645
                          Yannick,
                          I understand your point.. I tried out the same thing that you mentioned in my standalone test case as per your previous post instead of dynamic region. (
                          https://lh4.googleusercontent.com/xx6H1kykz9AZQDmoe965icdL60GZZUBFptVfaS0cANSK0avbyGQL4O1vMnFYi-3PVyKdwhd3TuIArumdBdL92hYGOg=s512)

                          May be the content presenter taskflow is handling the exception internally and thats the reason
                          Exception ex = currentViewPort.getExceptionData();
                          Exception exceptionData = currentRootViewPort.getExceptionData();

                          these objects are null and never going inside error page. But this assumption holds good only for this standlone test case..

                          I took the same wrapper taskflow (created in this design -- having method activity routes to view activities) and deployed to resource catalog..i still see the same old issue. But i replaced someTaskflow with ContentPresentTF.

                          Can you try using ContentPresenterTaskflow instead of someTaskflow in widget.jsff and deploy your WrapperTF to Resource Catalog. Create a page in Webcenter Administration and consume this WrapperTF taskflow in that page. Open the page , edit mode and change the parameter values to incorrect value. You will see the popup messages greeting you....

                          I think that, Content Presenter Taskflow is queuing these messages in FacesContext and poping them up in the dynamic webcenter pages. Even if you try to set the value to corrct one, you will still see the same exception poped up...Please try this example to see what i am getting at.....

                          Regards
                          Prasath.C