Skip to content

Commit 0779550

Browse files
author
Zsolt Györffi
committed
Address review comments #401
1 parent 11e6f47 commit 0779550

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

core/src/main/java/org/everit/json/schema/NumberSchemaValidatingVisitor.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ void visitMinimum(Number minimum) {
4242
if (minimum == null) {
4343
return;
4444
}
45-
if (exclusiveMinimum && compare(numberSubject, minimum) <= 0) {
45+
int comparison = compare(numberSubject, minimum);
46+
if (exclusiveMinimum && comparison <= 0) {
4647
owner.failure(subject + " is not greater than " + minimum, "exclusiveMinimum");
47-
} else if (compare(numberSubject, minimum) < 0) {
48+
} else if (comparison < 0) {
4849
owner.failure(subject + " is not greater or equal to " + minimum, "minimum");
4950
}
5051
}
@@ -63,9 +64,10 @@ void visitMaximum(Number maximum) {
6364
if (maximum == null) {
6465
return;
6566
}
66-
if (exclusiveMaximum && compare(maximum, numberSubject) <= 0) {
67+
int comparison = compare(maximum, numberSubject);
68+
if (exclusiveMaximum && comparison <= 0) {
6769
owner.failure(subject + " is not less than " + maximum, "exclusiveMaximum");
68-
} else if (compare(maximum, numberSubject) < 0) {
70+
} else if (comparison < 0) {
6971
owner.failure(subject + " is not less or equal to " + maximum, "maximum");
7072
}
7173
}

0 commit comments

Comments
 (0)