@@ -42,19 +42,17 @@ void visitIfSchema(Schema ifSchema) {
42
42
void visitThenSchema (Schema thenSchema ) {
43
43
if (ifSchemaException == null ) {
44
44
ValidationException thenSchemaException = owner .getFailureOfSchema (thenSchema , subject );
45
+ ValidationException failure = null ;
45
46
if (thenSchemaException != null ) {
46
- ValidationException failure = new ValidationException (conditionalSchema ,
47
+ failure = new ValidationException (conditionalSchema ,
47
48
new StringBuilder (new StringBuilder ("#" )),
48
49
"input is invalid against the \" then\" schema" ,
49
50
Arrays .asList (thenSchemaException ),
50
51
"then" ,
51
52
conditionalSchema .getSchemaLocation ());
52
-
53
53
owner .failure (failure );
54
- owner .reportSchemaMatchEvent (thenSchema , failure );
55
- } else {
56
- owner .reportSchemaMatchEvent (thenSchema , null );
57
54
}
55
+ owner .reportSchemaMatchEvent (thenSchema , failure );
58
56
} else {
59
57
owner .reportSchemaMatchEvent (thenSchema , ifSchemaException );
60
58
}
@@ -64,18 +62,18 @@ void visitThenSchema(Schema thenSchema) {
64
62
void visitElseSchema (Schema elseSchema ) {
65
63
if (ifSchemaException != null ) {
66
64
ValidationException elseSchemaException = owner .getFailureOfSchema (elseSchema , subject );
65
+ ValidationException failure = null ;
67
66
if (elseSchemaException != null ) {
68
- ValidationException failure = new ValidationException (conditionalSchema ,
67
+ failure = new ValidationException (conditionalSchema ,
69
68
new StringBuilder (new StringBuilder ("#" )),
70
69
"input is invalid against both the \" if\" and \" else\" schema" ,
71
70
Arrays .asList (ifSchemaException , elseSchemaException ),
72
71
"else" ,
73
72
conditionalSchema .getSchemaLocation ());
74
73
owner .failure (failure );
75
- owner .reportSchemaMatchEvent (elseSchema , failure );
76
- } else {
77
- owner .reportSchemaMatchEvent (elseSchema , null );
74
+
78
75
}
76
+ owner .reportSchemaMatchEvent (elseSchema , failure );
79
77
}
80
78
}
81
79
0 commit comments