pandaapo commented on code in PR #4337:
URL: https://github.com/apache/eventmesh/pull/4337#discussion_r1285751650
##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/common/EventMeshCloudEventUtils.java:
##########
@@ -380,7 +292,7 @@ public static Map<String, String> getAttributes(final
CloudEvent cloudEvent) {
if (Objects.isNull(cloudEvent)) {
return new HashMap<>(0);
}
- Map<String, CloudEventAttributeValue> attributesMap =
Optional.ofNullable(cloudEvent.getAttributesMap()).orElse(new HashMap<>(0));
+ Map<String, CloudEventAttributeValue> attributesMap =
Optional.of(cloudEvent.getAttributesMap()).orElse(new HashMap<>(0));
Review Comment:
Same as the opinion above.
##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/common/EventMeshCloudEventUtils.java:
##########
@@ -363,15 +275,15 @@ public static String getDataContent(CloudEvent
cloudEvent) {
public static String getDataContent(final CloudEvent cloudEvent, String
defaultValue) {
String dataContentType = getDataContentType(cloudEvent);
if (ProtoSupport.isTextContent(dataContentType)) {
- return
Optional.ofNullable(cloudEvent.getTextData()).orElse(defaultValue);
+ return Optional.of(cloudEvent.getTextData()).orElse(defaultValue);
Review Comment:
After making this modifications, does `orElse()` become redundant?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]