From ea040be817b26e77b37f17e19b03807c2f0702b0 Mon Sep 17 00:00:00 2001 From: Dmitry Taimanov Date: Wed, 10 Aug 2022 12:39:41 +0400 Subject: [PATCH] NPE occurs after adding dynamic attribute manually to a table. Spotbugs jmix-framework/jmix#855 --- .../io/jmix/ui/component/impl/AbstractDataGrid.java | 1 - .../java/io/jmix/ui/component/impl/AbstractTable.java | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/jmix-ui/ui/src/main/java/io/jmix/ui/component/impl/AbstractDataGrid.java b/jmix-ui/ui/src/main/java/io/jmix/ui/component/impl/AbstractDataGrid.java index e9c93908e5..acb4826477 100644 --- a/jmix-ui/ui/src/main/java/io/jmix/ui/component/impl/AbstractDataGrid.java +++ b/jmix-ui/ui/src/main/java/io/jmix/ui/component/impl/AbstractDataGrid.java @@ -1930,7 +1930,6 @@ public ActionsPermissions getActionsPermissions() { } protected List> getInitialVisibleColumns() { - MetaClass metaClass = getEntityDataGridItems().getEntityMetaClass(); return columnsOrder.stream() .filter(column -> { MetaPropertyPath propertyPath = column.getPropertyPath(); diff --git a/jmix-ui/ui/src/main/java/io/jmix/ui/component/impl/AbstractTable.java b/jmix-ui/ui/src/main/java/io/jmix/ui/component/impl/AbstractTable.java index d506ef0446..2107115114 100644 --- a/jmix-ui/ui/src/main/java/io/jmix/ui/component/impl/AbstractTable.java +++ b/jmix-ui/ui/src/main/java/io/jmix/ui/component/impl/AbstractTable.java @@ -736,10 +736,8 @@ public void setEditable(boolean editable) { } } - protected void enableEditableColumns(EntityTableItems entityTableSource, + protected void enableEditableColumns(@SuppressWarnings("unused") EntityTableItems entityTableSource, //backward compatibility //todo remove in minor release Collection propertyIds) { - MetaClass metaClass = entityTableSource.getEntityMetaClass(); - List editableColumns = new ArrayList<>(propertyIds.size()); for (MetaPropertyPath propertyId : propertyIds) { UiEntityAttributeContext attributeContext = @@ -1573,8 +1571,8 @@ && getComponent().getJTestId() == null) { } } - protected List getPropertyColumns(EntityTableItems entityTableSource, List> columnsOrder) { - MetaClass entityMetaClass = entityTableSource.getEntityMetaClass(); + protected List getPropertyColumns(@SuppressWarnings("unused") EntityTableItems entityTableSource, //backward compatibility //todo remove in minor release + List> columnsOrder) { return columnsOrder.stream() .filter(c -> { MetaPropertyPath propertyPath = c.getMetaPropertyPath(); @@ -2336,10 +2334,9 @@ protected void createStubsForGeneratedColumns() { } } - protected List getInitialVisibleColumnIds(EntityTableItems entityTableSource) { + protected List getInitialVisibleColumnIds(@SuppressWarnings("unused") EntityTableItems entityTableSource) {//backward compatibility //todo remove in minor release List result = new ArrayList<>(); - MetaClass metaClass = entityTableSource.getEntityMetaClass(); for (Column column : columnsOrder) { if (column.getId() instanceof MetaPropertyPath) { MetaPropertyPath propertyPath = (MetaPropertyPath) column.getId();