Tapestry
  1. Tapestry
  2. TAPESTRY-1343

Under Tomcat, a root path URL such as http://.../context (without a trailing slash) causes a StringIndexOutOfBoundsException inside PageRenderDispatcher

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.3
    • Fix Version/s: 5.0.3
    • Component/s: None
    • Labels:
      None
    • Environment:
      linux, tomcat4 ("connected" to apache1.3 via modjk), java 1.5

      Description

      PageRenderDispatcher.dispatch assumes that request.getPath() will always return at least "/". However, it is possible with tomcat for getPath() to return an empty string.
      http://www.foo.com/context will return an empty string in tomcat (not in jetty).

      1. TAPESTRY-1343.patch
        1 kB
        Robert Zeigler
      2. TestPageRenderDispatcher.java
        1 kB
        Robert Zeigler

        Activity

        Robert Zeigler created issue -
        Hide
        Robert Zeigler added a comment -

        TestNG test class to illustrate the problem.

        Show
        Robert Zeigler added a comment - TestNG test class to illustrate the problem.
        Robert Zeigler made changes -
        Field Original Value New Value
        Attachment TestPageRenderDispatcher.java [ 12353117 ]
        Hide
        Robert Zeigler added a comment -

        patch to fix the issue. Uses ioc's Defense.notBlank to check for the blank string.

        Show
        Robert Zeigler added a comment - patch to fix the issue. Uses ioc's Defense.notBlank to check for the blank string.
        Robert Zeigler made changes -
        Attachment TAPESTRY-1343.patch [ 12353119 ]
        Howard M. Lewis Ship made changes -
        Summary StringIndexOutOfBoundsException thrown when trying to find page name when request.getPath() returns an empty string. Under Tomcat, a root path URL such as http://.../context (without a trailing slash) causes a StringIndexOutOfBoundsException inside PageRenderDispatcher
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Howard M. Lewis Ship [ hlship ]
        Resolution Fixed [ 1 ]
        Hide
        Howard M. Lewis Ship added a comment -

        Robert ... triggering a thrown exception to avoid a call to String.equals("") is not exactly efficient Thanks for the problem description and I hope this fixes your issue.

        Show
        Howard M. Lewis Ship added a comment - Robert ... triggering a thrown exception to avoid a call to String.equals("") is not exactly efficient Thanks for the problem description and I hope this fixes your issue.
        Hide
        Robert Zeigler added a comment -

        My first version (which, obviously, I didn't use) just had a String.equals call. But then I remembered seeing the "notBlank" method elsewhere in the code, and wondered if that would be preferable for the sake of consistency in the code. Either way, it should fix the issue.

        Robert

        Show
        Robert Zeigler added a comment - My first version (which, obviously, I didn't use) just had a String.equals call. But then I remembered seeing the "notBlank" method elsewhere in the code, and wondered if that would be preferable for the sake of consistency in the code. Either way, it should fix the issue. Robert
        Mark Thomas made changes -
        Workflow jira [ 12399349 ] Default workflow, editable Closed status [ 12569193 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569193 ] jira [ 12590446 ]

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Robert Zeigler
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development