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

devonfw / IDEasy / 17121363550

21 Aug 2025 08:23AM UTC coverage: 69.146% (+0.06%) from 69.091%
17121363550

Pull #1280

github

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

3406 of 5375 branches covered (63.37%)

Branch coverage included in aggregate %.

8886 of 12402 relevant lines covered (71.65%)

3.15 hits per line

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

72.22
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.Collections;
7
import java.util.List;
8

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

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

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

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

24

25
  private ToolSecurity() {
26
    super();
27
  }
28

29
  private ToolSecurity(List<CVE> issues) {
30

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

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

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

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

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

64
    return EMPTY;
2✔
65
  }
66

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

74
  /**
75
   * @param issues the list of CVEs
76
   */
77
  public void setIssues(List<CVE> issues) {
78
    this.issues = issues;
3✔
79
  }
1✔
80
}
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