jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
693 stars 124 forks source link

Better handling of PivotTable misconfiguration #3823

Closed knstvk closed 4 days ago

knstvk commented 3 weeks ago

Jmix 2.4.0

Add a pivot table to a view and connect to a data container:

<pvttbl:pivotTable dataContainer="operationsDc"/>

You will get an NPE at runtime:

java.lang.NullPointerException: Cannot invoke "java.util.Map.entrySet()" because the return value of "io.jmix.pivottableflowui.kit.component.model.PivotTableOptions.getProperties()" is null
    at io.jmix.pivottableflowui.kit.component.JmixPivotTable.lambda$performUpdateItems$5(JmixPivotTable.java:829)

This is what a user will do when using the component for the first time. Let's handle this error and show something more friendly than NPE.

SergeiAksenov2 commented 4 days ago

Tested on: 1) Jmix version: 2.5.999-SNAPSHOT Jmix Studio plugin version: 2.4.SNAPSHOT6961-243 IntelliJ version: IntelliJ IDEA 2024.3 (Community Edition) 2) Jmix version: 2.5.999-SNAPSHOT Jmix Studio plugin version: 2.4.SNAPSHOT6960-242 IntelliJ version: IntelliJ IDEA 2024.2.4 (Community Edition)