[jboss-svn-commits] JBoss Portal SVN: r5324 - in branches/JBoss_Portal_Branch_2_4: common/src/main/org/jboss/portal/common/util wsrp/src/main/org/jboss/portal/wsrp wsrp/src/main/org/jboss/portal/wsrp/consumer

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Oct 3 19:27:47 EDT 2006


Author: chris.laprun at jboss.com
Date: 2006-10-03 19:27:44 -0400 (Tue, 03 Oct 2006)
New Revision: 5324

Modified:
   branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/ParameterValidation.java
   branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
   branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
   branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
Log:
JBPORTAL-987: Consolidated ParameterValidation and their use.

Modified: branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/ParameterValidation.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/ParameterValidation.java	2006-10-03 23:02:26 UTC (rev 5323)
+++ branches/JBoss_Portal_Branch_2_4/common/src/main/org/jboss/portal/common/util/ParameterValidation.java	2006-10-03 23:27:44 UTC (rev 5324)
@@ -29,11 +29,11 @@
  */
 public class ParameterValidation
 {
-   public static void checkStringValidity(String valueToCheck, String valueName, String contextName)
+   public static void throwIllegalArgExceptionIfNullOrEmpty(String valueToCheck, String valueName, String contextName)
    {
       if (valueToCheck == null || valueToCheck.length() == 0)
       {
-         throw new IllegalArgumentException(contextName + " requires a non-null, non-empty " + valueName);
+         throw new IllegalArgumentException(contextName != null ? contextName + " r" : "R" + "equires a non-null, non-empty " + valueName);
       }
    }
 
@@ -45,23 +45,6 @@
       }
    }
 
