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
{