Skip to content

Commit ae97ff6

Browse files
committed
Add debug logging for last modified date determination
1 parent f5ac7db commit ae97ff6

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

core/src/main/java/io/snyk/plugins/artifactory/scanner/ScannerModule.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,16 @@ private void filter(MonitoredArtifact artifact) {
9898
private @NotNull MonitoredArtifact toMonitoredArtifact(TestResult testResult, @NotNull RepoPath repoPath) {
9999
Ignores ignores = Ignores.read(new RepositoryArtifactProperties(repoPath, repositories));
100100
Instant lastModifiedDate = getLastModifiedDate(repoPath);
101+
102+
LOG.debug("Retrieved last modified date of {} for {}", lastModifiedDate, repoPath)
101103

102104
// Only apply lastModifiedDate to packages from remote repositories.
103-
if(lastModifiedDateRemoteOnly() && !isRemoteRepository(repoPath)) {
104-
lastModifiedDate = null;
105+
if(lastModifiedDateRemoteOnly()) {
106+
LOG.debug("Last modified date applied to only remote repositories.")
107+
if (!isRemoteRepository(repoPath)) {
108+
LOG.debug("Repository provided is not a remote repository, skipping last modified date check.")
109+
lastModifiedDate = null;
110+
}
105111
}
106112
return new MonitoredArtifact(repoPath.toString(), testResult, ignores, lastModifiedDate);
107113
}
@@ -112,6 +118,8 @@ private Instant getLastModifiedDate(RepoPath repoPath) {
112118
if (itemInfo != null) {
113119
Instant lastModified = Instant.ofEpochMilli(itemInfo.getLastModified());
114120
return lastModified;
121+
} else {
122+
LOG.debug("Unable to retrieve ItemInfo for {}, could not retrieve last modified date", repoPath)
115123
}
116124
} catch (Exception e) {
117125
LOG.debug("Could not retrieve last modified date for {}: {}", repoPath, e);

0 commit comments

Comments
 (0)