Commit be6e30dbc2a058ee907ee31b3c554401e5a6a70b
Merge branch '20220322' into 'master'
20220322 See merge request huang/thingsboard3.3.2!72
Showing
2 changed files
with
5 additions
and
1 deletions
@@ -43,6 +43,7 @@ import org.thingsboard.server.common.data.exception.ThingsboardException; | @@ -43,6 +43,7 @@ import org.thingsboard.server.common.data.exception.ThingsboardException; | ||
43 | import org.thingsboard.server.common.data.yunteng.core.Result; | 43 | import org.thingsboard.server.common.data.yunteng.core.Result; |
44 | import org.thingsboard.server.common.data.yunteng.core.exception.ThingsKitException; | 44 | import org.thingsboard.server.common.data.yunteng.core.exception.ThingsKitException; |
45 | import org.thingsboard.server.common.msg.tools.TbRateLimitsException; | 45 | import org.thingsboard.server.common.msg.tools.TbRateLimitsException; |
46 | +import org.thingsboard.server.dao.exception.DataValidationException; | ||
46 | import org.thingsboard.server.service.security.exception.AuthMethodNotSupportedException; | 47 | import org.thingsboard.server.service.security.exception.AuthMethodNotSupportedException; |
47 | import org.thingsboard.server.service.security.exception.JwtExpiredTokenException; | 48 | import org.thingsboard.server.service.security.exception.JwtExpiredTokenException; |
48 | import org.thingsboard.server.service.security.exception.UserPasswordExpiredException; | 49 | import org.thingsboard.server.service.security.exception.UserPasswordExpiredException; |
@@ -134,6 +135,9 @@ public class ThingsboardErrorResponseHandler extends ResponseEntityExceptionHand | @@ -134,6 +135,9 @@ public class ThingsboardErrorResponseHandler extends ResponseEntityExceptionHand | ||
134 | handleAuthenticationException((AuthenticationException) exception, response); | 135 | handleAuthenticationException((AuthenticationException) exception, response); |
135 | }else if(exception instanceof ThingsKitException){ | 136 | }else if(exception instanceof ThingsKitException){ |
136 | handleThingsKitException((ThingsKitException)exception, response); | 137 | handleThingsKitException((ThingsKitException)exception, response); |
138 | + }else if(exception instanceof DataValidationException){ | ||
139 | + response.setStatus(HttpStatus.BAD_REQUEST.value()); | ||
140 | + mapper.writeValue(response.getWriter(), exception.getMessage()); | ||
137 | } | 141 | } |
138 | else { | 142 | else { |
139 | response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); | 143 | response.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); |
@@ -114,7 +114,7 @@ class TriggerState { | @@ -114,7 +114,7 @@ class TriggerState { | ||
114 | } | 114 | } |
115 | AlarmEvalResult evalResult = evalFunction.apply(ruleState, data); | 115 | AlarmEvalResult evalResult = evalFunction.apply(ruleState, data); |
116 | if (AlarmEvalResult.TRUE.equals(evalResult)) { | 116 | if (AlarmEvalResult.TRUE.equals(evalResult)) { |
117 | - stateUpdate = true; | 117 | + stateUpdate = clearAlarmState(stateUpdate, ruleState); |
118 | } else if (AlarmEvalResult.FALSE.equals(evalResult)) { | 118 | } else if (AlarmEvalResult.FALSE.equals(evalResult)) { |
119 | stateUpdate = clearAlarmState(stateUpdate, ruleState); | 119 | stateUpdate = clearAlarmState(stateUpdate, ruleState); |
120 | } | 120 | } |