Skip to content

Commit

Permalink
fix npe bug
Browse files Browse the repository at this point in the history
  • Loading branch information
codewindy committed Oct 26, 2022
1 parent 0ad1972 commit 51e749d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@ public ProtocolTransportObject fromCloudEvent(CloudEvent cloudEvent) throws Prot
}
httpEventWrapper.setSysHeaderMap(sysHeaderMap);
// ce data
Map<String, Object> dataContentMap = JsonUtils.deserialize(new String(cloudEvent.getData().toBytes(), Constants.DEFAULT_CHARSET),
String jsonStr = new String(cloudEvent.getData().toBytes(), Constants.DEFAULT_CHARSET);
if (StringUtils.isNotBlank(jsonStr)) {
Map<String, Object> dataContentMap = JsonUtils.deserialize(jsonStr,
new TypeReference<Map<String, Object>>() {});
}

String requestHeader = JsonUtils.serialize(dataContentMap.get(CONSTANTS_KEY_HEADERS));
byte[] requestBody = JsonUtils.serialize(dataContentMap.get(CONSTANTS_KEY_BODY)).getBytes(StandardCharsets.UTF_8);
Expand Down

0 comments on commit 51e749d

Please sign in to comment.