tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Lin (Created) (JIRA)" <...@tapestry.apache.org>
Subject [jira] [Created] (TAPESTRY-2785) [T5.3] - PageTester causes StringIndexOutOfBoundsException for any page request path with query parameter
Date Thu, 01 Dec 2011 01:51:40 GMT
[T5.3] - PageTester causes StringIndexOutOfBoundsException for any page request path with query

                 Key: TAPESTRY-2785
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2785
             Project: Tapestry
          Issue Type: Bug
          Components: tapestry-test
            Reporter: Kevin Lin

I was running a web test using the latest source code from testify on a T5.3 application.
And I get the following exception for any tests that contains a request/event:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
	at java.lang.String.substring(String.java:1937)
	at java.lang.String.substring(String.java:1904)
	at org.apache.tapestry5.test.PageTester.setupRequestFromURI(PageTester.java:345)
	at org.apache.tapestry5.test.PageTester.setupRequestFromLink(PageTester.java:331)
	at org.apache.tapestry5.test.PageTester.runComponentEventRequest(PageTester.java:313)
	at org.apache.tapestry5.test.PageTester.clickLinkAndReturnResponse(PageTester.java:264)

At bit digging through the code shows that there is mostly a coding bug in org.apache.tapestry5.test.PageTester#setupRequestFromURI()
    private void setupRequestFromURI(String URI)
        String linkPath = stripContextFromPath(URI);
        int comma = linkPath.indexOf('?');
        String path = comma < 0 ? linkPath : linkPath.substring(0, comma);
        if (comma > 0)
            decodeParametersIntoRequest(path.substring(comma + 1));

The path variable is the URL path with the event parameters (?xxx) stripped, trying to substring
it again cause the IndexOutOfBounds exception. The correct variable to pass should instead
be: linkPath. A comparison with the same class file confirms my findings.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message