sanha commented on a change in pull request #241: [NEMO-424] Fix Sonarcloud
bugs regarding Optional
URL: https://github.com/apache/incubator-nemo/pull/241#discussion_r334278540
##########
File path: common/src/main/java/org/apache/nemo/common/Util.java
##########
@@ -117,7 +117,10 @@ public static IREdge cloneEdge(final IREdge edgeToClone,
final IRVertex newSrc,
final IRVertex newDst) {
return cloneEdge(
- edgeToClone.getPropertyValue(CommunicationPatternProperty.class).get(),
edgeToClone, newSrc, newDst);
+
edgeToClone.getPropertyValue(CommunicationPatternProperty.class).orElseThrow(IllegalStateException::new),
Review comment:
IMHO, it is not good to propagate the error with null. If we just return
null if the `Optional` is empty, we can't know where the "nulled' value occurs
NPE.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services