From 23608ab6b6f60ab57698abc1e02d9adbdeec2604 Mon Sep 17 00:00:00 2001 From: Isuru Wijesiri Date: Tue, 28 May 2024 18:49:12 +0530 Subject: [PATCH] Handle all malformed channel and connection closing errors --- .../message/store/impl/rabbitmq/RabbitMQProducer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/core/src/main/java/org/apache/synapse/message/store/impl/rabbitmq/RabbitMQProducer.java b/modules/core/src/main/java/org/apache/synapse/message/store/impl/rabbitmq/RabbitMQProducer.java index eca0a1debc..f1ef3197a5 100644 --- a/modules/core/src/main/java/org/apache/synapse/message/store/impl/rabbitmq/RabbitMQProducer.java +++ b/modules/core/src/main/java/org/apache/synapse/message/store/impl/rabbitmq/RabbitMQProducer.java @@ -112,17 +112,17 @@ public boolean storeMessage(MessageContext synCtx) { if (channel != null) { try { channel.close(); - } catch (IOException | TimeoutException exception) { + } catch (Exception channelCloseException) { log.error("Error occurred while closing the malformed channel Error: " + - exception.getLocalizedMessage()); + channelCloseException.getLocalizedMessage()); } } if (connection != null) { try { connection.close(); - } catch (IOException ioException) { + } catch (Exception connectionCloseException) { log.error("Error occurred while closing the malformed connection Error: " + - ioException.getLocalizedMessage()); + connectionCloseException.getLocalizedMessage()); } } channel = null;