[gatein-commits] gatein SVN: r2346 - portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Mar 22 17:57:56 EDT 2010


Author: julien_viet
Date: 2010-03-22 17:57:56 -0400 (Mon, 22 Mar 2010)
New Revision: 2346

Modified:
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
Log:
GTNPORTAL-942: Incorrect exception handling thrown by a portlet during invocation

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java	2010-03-22 19:23:02 UTC (rev 2345)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletLifecycle.java	2010-03-22 21:57:56 UTC (rev 2346)
@@ -287,11 +287,16 @@
                               + "]. Expected a FragmentResponse or an ErrorResponse");
                      }
 
-                     PortletExceptionHandleService portletExceptionService =
-                        (PortletExceptionHandleService)container
-                           .getComponentInstanceOfType(PortletExceptionHandleService.class);
-                     portletExceptionService.handle(pcException);
+                     //
+                     PortletExceptionHandleService portletExceptionService = uicomponent.getApplicationComponent(PortletExceptionHandleService.class);
+                     if (portletExceptionService != null)
+                     {
+                        portletExceptionService.handle(pcException);
+                     }
 
+                     // Log the error
+                     log.error("Portlet render threw an exception", pcException);
+
                      markup = Text.create(context.getApplicationResourceBundle().getString("UIPortlet.message.RuntimeError"));
                   }
                }
@@ -301,17 +306,16 @@
       catch (Exception e)
       {
          PortletContainerException pcException = new PortletContainerException(e);
-         PortletExceptionHandleService portletExceptionService =
-            (PortletExceptionHandleService)container.getComponentInstanceOfType(PortletExceptionHandleService.class);
+         PortletExceptionHandleService portletExceptionService = uicomponent.getApplicationComponent(PortletExceptionHandleService.class);
          if (portletExceptionService != null)
          {
-             portletExceptionService.handle(pcException);
+            portletExceptionService.handle(pcException);
          }
-         else
-         {
-        	 log.warn("Could not find the PortletExceptionHandleService in the exo container");
-         }
 
+         // Log the error
+         log.error("Portlet render threw an exception", pcException);
+
+         //
          markup = Text.create(context.getApplicationResourceBundle().getString("UIPortlet.message.RuntimeError"));
       }
 



More information about the gatein-commits mailing list