Tapestry
  1. Tapestry
  2. TAPESTRY-1925

Obscure exception when a Collection (not a List) is used as a GridDataSource

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.0.6
    • Fix Version/s: 5.0.7
    • Component/s: Core Components
    • Labels:
      None

      Description

      Tapestry throws an exception when providing an empty collection, such as java.util.Collections.EMPTY_SET, to the Grid component as the source parameter. The message is of the form "tried to access class java.util.Collections$EmptySet from clas $PropertyConduit_XXX".

      It appears to be a case of not knowing which type of class to use, rather than just using the interface.

      1. TAPESTRY-1925_(2).patch
        4 kB
        Kevin Menard
      2. TAPESTRY-1925.patch
        4 kB
        Kevin Menard

        Activity

        Hide
        Kevin Menard added a comment -

        Updated the type coercion to work with any Collection type. Although the grid does expect to be able to reference items by index, implying a defined iteration order, this invariant should be held by the fact that grid wraps up the collection as a List anyway.

        I added a test that simply checks for the non-existence of an error page when a Set is used as a grid source. There's probably a better way to test, but I'm still getting my feet wet.

        Show
        Kevin Menard added a comment - Updated the type coercion to work with any Collection type. Although the grid does expect to be able to reference items by index, implying a defined iteration order, this invariant should be held by the fact that grid wraps up the collection as a List anyway. I added a test that simply checks for the non-existence of an error page when a Set is used as a grid source. There's probably a better way to test, but I'm still getting my feet wet.
        Hide
        Kevin Menard added a comment -

        I failed to update the javadocs in the last one. This patch corrects that.

        Show
        Kevin Menard added a comment - I failed to update the javadocs in the last one. This patch corrects that.
        Hide
        Howard M. Lewis Ship added a comment -

        Looks like the GridSetDemo class was omitted as well. I think I can make it up.

        Show
        Howard M. Lewis Ship added a comment - Looks like the GridSetDemo class was omitted as well. I think I can make it up.
        Hide
        Kevin Menard added a comment -

        Thanks for adding the GridSetDemo.java. I did have one written, but it looks like it didn't get added to the patch. I'll chock it up to using a new IDE. Fortunately it was simple enough, so thanks for providing one.

        Show
        Kevin Menard added a comment - Thanks for adding the GridSetDemo.java. I did have one written, but it looks like it didn't get added to the patch. I'll chock it up to using a new IDE. Fortunately it was simple enough, so thanks for providing one.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development