Skip to content

Commit

Permalink
Improved error logging for unexpected constraint validation errors, w…
Browse files Browse the repository at this point in the history
…hich were not being logged.
  • Loading branch information
david-waltermire authored and aj-stein-gsa committed Sep 7, 2024
1 parent 61a978d commit 999e5b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@
import gov.nist.secauto.metaschema.core.util.CollectionUtil;
import gov.nist.secauto.metaschema.core.util.ObjectUtils;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.LinkedList;
import java.util.List;
import java.util.regex.Pattern;

import edu.umd.cs.findbugs.annotations.NonNull;

@SuppressWarnings("PMD.CouplingBetweenObjects")
public class FindingCollectingConstraintValidationHandler
extends AbstractConstraintValidationHandler
implements IValidationResult {
private static final Logger LOGGER = LogManager.getLogger(FindingCollectingConstraintValidationHandler.class);
@NonNull
private final List<ConstraintValidationFinding> findings = new LinkedList<>();
@NonNull
Expand Down Expand Up @@ -263,6 +268,7 @@ public void handleError(
INodeItem node,
String message,
Throwable exception) {
LOGGER.atError().withThrowable(exception).log(message);
addFinding(ConstraintValidationFinding.builder(constraint, node)
.kind(Kind.FAIL)
.severity(Level.CRITICAL)
Expand Down
3 changes: 1 addition & 2 deletions metaschema-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<scm>
<url>${scm.url}/tree/develop/metaschema-maven-plugin</url>
<tag>HEAD</tag>
</scm>
</scm>

<dependencies>
<dependency>
Expand Down Expand Up @@ -75,7 +75,6 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>${dependency.maven-plugin-tools.version}</version>
<scope>provided</scope>
<optional>true</optional>
</dependency>
Expand Down

0 comments on commit 999e5b2

Please sign in to comment.