ArrayIndexOutOfBoundsException when use PF datatable exporter programmatically
See original GitHub issueHi, Our system is generating the pages programmatically, we used to use datatable exporter in PFExt, but when we upgraded the versions we moved to use the one in PF, and now we got the below exception.
Mojarra JSF 2.3.14 (Specification 2.3) Primefaces 11.0.0 Weblogic 14.1.1.0.0 Java 1.8
I have attached a very simple project which generate datatable and exporter, when we tried to use the exporter we got the below exception. Thanks
<h:form id="mainForm" enctype="multipart/form-data">
<pe:layout id="mainLayout" fullPage="true" widgetVar="mainLayout">
<pe:layoutPane id="otbo-main" resizable="false" position="center" >
<h:panelGroup id="applicationRoot" binding="#{rootBean.rootApp}" />
</pe:layoutPane>
</pe:layout>
</h:form>
//create dataTable
private void initDataTable() {
DataTable dataTable = (DataTable) getApplication().createComponent( DataTable.COMPONENT_TYPE);
dataTable.setId("myDataTable");
dataTable.setVar( "row" );
dataTable.setLazy( false );
dataTable.setResizableColumns( true );
dataTable.setReflow( true );
dataTable.setRowKey("name");
createExporters( dataTable );
addColumn("Name", "name", dataTable);
addColumn("City", "city", dataTable);
addColumn("Age", "age", dataTable);
dataTable.setValueExpression( "value", createValueExpression( "#{rootBean.data}", List.class ));
addChild(rootApp, dataTable);
}
//create exporter
private void createExporters( DataTable dataTable ) {
CommandLink link = createComponent( CommandLink.COMPONENT_TYPE );
link.setValue("Export table");
DataExporter exporter = new DataExporter( createValueExpression( dataTable.getId(), String.class ),
createValueExpression( "xlsx", String.class ), createValueExpression( "excelOut", String.class ),
null, null, null, null, null, null, null);
link.addActionListener( exporter );
HtmlPanelGroup group = createComponent( HtmlPanelGroup.COMPONENT_TYPE );
addChild( group, link );
addChild(rootApp, group);
}
<09-Feb-2022 11:21:26,012 o’clock GMT> <Error> <javax.enterprise.resource.webcontainer.jsf.context> <BEA-000000> <java.lang.ArrayIndexOutOfBoundsException: 10 at javax.faces.component.UIComponentBase.restoreChildState(UIComponentBase.java:3418) at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1026) at javax.faces.component.UIComponentBase.restoreFacetsState(UIComponentBase.java:3445) at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1029) at javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:932)
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (5 by maintainers)
thanks. I update the JSF implementation to higher version and it worked
Cool I added the workaround label to this ticket thanks for reporting back!