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

        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.
        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.

          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