Commit 647b5383 authored by Jung Seungho's avatar Jung Seungho Committed by Jee Hyeok Kim

[IOT-1599] fix message publish in MQ

removed logic for checking 'message' property
https://jira.iotivity.org/browse/IOT-1599

Change-Id: I1edc3eb68d97156ce3befe44205e2d1ff6006b7c
Signed-off-by: default avatarJung Seungho <shonest.jung@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14715Reviewed-by: default avatarUze Choi <uzchoi@samsung.com>
Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: default avatarJee Hyeok Kim <jihyeok13.kim@samsung.com>
parent da4ccd54
......@@ -121,8 +121,8 @@ public class Topic {
*/
public IResponse handleCreateSubtopic(IRequest request) {
String newTopicName = request.getUriPathSegments().get(
request.getUriPathSegments().size() - 1);
String newTopicName = request.getUriPathSegments()
.get(request.getUriPathSegments().size() - 1);
String newTopicType = new String();
......@@ -209,8 +209,8 @@ public class Topic {
}
synchronized (mSubscribers) {
mSubscribers.put(request.getRequestId(), new TopicSubscriber(
srcDevice, request));
mSubscribers.put(request.getRequestId(),
new TopicSubscriber(srcDevice, request));
}
return MessageBuilder.createResponse(request, ResponseStatus.CONTENT,
......@@ -229,8 +229,8 @@ public class Topic {
synchronized (mSubscribers) {
TopicSubscriber subscriber = mSubscribers.get(request
.getRequestId());
TopicSubscriber subscriber = mSubscribers
.get(request.getRequestId());
mSubscribers.remove(subscriber.mRequest.getRequestId());
......@@ -263,10 +263,8 @@ public class Topic {
HashMap<String, Object> message = mCbor.parsePayloadFromCbor(payload,
HashMap.class);
if (message == null
|| message.containsKey(Constants.MQ_MESSAGE) == false) {
throw new PreconditionFailedException(
"message field is not included");
if (message == null || message.isEmpty()) {
throw new PreconditionFailedException("message is not included");
}
if (mKafkaProducerOperator.publishMessage(payload) == false) {
......@@ -336,8 +334,8 @@ public class Topic {
synchronized (mSubscribers) {
for (TopicSubscriber subscriber : mSubscribers.values()) {
subscriber.mSubscriber.sendResponse(MessageBuilder
.createResponse(subscriber.mRequest,
subscriber.mSubscriber.sendResponse(
MessageBuilder.createResponse(subscriber.mRequest,
ResponseStatus.CONTENT,
ContentFormat.APPLICATION_CBOR, mLatestData));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment