[jboss-svn-commits] JBoss Portal SVN: r5148 - in branches/JBoss_Portal_Branch_2_4: 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:46:56 EDT 2006


Author: julien at jboss.com
Date: 2006-09-05 10:46:48 -0400 (Tue, 05 Sep 2006)
New Revision: 5148

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

Modified: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java	2006-09-05 14:43:38 UTC (rev 5147)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ContextDispatcherInterceptor.java	2006-09-05 14:46:48 UTC (rev 5148)
@@ -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 = Exceptions.unwrap(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: branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java	2006-09-05 14:43:38 UTC (rev 5147)
+++ branches/JBoss_Portal_Branch_2_4/portlet/src/main/org/jboss/portal/portlet/container/PortletContainer.java	2006-09-05 14:46:48 UTC (rev 5148)
@@ -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>
@@ -450,6 +451,11 @@
          // Rethrow the invocation
          throw e;
       }
+      catch (NoClassDefFoundError e)
+      {
+         // 
+         invocation.setResult(new ErrorResult(e));
+      }
       catch (Exception e)
       {
          portletLog.error("The portlet threw an exception", e);
@@ -479,7 +485,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 +510,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: branches/JBoss_Portal_Branch_2_4/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java	2006-09-05 14:43:38 UTC (rev 5147)
+++ branches/JBoss_Portal_Branch_2_4/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java	2006-09-05 14:46:48 UTC (rev 5148)
@@ -293,6 +293,14 @@
          InterceptorStack stack = getInterceptorStack();
          invocation.invoke(stack.getInterceptors());
       }
+      catch (ServletException e)
+      {
+         throw e;
+      }
+      catch (IOException e)
+      {
+         throw e;
+      }
       catch (ServerException e)
       {
          log.error("Server exception", e);




More information about the jboss-svn-commits mailing list