diff --git a/core/src/main/java/io/snyk/plugins/artifactory/SnykPlugin.java b/core/src/main/java/io/snyk/plugins/artifactory/SnykPlugin.java index 822addc..08db09c 100644 --- a/core/src/main/java/io/snyk/plugins/artifactory/SnykPlugin.java +++ b/core/src/main/java/io/snyk/plugins/artifactory/SnykPlugin.java @@ -2,6 +2,7 @@ import javax.annotation.Nonnull; import java.io.File; +import java.util.Optional; import java.util.Properties; import io.snyk.plugins.artifactory.audit.AuditModule; @@ -91,15 +92,20 @@ public void handleBeforeDownloadEvent(RepoPath repoPath) { try { scannerModule.scanArtifact(repoPath); } catch (CannotScanException e) { - LOG.warn("Artifact cannot be scanned {}. {}", repoPath, e.getMessage()); + LOG.debug("Artifact cannot be scanned {}. {}", repoPath, e.getMessage()); } catch (SnykAPIFailureException e) { final String blockOnApiFailurePropertyKey = SCANNER_BLOCK_ON_API_FAILURE.propertyKey(); final String blockOnApiFailure = configurationModule.getPropertyOrDefault(SCANNER_BLOCK_ON_API_FAILURE); - String message = "Failed to scan artifact '" + repoPath + "'. " + e.getMessage(); + final String causeMessage = Optional.ofNullable(e.getCause()) + .map(Throwable::getMessage) + .map(m -> " " + m) + .orElse(""); + + String message = "Failed to scan artifact '" + repoPath + "'. " + e.getMessage() + causeMessage; if ("true".equals(blockOnApiFailure)) { - throw new CancelException(message, e, 500); + throw new CancelException(message, 500); } - LOG.warn(message, e); + LOG.debug(message); LOG.debug("Property '{}' is false, so allowing download: '{}'", blockOnApiFailurePropertyKey, repoPath); } } diff --git a/core/src/main/java/io/snyk/plugins/artifactory/scanner/MavenScanner.java b/core/src/main/java/io/snyk/plugins/artifactory/scanner/MavenScanner.java index ba85b89..9b12a6c 100644 --- a/core/src/main/java/io/snyk/plugins/artifactory/scanner/MavenScanner.java +++ b/core/src/main/java/io/snyk/plugins/artifactory/scanner/MavenScanner.java @@ -34,10 +34,6 @@ public static String getArtifactDetailsURL(String groupID, String artifactID, St } public TestResult scan(FileLayoutInfo fileLayoutInfo, RepoPath repoPath) { - if (!fileLayoutInfo.isValid()) { - LOG.warn("Artifact '{}' file layout info is not valid.", repoPath); - } - String groupID = Optional.ofNullable(fileLayoutInfo.getOrganization()) .orElseThrow(() -> new CannotScanException("Group ID not provided.")); String artifactID = Optional.ofNullable(fileLayoutInfo.getModule())