File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
test/framework/src/main/java/org/elasticsearch/test Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,8 @@ public static TransportVersion getPreviousVersion(TransportVersion version) {
8686 // version does not exist - need the item before the index this version should be inserted
8787 place = -(place + 1 );
8888 }
89- if (place <= 1 ) {
89+
90+ if (place < 1 ) {
9091 throw new IllegalArgumentException ("couldn't find any released versions before [" + version + "]" );
9192 }
9293 return ALL_VERSIONS .get (place - 1 );
@@ -97,11 +98,15 @@ public static TransportVersion getNextVersion(TransportVersion version) {
9798 if (place < 0 ) {
9899 // version does not exist - need the item at the index this version should be inserted
99100 place = -(place + 1 );
101+ } else {
102+ // need the *next* version
103+ place ++;
100104 }
101- if (place <= 1 ) {
105+
106+ if (place < 0 || place >= ALL_VERSIONS .size ()) {
102107 throw new IllegalArgumentException ("couldn't find any released versions after [" + version + "]" );
103108 }
104- return ALL_VERSIONS .get (place + 1 );
109+ return ALL_VERSIONS .get (place );
105110 }
106111
107112 /** Returns a random {@link Version} from all available versions, that is compatible with the given version. */
You can’t perform that action at this time.
0 commit comments