Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Management Bug #22122

Merged
merged 3 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,13 @@ private Mono<Void> isAuthorized() {
.next()
.switchIfEmpty(Mono.error(new AmqpException(false, "Did not get response from tokenManager: " + entityPath, getErrorContext())))
.handle((response, sink) -> {
if (response != AmqpResponseCode.ACCEPTED && response != AmqpResponseCode.OK) {
if (RequestResponseUtils.isSuccessful(response)) {
sink.complete();
} else {
final String message = String.format("User does not have authorization to perform operation "
+ "on entity [%s]. Response: [%s]", entityPath, response);
sink.error(ExceptionUtil.amqpResponseCodeToException(response.getValue(), message,
getErrorContext()));

} else {
sink.complete();
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,14 @@ private <T> Mono<T> getProperties(Map<String, Object> properties, Class<T> respo
.handle((message, sink) -> {
if (RequestResponseUtils.isSuccessful(message)) {
sink.next(messageSerializer.deserialize(message, responseType));
}

final AmqpResponseCode statusCode = RequestResponseUtils.getStatusCode(message);
final String statusDescription = RequestResponseUtils.getStatusDescription(message);
final Throwable error = ExceptionUtil.amqpResponseCodeToException(statusCode.getValue(),
statusDescription, channel.getErrorContext());
} else {
final AmqpResponseCode statusCode = RequestResponseUtils.getStatusCode(message);
final String statusDescription = RequestResponseUtils.getStatusDescription(message);
final Throwable error = ExceptionUtil.amqpResponseCodeToException(statusCode.getValue(),
statusDescription, channel.getErrorContext());

sink.error(logger.logExceptionAsWarning(Exceptions.propagate(error)));
sink.error(logger.logExceptionAsWarning(Exceptions.propagate(error)));
}
}));
});
}
Expand Down