From 5c5bf941f33488931b3fe42d67cde379de092489 Mon Sep 17 00:00:00 2001 From: Warren Zhu Date: Fri, 6 Jul 2018 10:26:48 +0800 Subject: [PATCH] Use more specific runtime exception when service bus key empty --- .../servicebus/factory/AbstractServiceBusSenderFactory.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spring-integration-azure/src/main/java/com/microsoft/azure/spring/integration/servicebus/factory/AbstractServiceBusSenderFactory.java b/spring-integration-azure/src/main/java/com/microsoft/azure/spring/integration/servicebus/factory/AbstractServiceBusSenderFactory.java index b1a49d80..b37d51c0 100644 --- a/spring-integration-azure/src/main/java/com/microsoft/azure/spring/integration/servicebus/factory/AbstractServiceBusSenderFactory.java +++ b/spring-integration-azure/src/main/java/com/microsoft/azure/spring/integration/servicebus/factory/AbstractServiceBusSenderFactory.java @@ -12,6 +12,7 @@ import com.microsoft.azure.management.servicebus.ServiceBusNamespace; import com.microsoft.azure.servicebus.primitives.ConnectionStringBuilder; import com.microsoft.azure.spring.cloud.context.core.AzureAdmin; import com.microsoft.azure.spring.integration.core.Memoizer; +import com.microsoft.azure.spring.integration.servicebus.ServiceBusRuntimeException; import org.springframework.lang.NonNull; import org.springframework.util.Assert; @@ -40,7 +41,7 @@ public abstract class AbstractServiceBusSenderFactory implements ServiceBusSende return namespace.authorizationRules().list().stream().findFirst().map(AuthorizationRule::getKeys) .map(AuthorizationKeys::primaryConnectionString) .map(s -> new ConnectionStringBuilder(s, name).toString()).orElseThrow( - () -> new RuntimeException(String.format("Service bus namespace '%s' key is empty", name), - null)); + () -> new ServiceBusRuntimeException( + String.format("Service bus namespace '%s' key is empty", name), null)); } }