From 7c8cfa068f073eb9238ac5f618abd7230c1f5e70 Mon Sep 17 00:00:00 2001 From: Gerd Aschemann Date: Mon, 16 Sep 2024 08:02:08 +0200 Subject: [PATCH] Extend logging of "legacy" checkers --- .../htmlsanitycheck/check/BrokenCrossReferencesChecker.java | 3 +++ .../aim42/htmlsanitycheck/check/BrokenHttpLinksChecker.java | 3 +++ .../org/aim42/htmlsanitycheck/check/DuplicateIdChecker.java | 3 +++ .../java/org/aim42/htmlsanitycheck/check/ImageMapChecker.java | 3 +++ .../htmlsanitycheck/check/MissingAltInImageTagsChecker.java | 3 +++ .../aim42/htmlsanitycheck/check/MissingImageFilesChecker.java | 3 +++ .../htmlsanitycheck/check/MissingLocalResourcesChecker.java | 3 +++ .../src/main/java/org/aim42/htmlsanitycheck/tools/Web.java | 3 +++ 8 files changed, 24 insertions(+) diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesChecker.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesChecker.java index 632edda6..d6dcbbc0 100644 --- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesChecker.java +++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenCrossReferencesChecker.java @@ -1,5 +1,6 @@ package org.aim42.htmlsanitycheck.check; +import lombok.extern.slf4j.Slf4j; import org.aim42.htmlsanitycheck.Configuration; import org.aim42.htmlsanitycheck.collect.SingleCheckResults; import org.aim42.htmlsanitycheck.html.HtmlPage; @@ -11,6 +12,7 @@ import java.util.List; import java.util.Set; +@Slf4j public class BrokenCrossReferencesChecker extends SuggestingChecker { private List listOfIds; private List hrefList; @@ -34,6 +36,7 @@ protected void setValidPossibilities() { @Override protected SingleCheckResults check(final HtmlPage pageToCheck) { + log.trace("Checking '{}'", pageToCheck.getFile()); //get list of all a-tags "(hrefList); diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenHttpLinksChecker.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenHttpLinksChecker.java index 0c0cf57f..e7addd3a 100644 --- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenHttpLinksChecker.java +++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/BrokenHttpLinksChecker.java @@ -1,5 +1,6 @@ package org.aim42.htmlsanitycheck.check; +import lombok.extern.slf4j.Slf4j; import org.aim42.htmlsanitycheck.Configuration; import org.aim42.htmlsanitycheck.collect.Finding; import org.aim42.htmlsanitycheck.collect.SingleCheckResults; @@ -20,6 +21,7 @@ * * @see https://www.w3schools.com/tags/att_a_href.asp */ +@Slf4j class BrokenHttpLinksChecker extends Checker { // get the (configured) statusCodes, just syntactic sugar... @@ -51,6 +53,7 @@ protected void initCheckingResultsDescription() { @Override protected SingleCheckResults check(final HtmlPage pageToCheck) { + log.trace("Checking '{}'", pageToCheck.getFile()); //get set of all a-tags " idStringsSet; private List idStringsList; @@ -25,6 +27,7 @@ protected void initCheckingResultsDescription() { @Override protected SingleCheckResults check(final HtmlPage pageToCheck) { + log.trace("Checking '{}'", pageToCheck.getFile()); //get list of all tagsWithId '<... id="XYZ"...' in html file diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/ImageMapChecker.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/ImageMapChecker.java index 4495fd19..db04f626 100644 --- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/ImageMapChecker.java +++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/ImageMapChecker.java @@ -1,5 +1,6 @@ package org.aim42.htmlsanitycheck.check; +import lombok.extern.slf4j.Slf4j; import org.aim42.htmlsanitycheck.Configuration; import org.aim42.htmlsanitycheck.collect.Finding; import org.aim42.htmlsanitycheck.collect.SingleCheckResults; @@ -23,6 +24,7 @@ *

* see also: http://www.w3schools.com/tags/tag_map.asp **/ +@Slf4j public class ImageMapChecker extends Checker { private List mapNames; private List imagesWithUsemapRefs; @@ -44,6 +46,7 @@ protected void initCheckingResultsDescription() { @Override protected SingleCheckResults check(final HtmlPage pageToCheck) { + log.trace("Checking '{}'", pageToCheck.getFile()); this.pageToCheck = pageToCheck; diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingAltInImageTagsChecker.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingAltInImageTagsChecker.java index 26b8dd81..593f95bd 100644 --- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingAltInImageTagsChecker.java +++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingAltInImageTagsChecker.java @@ -1,5 +1,6 @@ package org.aim42.htmlsanitycheck.check; +import lombok.extern.slf4j.Slf4j; import org.aim42.htmlsanitycheck.Configuration; import org.aim42.htmlsanitycheck.collect.SingleCheckResults; import org.aim42.htmlsanitycheck.html.HtmlElement; @@ -8,6 +9,7 @@ /** * checks for missing or empty alt-attributes in image tags. */ +@Slf4j public class MissingAltInImageTagsChecker extends Checker { public MissingAltInImageTagsChecker(Configuration pConfig) { super(pConfig); @@ -23,6 +25,7 @@ protected void initCheckingResultsDescription() { @Override protected SingleCheckResults check(final HtmlPage pageToCheck) { + log.trace("Checking '{}'", pageToCheck.getFile()); // the number of checks is calculated by counting // ALL image tags: getCheckingResults().setNrOfChecks(pageToCheck.getAllImageTags().size()); diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingImageFilesChecker.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingImageFilesChecker.java index 8c482f25..900db39d 100644 --- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingImageFilesChecker.java +++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingImageFilesChecker.java @@ -1,5 +1,6 @@ package org.aim42.htmlsanitycheck.check; +import lombok.extern.slf4j.Slf4j; import org.aim42.htmlsanitycheck.Configuration; import org.aim42.htmlsanitycheck.collect.SingleCheckResults; import org.aim42.htmlsanitycheck.html.HtmlElement; @@ -14,6 +15,7 @@ import java.util.List; import java.util.regex.Pattern; +@Slf4j public class MissingImageFilesChecker extends Checker { private static final Logger logger = LoggerFactory.getLogger(MissingImageFilesChecker.class); @@ -35,6 +37,7 @@ protected void initCheckingResultsDescription() { @Override protected SingleCheckResults check(final HtmlPage pageToCheck) { + log.trace("Checking '{}'", pageToCheck.getFile()); final File file1 = pageToCheck.getFile(); final File file = (file1 == null ? null : file1.getParentFile()); currentDir = file != null ? file : baseDir; diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingLocalResourcesChecker.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingLocalResourcesChecker.java index a2c76a6c..ddf4e27e 100644 --- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingLocalResourcesChecker.java +++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/MissingLocalResourcesChecker.java @@ -1,5 +1,6 @@ package org.aim42.htmlsanitycheck.check; +import lombok.extern.slf4j.Slf4j; import org.aim42.htmlsanitycheck.Configuration; import org.aim42.htmlsanitycheck.collect.SingleCheckResults; import org.aim42.htmlsanitycheck.html.HtmlPage; @@ -15,6 +16,7 @@ import java.util.Set; import java.util.stream.Collectors; +@Slf4j public class MissingLocalResourcesChecker extends Checker { public static final String MLRC_MESSAGE_PREFIX = "local resource"; public static final String MLRC_MESSAGE_MISSING = "missing"; @@ -47,6 +49,7 @@ protected void initCheckingResultsDescription() { @Override protected SingleCheckResults check(final HtmlPage pageToCheck) { + log.trace("Checking '{}'", pageToCheck.getFile()); //get list of all anchor-tags containing href="xyz" in html file List allHrefs = pageToCheck.getAllHrefStrings(); diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java index 9fc3d93d..e90a4e36 100644 --- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java +++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/tools/Web.java @@ -1,5 +1,6 @@ package org.aim42.htmlsanitycheck.tools; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.validator.routines.InetAddressValidator; import java.net.InetAddress; @@ -12,6 +13,7 @@ import java.util.Set; import java.util.regex.Pattern; +@Slf4j public class Web { private Web() { @@ -219,6 +221,7 @@ public static boolean isLocalResource(String link) { } else { URI aUri; try { + log.trace("Trying to resolve URI for '{}'", link); aUri = new URI(link); } catch (URISyntaxException e) { throw new InvalidUriSyntaxException(e);