A colleague already filed this JIRA last year:

PageTester causes StringIndexOutOfBoundsException with query parameter
https://issues.apache.org/jira/browse/TAP5-1770

While you're at it, you may also wish to patch TestableRequestImpl
with the following:

@Override
public TestableRequest clear() {
        parameters.clear();

        /* ---- MUNKY PATCH 
---------------------------------------------------- */
        // Fudge for T5 PageTester not clearing down Request Attributes
        // Needed to clear the OpenSpringSessionInViewFilter.FILTERED flag
        attributes.clear();
        /* ---- MUNKY PATCH 
---------------------------------------------------- */

        return this;
}

@Override
public TestableRequest setPath(String path) {
        /* ---- MUNKY PATCH 
---------------------------------------------------- */
        // strip any anchor information off the path URL 'cos
        //  1. it's not supposed to be there
        //  2. T5 throws up if it finds it!
        if (path.contains("#")) {
                path = path.substring(0, path.indexOf('#'));
        }
        /* ---- MUNKY PATCH 
---------------------------------------------------- */
        this.path = path;
        return this;
}

--
Steve Eynon
-------------------------------
"If at first you don't succeed,
   so much for skydiving!"



On 19 June 2012 06:47, Karan Rajanayagam <karan.rajanaya...@dossier.no> wrote:
>
> PageTester cant handle query string.. for ex. an link like:
>  admin/clazz/edit?schoolYearId=0
>
>
> Im getting StringIndexOutOfBounds because an error in PageTester class.,
>
>
> PageTester class we have:
>
> /  private void setupRequestFromURI(String URI)
>    {
>        String linkPath = stripContextFromPath(URI);
>
>        int comma = linkPath.indexOf('?');
>
>        String path = comma < 0 ? linkPath : linkPath.substring(0, comma);
>
>        request.clear().setPath(path);
>
>        if (comma > 0)
> *            decodeParametersIntoRequest(path.substring(comma + 1));*
>    }
> /
> Last line should rather be:
> *  decodeParametersIntoRequest(*linkPath*.substring(comma + 1));*
>
> Shall i fire a bug ?
> --
>  Kind regards
> *Karan Rajanayagam*

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to