@Override protected void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException { try { // try to let super handle - it'll call methods annotated for // handling, the default doXYZ(), or throw if a handler for the mode // is not found super.doDispatch(request, response); } catch (PortletException e) { if (e.getCause() == null) { // No cause interpreted as 'unknown mode' - pass that trough // so that the application can handle handleRequest(request, response); } else { // Something else failed, pass on throw e; } } }
Throwable cause = pe.getCause();
@Override public Part getPart(String name) throws IOException, ServletException { if (preq instanceof ClientDataRequest) { try { return ((ClientDataRequest) preq).getPart(name); } catch (PortletException e) { throw new ServletException(e.getCause()); } } return null; }
@Override public Collection<Part> getParts() throws IOException, ServletException { if (preq instanceof ClientDataRequest) { try { return ((ClientDataRequest) preq).getParts(); } catch (PortletException e) { throw new ServletException(e.getCause()); } } return null; }
/** * Prints the stack trace of this exception to the specified print writer. * * @param out the <code>PrintWriter</code> to be used for output */ public void printStackTrace(java.io.PrintWriter out) { super.printStackTrace(out); if( getCause () != null ) { out.println(); out.print("Nested Exception is "); getCause ().printStackTrace(out); } // change this when going tojdk1.4: /* super.printStackTrace(out); if( getRootCause () != null ) { out.println(); out.print("Nested Exception is "); getRootCause ().printStackTrace(out); } */ }
cause = ((PortletException) e).getCause();