diff --git a/CHANGELOG.md b/CHANGELOG.md index 08321edb0..0b3aadce2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/core/jobs/src/main/java/com/cognifide/aet/job/common/comparators/w3chtml5/wrapper/NuValidatorWrapper.java b/core/jobs/src/main/java/com/cognifide/aet/job/common/comparators/w3chtml5/wrapper/NuValidatorWrapper.java index 3ef97acd6..7860ee7e7 100644 --- a/core/jobs/src/main/java/com/cognifide/aet/job/common/comparators/w3chtml5/wrapper/NuValidatorWrapper.java +++ b/core/jobs/src/main/java/com/cognifide/aet/job/common/comparators/w3chtml5/wrapper/NuValidatorWrapper.java @@ -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)); @@ -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);