use of nu.validator.source.SourceCode in project validator by validator.
the class SimpleCommandLineValidator method setErrorHandler.
private static void setErrorHandler() {
SourceCode sourceCode = validator.getSourceCode();
ImageCollector imageCollector = new ImageCollector(sourceCode);
boolean showSource = false;
if (outputFormat == OutputFormat.TEXT) {
errorHandler = new MessageEmitterAdapter(filterPattern, sourceCode, showSource, imageCollector, lineOffset, true, new TextMessageEmitter(out, asciiQuotes));
} else if (outputFormat == OutputFormat.GNU) {
errorHandler = new MessageEmitterAdapter(filterPattern, sourceCode, showSource, imageCollector, lineOffset, true, new GnuMessageEmitter(out, asciiQuotes));
} else if (outputFormat == OutputFormat.XML) {
errorHandler = new MessageEmitterAdapter(filterPattern, sourceCode, showSource, imageCollector, lineOffset, true, new XmlMessageEmitter(new XmlSerializer(out)));
} else if (outputFormat == OutputFormat.JSON) {
String callback = null;
errorHandler = new MessageEmitterAdapter(filterPattern, sourceCode, showSource, imageCollector, lineOffset, true, new JsonMessageEmitter(new nu.validator.json.Serializer(out), callback));
} else {
throw new RuntimeException("Bug. Should be unreachable.");
}
errorHandler.setErrorsOnly(errorsOnly);
}
Aggregations