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

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Nov 3 15:52:28 EDT 2010


Author: mwringe
Date: 2010-11-03 15:52:26 -0400 (Wed, 03 Nov 2010)
New Revision: 4922

Modified:
   portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
Log:
GTNPORTAL-1629: fix NPE when dealing with ErrorResponse which don't contain a cause. Should use the error message if this is the case, or throw a generic exception if both are missing.

Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java	2010-11-03 14:07:14 UTC (rev 4921)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java	2010-11-03 19:52:26 UTC (rev 4922)
@@ -388,7 +388,19 @@
                if (portletResponse instanceof ErrorResponse)
                {
                   ErrorResponse errorResponse = (ErrorResponse)portletResponse;
-                  throw (Exception)errorResponse.getCause();
+                  if (errorResponse.getCause() != null)
+                  {
+                     throw (Exception)errorResponse.getCause();
+                  }
+                  else if (errorResponse.getMessage() != null)
+                  {
+                     throw new Exception("Received an error response with message : " + errorResponse.getMessage());
+                  }
+                  else
+                  {
+                     throw new Exception("Received an error response.");
+                  }
+                  
                }
                else
                {



More information about the gatein-commits mailing list