Tapestry
  1. Tapestry
  2. TAPESTRY-1315

Context expression without period results in StringIndexOutOfBoundsException

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0.8
    • Component/s: tapestry-ioc
    • Labels:
      None
    • Environment:
      Tapestry 5.0.2, Windows XP

      Description

      A context expression that does not include at least one period (for example "context:/blah") results in a StringIndexOutOfBoundsException.
      "String index out of range: -1"

      1. java.lang.String.substring(String.java:1768)
      2. org.apache.tapestry.ioc.internal.util.LocalizedNameGenerator.<init>(LocalizedNameGenerator.java:68)
      3. org.apache.tapestry.ioc.internal.util.AbstractResource.forLocale(AbstractResource.java:101)
      4. org.apache.tapestry.internal.services.AssetSourceImpl.findRelativeAsset(AssetSourceImpl.java:93)
      5. org.apache.tapestry.internal.services.AssetSourceImpl.findAsset(AssetSourceImpl.java:87)
      6. org.example.myapp.components.PageStyle.setup(PageStyle.java:30)
        .
        .
      1. LocalizedNameGeneratorTest.java
        2 kB
        Paul Cooley
      2. LocalizedNameGenerator.java
        5 kB
        Paul Cooley

        Activity

        Mike D Pilsbury created issue -
        Mike D Pilsbury made changes -
        Field Original Value New Value
        Summary Context expression with period results in StringIndexOutOfBoundsException Context expression without period results in StringIndexOutOfBoundsException
        Hide
        Paul Cooley added a comment -

        Proposed fix for cases where there is no "." in the suffix. Unless there is some specific need to further parse the "path," then it seems as though using the entire path for inclusion is applicable.

        For instance, if a user passes in the path "context:/blah", then its localized name should be "context:/blah_LOCALE." While this is not necessarily an advised manner to handle names in the localized space, it should keep the current StringOutOfBoundsException from occurring.

        Show
        Paul Cooley added a comment - Proposed fix for cases where there is no "." in the suffix. Unless there is some specific need to further parse the "path," then it seems as though using the entire path for inclusion is applicable. For instance, if a user passes in the path "context:/blah", then its localized name should be "context:/blah_LOCALE." While this is not necessarily an advised manner to handle names in the localized space, it should keep the current StringOutOfBoundsException from occurring.
        Paul Cooley made changes -
        Attachment LocalizedNameGenerator.java [ 12360534 ]
        Attachment LocalizedNameGeneratorTest.java [ 12360533 ]
        Howard M. Lewis Ship made changes -
        Assignee Howard M. Lewis Ship [ hlship ]
        Hide
        Howard M. Lewis Ship added a comment -

        A patch is generally easier to use than files, but thanks anyway.

        Show
        Howard M. Lewis Ship added a comment - A patch is generally easier to use than files, but thanks anyway.
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Howard M. Lewis Ship made changes -
        Resolution Fixed [ 1 ]
        Fix Version/s 5.0.8 [ 12312898 ]
        Status In Progress [ 3 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12398705 ] Default workflow, editable Closed status [ 12569182 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12569182 ] jira [ 12592119 ]

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Mike D Pilsbury
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development