-   public static void throwIllegalArgExceptionIfNullOrEmpty(String valueToTest, String name)
-   {
-      throwIllegalArgExceptionIfNull(valueToTest, name);
-      if (valueToTest.length() == 0)
-      {
-         throw new IllegalArgumentException("Must pass a non-empty " + name);
-      }
-   }
-
-   public static void throwIllegalArgExceptionIfEmpty(String valueToTest, String name)
-   {
-      if (valueToTest != null && valueToTest.length() == 0)
-      {
-         throw new IllegalArgumentException("Must pass a non-empty " + name);
-      }
-   }
-
    /** @since 2.4.1 */
    public static void throwIllegalArgExceptionIfNullOrEmpty(Object[] array, String name)
    {

Modified: branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java	2006-10-03 23:02:26 UTC (rev 5323)
+++ branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/WSRPTypeFactory.java	2006-10-03 23:27:44 UTC (rev 5324)
@@ -35,6 +35,7 @@
 import org.jboss.portal.wsrp.core.CacheControl;
 import org.jboss.portal.wsrp.core.ClientData;
 import org.jboss.portal.wsrp.core.GetMarkup;
+import org.jboss.portal.wsrp.core.GetPortletDescription;
 import org.jboss.portal.wsrp.core.GetServiceDescription;
 import org.jboss.portal.wsrp.core.InitCookie;
 import org.jboss.portal.wsrp.core.InteractionParams;
@@ -67,6 +68,8 @@
  */
 public class WSRPTypeFactory
 {
+   /** ====== WSRP request objects ====== **/
+
    /**
     * registrationContext(RegistrationContext)?, desiredLocales(xsd:string)*
     *
@@ -100,82 +103,13 @@
     */
    public static GetMarkup createMarkupRequest(String handle, RuntimeContext runtimeContext, MarkupParams markupParams)
    {
-      if (handle == null || runtimeContext == null || markupParams == null)
-      {
-         throw new IllegalArgumentException("GetMarkup requires non-null handle, runtime context and markup params.\n" +
-            "Was given:\n\thandle: <" + handle + ">\n\truntime context: <" + runtimeContext
-            + ">\n\tmarkup params: <" + markupParams + ">.");
-      }
+      ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext, "RuntimeContext");
+      ParameterValidation.throwIllegalArgExceptionIfNull(markupParams, "MarkupParams");
 
       return new GetMarkup(null, createPortletContext(handle), runtimeContext, null, markupParams);
    }
 
    /**
-    * Same as createMarkupParams(false, {@link WSRPConstants#DEFAULT_LOCALES}, {@link WSRPConstants#DEFAULT_MIME_TYPES},
-    * {@link WSRPConstants#VIEW_MODE}, {@link WSRPConstants#NORMAL_WINDOW_STATE})
-    *
-    * @return
-    */
-   public static MarkupParams createDefaultMarkupParams()
-   {
-      return createMarkupParams(false, WSRPConstants.DEFAULT_LOCALES, WSRPConstants.DEFAULT_MIME_TYPES,
-         WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE);
-   }
-
-   /**
-    * secureClientCommunication(xsd:boolean), locales(xsd:string)+, mimeTypes(xsd:string)+, mode(xsd:string),
-    * windowState(xsd:string), clientData({@link org.jboss.portal.wsrp.core.ClientData})?,
-    * navigationalState(xsd:string)?, markupCharacterSets(xsd:string)*, validateTag(xsd:string)?,
-    * validNewModes(xsd:string)*, validNewWindowStates(xsd:string)*, extensions({@link
-    * org.jboss.portal.wsrp.core.Extension})*
-    *
-    * @return
-    */
-   public static MarkupParams createMarkupParams(boolean secureClientCommunication, String[] locales,
-                                                 String[] mimeTypes, String mode, String windowState)
-   {
-      return new MarkupParams(secureClientCommunication, locales, mimeTypes, mode, windowState, null, null, null,
-         null, null, null, null);
-   }
-
-   /**
-    * Same as createRuntimeContext({@link WSRPConstants#NONE_USER_AUTHENTICATION})
-    *
-    * @return
-    */
-   public static RuntimeContext createDefaultRuntimeContext()
-   {
-      return createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION);
-   }
-
-   /**
-    * userAuthentication(xsd:string), portletInstanceKey(xsd:string)?, namespacePrefix(xsd:string)?,
-    * templates(Templates)?, sessionID(xsd:string)?, extensions(Extension)*
-    *
-    * @return
-    */
-   public static RuntimeContext createRuntimeContext(String userAuthentication)
-   {
-      RuntimeContext runtimeContext = new RuntimeContext();
-      runtimeContext.setUserAuthentication(userAuthentication);
-      return runtimeContext;
-   }
-
-   /**
-    * portletHandle(xsd:string), portletState(xsd:base64Binary)?, extensions({@link
-    * org.jboss.portal.wsrp.core.Extension})*
-    *
-    * @param portletHandle
-    * @return
-    */
-   public static PortletContext createPortletContext(String portletHandle)
-   {
-      PortletContext portletContext = new PortletContext();
-      portletContext.setPortletHandle(portletHandle);
-      return portletContext;
-   }
-
-   /**
     * Same as createPerformBlockingInteraction(portletHandle, {@link #createDefaultRuntimeContext}(), {@link
     * #createDefaultMarkupParams}(), {@link #createDefaultInteractionParams}());
     *
@@ -203,39 +137,29 @@
                                                                              MarkupParams markupParams,
                                                                              InteractionParams interactionParams)
    {
-      if (portletHandle == null || runtimeContext == null || markupParams == null || interactionParams == null)
-      {
-         throw new IllegalArgumentException("PerformBlockingInteraction requires non-null handle, runtime context, " +
-            "markup and interaction params.\n" +
-            "Was given:\n\thandle: <" + portletHandle + ">\n\truntime context: <" + runtimeContext
-            + ">\n\tmarkup params: <" + markupParams + ">\n\tinteraction params: <" + interactionParams + ">.");
-      }
+      ParameterValidation.throwIllegalArgExceptionIfNull(runtimeContext, "RuntimeContext");
+      ParameterValidation.throwIllegalArgExceptionIfNull(markupParams, "MarkupParams");
+      ParameterValidation.throwIllegalArgExceptionIfNull(interactionParams, "InteractionParams");
+
       return new PerformBlockingInteraction(null, createPortletContext(portletHandle), runtimeContext, null,
          markupParams, interactionParams);
    }
 
    /**
-    * Same as createInteractionParams(StateChange.readOnly)
+    * registrationContext(RegistrationContext)?, portletContext(PortletContext), userContext(UserContext)?,
+    * desiredLocales(xsd:string)*
     *
+    * @param registrationContext
+    * @param portletHandle       handle for the PortletContext
     * @return
+    * @since 2.4.1
     */
