From b280c59681d431a9d95d9c1ce7aac5d26f8374d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jiri=20Dan=C4=9Bk?= Date: Fri, 24 Mar 2023 21:51:31 +0100 Subject: [PATCH] Assorted jmslib and jakartalib fixups --- .../src/main/java/com/redhat/mqe/lib/ReceiverClient.java | 2 +- .../src/main/java/com/redhat/mqe/lib/SenderClient.java | 5 ++--- jmslib/src/main/java/com/redhat/mqe/lib/SenderClient.java | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/jakartalib/src/main/java/com/redhat/mqe/lib/ReceiverClient.java b/jakartalib/src/main/java/com/redhat/mqe/lib/ReceiverClient.java index 297ff98f..ce764994 100644 --- a/jakartalib/src/main/java/com/redhat/mqe/lib/ReceiverClient.java +++ b/jakartalib/src/main/java/com/redhat/mqe/lib/ReceiverClient.java @@ -155,7 +155,7 @@ private void unsubscribe() { try { session.unsubscribe(durableSubscriberName); } catch (JMSException e) { - LOG.error("Error while unsubscribing durable subscriptor " + durableSubscriberName); + LOG.error("Error while unsubscribing durable subscriber " + durableSubscriberName); e.printStackTrace(); } finally { close(session); diff --git a/jakartalib/src/main/java/com/redhat/mqe/lib/SenderClient.java b/jakartalib/src/main/java/com/redhat/mqe/lib/SenderClient.java index 4bdbfb4a..14848ccf 100644 --- a/jakartalib/src/main/java/com/redhat/mqe/lib/SenderClient.java +++ b/jakartalib/src/main/java/com/redhat/mqe/lib/SenderClient.java @@ -171,7 +171,7 @@ public void startClient() { doTransaction(session, senderOptions.getOption(ClientOptions.TX_ENDLOOP_ACTION).getValue()); } } catch (JMSException | IllegalArgumentException jmse) { - LOG.error("Error while sending a message!", jmse.getMessage()); + LOG.error("Error while sending a message! {}", jmse.getMessage()); jmse.printStackTrace(); System.exit(1); } finally { @@ -191,8 +191,7 @@ public void startClient() { protected static void setMessageProducer(ClientOptions senderOptions, MessageProducer producer) { try { // set delivery mode - durable/non-durable - String deliveryModeArg = senderOptions.getOption(ClientOptions.MSG_DURABLE).getValue().toLowerCase(); - int deliveryMode = (deliveryModeArg.equals("true") || deliveryModeArg.equals("yes")) + int deliveryMode = Utils.convertOptionToBoolean(senderOptions.getOption(ClientOptions.MSG_DURABLE).getValue()) ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT; producer.setDeliveryMode(deliveryMode); // set time to live of message if provided diff --git a/jmslib/src/main/java/com/redhat/mqe/lib/SenderClient.java b/jmslib/src/main/java/com/redhat/mqe/lib/SenderClient.java index 99a36752..0b9cd656 100644 --- a/jmslib/src/main/java/com/redhat/mqe/lib/SenderClient.java +++ b/jmslib/src/main/java/com/redhat/mqe/lib/SenderClient.java @@ -171,7 +171,7 @@ public void startClient() { doTransaction(session, senderOptions.getOption(ClientOptions.TX_ENDLOOP_ACTION).getValue()); } } catch (JMSException | IllegalArgumentException jmse) { - LOG.error("Error while sending a message!", jmse.getMessage()); + LOG.error("Error while sending a message! {}", jmse.getMessage()); jmse.printStackTrace(); System.exit(1); } finally { @@ -191,8 +191,7 @@ public void startClient() { protected static void setMessageProducer(ClientOptions senderOptions, MessageProducer producer) { try { // set delivery mode - durable/non-durable - String deliveryModeArg = senderOptions.getOption(ClientOptions.MSG_DURABLE).getValue().toLowerCase(); - int deliveryMode = (deliveryModeArg.equals("true") || deliveryModeArg.equals("yes")) + int deliveryMode = Utils.convertOptionToBoolean(senderOptions.getOption(ClientOptions.MSG_DURABLE).getValue()) ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT; producer.setDeliveryMode(deliveryMode); // set time to live of message if provided