Skip to content

Commit

Permalink
Remove unnecessary warnings in administration client (#37915)
Browse files Browse the repository at this point in the history
* Removing extraneous warning logs.

* Add CHANGELOG entry.
  • Loading branch information
conniey authored Dec 4, 2023
1 parent 5d2cfe6 commit 6e86a45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 2 additions & 0 deletions sdk/servicebus/azure-messaging-servicebus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

- Removes extraneous log messages when deserializing topics or subscriptions. ([32325](https://github.com/Azure/azure-sdk-for-java/issues/32325))

### Other Changes

## 7.15.0-beta.5 (2023-11-22)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,11 +432,8 @@ private <T> T deserialize(Object object, Class<T> clazz) {
Response<QueueProperties> deserializeQueue(Response<Object> response) {
final QueueDescriptionEntryImpl entry = deserialize(response.getValue(), QueueDescriptionEntryImpl.class);

// This was an empty response (ie. 204).
if (entry == null) {
return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null);
} else if (entry.getContent() == null) {
logger.info("entry.getContent() is null. The entity may not exist. {}", entry);
// This was an empty response (ie. 204) or the entity does not exist.
if (entry == null || entry.getContent() == null) {
return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null);
} else if (entry.getContent().getQueueDescription() == null) {
final TopicDescriptionEntryImpl entryTopic = deserialize(response.getValue(), TopicDescriptionEntryImpl.class);
Expand All @@ -455,11 +452,8 @@ Response<QueueProperties> deserializeQueue(Response<Object> response) {
Response<TopicProperties> deserializeTopic(Response<Object> response) {
final TopicDescriptionEntryImpl entry = deserialize(response.getValue(), TopicDescriptionEntryImpl.class);

// This was an empty response (ie. 204).
if (entry == null) {
return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null);
} else if (entry.getContent() == null) {
logger.warning("entry.getContent() is null. There should have been content returned. Entry: {}", entry);
// This was an empty response (i.e. 204) or the entity does not exist.
if (entry == null || entry.getContent() == null) {
return new SimpleResponse<>(response.getRequest(), response.getStatusCode(), response.getHeaders(), null);
} else if (entry.getContent().getTopicDescription() == null) {
final QueueDescriptionEntryImpl entryQueue = deserialize(response.getValue(), QueueDescriptionEntryImpl.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,21 @@ public String serialize(Object object, SerializerEncoding encoding) throws IOExc

// This hack is here because value of custom property within RuleFilter should have a namespace like
// xmlns:d6p1="http://www.w3.org/2001/XMLSchema" ns0:type="d6p1:string".
// It is possible that there is no "Value" to set in the rule.
if (CreateRuleBodyImpl.class.equals(clazz)) {
final Matcher filterValue = FILTER_VALUE_PATTERN.matcher(replaced);
if (filterValue.find()) {
replaced = filterValue.replaceAll(RULE_VALUE_ATTRIBUTE_XML);
} else {
LOGGER.warning("Could not find filter name pattern '{}' in {}.", FILTER_VALUE_PATTERN.pattern(),
contents);
}
}

// This hack is here because RuleFilter and RuleAction type="Foo" should have a namespace like n0:type="Foo".
// It is possible that there is no RuleFilter or RuleAction type. (i.e. creating a subscription with its
// default rule.)
final Matcher filterType = FILTER_ACTION_PATTERN.matcher(replaced);
if (filterType.find()) {
return filterType.replaceAll("<$1 xmlns:ns0=\"http://www.w3.org/2001/XMLSchema-instance\" ns0:type=");
} else {
LOGGER.warning("Could not find filter name pattern '{}' in {}.", FILTER_ACTION_PATTERN.pattern(),
contents);
return replaced;
}
}
Expand Down

0 comments on commit 6e86a45

Please sign in to comment.