[jboss-svn-commits] JBoss Portal SVN: r5149 - in trunk: portlet/src/main/org/jboss/portal/portlet/aspects/portlet portlet/src/main/org/jboss/portal/portlet/container server/src/main/org/jboss/portal/server/servlet

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 5 10:59:35 EDT 2006


Author: julien at jboss.com
Date: 2006-09-05 10:59:29 -0400 (Tue, 05 Sep 2006)
New Revision: 5149

Modified:
   trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
   trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
   trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
Log:
JBPORTAL-1019 : NoClassDefFoundError does not show up during portlet access

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java	2006-09-05 14:46:48 UTC (rev 5148)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java	2006-09-05 14:59:29 UTC (rev 5149)
@@ -22,6 +22,7 @@
 package org.jboss.portal.portlet.aspects.portlet;
 
 import org.jboss.portal.common.invocation.InvocationException;
+import org.jboss.portal.common.util.Exceptions;
 import org.jboss.portal.portlet.container.PortletContainer;
 import org.jboss.portal.portlet.container.PortletApplication;
 import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
@@ -86,7 +87,23 @@
       }
       catch (ServletException e)
       {
-         throw new PortletInvokerException(e);
+         // Unwrap underlying exception if any
+         Throwable t = e.getRootCause();
+
+         //
+         if (t instanceof Error)
+         {
+            // Rethrow any error
+            throw (Error)t;
+         }
+         else if (t == null)
+         {
+            // If no nested exception use the servlet exception
+            t = e;
+         }
+
+         //
+         throw new PortletInvokerException(t);
       }
       finally
       {

Modified: trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java	2006-09-05 14:46:48 UTC (rev 5148)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java	2006-09-05 14:59:29 UTC (rev 5149)
@@ -62,6 +62,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.io.IOException;
 
 /**
  * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
@@ -445,10 +446,10 @@
             throw new InvocationException("Unexpected invocation " + invocation);
          }
       }
-      catch (InvocationException e)
+      catch (NoClassDefFoundError e)
       {
-         // Rethrow the invocation
-         throw e;
+         //
+         invocation.setResult(new ErrorResult(e));
       }
       catch (Exception e)
       {
@@ -479,7 +480,7 @@
       }
    }
 
-   protected Result invokeAction(ActionInvocation invocation) throws Exception
+   protected Result invokeAction(ActionInvocation invocation) throws IOException, PortletException
    {
       APIFactory factory = application.getAPIFactory();
       ActionRequestImpl areq = factory.createActionRequest(invocation);
@@ -504,7 +505,7 @@
       return aresp.getResult();
    }
 
-   protected Result invokeRender(RenderInvocation invocation) throws Exception
+   protected Result invokeRender(RenderInvocation invocation) throws IOException, PortletException
    {
       APIFactory factory = application.getAPIFactory();
       RenderRequestImpl rreq = factory.createRenderRequest(invocation);

Modified: trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java	2006-09-05 14:46:48 UTC (rev 5148)
+++ trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java	2006-09-05 14:59:29 UTC (rev 5149)
@@ -284,6 +284,14 @@
          Throwable nested = Exceptions.unwrap(e);
          throw new ServletException(nested);
       }
+      catch (ServletException e)
+      {
+         throw e;
+      }
+      catch (IOException e)
+      {
+         throw e;
+      }
       catch (Exception e)
       {
          log.error("Unexpected exception", e);




More information about the jboss-svn-commits mailing list