This is how exceptions are handled


Posted:   |  More posts about filenet java

This is how WcmController.java, the "Controller" part of FileNet Workplace's implementation of MVC pattern, handles exceptions:

First, declare this:

[java] private Exception configureWindowIdException = null; [/java]

Then, in ConfigurePage function, do this:

[java] public void configurePage(ServletContext applicationValue, HttpServletRequest request, long windowIdMode) throws Exception { ... skipped ... configureWindowId(request);

  //  If configureWindowId constructed an exception, throw it.
  if ( configureWindowIdException != null  )
  {
       if ( !sp.isSignedIn() )
       {
           // We attempted to propogate a window Id when not signed in
           // probably the result of signing out of an info page.
           // Don't throw.  Fix the windowId to mainWindow instead.
           //
           WindowID assignedId = new WindowID(null);
           WindowID currentId  = new WindowID(null);

           assignWindowId(assignedId, currentId, false);
           configureWindowState();
           postProcessWindowId(assignedId, currentId, currentId,
                               false, false, false, false, false);
       }
       else
           throw configureWindowIdException;
  }
      ... skipped ...

}

[/java]

What about good old try-catch?

There is no proper exception handling in Workplace. Should I send this piece to The Daily WTF?

Technorati Tags: ,

Contents © 2013 Aleksey Maksimov - Powered by Nikola