From 84aa73f87aeb75e08f654b767e4469186681faf1 Mon Sep 17 00:00:00 2001 From: Tomasz Kaik Date: Tue, 18 Sep 2018 12:40:26 +0200 Subject: [PATCH 1/2] Disable nu.validator language detection to fix random npe --- .../comparators/w3chtml5/wrapper/NuValidatorWrapper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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); From bce9b62d8c7e0a187db669e1fdc790b2efe86e4b Mon Sep 17 00:00:00 2001 From: Tomasz Kaik Date: Wed, 19 Sep 2018 09:12:07 +0200 Subject: [PATCH 2/2] [Fixed #351] Updated CHANGELOG --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) 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