-   public static InteractionParams createDefaultInteractionParams()
+   public static GetPortletDescription createGetPortletDescription(RegistrationContext registrationContext, String portletHandle)
    {
-      return createInteractionParams(StateChange.readOnly);
+      return new GetPortletDescription(registrationContext, createPortletContext(portletHandle), null, null);
    }
 
-   /**
-    * portletStateChange({@link StateChange}), interactionState(xsd:string)?, formParameters(NamedString)*,
-    * uploadContexts(UploadContext)*, extensions(Extension)*
-    *
-    * @return
-    */
-   public static InteractionParams createInteractionParams(StateChange portletStateChange)
-   {
-      InteractionParams interactionParams = new InteractionParams();
-      interactionParams.setPortletStateChange(portletStateChange);
-      return interactionParams;
-   }
+   /** ====== WSRP Response objects ====== **/
 
    /**
     * ( updateResponse(UpdateResponse) | redirectURL(xsd:string) ), extensions(Extension)*
@@ -246,7 +170,7 @@
    {
       if (updateResponse == null)
       {
-         throw new IllegalArgumentException("BlockingInteractionResponse has a required UpdateResponse or redirect URL.");
+         throw new IllegalArgumentException("BlockingInteractionResponse requires either an UpdateResponse or a redirect URL.");
       }
       return new BlockingInteractionResponse(updateResponse, null, null);
    }
@@ -258,9 +182,9 @@
     */
    public static BlockingInteractionResponse createBlockingInteractionResponse(String redirectURL)
    {
-      if (redirectURL == null)
+      if (redirectURL == null || redirectURL.length() == 0)
       {
-         throw new IllegalArgumentException("BlockingInteractionResponse has a required UpdateResponse or redirect URL.");
+         throw new IllegalArgumentException("BlockingInteractionResponse requires either an UpdateResponse or a redirect URL.");
       }
       return new BlockingInteractionResponse(null, redirectURL, null);
    }
@@ -288,16 +212,9 @@
     */
    public static PortletDescription createPortletDescription(String portletHandle, MarkupType[] markupTypes)
    {
-      if (portletHandle == null || portletHandle.length() == 0 || portletHandle.length() > 255)
-      {
-         throw new IllegalArgumentException("PortletDescription requires a valid portlet handle. " +
-            "Was given: >" + portletHandle + "<");
-      }
+      checkPortletHandle(portletHandle);
 
-      if (markupTypes == null || markupTypes.length == 0)
-      {
-         throw new IllegalArgumentException("PortletDescription requires at least one MarkupType.");
-      }
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(markupTypes, "MarkupType");
 
       PortletDescription portletDescription = new PortletDescription();
       portletDescription.setPortletHandle(portletHandle);
@@ -305,7 +222,116 @@
       return portletDescription;
    }
 
