primefaces: Datatable throws ListDataModel cast exception
I think there was a bug introduced somewhere due to #7391, because this didn’t happen for us on 10.0.5 and suddenly appeared on 10.0.6. The problem happens when selecting rows in a filtered datatable with lazy model.
Caused by: java.lang.ClassCastException: class pl...DataModel cannot be cast to class java.util.List (pl...DataModel is in unnamed module of loader 'deployment...-web-1.war' @3428e777; java.util.List is in module java.base of loader 'bootstrap')
at javax.faces.api@3.0.0.SP04//javax.faces.model.ListDataModel.setWrappedData(ListDataModel.java:200)
at deployment...-web-1.war//org.primefaces.model.SelectableDataModelWrapper.<init>(SelectableDataModelWrapper.java:31)
at deployment...-web-1.war//org.primefaces.component.datatable.DataTable.updateValue(DataTable.java:306)
at deployment...-web-1.war//org.primefaces.component.datatable.feature.SelectionFeature.decode(SelectionFeature.java:55)
at deployment...-web-1.war//org.primefaces.component.datatable.DataTableRenderer.decode(DataTableRenderer.java:65)
at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponentBase.decode(UIComponentBase.java:509)
at deployment...-web-1.war//org.primefaces.component.api.UIData.processDecodes(UIData.java:109)
at com.sun.jsf-impl@2.3.14.SP04//com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback.visit(PartialViewContextImpl.java:606)
at com.sun.jsf-impl@2.3.14.SP04//com.sun.faces.component.visit.PartialVisitContext.invokeVisitCallback(PartialVisitContext.java:159)
at deployment...-web-1.war//org.primefaces.component.api.UIData.visitTree(UIData.java:683)
at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
at deployment...-web-1.war//org.primefaces.component.api.UITabPanel.visitTree(UITabPanel.java:931)
at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
at javax.faces.api@3.0.0.SP04//javax.faces.component.UIForm.visitTree(UIForm.java:355)
at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
at javax.faces.api@3.0.0.SP04//javax.faces.component.UIComponent.visitTree(UIComponent.java:1468)
at com.sun.jsf-impl@2.3.14.SP04//com.sun.faces.context.PartialViewContextImpl.processComponents(PartialViewContextImpl.java:400)
at com.sun.jsf-impl@2.3.14.SP04//com.sun.faces.context.PartialViewContextImpl.processPartial(PartialViewContextImpl.java:261)
(lazy data model descendant class name and deployment name redacted)
In the old code this part of SelectionFeature
if (isFiltered) {
table.updateValue(originalValue);
}
called this part of UIData:
public void setValue(Object value) {
setDataModel(null);
getStateHelper().put(PropertyKeys.value, value);
}
and it worked. Now it calls the code you see in the stack trace. That code expects originalValue to be a list, while it gets a LazyDataModel from datatable’s getValue().
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 23 (11 by maintainers)
Commits related to this issue
- #7737: integrationtests — committed to christophs78/primefaces by christophs78 3 years ago
- #7737: integrationtests — committed to christophs78/primefaces by christophs78 3 years ago
- #7737: integrationtests (DataTable + lazy + filter + single/multiple selection) (#7741) * #7737: integrationtests * #7737: integrationtests — committed to primefaces/primefaces by christophs78 3 years ago
- #7737: integrationtests (DataTable + lazy + filter + selectionMode="single") — committed to christophs78/primefaces by christophs78 3 years ago
- #7737: integrationtests (DataTable + lazy + filter + selectionMode="single") — committed to christophs78/primefaces by christophs78 3 years ago
- #7737: integrationtests (DataTable + lazy + filter + selectionMode="single") (#7743) — committed to primefaces/primefaces by christophs78 3 years ago
created a issue for the jitpack issue
i cant replicate it with a snapshot, however i dont know if i make something wrong
@sqores @mertsincan can you have a look? i really suggest to release 11.0 as 10.1 and get rid of all that datatable issues easily.
i will also ping PrimeTek in the team chat and likely close that issue then, thats only elite.
@morvael I tested with 10.0.6 and 11.0.0-SNAPSHOT. Yes it doesn’t work with 10.0.6 and it works with 11.0.0-SNAPSHOT. I’ll try to fix it for the next elite version.