Skip to content

Commit

Permalink
Fixing a bug that causes, in rare cases, completable futures to never…
Browse files Browse the repository at this point in the history
… complete in managemet client. (#21874)

Parsing xml description sometime can throw unexpected runtime exceptions and when that happens, those exceptions were not handled.
  • Loading branch information
yvgopal authored May 27, 2021
1 parent 0c50a04 commit d9b2a83
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 20 deletions.
2 changes: 1 addition & 1 deletion eng/spotbugs-aggregate-report/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>3.7.0-beta.1</version> <!-- {x-version-update;com.microsoft.azure:azure-servicebus;current} -->
<version>3.6.4</version> <!-- {x-version-update;com.microsoft.azure:azure-servicebus;current} -->
</dependency>
</dependencies>
<properties>
Expand Down
2 changes: 1 addition & 1 deletion eng/versioning/version_data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ com.microsoft.azure:azure-keyvault-cryptography;1.2.4;1.3.0-beta.1
com.microsoft.azure:azure-keyvault-extensions;1.2.4;1.3.0-beta.1
com.microsoft.azure:azure-keyvault-test;1.2.3;1.2.4
com.microsoft.azure:azure-keyvault-webkey;1.2.4;1.3.0-beta.1
com.microsoft.azure:azure-servicebus;3.6.3;3.7.0-beta.1
com.microsoft.azure:azure-servicebus;3.6.3;3.6.4
com.microsoft.azure:azure-storage;8.6.5;8.6.5
com.microsoft.azure:azure-storage-blob;11.0.2;11.0.2
com.microsoft.azure.msi_auth_token_provider:azure-authentication-msi-token-provider;1.1.0-beta.1;1.1.0-beta.1
Expand Down
2 changes: 1 addition & 1 deletion sdk/servicebus/microsoft-azure-servicebus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The package can be downloaded from [Maven](https://search.maven.org/artifact/com
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>3.6.3</version>
<version>3.6.4</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down
2 changes: 1 addition & 1 deletion sdk/servicebus/microsoft-azure-servicebus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-servicebus</artifactId>
<version>3.7.0-beta.1</version> <!-- {x-version-update;com.microsoft.azure:azure-servicebus;current} -->
<version>3.6.4</version> <!-- {x-version-update;com.microsoft.azure:azure-servicebus;current} -->

<name>Microsoft Azure SDK for Service Bus</name>
<description>Java library for Azure Service Bus. Please note, a newer package com.azure:azure-messaging-servicebus for Azure Service Bus is available as of December 2020. While this package will continue to receive critical bug fixes, we strongly encourage you to upgrade. Read the migration guide at https://aka.ms/azsdk/java/migrate/sb for more details.</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public CompletableFuture<NamespaceInfo> getNamespaceInfoAsync() {
} else {
try {
nsInfoFuture.complete(NamespaceInfoSerializer.parseFromContent(content));
} catch (ServiceBusException e) {
} catch (Exception e) {
nsInfoFuture.completeExceptionally(e);
}
}
Expand All @@ -138,7 +138,7 @@ public CompletableFuture<QueueDescription> getQueueAsync(String path) {
} else {
try {
qdFuture.complete(QueueDescriptionSerializer.parseFromContent(content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
qdFuture.completeExceptionally(e);
}
}
Expand All @@ -165,7 +165,7 @@ public CompletableFuture<QueueRuntimeInfo> getQueueRuntimeInfoAsync(String path)
} else {
try {
qdFuture.complete(QueueRuntimeInfoSerializer.parseFromContent(content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
qdFuture.completeExceptionally(e);
}
}
Expand All @@ -192,7 +192,7 @@ public CompletableFuture<TopicDescription> getTopicAsync(String path) {
} else {
try {
tdFuture.complete(TopicDescriptionSerializer.parseFromContent(content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
tdFuture.completeExceptionally(e);
}
}
Expand All @@ -219,7 +219,7 @@ public CompletableFuture<TopicRuntimeInfo> getTopicRuntimeInfoAsync(String path)
} else {
try {
tdFuture.complete(TopicRuntimeInfoSerializer.parseFromContent(content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
tdFuture.completeExceptionally(e);
}
}
Expand Down Expand Up @@ -249,7 +249,7 @@ public CompletableFuture<SubscriptionDescription> getSubscriptionAsync(String to
} else {
try {
sdFuture.complete(SubscriptionDescriptionSerializer.parseFromContent(topicPath, content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
sdFuture.completeExceptionally(e);
}
}
Expand Down Expand Up @@ -279,7 +279,7 @@ public CompletableFuture<SubscriptionRuntimeInfo> getSubscriptionRuntimeInfoAsyn
} else {
try {
sdFuture.complete(SubscriptionRuntimeInfoSerializer.parseFromContent(topicPath, content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
sdFuture.completeExceptionally(e);
}
}
Expand Down Expand Up @@ -311,7 +311,7 @@ public CompletableFuture<RuleDescription> getRuleAsync(String topicPath, String
} else {
try {
rdFuture.complete(RuleDescriptionSerializer.parseFromContent(content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
rdFuture.completeExceptionally(e);
}
}
Expand Down Expand Up @@ -352,7 +352,11 @@ public CompletableFuture<List<QueueDescription>> getQueuesAsync(int count, int s
if (ex != null) {
qdFuture.completeExceptionally(ex);
} else {
qdFuture.complete(QueueDescriptionSerializer.parseCollectionFromContent(content));
try {
qdFuture.complete(QueueDescriptionSerializer.parseCollectionFromContent(content));
} catch (Exception e) {
qdFuture.completeExceptionally(e);
}
}
return null;
}, MessagingFactory.INTERNAL_THREAD_POOL);
Expand Down Expand Up @@ -391,7 +395,11 @@ public CompletableFuture<List<TopicDescription>> getTopicsAsync(int count, int s
if (ex != null) {
tdFuture.completeExceptionally(ex);
} else {
tdFuture.complete(TopicDescriptionSerializer.parseCollectionFromContent(content));
try {
tdFuture.complete(TopicDescriptionSerializer.parseCollectionFromContent(content));
} catch (Exception e) {
tdFuture.completeExceptionally(e);
}
}
return null;
}, MessagingFactory.INTERNAL_THREAD_POOL);
Expand Down Expand Up @@ -434,7 +442,11 @@ public CompletableFuture<List<SubscriptionDescription>> getSubscriptionsAsync(St
if (ex != null) {
sdFuture.completeExceptionally(ex);
} else {
sdFuture.complete(SubscriptionDescriptionSerializer.parseCollectionFromContent(topicName, content));
try {
sdFuture.complete(SubscriptionDescriptionSerializer.parseCollectionFromContent(topicName, content));
} catch (Exception e) {
sdFuture.completeExceptionally(e);
}
}
return null;
}, MessagingFactory.INTERNAL_THREAD_POOL);
Expand Down Expand Up @@ -483,7 +495,11 @@ public CompletableFuture<List<RuleDescription>> getRulesAsync(String topicName,
if (ex != null) {
rulesFuture.completeExceptionally(ex);
} else {
rulesFuture.complete(RuleDescriptionSerializer.parseCollectionFromContent(content));
try {
rulesFuture.complete(RuleDescriptionSerializer.parseCollectionFromContent(content));
} catch (Exception e) {
rulesFuture.completeExceptionally(e);
}
}
return null;
}, MessagingFactory.INTERNAL_THREAD_POOL);
Expand Down Expand Up @@ -563,7 +579,7 @@ private CompletableFuture<QueueDescription> putQueueAsync(QueueDescription queue
} else {
try {
responseFuture.complete(QueueDescriptionSerializer.parseFromContent(content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
responseFuture.completeExceptionally(e);
}
}
Expand Down Expand Up @@ -627,7 +643,7 @@ private CompletableFuture<TopicDescription> putTopicAsync(TopicDescription topic
} else {
try {
responseFuture.complete(TopicDescriptionSerializer.parseFromContent(content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
responseFuture.completeExceptionally(e);
}
}
Expand Down Expand Up @@ -706,7 +722,7 @@ private CompletableFuture<SubscriptionDescription> putSubscriptionAsync(Subscrip
} else {
try {
responseFuture.complete(SubscriptionDescriptionSerializer.parseFromContent(subscriptionDescription.getTopicPath(), content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
responseFuture.completeExceptionally(e);
}
}
Expand Down Expand Up @@ -766,7 +782,7 @@ private CompletableFuture<RuleDescription> putRuleAsync(String topicName, String
} else {
try {
responseFuture.complete(RuleDescriptionSerializer.parseFromContent(content));
} catch (MessagingEntityNotFoundException e) {
} catch (Exception e) {
responseFuture.completeExceptionally(e);
}
}
Expand Down

0 comments on commit d9b2a83

Please sign in to comment.