+   private static void checkPortletHandle(String portletHandle)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", "PortletDescription");
+      if (portletHandle.length() > 255)
+      {
+         throw new IllegalArgumentException("Portlet handles must be less than 255 characters long. Was "
+            + portletHandle.length() + " long.");
+      }
+   }
+
    /**
+    * Same as createMarkupParams(false, {@link WSRPConstants#DEFAULT_LOCALES}, {@link WSRPConstants#DEFAULT_MIME_TYPES},
+    * {@link WSRPConstants#VIEW_MODE}, {@link WSRPConstants#NORMAL_WINDOW_STATE})
+    *
+    * @return
+    */
+   public static MarkupParams createDefaultMarkupParams()
+   {
+      return createMarkupParams(false, WSRPConstants.DEFAULT_LOCALES, WSRPConstants.DEFAULT_MIME_TYPES,
+         WSRPConstants.VIEW_MODE, WSRPConstants.NORMAL_WINDOW_STATE);
+   }
+
+   /**
+    * secureClientCommunication(xsd:boolean), locales(xsd:string)+, mimeTypes(xsd:string)+, mode(xsd:string),
+    * windowState(xsd:string), clientData({@link org.jboss.portal.wsrp.core.ClientData})?,
+    * navigationalState(xsd:string)?, markupCharacterSets(xsd:string)*, validateTag(xsd:string)?,
+    * validNewModes(xsd:string)*, validNewWindowStates(xsd:string)*, extensions({@link
+    * org.jboss.portal.wsrp.core.Extension})*
+    *
+    * @return
+    */
+   public static MarkupParams createMarkupParams(boolean secureClientCommunication, String[] locales,
+                                                 String[] mimeTypes, String mode, String windowState)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(locales, "locales");
+      ParameterValidation.throwIllegalArgExceptionIfNull(mimeTypes, "MIME types");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mode, "mode", "MarkupParams");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(windowState, "window state", "MarkupParams");
+
+      return new MarkupParams(secureClientCommunication, locales, mimeTypes, mode, windowState, null, null, null,
+         null, null, null, null);
+   }
+
+   /**
+    * Same as createRuntimeContext({@link WSRPConstants#NONE_USER_AUTHENTICATION})
+    *
+    * @return
+    */
+   public static RuntimeContext createDefaultRuntimeContext()
+   {
+      return createRuntimeContext(WSRPConstants.NONE_USER_AUTHENTICATION);
+   }
+
+   /**
+    * userAuthentication(xsd:string), portletInstanceKey(xsd:string)?, namespacePrefix(xsd:string)?,
+    * templates(Templates)?, sessionID(xsd:string)?, extensions(Extension)*
+    *
+    * @return
+    */
+   public static RuntimeContext createRuntimeContext(String userAuthentication)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userAuthentication, "user authentication", "RuntimeContext");
+
+      RuntimeContext runtimeContext = new RuntimeContext();
+      runtimeContext.setUserAuthentication(userAuthentication);
+      return runtimeContext;
+   }
+
+   /**
+    * portletHandle(xsd:string), portletState(xsd:base64Binary)?, extensions({@link
+    * org.jboss.portal.wsrp.core.Extension})*
+    *
+    * @param portletHandle
+    * @return
+    */
+   public static PortletContext createPortletContext(String portletHandle)
+   {
+      checkPortletHandle(portletHandle);
+
+      PortletContext portletContext = new PortletContext();
+      portletContext.setPortletHandle(portletHandle);
+      return portletContext;
+   }
+
+   /**
+    * Same as createInteractionParams(StateChange.readOnly)
+    *
+    * @return
+    */
+   public static InteractionParams createDefaultInteractionParams()
+   {
+      return createInteractionParams(StateChange.readOnly);
+   }
+
+   /**
+    * portletStateChange({@link StateChange}), interactionState(xsd:string)?, formParameters(NamedString)*,
+    * uploadContexts(UploadContext)*, extensions(Extension)*
+    *
+    * @return
+    */
+   public static InteractionParams createInteractionParams(StateChange portletStateChange)
+   {
+      ParameterValidation.throwIllegalArgExceptionIfNull(portletStateChange, "portletStateChange");
+
+      InteractionParams interactionParams = new InteractionParams();
+      interactionParams.setPortletStateChange(portletStateChange);
+      return interactionParams;
+   }
+
+   /**
     * registrationContext(RegistrationContext)?
     *
     * @param registrationContext
@@ -339,10 +365,8 @@
     */
    public static MarkupResponse createMarkupResponse(MarkupContext markupContext)
    {
-      if (markupContext == null)
-      {
-         throw new IllegalArgumentException("MarkupResponse requires a non-null MarkupContext.");
-      }
+      ParameterValidation.throwIllegalArgExceptionIfNull(markupContext, "MarkupContext");
+
       return new MarkupResponse(markupContext, null, null);
    }
 
