Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ public static TransportVersion getPreviousVersion(TransportVersion version) {
// version does not exist - need the item before the index this version should be inserted
place = -(place + 1);
}
if (place <= 1) {

if (place < 1) {
throw new IllegalArgumentException("couldn't find any released versions before [" + version + "]");
}
return ALL_VERSIONS.get(place - 1);
Expand All @@ -97,11 +98,15 @@ public static TransportVersion getNextVersion(TransportVersion version) {
if (place < 0) {
// version does not exist - need the item at the index this version should be inserted
place = -(place + 1);
} else {
// need the *next* version
place++;
}
if (place <= 1) {

if (place < 0 || place >= ALL_VERSIONS.size()) {
throw new IllegalArgumentException("couldn't find any released versions after [" + version + "]");
}
return ALL_VERSIONS.get(place + 1);
return ALL_VERSIONS.get(place);
}

/** Returns a random {@link Version} from all available versions, that is compatible with the given version. */
Expand Down