diff --git a/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/EventMeshHttpConsumer.java b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/EventMeshHttpConsumer.java index bbbdf39d7e..476dc98952 100644 --- a/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/EventMeshHttpConsumer.java +++ b/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/http/consumer/EventMeshHttpConsumer.java @@ -98,8 +98,8 @@ public void subscribe(final List topicList, final String subsc try { final String subRes = HttpUtils.post(httpClient, target, subscribeParam); final EventMeshRetObj ret = JsonUtils.parseObject(subRes, EventMeshRetObj.class); - if (ret.getRetCode() != EventMeshRetCode.SUCCESS.getRetCode()) { - throw new EventMeshException(Object.requireNonNull(ret).getRetCode(), Object.requireNonNull(ret).getRetMsg()); + if (Object.requireNonNull(ret).getRetCode() != EventMeshRetCode.SUCCESS.getRetCode()) { + throw new EventMeshException(ret.getRetCode(),ret.getRetMsg()); } SUBSCRIPTIONS.addAll(topicList); } catch (Exception ex) { @@ -130,7 +130,7 @@ public void heartBeat(final List topicList, final String subsc final String res = HttpUtils.post(httpClient, target, requestParam); final EventMeshRetObj ret = JsonUtils.parseObject(res, EventMeshRetObj.class); if (EventMeshRetCode.SUCCESS.getRetCode() != Object.requireNonNull(ret).getRetCode()) { - throw new EventMeshException(Object.requireNonNull(ret).getRetCode(), Object.requireNonNull(ret).getRetMsg()); + throw new EventMeshException(ret.getRetCode(),ret.getRetMsg()); } } catch (Exception e) { log.error("send heartBeat error", e); @@ -158,7 +158,7 @@ public void unsubscribe(final List topicList, final String unSubscribeUr final EventMeshRetObj ret = JsonUtils.parseObject(unSubRes, EventMeshRetObj.class); if (EventMeshRetCode.SUCCESS.getRetCode() != Object.requireNonNull(ret).getRetCode()) { - throw new EventMeshException(Object.requireNonNull(ret).getRetCode(), Object.requireNonNull (ret).getRetMsg()); + throw new EventMeshException(ret.getRetCode(),ret.getRetMsg()); } // todo: avoid concurrentModifiedException SUBSCRIPTIONS.removeIf(item -> topicList.contains(item.getTopic()));