Skip to content

Commit 0719a75

Browse files
authored
Merge pull request #143 from snyk/feat/SLS-709-last-modified-delay-download
SLS-709 - Add debug logging for last modified date determination
2 parents f5ac7db + f8b878d commit 0719a75

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

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

Lines changed: 11 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
}
@@ -111,7 +117,10 @@ private Instant getLastModifiedDate(RepoPath repoPath) {
111117
ItemInfo itemInfo = repositories.getItemInfo(repoPath);
112118
if (itemInfo != null) {
113119
Instant lastModified = Instant.ofEpochMilli(itemInfo.getLastModified());
120+
LOG.debug("Retrieved last modifed date of {}", lastModified.toString());
114121
return lastModified;
122+
} else {
123+
LOG.debug("Unable to retrieve ItemInfo for {}, could not retrieve last modified date", repoPath);
115124
}
116125
} catch (Exception e) {
117126
LOG.debug("Could not retrieve last modified date for {}: {}", repoPath, e);

0 commit comments

Comments
 (0)