From 01967c6a1b73d43517e756031f560b266ca70bfd Mon Sep 17 00:00:00 2001 From: Amalka Subasinghe Date: Fri, 21 Apr 2023 22:44:43 +0530 Subject: [PATCH] bug fix is extracting payload --- .../device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java index 5ae262b9a..ad1c149b7 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/src/main/java/org/wso2/carbon/device/mgt/input/adapter/mqtt/util/MQTTAdapterListener.java @@ -199,7 +199,7 @@ public class MQTTAdapterListener implements MqttCallback, Runnable { public void messageArrived(String topic, MqttMessage mqttMessage) throws Exception { try { String mqttMsgString = mqttMessage.toString(); - String msgText = mqttMsgString.substring(mqttMsgString.indexOf("{"), mqttMsgString.indexOf("}") +1); + String msgText = mqttMsgString.substring(mqttMsgString.indexOf("{"), mqttMsgString.lastIndexOf("}") + 1); if (log.isDebugEnabled()) { log.debug(msgText); }