Browse Source

added null check for output

pull/14550/head
IrynaMatveieva 10 months ago
parent
commit
e68c0012cb
  1. 12
      application/src/main/java/org/thingsboard/server/service/cf/ctx/state/CalculatedFieldCtx.java

12
application/src/main/java/org/thingsboard/server/service/cf/ctx/state/CalculatedFieldCtx.java

@ -637,10 +637,12 @@ public class CalculatedFieldCtx implements Closeable {
} }
public boolean hasRefreshContextOnlyChanges(CalculatedFieldCtx other) { // has changes that do not require state recalculation public boolean hasRefreshContextOnlyChanges(CalculatedFieldCtx other) { // has changes that do not require state recalculation
var thisOutputStrategy = calculatedField.getConfiguration().getOutput().getStrategy(); if (output != null) {
var otherOutputStrategy = other.getCalculatedField().getConfiguration().getOutput().getStrategy(); var thisOutputStrategy = output.getStrategy();
if (thisOutputStrategy.hasRefreshContextOnlyChanges(otherOutputStrategy)) { var otherOutputStrategy = other.getCalculatedField().getConfiguration().getOutput().getStrategy();
return true; if (thisOutputStrategy.hasRefreshContextOnlyChanges(otherOutputStrategy)) {
return true;
}
} }
if (calculatedField.getConfiguration() instanceof EntityAggregationCalculatedFieldConfiguration thisConfig if (calculatedField.getConfiguration() instanceof EntityAggregationCalculatedFieldConfiguration thisConfig
@ -657,7 +659,7 @@ public class CalculatedFieldCtx implements Closeable {
if (calculatedField.getConfiguration() instanceof ExpressionBasedCalculatedFieldConfiguration && !Objects.equals(expression, other.expression)) { if (calculatedField.getConfiguration() instanceof ExpressionBasedCalculatedFieldConfiguration && !Objects.equals(expression, other.expression)) {
return true; return true;
} }
if (output.hasContextOnlyChanges(other.output)) { if (output != null && output.hasContextOnlyChanges(other.output)) {
return true; return true;
} }
if (calculatedField.getConfiguration() instanceof SimpleCalculatedFieldConfiguration thisConfig if (calculatedField.getConfiguration() instanceof SimpleCalculatedFieldConfiguration thisConfig

Loading…
Cancel
Save