@@ -360,10 +384,10 @@
     */
    public static MarkupContext createMarkupContext(String mimeType, String markupString)
    {
-      ParameterValidation.checkStringValidity(mimeType, "MIME type", "MarkupContext");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mimeType, "MIME type", "MarkupContext");
       if (markupString == null)
       {
-         throw new IllegalArgumentException("MarkupContext requires a non-null markup string or binary markup.");
+         throw new IllegalArgumentException("MarkupContext requires either a non-null markup string or binary markup.");
       }
       return new MarkupContext(Boolean.FALSE, mimeType, markupString, null, null, Boolean.FALSE, null, null, null);
    }
@@ -382,10 +406,10 @@
     */
    public static MarkupContext createMarkupContext(String mimeType, byte[] markupBinary)
    {
-      ParameterValidation.checkStringValidity(mimeType, "MIME type", "MarkupContext");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(mimeType, "MIME type", "MarkupContext");
       if (markupBinary == null || markupBinary.length == 0)
       {
-         throw new IllegalArgumentException("MarkupContext requires a non-null markup string or binary markup.");
+         throw new IllegalArgumentException("MarkupContext requires either a non-null markup string or binary markup.");
       }
       return new MarkupContext(Boolean.FALSE, mimeType, null, markupBinary, null, Boolean.FALSE, null, null, null);
    }
@@ -402,7 +426,7 @@
     */
    public static SessionContext createSessionContext(String sessionID, int expires)
    {
-      ParameterValidation.checkStringValidity(sessionID, "session Id", "SessionContext");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(sessionID, "session Id", "SessionContext");
       if (expires < 0)
       {
          throw new IllegalArgumentException("SessionContext requires a positive expiration time.");
@@ -419,7 +443,7 @@
     */
    public static UserContext createUserContext(String userContextKey)
    {
-      ParameterValidation.checkStringValidity(userContextKey, "user context key", "UserContext");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userContextKey, "user context key", "UserContext");
       return new UserContext(userContextKey, null, null, null);
    }
 
@@ -443,8 +467,8 @@
     */
    public static RegistrationData createRegistrationData(String consumerName, String consumerAgent, boolean methodGetSupported)
    {
-      ParameterValidation.checkStringValidity(consumerName, "consumer name", "RegistrationData");
-      ParameterValidation.checkStringValidity(consumerAgent, "consumer agent", "RegistrationData");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerName, "consumer name", "RegistrationData");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(consumerAgent, "consumer agent", "RegistrationData");
       // todo: check consumerAgent format...
       return new RegistrationData(consumerName, consumerAgent, methodGetSupported, null, null, null, null, null, null);
    }
@@ -456,6 +480,10 @@
     */
    public static Property createProperty(String name, String lang, String stringValue)
    {
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "name", "Property");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang, "language", "Property");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(stringValue, "String value", "Property");
+
       return new Property(name, lang, stringValue, null);
    }
 
@@ -540,7 +568,7 @@
     */
    public static ClientData createClientData(String userAgent)
    {
-      ParameterValidation.checkStringValidity(userAgent, "user agent", "ClientData");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userAgent, "user agent", "ClientData");
       return new ClientData(userAgent, null);
    }
 
