Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ All notable changes to AET will be documented in this file.
## Unreleased
**List of changes that are finished but not yet released in any final version.**

- [PR-359](https://github.com/Cognifide/aet/pull/359) ([#351](https://github.com/Cognifide/aet/issues/351)) Disabled nu.validator language detection to fix random NPE

## Version 3.0.0


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public String validate(InputStream sourceStream) throws ProcessingException {
private void setupAndValidate(InputStream sourceStream) throws ProcessingException {
System.setProperty("nu.validator.datatype.warn", "true");
out = new ByteArrayOutputStream();
validator = new SimpleDocumentValidator();
validator = createValidatorWithDisabledLanguageDetection();
try {
setup();
validator.checkHtmlInputSource(new InputSource(sourceStream));
Expand All @@ -65,6 +65,13 @@ private void setupAndValidate(InputStream sourceStream) throws ProcessingExcepti
}
}

private SimpleDocumentValidator createValidatorWithDisabledLanguageDetection() {
boolean initializeLog4j = true;
boolean logUrls = true;
boolean enableLanguageDetection = false;
return new SimpleDocumentValidator(initializeLog4j, logUrls, enableLanguageDetection);
}

private void setup() throws ProcessingException, SAXException {
setErrorHandler();
errorHandler.setHtml(true);
Expand Down