Browse Source
Merge pull request #14550 from irynamatveieva/fix/tests
Added null checks for Calculated Field output during update comparison
pull/14557/head
Viacheslav Klimov
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
7 additions and
5 deletions
-
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
|
|
|
|
var thisOutputStrategy = calculatedField.getConfiguration().getOutput().getStrategy(); |
|
|
|
var otherOutputStrategy = other.getCalculatedField().getConfiguration().getOutput().getStrategy(); |
|
|
|
if (thisOutputStrategy.hasRefreshContextOnlyChanges(otherOutputStrategy)) { |
|
|
|
return true; |
|
|
|
if (output != null) { |
|
|
|
var thisOutputStrategy = output.getStrategy(); |
|
|
|
var otherOutputStrategy = other.getCalculatedField().getConfiguration().getOutput().getStrategy(); |
|
|
|
if (thisOutputStrategy.hasRefreshContextOnlyChanges(otherOutputStrategy)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
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)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (output.hasContextOnlyChanges(other.output)) { |
|
|
|
if (output != null && output.hasContextOnlyChanges(other.output)) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
if (calculatedField.getConfiguration() instanceof SimpleCalculatedFieldConfiguration thisConfig |
|
|
|
|