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

devonfw / IDEasy / 17659177311

11 Sep 2025 10:43PM UTC coverage: 68.76% (+0.04%) from 68.725%
17659177311

Pull #1280

github

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

3417 of 5443 branches covered (62.78%)

Branch coverage included in aggregate %.

8920 of 12499 relevant lines covered (71.37%)

3.14 hits per line

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

78.95
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
   * @param file the {@link Path} to the JSON file to load.
38
   * @return the loaded {@link ToolSecurity} or the {@link #getEmpty() empty instance} if given {@link Path} does not exist.
39
   */
40
  public static ToolSecurity of(Path file) {
41

42
    if (Files.exists(file)) {
5!
43
      try (BufferedReader reader = Files.newBufferedReader(file)) {
3✔
44
        return MAPPER.readValue(reader, ToolSecurity.class);
8✔
45
      } catch (Exception e) {
×
46
        throw new IllegalStateException("Failed to load " + file, e);
×
47
      }
48
    } else {
49
      return EMPTY;
×
50
    }
51
  }
52

53
  /**
54
   * @return the empty instance of {@link ToolSecurity}.
55
   */
56
  public static ToolSecurity getEmpty() {
57

58
    return EMPTY;
2✔
59
  }
60

61
  /**
62
   * @return the list of CVEs
63
   */
64
  public List<CVE> getIssues() {
65
    return issues;
3✔
66
  }
67

68
  /**
69
   * @param issues the list of CVEs
70
   */
71
  public void setIssues(List<CVE> issues) {
72
    this.issues = issues;
3✔
73
  }
1✔
74
}
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