Skip to content

Commit 118226b

Browse files
committed
wip
Signed-off-by: Attila Mészáros <[email protected]>
1 parent d3e4886 commit 118226b

File tree

2 files changed

+0
-27
lines changed

2 files changed

+0
-27
lines changed

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -454,18 +454,6 @@ public static <P extends HasMetadata> P addFinalizerWithSSA(
454454
public static int compareResourceVersions(String v1, String v2) {
455455
var v1Length = v1.length();
456456
var v2Length = v2.length();
457-
if (v1Length == 0) {
458-
throw new IllegalArgumentException("resource version must not be empty (1)");
459-
}
460-
if (v2Length == 0) {
461-
throw new IllegalArgumentException("resource version must not be empty (2)");
462-
}
463-
if (v1.charAt(0) == '0') {
464-
throw new IllegalArgumentException("resource version (1) must not start with 0");
465-
}
466-
if (v2.charAt(0) == '0') {
467-
throw new IllegalArgumentException("resource version (2) must not start with 0");
468-
}
469457
if (v1Length > v2Length) {
470458
return 1;
471459
}
@@ -475,14 +463,6 @@ public static int compareResourceVersions(String v1, String v2) {
475463
for (int i = 0; i < v1Length; i++) {
476464
var char1 = v1.charAt(i);
477465
var char2 = v2.charAt(i);
478-
if (!Character.isDigit(char1)) {
479-
throw new IllegalArgumentException(
480-
"Non numeric characters in resource version (1): " + char1);
481-
}
482-
if (!Character.isDigit(char2)) {
483-
throw new IllegalArgumentException(
484-
"Non numeric characters in resource version (2): " + char2);
485-
}
486466
if (char1 > char2) {
487467
return 1;
488468
}

operator-framework-core/src/test/java/io/javaoperatorsdk/operator/api/reconciler/PrimaryUpdateAndCacheUtilsTest.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,6 @@ public void compareResourceVersionsTest() {
190190

191191
assertThat(compareResourceVersions("123", "2")).isPositive();
192192
assertThat(compareResourceVersions("3", "211")).isNegative();
193-
194-
assertThrows(IllegalArgumentException.class, () -> compareResourceVersions("aa", "22"));
195-
assertThrows(IllegalArgumentException.class, () -> compareResourceVersions("11", "ba"));
196-
assertThrows(IllegalArgumentException.class, () -> compareResourceVersions("", "22"));
197-
assertThrows(IllegalArgumentException.class, () -> compareResourceVersions("11", ""));
198-
assertThrows(IllegalArgumentException.class, () -> compareResourceVersions("01", "123"));
199-
assertThrows(IllegalArgumentException.class, () -> compareResourceVersions("123", "01"));
200193
}
201194

202195
// naive performance that compares the works case scenario for non parsing variant

0 commit comments

Comments
 (0)