Author: thomas.heute(a)jboss.com
Date: 2008-02-04 06:31:55 -0500 (Mon, 04 Feb 2008)
New Revision: 9740
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletUtilsTestCase.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
modules/portlet/trunk/test/src/test/resources/test/local-jboss-unit.xml
Log:
JBPORTAL-1875: RenderResponse.getNamespace() generates a not correct value
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2008-02-04
11:26:00 UTC (rev 9739)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletUtils.java 2008-02-04
11:31:55 UTC (rev 9740)
@@ -109,7 +109,8 @@
for (int i = 0; i < windowId.length(); i++)
{
char c = windowId.charAt(i);
- if (Character.isLetterOrDigit(c))
+ int charVal = c;
+ if ((charVal >= 65 && charVal <= 90) || (charVal >= 97
&& charVal <= 122) || (charVal >=48 && charVal <= 57) || (charVal
== 95) || charVal == 36)
{
tmp.append(c);
}
Added:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletUtilsTestCase.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletUtilsTestCase.java
(rev 0)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletUtilsTestCase.java 2008-02-04
11:31:55 UTC (rev 9740)
@@ -0,0 +1,21 @@
+package org.jboss.portal.portlet.test;
+
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+
+import static org.jboss.unit.api.Assert.*;
+
+public class PortletUtilsTestCase {
+
+ public void testgenerateNamespaceFrom()
+ {
+ String name = "_09azAZ$";
+ assertEquals(PortletUtils.PREFIX + name + PortletUtils.SUFFIX,
PortletUtils.generateNamespaceFrom(name));
+
+ name = "_";
+ assertEquals(PortletUtils.PREFIX + "_" + PortletUtils.SUFFIX,
PortletUtils.generateNamespaceFrom(name));
+
+ name = "_é";
+ assertEquals(PortletUtils.PREFIX + "__e9" + PortletUtils.SUFFIX,
PortletUtils.generateNamespaceFrom(name));
+ }
+
+}
Modified: modules/portlet/trunk/test/src/test/resources/test/local-jboss-unit.xml
===================================================================
--- modules/portlet/trunk/test/src/test/resources/test/local-jboss-unit.xml 2008-02-04
11:26:00 UTC (rev 9739)
+++ modules/portlet/trunk/test/src/test/resources/test/local-jboss-unit.xml 2008-02-04
11:31:55 UTC (rev 9740)
@@ -5,6 +5,10 @@
xsi:schemaLocation="urn:jboss:jboss-unit:1.0 jboss-unit_1_0.xsd">
<pojo>
<test>
+ <class
name="org.jboss.portal.portlet.test.PortletUtilsTestCase">
+ </class>
+ </test>
+ <test>
<class
name="org.jboss.portal.portlet.test.url.DecoderTestCase">
</class>
</test>
Show replies by date