Huh, ISTR hearing from a reputable source that substring didn't return a view of the same backing array due to creating uncollectable garbage. But I just checked the relevant JRE bug[1] and it seems to be working-as-intended.

I agree it is not an issue here due to the typically small number of trailing leading slashes.

[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4513622