From 4faf810643add119e6d85b5f9c8d91333295c3fc Mon Sep 17 00:00:00 2001 From: horoc Date: Thu, 3 Nov 2022 20:02:55 +0800 Subject: [PATCH] fix CI error: protocol http --- .../protocol/http/HttpProtocolAdaptor.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java b/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java index 3b729f970f..31c1f2be8b 100644 --- a/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java +++ b/eventmesh-protocol-plugin/eventmesh-protocol-http/src/main/java/org/apache/eventmesh/protocol/http/HttpProtocolAdaptor.java @@ -17,8 +17,11 @@ package org.apache.eventmesh.protocol.http; -import com.fasterxml.jackson.core.type.TypeReference; -import io.cloudevents.CloudEvent; +import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.CONSTANTS_KEY_BODY; +import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.CONSTANTS_KEY_HEADERS; +import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.CONSTANTS_KEY_METHOD; +import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.CONSTANTS_KEY_PATH; + import org.apache.eventmesh.common.Constants; import org.apache.eventmesh.common.protocol.ProtocolTransportObject; import org.apache.eventmesh.common.protocol.http.HttpEventWrapper; @@ -34,7 +37,10 @@ import java.util.Map; import java.util.Set; -import static org.apache.eventmesh.protocol.http.HttpProtocolConstant.*; +import io.cloudevents.CloudEvent; + +import com.fasterxml.jackson.core.type.TypeReference; + /** * CloudEvents protocol adaptor, used to transform CloudEvents message to CloudEvents message. @@ -92,8 +98,8 @@ public ProtocolTransportObject fromCloudEvent(CloudEvent cloudEvent) throws Prot // ce data if (null != cloudEvent.getData()) { Map dataContentMap = JsonUtils.deserialize(new String(cloudEvent.getData().toBytes(), Constants.DEFAULT_CHARSET), - new TypeReference>() { - }); + new TypeReference>() { + }); String requestHeader = JsonUtils.serialize(dataContentMap.get(CONSTANTS_KEY_HEADERS)); byte[] requestBody = JsonUtils.serialize(dataContentMap.get(CONSTANTS_KEY_BODY)).getBytes(StandardCharsets.UTF_8); Map requestHeaderMap = JsonUtils.deserialize(requestHeader, new TypeReference>() {