bbotella commented on code in PR #41:
URL: 
https://github.com/apache/cassandra-in-jvm-dtest-api/pull/41#discussion_r2373022816


##########
src/main/java/org/apache/cassandra/distributed/shared/Versions.java:
##########
@@ -123,17 +123,27 @@ private static Semver first(Semver version)
 
     public Version getLatest(Semver version)
     {
-        return versions.get(first(version))
-                                                                               
          .stream()
-                                                                               
                .findFirst()
-                                                                               
          .orElseThrow(() -> new RuntimeException("No " + version + " versions 
found"));
+        return versions.getOrDefault(first(version), Collections.emptyList())

Review Comment:
   What's the goal of this default if it is going to fail anyway?



##########
src/main/java/org/apache/cassandra/distributed/shared/Versions.java:
##########
@@ -123,17 +123,27 @@ private static Semver first(Semver version)
 
     public Version getLatest(Semver version)
     {
-        return versions.get(first(version))
-                                                                               
          .stream()
-                                                                               
                .findFirst()
-                                                                               
          .orElseThrow(() -> new RuntimeException("No " + version + " versions 
found"));
+        return versions.getOrDefault(first(version), Collections.emptyList())
+                       .stream()
+                       .findFirst()
+                       .orElseThrow(() -> new RuntimeException("No " + version 
+ " versions found"));

Review Comment:
   Nitpick: maybe improve the exception text? Would this return "No 5.0 
versions found"? What about something like "Version 5.0 not found"?



-- 
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]

Reply via email to