chkal/pf-issue-test — Issue #121: Empty segments aren't handled correctly
Author: chkal
Created: 2012-03-06 07:39:29+00:00
State: open
Labels: Priority-Medium, Type-Defect

Originally filed by **chkalt** on 2011-10-24T16:59:27

Google Code issue: http://code.google.com/p/prettyfaces/issues/detail?id=123

Reported by a user on the forum:

http://ocpsoft.com/support/topic/url-rewrite-with-empty-parameters-in-the-url

I had a look at this issue and built a test that reproduces this:

assertEquals("/test//", new URL("/test//").decode().toURL());

This test fails! The full test is attached to the ticket. I think the root cause is this line in the URL constructor:

String[] segments = trimmedUrl.split("/");

It seems like split() doesn't work as expected here (because the / at the end of the string) and so the empty segment is lost.

Unfortunately I've currently not much time to look into this. Hopefully later. :)