File tree Expand file tree Collapse file tree 2 files changed +20
-16
lines changed
tls/src/main/java/org/bouncycastle/jsse/provider Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -880,16 +880,18 @@ private static final class Match
880880
881881 public int compareTo (Match that )
882882 {
883- int cmp = Boolean . compare ( that . isValid (), this .isValid () );
884- if (cmp == 0 )
883+ boolean thisValid = this . isValid (), thatValid = that .isValid ();
884+ if (thisValid != thatValid )
885885 {
886- cmp = Integer .compare (this .keyTypeIndex , that .keyTypeIndex );
887- if (cmp == 0 )
888- {
889- cmp = this .quality .compareTo (that .quality );
890- }
886+ return thisValid ? -1 : 1 ;
887+ }
888+
889+ if (this .keyTypeIndex != that .keyTypeIndex )
890+ {
891+ return this .keyTypeIndex < that .keyTypeIndex ? -1 : 1 ;
891892 }
892- return cmp ;
893+
894+ return this .quality .compareTo (that .quality );
893895 }
894896
895897 boolean isIdeal ()
Original file line number Diff line number Diff line change @@ -362,16 +362,18 @@ private static final class Match
362362
363363 public int compareTo (Match that )
364364 {
365- int cmp = ( that . isValid () == this .isValid ()) ? 0 : ( that .isValid () ? 1 : - 1 );
366- if (cmp == 0 )
365+ boolean thisValid = this .isValid (), thatValid = that .isValid ();
366+ if (thisValid != thatValid )
367367 {
368- cmp = this .keyTypeIndex < that .keyTypeIndex ? -1 : (this .keyTypeIndex == that .keyTypeIndex ? 0 : 1 );
369- if (cmp == 0 )
370- {
371- cmp = this .quality .compareTo (that .quality );
372- }
368+ return thisValid ? -1 : 1 ;
369+ }
370+
371+ if (this .keyTypeIndex != that .keyTypeIndex )
372+ {
373+ return this .keyTypeIndex < that .keyTypeIndex ? -1 : 1 ;
373374 }
374- return cmp ;
375+
376+ return this .quality .compareTo (that .quality );
375377 }
376378
377379 boolean isIdeal ()
You can’t perform that action at this time.
0 commit comments