You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2023/07/13 15:22:42 UTC
[jackrabbit-filevault-package-maven-plugin] 01/01: JCRVLT-669 Always log throwable of violation
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch feature/log-throwable
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault-package-maven-plugin.git
commit a2b7a9d9bc2de3373b59726eb0ec6160c21dbeec
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Thu Jul 13 17:22:36 2023 +0200
JCRVLT-669 Always log throwable of violation
Emit stacktrace on debug level
---
.gitignore | 1 +
.../packaging/impl/ValidationMessagePrinter.java | 51 +++++++++++-----------
2 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4ad033d..db0faa5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@ target
.settings
*.iml
.DS_Store
+.flattened-pom.xml
\ No newline at end of file
diff --git a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ValidationMessagePrinter.java b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ValidationMessagePrinter.java
index 0985395..869b350 100644
--- a/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ValidationMessagePrinter.java
+++ b/src/main/java/org/apache/jackrabbit/filevault/maven/packaging/impl/ValidationMessagePrinter.java
@@ -81,33 +81,29 @@ public class ValidationMessagePrinter implements Closeable {
public void printMessages(Collection<ValidationViolation> violations, BuildContext buildContext, Path baseDirectory) throws IOException {
for (ValidationViolation violation : violations) {
final int buildContextSeverity;
- switch (violation.getSeverity()) {
- case ERROR:
- log.error(getDetailMessage(violation, baseDirectory));
- if (violation.getThrowable() != null) {
- log.debug(violation.getThrowable());
- }
- buildContextSeverity = BuildContext.SEVERITY_ERROR;
- noOfEmittedValidationMessagesWithLevelError++;
- break;
- case WARN:
- log.warn(getDetailMessage(violation, baseDirectory));
- if (violation.getThrowable() != null) {
- log.debug(violation.getThrowable());
- }
- noOfEmittedValidationMessagesWithLevelWarn++;
- buildContextSeverity = BuildContext.SEVERITY_WARNING;
- break;
- case INFO:
- log.info(getDetailMessage(violation, baseDirectory));
- buildContextSeverity = -1;
- break;
- default:
- log.debug(getDetailMessage(violation, baseDirectory));
- buildContextSeverity = -1;
- break;
+ switch (violation.getSeverity()) {
+ case ERROR:
+ log.error(getDetailMessage(violation, baseDirectory));
+ buildContextSeverity = BuildContext.SEVERITY_ERROR;
+ noOfEmittedValidationMessagesWithLevelError++;
+ break;
+ case WARN:
+ log.warn(getDetailMessage(violation, baseDirectory));
+ noOfEmittedValidationMessagesWithLevelWarn++;
+ buildContextSeverity = BuildContext.SEVERITY_WARNING;
+ break;
+ case INFO:
+ log.info(getDetailMessage(violation, baseDirectory));
+ buildContextSeverity = -1;
+ break;
+ default:
+ log.debug(getDetailMessage(violation, baseDirectory));
+ buildContextSeverity = -1;
+ break;
+ }
+ if (violation.getThrowable() != null) {
+ log.debug(violation.getThrowable());
}
-
if (buildContextSeverity > 0) {
// only emit via build context inside eclipse, otherwise log from above is better!
if (!(buildContext instanceof DefaultBuildContext)) {
@@ -166,6 +162,9 @@ public class ValidationMessagePrinter implements Closeable {
if (violation.getNodePath() != null) {
builder.a(", JCR node path: ").strong(violation.getNodePath());
}
+ if (violation.getThrowable() != null) {
+ builder.a(", Throwable: ").strong(violation.getThrowable().getMessage());
+ }
return builder.toString();
}