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 committed Sep 7, 2024
1 parent aa2ac75 commit 130ac45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
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;
Expand All @@ -25,6 +28,7 @@
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 +267,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 130ac45

Please sign in to comment.