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

Check if a queue exists but the name is used for a topic and vice versa #19513

Merged
merged 2 commits into from
Jun 3, 2021
Merged
Changes from all 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 @@ -2229,6 +2229,12 @@ private Response<QueueProperties> deserializeQueue(Response<Object> response) {
} else if (entry.getContent() == null) {
logger.info("entry.getContent() is null. The entity may not exist. {}", entry);
return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null);
} else if (entry.getContent().getQueueDescription() == null) {
frascu marked this conversation as resolved.
Show resolved Hide resolved
final TopicDescriptionEntry entryTopic = deserialize(response.getValue(), TopicDescriptionEntry.class);
if (entryTopic != null && entryTopic.getContent() != null && entryTopic.getContent().getTopicDescription() != null) {
logger.warning("'{}' is not a queue, it is a topic.", entryTopic.getTitle());
return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null);
}
}

final QueueProperties result = EntityHelper.toModel(entry.getContent().getQueueDescription());
Expand Down Expand Up @@ -2308,6 +2314,12 @@ private Response<TopicProperties> deserializeTopic(Response<Object> response) {
} else if (entry.getContent() == null) {
logger.warning("entry.getContent() is null. There should have been content returned. Entry: {}", entry);
return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null);
} else if (entry.getContent().getTopicDescription() == null) {
final QueueDescriptionEntry entryQueue = deserialize(response.getValue(), QueueDescriptionEntry.class);
if (entryQueue != null && entryQueue.getContent() != null && entryQueue.getContent().getQueueDescription() != null) {
logger.warning("'{}' is not a topic, it is a queue.", entryQueue.getTitle());
return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null);
}
}

final TopicProperties result = EntityHelper.toModel(entry.getContent().getTopicDescription());
Expand Down