• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

devonfw / IDEasy / 17657162730

11 Sep 2025 09:00PM UTC coverage: 68.691% (-0.03%) from 68.725%
17657162730

Pull #1280

github

web-flow
Merge aed4d9120 into a2fce66c4
Pull Request #1280: CVE: adapt IDEasy to consider security.json files to warn user

3405 of 5433 branches covered (62.67%)

Branch coverage included in aggregate %.

8903 of 12485 relevant lines covered (71.31%)

3.14 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
cli/src/main/java/com/devonfw/tools/ide/url/model/file/json/ToolSecurity.java
1
package com.devonfw.tools.ide.url.model.file.json;
2

3
import java.io.BufferedReader;
4
import java.nio.file.Files;
5
import java.nio.file.Path;
6
import java.util.ArrayList;
7
import java.util.Collections;
8
import java.util.List;
9

10
import com.devonfw.tools.ide.json.JsonMapping;
11
import com.fasterxml.jackson.databind.ObjectMapper;
12

13
/**
14
 * Container representing data from the "security.json".
15
 *
16
 * @see com.devonfw.tools.ide.url.model.file.UrlSecurityFile
17
 */
18
public class ToolSecurity {
19

20
  private static final ObjectMapper MAPPER = JsonMapping.create();
2✔
21

22
  private static final ToolSecurity EMPTY = new ToolSecurity(Collections.emptyList());
6✔
23
  private List<CVE> issues;
24

25

26
  public ToolSecurity() {
27
    this(new ArrayList<>());
5✔
28
  }
1✔
29

30
  public ToolSecurity(List<CVE> issues) {
31

32
    super();
2✔
33
    this.issues = issues;
3✔
34
  }
1✔
35

36
  /**
37
   * @return The {@link List} of {@link CVE}s for the given tool.
38
   */
39
  public List<CVE> findCVEs() {
40
    return issues;
3✔
41
  }
42

43
  /**
44
   * @param file the {@link Path} to the JSON file to load.
45
   * @return the loaded {@link ToolSecurity} or the {@link #getEmpty() empty instance} if given {@link Path} does not exist.
46
   */
47
  public static ToolSecurity of(Path file) {
48

49
    if (Files.exists(file)) {
5!
50
      try (BufferedReader reader = Files.newBufferedReader(file)) {
3✔
51
        return MAPPER.readValue(reader, ToolSecurity.class);
8✔
52
      } catch (Exception e) {
×
53
        throw new IllegalStateException("Failed to load " + file, e);
×
54
      }
55
    } else {
56
      return EMPTY;
×
57
    }
58
  }
59

60
  /**
61
   * @return the empty instance of {@link ToolSecurity}.
62
   */
63
  public static ToolSecurity getEmpty() {
64

65
    return EMPTY;
2✔
66
  }
67

68
  /**
69
   * @return the list of CVEs
70
   */
71
  public List<CVE> getIssues() {
72
    return issues;
×
73
  }
74

75
  /**
76
   * @param issues the list of CVEs
77
   */
78
  public void setIssues(List<CVE> issues) {
79
    this.issues = issues;
3✔
80
  }
1✔
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc