Skip to content

Store CVEs in cache#61

Merged
yahavi merged 4 commits intojfrog:masterfrom
yahavi:cve-cache
Nov 2, 2021
Merged

Store CVEs in cache#61
yahavi merged 4 commits intojfrog:masterfrom
yahavi:cve-cache

Conversation

@yahavi
Copy link
Copy Markdown
Member

@yahavi yahavi commented Nov 1, 2021

  • All tests passed. If this feature is not already covered by the tests, I added new tests.

Store CVEs in cache and increase cache version from 0 to 1, to make sure the cache will be initialized.

Comment thread src/main/java/com/jfrog/ide/common/persistency/ScanCache.java Outdated
add(issue);
}}, new HashSet<>());
this.add(artifact);
Artifact artifact = new Artifact(info, Sets.newHashSet(issue), new HashSet<>());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something I noticed about the Artifact class -
Its constructor receieve two hashsets, but inside the class, these hashets are also initialized upon defibition, whicg seem redundant. I therefore suggest changing -

public class Artifact implements Serializable {
    private static final long serialVersionUID = 1L;
    private GeneralInfo generalInfo = new GeneralInfo();
    private Set<Issue> issues = new HashSet();
    private Set<License> licenses = new HashSet();

    public Artifact() {
    }

    public Artifact(GeneralInfo generalInfo, Set<Issue> issues, Set<License> licenses) {
        this.generalInfo = generalInfo;
        this.issues = issues;
        this.licenses = licenses;
    }

into -

public class Artifact implements Serializable {
    private static final long serialVersionUID = 1L;
    private GeneralInfo generalInfo;
    private Set<Issue> issues;
    private Set<License> licenses;

    public Artifact() {
       generalInfo = new GeneralInfo();
       issues = new HashSet();
       licenses = new HashSet();
    }

    public Artifact(GeneralInfo generalInfo, Set<Issue> issues, Set<License> licenses) {
        this.generalInfo = generalInfo;
        this.issues = issues;
        this.licenses = licenses;
    }

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/main/java/com/jfrog/ide/common/utils/Utils.java Outdated
@yahavi yahavi merged commit 50a37c0 into jfrog:master Nov 2, 2021
@yahavi yahavi deleted the cve-cache branch November 2, 2021 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants