Author: julien(a)jboss.com
Date: 2007-01-20 21:11:45 -0500 (Sat, 20 Jan 2007)
New Revision: 6060
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
Log:
- rename PortletUtils checkRenderParameter* methods to checkPortletParameter*Validity
instead
- updated the javadoc of those methods to describe what they do
Modified:
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java 2007-01-21
01:48:01 UTC (rev 6059)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java 2007-01-21
02:11:45 UTC (rev 6060)
@@ -152,7 +152,7 @@
public void setRenderParameters(Map map)
{
- PortletUtils.checkRenderParameterMap(map);
+ PortletUtils.checkPortletParameterMapValidity(map);
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
@@ -168,7 +168,7 @@
public void setRenderParameter(String name, String value)
{
- PortletUtils.checkRenderParameter(name, value);
+ PortletUtils.checkPortletParameterValidity(name, value);
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
@@ -184,7 +184,7 @@
public void setRenderParameter(String name, String[] values)
{
- PortletUtils.checkRenderParameter(name, values);
+ PortletUtils.checkPortletParameterValidity(name, values);
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java 2007-01-21
01:48:01 UTC (rev 6059)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java 2007-01-21
02:11:45 UTC (rev 6060)
@@ -94,7 +94,7 @@
/** @throws IllegalArgumentException if the name is null */
public void setParameter(String name, String value)
{
- PortletUtils.checkRenderParameter(name, value);
+ PortletUtils.checkPortletParameterValidity(name, value);
//
url.getInternalParameters().setValue(name, value);
@@ -102,7 +102,7 @@
public void setParameter(String name, String[] values)
{
- PortletUtils.checkRenderParameter(name, values);
+ PortletUtils.checkPortletParameterValidity(name, values);
//
url.getInternalParameters().setValues(name, values);
@@ -110,7 +110,7 @@
public void setParameters(Map parameters)
{
- PortletUtils.checkRenderParameterMap(parameters);
+ PortletUtils.checkPortletParameterMapValidity(parameters);
//
url.getInternalParameters().replace(parameters);
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
---
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-21
01:48:01 UTC (rev 6059)
+++
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2007-01-21
02:11:45 UTC (rev 6060)
@@ -37,10 +37,21 @@
*/
public class PortletUtils
{
- public static final String PREFIX = "jbpns";
- public static final String SUFFIX = "snpbj";
+ private static final String PREFIX = "jbp";
- public static void checkRenderParameterMap(Map map)
+ /**
+ * Check that provided map follow the constraints :
+ * <ul>
+ * <li>Not null</li>
+ * <li>Keys are non null string</li>
+ * <li>Values are non null string arrays</li>
+ * </ul>
+ * If a constraint is not respected then an IllegalArgumentException is thrown.
+ *
+ * @param map the map to check
+ * @throws IllegalArgumentException
+ */
+ public static void checkPortletParameterMapValidity(Map map) throws
IllegalArgumentException
{
if (map == null)
{
@@ -70,7 +81,12 @@
}
}
- public static void checkRenderParameter(String name, String value)
+ /**
+ * Check that the passed argument are non null otherwise throw an
IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ public static void checkPortletParameterValidity(String name, String value) throws
IllegalArgumentException
{
if (name == null)
{
@@ -82,7 +98,12 @@
}
}
- public static void checkRenderParameter(String name, String[] values)
+ /**
+ * Check that the passed argument are non null otherwise throw an
IllegalArgumentException.
+ *
+ * @throws IllegalArgumentException
+ */
+ public static void checkPortletParameterValidity(String name, String[] values) throws
IllegalArgumentException
{
if (name == null)
{
@@ -170,7 +191,7 @@
{
StringBuffer tmp = new StringBuffer(PREFIX.length() + windowId.length() * 2);
tmp.append(PREFIX);
- for (int i = 0; i < windowId.length(); i++)
+ for (int i = 0;i < windowId.length();i++)
{
char c = windowId.charAt(i);
if (Character.isLetterOrDigit(c))
@@ -184,7 +205,6 @@
tmp.append(Character.forDigit((((int)c) & 0X0F), 16));
}
}
- tmp.append(SUFFIX);
return tmp.toString();
}
}
Show replies by date