This is an automated email from the ASF dual-hosted git repository.
thiagohp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/master by this push:
new fda8de0 TAP5-2689 preventing unknown value exception with sorted grid
in case of cached sorted column is not part of property model anymore.
fda8de0 is described below
commit fda8de0ea4dbe40a2999242be32d57f1217a9a39
Author: Benjamin Hartmann <[email protected]>
AuthorDate: Thu Aug 26 20:27:54 2021 +0200
TAP5-2689 preventing unknown value exception with sorted grid in case of
cached sorted column is not part of property model anymore.
---
.../main/java/org/apache/tapestry5/corelib/components/Grid.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
index 185f1b6..79e120b 100644
---
a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
+++
b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
@@ -418,12 +418,15 @@ public class Grid implements GridModel, ClientElement
public List<SortConstraint> getSortConstraints()
{
// In a few limited cases we may not have yet hit the SetupRender
phase, and the model may be null.
- if (paginationModel == null || paginationModel.getSortColumnId()
== null)
+ // Furthermore, because the sort column id is cached, an unknown
value exception must be prevented in case of dynamically created bean models
(e.g. usage of the 'include' parameter)
+ final BeanModel dataModel = getDataModel();
+
+ if ((paginationModel == null || paginationModel.getSortColumnId()
== null) ||
!(dataModel.getPropertyNames().contains(TapestryInternalUtils.extractIdFromPropertyExpression(paginationModel.getSortColumnId()))))
{
return Collections.emptyList();
}
- PropertyModel sortModel =
getDataModel().getById(paginationModel.getSortColumnId());
+ PropertyModel sortModel =
dataModel.getById(paginationModel.getSortColumnId());
SortConstraint constraint = new SortConstraint(sortModel,
getColumnSort());