Author: julien(a)jboss.com
Date: 2007-10-18 18:08:06 -0400 (Thu, 18 Oct 2007)
New Revision: 8705
Modified:
modules/common/trunk/common/pom.xml
modules/common/trunk/common/src/main/java/org/jboss/portal/common/text/FastURLDecoder.java
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/text/FastURLDecoderTestCase.java
modules/common/trunk/common/src/test/resources/implode/foo.sar/bar.war/index.jsp
Log:
JBPORTAL-1759 : FastURLDecoder with malformed input %FC throws an
ArrayIndexOutOfBoundsException instead of throwing MalformedInputException
Modified: modules/common/trunk/common/pom.xml
===================================================================
--- modules/common/trunk/common/pom.xml 2007-10-18 20:42:33 UTC (rev 8704)
+++ modules/common/trunk/common/pom.xml 2007-10-18 22:08:06 UTC (rev 8705)
@@ -145,6 +145,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
+<!--
+ <forkMode>never</forkMode>
+ <argLine>-enableassertions</argLine>
+-->
<excludes>
<exclude>org/jboss/portal/test/common/BundleNameParserTestCase*.java</exclude>
<exclude>org/jboss/portal/test/common/net/URLNavigatorTestCase.java</exclude>
Modified:
modules/common/trunk/common/src/main/java/org/jboss/portal/common/text/FastURLDecoder.java
===================================================================
---
modules/common/trunk/common/src/main/java/org/jboss/portal/common/text/FastURLDecoder.java 2007-10-18
20:42:33 UTC (rev 8704)
+++
modules/common/trunk/common/src/main/java/org/jboss/portal/common/text/FastURLDecoder.java 2007-10-18
22:08:06 UTC (rev 8705)
@@ -252,19 +252,19 @@
tmp.append(' ');
break;
case ESCAPE:
- if (i + 2 > length)
- {
- throw new MalformedInputException("Not enough chars to decode an
escaped value length should have been" +
- (i + 2) + " but is " + length);
- }
-
- //
int j = i;
//
LookupNonTerm current = root;
while (true)
{
+ if (j + 2 > length)
+ {
+ throw new MalformedInputException("Not enough chars to decode
an escaped value length should have been" +
+ (j + 2) + " but is " + length);
+ }
+
+ //
char c1 = chars[j++];
char c2 = chars[j++];
Modified:
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/text/FastURLDecoderTestCase.java
===================================================================
---
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/text/FastURLDecoderTestCase.java 2007-10-18
20:42:33 UTC (rev 8704)
+++
modules/common/trunk/common/src/test/java/org/jboss/portal/test/common/text/FastURLDecoderTestCase.java 2007-10-18
22:08:06 UTC (rev 8705)
@@ -203,6 +203,14 @@
catch (MalformedInputException expected)
{
}
+ try
+ {
+ encoder.encode("%FC", new CharBuffer());
+ fail();
+ }
+ catch (MalformedInputException expected)
+ {
+ }
//
if (strict)
Modified:
modules/common/trunk/common/src/test/resources/implode/foo.sar/bar.war/index.jsp
===================================================================
---
modules/common/trunk/common/src/test/resources/implode/foo.sar/bar.war/index.jsp 2007-10-18
20:42:33 UTC (rev 8704)
+++
modules/common/trunk/common/src/test/resources/implode/foo.sar/bar.war/index.jsp 2007-10-18
22:08:06 UTC (rev 8705)
@@ -0,0 +1 @@
+<%@ page language="java" %>
\ No newline at end of file