Skip to content

Commit 37e8c5a

Browse files
authored
Merge e3c0657 into 0f7278f
2 parents 0f7278f + e3c0657 commit 37e8c5a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

eventmesh-protocol-plugin/eventmesh-protocol-cloudevents/src/main/java/org/apache/eventmesh/protocol/cloudevents/resolver/http/SendMessageBatchV2ProtocolResolver.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.apache.commons.lang3.StringUtils;
2929

3030
import java.nio.charset.StandardCharsets;
31+
import java.util.Objects;
3132

3233
import io.cloudevents.CloudEvent;
3334
import io.cloudevents.SpecVersion;
@@ -62,7 +63,7 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
6263

6364
CloudEvent event = null;
6465
if (StringUtils.equals(SpecVersion.V1.toString(), protocolVersion)) {
65-
event = EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE)
66+
event = Objects.requireNonNull(EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE))
6667
.deserialize(content.getBytes(StandardCharsets.UTF_8));
6768
event = CloudEventBuilder.from(event)
6869
.withExtension(ProtocolKey.REQUEST_CODE, code)
@@ -81,7 +82,7 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
8182
.withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, producerGroup)
8283
.build();
8384
} else if (StringUtils.equals(SpecVersion.V03.toString(), protocolVersion)) {
84-
event = EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE)
85+
event = Objects.requireNonNull(EventFormatProvider.getInstance().resolveFormat(JsonFormat.CONTENT_TYPE))
8586
.deserialize(content.getBytes(StandardCharsets.UTF_8));
8687
event = CloudEventBuilder.from(event)
8788
.withExtension(ProtocolKey.REQUEST_CODE, code)

0 commit comments

Comments
 (0)