diff --git a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/CheckerCreator.java b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/CheckerCreator.java
index 9f9b3297..ecf23f07 100644
--- a/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/CheckerCreator.java
+++ b/htmlSanityCheck-core/src/main/java/org/aim42/htmlsanitycheck/check/CheckerCreator.java
@@ -8,12 +8,16 @@
import java.util.stream.Collectors;
/**
- * abstract factory to create Checker instances
+ * Factory to create Checker instances
*/
public class CheckerCreator {
private static final Logger logger = LoggerFactory.getLogger(CheckerCreator.class);
- public static List createCheckerClassesFrom(final List> checkerClasses, final Configuration configuration) {
+ private CheckerCreator() {
+ }
+
+ public static List createCheckerClassesFrom(final List> checkerClasses,
+ final Configuration configuration) {
return checkerClasses.stream()
.map(checkerClass -> CheckerCreator.createSingleChecker(checkerClass, configuration))
@@ -27,9 +31,13 @@ private static boolean isCase(Class extends Checker> caseValue, Class extend
return false;
}
- public static Checker createSingleChecker(final Class extends Checker> checkerClass, final Configuration pConfig) {
- Checker checker;
+ public static Checker createSingleChecker(final Class extends Checker> checkerClass,
+ final Configuration configuration) {
+ if (null == checkerClass) {
+ throw new UnknownCheckerException("Checker Class must not be 'null'");
+ }
+ Checker checker;
// switch over all possible Checker classes
// in case of new Checkers, this has to be adapted,
// as Checker constructors will differ in minor details!
@@ -37,21 +45,21 @@ public static Checker createSingleChecker(final Class extends Checker> checker
// clearly violates the open-close principle
if (isCase(BrokenCrossReferencesChecker.class, checkerClass)) {
- checker = new BrokenCrossReferencesChecker(pConfig);
+ checker = new BrokenCrossReferencesChecker(configuration);
} else if (isCase(BrokenHttpLinksChecker.class, checkerClass)) {
- checker = new BrokenHttpLinksChecker(pConfig);
+ checker = new BrokenHttpLinksChecker(configuration);
} else if (isCase(DuplicateIdChecker.class, checkerClass)) {
- checker = new DuplicateIdChecker(pConfig);
+ checker = new DuplicateIdChecker(configuration);
} else if (isCase(ImageMapChecker.class, checkerClass)) {
- checker = new ImageMapChecker(pConfig);
+ checker = new ImageMapChecker(configuration);
} else if (isCase(MissingAltInImageTagsChecker.class, checkerClass)) {
- checker = new MissingAltInImageTagsChecker(pConfig);
+ checker = new MissingAltInImageTagsChecker(configuration);
} else if (isCase(MissingImageFilesChecker.class, checkerClass)) {
- checker = new MissingImageFilesChecker(pConfig);
+ checker = new MissingImageFilesChecker(configuration);
} else if (isCase(MissingLocalResourcesChecker.class, checkerClass)) {
- checker = new MissingLocalResourcesChecker(pConfig);
+ checker = new MissingLocalResourcesChecker(configuration);
} else {
- logger.warn("unknown Checker " + checkerClass.toString());
+ logger.error("unknown Checker {}", checkerClass);
throw new UnknownCheckerException(checkerClass.toString());
}