Tapestry 5
  1. Tapestry 5
  2. TAP5-135

Attempting to set a default sort constraint on the Grid will cause an NullPointerException inside Grid.getSortConstraints()

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 5.0.15
    • Fix Version/s: 5.0.16
    • Component/s: None
    • Labels:
      None

      Description

      After I click the header of a grid column to sort by that header, I receive a NPE from Grid.getSortContraints.

        Issue Links

          Activity

          Hide
          Martin Grotzke added a comment -

          We're also experiencing this issue and it prevents us from upgrading from T-5.0.14 to a newer version.
          Unfortunately we're also affected by TAPESTRY-2561 from time to time and therefore really want to upgrade to the latest T5.

          Show
          Martin Grotzke added a comment - We're also experiencing this issue and it prevents us from upgrading from T-5.0.14 to a newer version. Unfortunately we're also affected by TAPESTRY-2561 from time to time and therefore really want to upgrade to the latest T5.
          Hide
          Howard M. Lewis Ship added a comment -

          Obviously, grid sorting is tested as part of T5's integration test suite. I need some help determining how to reproduce this bug. Templates, code samples, etc.

          Show
          Howard M. Lewis Ship added a comment - Obviously, grid sorting is tested as part of T5's integration test suite. I need some help determining how to reproduce this bug. Templates, code samples, etc.
          Hide
          Axel Mannhardt added a comment - - edited

          We are affected when using a workaround for default sorting. Basically we update the grid sort constraints if none are set. That works with Tapestry 5.0.14, but fails in 5.0.15 with a Nullpointer because initialization changed. Used is now "dataModel" (instead of "model" previously) which is initialized on setupRender - too late for the example below.

          public class Index
          {

          private BeanModel<TestRow> _testModel;

          @Inject
          private BeanModelSource _beanModelSource;

          @Inject
          private Messages _messages;

          @Component(id="testGrid")
          private Grid _grid;

          private List<TestRow> _testSource = new ArrayList<TestRow>();

          { _testSource.add(new TestRow("c")); _testSource.add(new TestRow("a")); _testSource.add(new TestRow("b")); }

          public static class TestRow {
          private String _testCol;
          public TestRow(String s) { _testCol = s; }
          public String getTestCol() { return _testCol; }
          public void setTestCol(String testCol) { _testCol = testCol; }
          }

          public void setupRender() {
          _testModel = _beanModelSource.create(TestRow.class, false, _messages);
          if ( _grid.getSortModel().getSortContraints().isEmpty() ) { _grid.getSortModel().updateSort("testCol"); }
          }

          public List<TestRow> getTestSource() { return _testSource; }
          public void setTestSource(List<TestRow> testSource) { this._testSource = testSource; }
          public BeanModel<TestRow> getTestModel() { return _testModel; }
          }


          public class Index
          {

          private BeanModel<TestRow> _testModel;

          @Inject
          private BeanModelSource _beanModelSource;

          @Inject
          private Messages _messages;

          @Component(id="testGrid")
          private Grid _grid;

          private List<TestRow> _testSource = new ArrayList<TestRow>();
          { _testSource.add(new TestRow("c")); _testSource.add(new TestRow("a")); _testSource.add(new TestRow("b")); }

          public static class TestRow {
          private String _testCol;

          public TestRow(String s)

          { _testCol = s; }

          public String getTestCol()

          { return _testCol; }

          public void setTestCol(String testCol)

          { _testCol = testCol; }

          }

          public void setupRender() {

          _testModel = _beanModelSource.create(TestRow.class, false, _messages);

          if ( _grid.getSortModel().getSortContraints().isEmpty() )

          { _grid.getSortModel().updateSort("testCol"); }

          }

          public List<TestRow> getTestSource()

          { return _testSource; }

          public void setTestSource(List<TestRow> testSource)

          { this._testSource = testSource; }

          public BeanModel<TestRow> getTestModel()

          { return _testModel; }

          }

          -------

          [...]
          <t:grid
          t:id="testGrid"
          t:source="testSource"
          t:model="testModel"/>
          [...]

          Show
          Axel Mannhardt added a comment - - edited We are affected when using a workaround for default sorting. Basically we update the grid sort constraints if none are set. That works with Tapestry 5.0.14, but fails in 5.0.15 with a Nullpointer because initialization changed. Used is now "dataModel" (instead of "model" previously) which is initialized on setupRender - too late for the example below. public class Index { private BeanModel<TestRow> _testModel; @Inject private BeanModelSource _beanModelSource; @Inject private Messages _messages; @Component(id="testGrid") private Grid _grid; private List<TestRow> _testSource = new ArrayList<TestRow>(); { _testSource.add(new TestRow("c")); _testSource.add(new TestRow("a")); _testSource.add(new TestRow("b")); } public static class TestRow { private String _testCol; public TestRow(String s) { _testCol = s; } public String getTestCol() { return _testCol; } public void setTestCol(String testCol) { _testCol = testCol; } } public void setupRender() { _testModel = _beanModelSource.create(TestRow.class, false, _messages); if ( _grid.getSortModel().getSortContraints().isEmpty() ) { _grid.getSortModel().updateSort("testCol"); } } public List<TestRow> getTestSource() { return _testSource; } public void setTestSource(List<TestRow> testSource) { this._testSource = testSource; } public BeanModel<TestRow> getTestModel() { return _testModel; } } public class Index { private BeanModel<TestRow> _testModel; @Inject private BeanModelSource _beanModelSource; @Inject private Messages _messages; @Component(id="testGrid") private Grid _grid; private List<TestRow> _testSource = new ArrayList<TestRow>(); { _testSource.add(new TestRow("c")); _testSource.add(new TestRow("a")); _testSource.add(new TestRow("b")); } public static class TestRow { private String _testCol; public TestRow(String s) { _testCol = s; } public String getTestCol() { return _testCol; } public void setTestCol(String testCol) { _testCol = testCol; } } public void setupRender() { _testModel = _beanModelSource.create(TestRow.class, false, _messages); if ( _grid.getSortModel().getSortContraints().isEmpty() ) { _grid.getSortModel().updateSort("testCol"); } } public List<TestRow> getTestSource() { return _testSource; } public void setTestSource(List<TestRow> testSource) { this._testSource = testSource; } public BeanModel<TestRow> getTestModel() { return _testModel; } } ------- [...] <t:grid t:id="testGrid" t:source="testSource" t:model="testModel"/> [...]

            People

            • Assignee:
              Howard M. Lewis Ship
              Reporter:
              Andy Huhn
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development