Skip to content

Commit 991397c

Browse files
authored
refactor: improve logs and add exception stack trace for YarnAuditAnalyzer (#7694)
1 parent dce88bb commit 991397c

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ private boolean isNodeAuditEnabled(Engine engine) {
196196
try {
197197
((AbstractNpmAnalyzer) a).prepareFileTypeAnalyzer(engine);
198198
} catch (InitializationException ex) {
199-
LOGGER.debug("Error initializing the {}", a.getName());
199+
String message = "Error initializing the " + a.getName();
200+
LOGGER.debug(message, ex);
200201
}
201202
}
202203
return a.isEnabled();

core/src/main/java/org/owasp/dependencycheck/analyzer/YarnAuditAnalyzer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,14 @@ protected void prepareFileTypeAnalyzer(Engine engine) throws InitializationExcep
188188
case yarnExecutableNotFoundExitValue:
189189
default:
190190
this.setEnabled(false);
191-
LOGGER.warn("The {} has been disabled. Yarn executable was not found.", getName());
191+
LOGGER.warn("The {} has been disabled after receiving exit value {}. Yarn executable was not " +
192+
"found or received a non-zero exit value.", getName(), exitValue);
192193
}
193194
}
194195
} catch (Exception ex) {
195196
this.setEnabled(false);
196-
LOGGER.warn("The {} has been disabled. Yarn executable was not found.", getName());
197+
LOGGER.warn("The {} has been disabled after receiving an exception. This can occur when Yarn executable " +
198+
"is not found.", getName());
197199
throw new InitializationException("Unable to read yarn audit output.", ex);
198200
}
199201
}

0 commit comments

Comments
 (0)