issue5432: avoid of serialization exception for javax.validation.ConstraintViolationException (#5672)
This commit is contained in:
parent
a9a69eac67
commit
0f99cb65c3
|
|
@ -27,6 +27,8 @@ import org.apache.dubbo.rpc.RpcException;
|
|||
import org.apache.dubbo.validation.Validation;
|
||||
import org.apache.dubbo.validation.Validator;
|
||||
|
||||
import javax.validation.ValidationException;
|
||||
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.CONSUMER;
|
||||
import static org.apache.dubbo.common.constants.CommonConstants.PROVIDER;
|
||||
import static org.apache.dubbo.common.constants.FilterConstants.VALIDATION_KEY;
|
||||
|
|
@ -89,6 +91,9 @@ public class ValidationFilter implements Filter {
|
|||
}
|
||||
} catch (RpcException e) {
|
||||
throw e;
|
||||
} catch (ValidationException e) {
|
||||
// only use exception's message to avoid potential serialization issue
|
||||
return AsyncRpcResult.newDefaultAsyncResult(new ValidationException(e.getMessage()), invocation);
|
||||
} catch (Throwable t) {
|
||||
return AsyncRpcResult.newDefaultAsyncResult(t, invocation);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue