Author: chris.laprun(a)jboss.com
Date: 2009-01-05 20:12:52 -0500 (Mon, 05 Jan 2009)
New Revision: 12429
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
Log:
- Added better error reporting and fixed comments.
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2009-01-06
00:07:33 UTC (rev 12428)
+++
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/portlet/PortletRequestDecoder.java 2009-01-06
01:12:52 UTC (rev 12429)
@@ -22,12 +22,13 @@
******************************************************************************/
package org.jboss.portal.core.portlet;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.common.util.ParameterMap;
+import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.OpaqueStateString;
+import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.cache.CacheLevel;
import java.util.Map;
@@ -185,21 +186,15 @@
if ((meta & RESOURCE_ID_MASK) != 0)
{
String[] resourceIdParam = queryParams.get(RESOURCE_ID_PARAMETER);
- if (resourceIdParam == null)
- {
- throw new IllegalArgumentException();
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(resourceIdParam,
"resource id");
resourceId = resourceIdParam[0];
}
- // Get the resource id from the parameters if it exists
+ // Get the cacheability from the parameters if it exists
if ((meta & CACHEABILITY_MASK) != 0)
{
String[] cacheabilityParam = queryParams.get(CACHEABILITY_PARAMETER);
- if (cacheabilityParam == null)
- {
- throw new IllegalArgumentException();
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(cacheabilityParam,
"cacheability");
cacheability = CacheLevel.valueOf(cacheabilityParam[0]);
}
}
@@ -209,10 +204,7 @@
if ((meta & MODE_MASK) != 0)
{
String[] modeParam = queryParams.get(MODE_PARAMETER);
- if (modeParam == null)
- {
- throw new IllegalArgumentException();
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(modeParam,
"mode");
mode = Mode.create(modeParam[0]);
}
@@ -220,10 +212,7 @@
if ((meta & WINDOW_STATE_MASK) != 0)
{
String[] windowStateParam = queryParams.get(WINDOW_STATE_PARAMETER);
- if (windowStateParam == null)
- {
- throw new IllegalArgumentException();
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(windowStateParam,
"window state");
windowState = WindowState.create(windowStateParam[0]);
}
}