@@ -49,35 +49,17 @@ public XSDValidator(List<ValidationError> errorList, String sclData) {
49
49
validator .setErrorHandler (new ErrorHandler () {
50
50
@ Override
51
51
public void warning (SAXParseException exception ) {
52
- var validationError = createValidationError (exception );
53
- errorList .add (validationError );
54
-
55
- LOGGER .debug ("XSD Validation - warning: '{}' (Linenumber {}, Columnnumber {})" ,
56
- validationError .getMessage (),
57
- validationError .getLinenumber (),
58
- validationError .getColumnNumber ());
52
+ errorList .add (createValidationError (exception , "warning" ));
59
53
}
60
54
61
55
@ Override
62
56
public void error (SAXParseException exception ) {
63
- var validationError = createValidationError (exception );
64
- errorList .add (validationError );
65
-
66
- LOGGER .debug ("XSD Validation - error: '{}' (Linenumber {}, Columnnumber {})" ,
67
- validationError .getMessage (),
68
- validationError .getLinenumber (),
69
- validationError .getColumnNumber ());
57
+ errorList .add (createValidationError (exception , "error" ));
70
58
}
71
59
72
60
@ Override
73
61
public void fatalError (SAXParseException exception ) {
74
- var validationError = createValidationError (exception );
75
- errorList .add (validationError );
76
-
77
- LOGGER .debug ("XSD Validation - fatal error, stopping: '{}' (Linenumber {}, Columnnumber {})" ,
78
- validationError .getMessage (),
79
- validationError .getLinenumber (),
80
- validationError .getColumnNumber ());
62
+ errorList .add (createValidationError (exception , "fatal" ));
81
63
}
82
64
});
83
65
}
@@ -93,12 +75,19 @@ public void validate() {
93
75
}
94
76
}
95
77
96
- private ValidationError createValidationError (SAXParseException exception ) {
78
+ private ValidationError createValidationError (SAXParseException exception , String type ) {
97
79
var validationError = new ValidationError ();
98
80
validationError .setMessage (exception .getMessage ());
99
81
validationError .setRuleName ("XSD validation" );
100
82
validationError .setLinenumber (exception .getLineNumber ());
101
83
validationError .setColumnNumber (exception .getColumnNumber ());
84
+
85
+ LOGGER .debug ("XSD Validation - {}: '{}' (Linenumber {}, Columnnumber {})" ,
86
+ type ,
87
+ validationError .getMessage (),
88
+ validationError .getLinenumber (),
89
+ validationError .getColumnNumber ());
90
+
102
91
return validationError ;
103
92
}
104
93
}
0 commit comments