@@ -554,7 +582,7 @@
     */
    public static CacheControl createCacheControl(int expires, String userScope)
    {
-      ParameterValidation.checkStringValidity(userScope, "user scope", "CacheControl");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(userScope, "user scope", "CacheControl");
       if (expires < -1)
       {
          throw new IllegalArgumentException("Cache expiration time must be greater than -1, " +

Modified: branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java	2006-10-03 23:02:26 UTC (rev 5323)
+++ branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/WSRPUtils.java	2006-10-03 23:27:44 UTC (rev 5324)
@@ -22,13 +22,13 @@
 
 package org.jboss.portal.wsrp;
 
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
 import org.jboss.portal.common.util.LocaleInfo;
 import org.jboss.portal.common.util.ParameterValidation;
 import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.Mode;
 import org.jboss.portal.portlet.PortletURL;
 import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.WindowState;
 import org.jboss.portal.portlet.state.AccessMode;
 import org.jboss.portal.wsrp.core.Fault;
 import org.jboss.portal.wsrp.core.MissingParametersFault;
@@ -80,7 +80,7 @@
 
    public static WindowState getJSR168WindowStateFromWSRPName(String wsrpWindowStateName)
    {
-      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(wsrpWindowStateName, WSRP_WINDOW_STATE_NAME);
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(wsrpWindowStateName, WSRP_WINDOW_STATE_NAME, null);
       WindowState windowState = (WindowState)WSRP_JSR168_WINDOW_STATES.get(wsrpWindowStateName);
       return (windowState == null) ? WindowState.create(wsrpWindowStateName) : windowState;
    }
@@ -93,7 +93,7 @@
       }
 
       // todo: how should we deal with solo?
-      ParameterValidation.throwIllegalArgExceptionIfEmpty(jsr168WindowStateName, WSRP_WINDOW_STATE_NAME);
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(jsr168WindowStateName, WSRP_WINDOW_STATE_NAME, null);
       String wsrpName = (String)JSR168_WSRP_WINDOW_STATES.get(jsr168WindowStateName);
       return (wsrpName == null) ? jsr168WindowStateName : wsrpName;
    }
@@ -106,7 +106,7 @@
 
    public static Mode getJSR168PortletModeFromWSRPName(String wsrpPortletModeName)
    {
-      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(wsrpPortletModeName, WSRP_MODE_NAME);
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(wsrpPortletModeName, WSRP_MODE_NAME, null);
       Mode mode = (Mode)WSRP_JSR168_MODES.get(wsrpPortletModeName);
       return (mode == null) ? Mode.create(wsrpPortletModeName) : mode;
    }
@@ -119,7 +119,7 @@
       }
 
       // todo: how should we deal with preview?
-      ParameterValidation.throwIllegalArgExceptionIfEmpty(jsr168PortletModeName, WSRP_MODE_NAME);
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(jsr168PortletModeName, WSRP_MODE_NAME, null);
       String wsrpName = (String)JSR168_WSRP_MODES.get(jsr168PortletModeName);
       return (wsrpName == null) ? jsr168PortletModeName : wsrpName;
    }

Modified: branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java	2006-10-03 23:02:26 UTC (rev 5323)
+++ branches/JBoss_Portal_Branch_2_4/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerSessionInformation.java	2006-10-03 23:27:44 UTC (rev 5324)
@@ -154,7 +154,7 @@
 
    public void addSessionForPortlet(String portletHandle, SessionContext sessionContext)
    {
-      ParameterValidation.throwIllegalArgExceptionIfNull(portletHandle, "portlet handle");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
 
       if (portletSessions == null)
       {
@@ -174,7 +174,7 @@
     */
    public String getSessionIdForPortlet(String portletHandle)
    {
-      ParameterValidation.throwIllegalArgExceptionIfNull(portletHandle, "portlet handle");
+      ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(portletHandle, "portlet handle", null);
 
       if (portletSessions == null)
       {
@@ -277,7 +277,7 @@
       public SessionInfo(SessionContext sessionContext)
       {
          ParameterValidation.throwIllegalArgExceptionIfNull(sessionContext, "SessionContext");
-         ParameterValidation.throwIllegalArgExceptionIfNull(sessionContext.getSessionID(), "session id");
+         ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(sessionContext.getSessionID(), "session id", "SessionContext");
 
          this.sessionContext = sessionContext;
          lastInvocationTime = System.currentTimeMillis();




More information about the jboss-svn-commits mailing list