dcapwell commented on a change in pull request #31:
URL:
https://github.com/apache/cassandra-in-jvm-dtest-api/pull/31#discussion_r799782318
##########
File path: src/main/java/org/apache/cassandra/distributed/shared/Versions.java
##########
@@ -101,11 +102,14 @@ public Version get(String full)
public Version get(Semver version)
{
- return versions.get(first(version))
- .stream()
+ Supplier<RuntimeException> onError = () -> new RuntimeException("No
version " + version.getOriginalValue() + " found");
+ List<Version> versions = this.versions.get(first(version));
+ if (versions == null)
+ throw onError.get();
+ return versions.stream()
.filter(v -> version.equals(v.version))
.findFirst()
- .orElseThrow(() -> new RuntimeException("No version " +
version.getOriginalValue() + " found"));
+ .orElseThrow(onError);
Review comment:
This was found in another ticket, if the version doesn't have the match,
we return null and throw a NPE, so handle that the same as `orElseThrow`
--
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]