Skip to content

Commit e068261

Browse files
csvirishawkins
andauthored
Update operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/PrimaryUpdateAndCacheUtils.java
Co-authored-by: Steven Hawkins <[email protected]>
1 parent c1a1abb commit e068261

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/reconciler/PrimaryUpdateAndCacheUtils.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ public static int compareResourceVersions(String v1, String v2) {
463463
var maxLength = Math.max(v1Length, v2Length);
464464
boolean v1LeadingZero = true;
465465
boolean v2LeadingZero = true;
466-
int lengthComparison = 0;
467466
int comparison = 0;
468467
for (int i = 0; i < maxLength; i++) {
469468
char char1 = 0;
@@ -493,14 +492,14 @@ public static int compareResourceVersions(String v1, String v2) {
493492
"Non numeric characters in resource version (2): " + char2);
494493
}
495494
if (char1 == 0) {
496-
lengthComparison = -1;
495+
comparison = -1;
497496
} else if (comparison == 0) {
498497
comparison = Character.compare(char1, char2);
499498
}
500499
} else {
501-
lengthComparison = 1;
500+
comparison = 1;
502501
}
503502
}
504-
return lengthComparison != 0 ? lengthComparison : comparison;
503+
return comparison;
505504
}
506505
}

0 commit comments

Comments
 (0)