Skip to content

Commit c5cf870

Browse files
#1033 - Fixed issue caused by change in NVD JSON feed which now includes empty arrays rather than not including the property at all.
1 parent 3cb0a64 commit c5cf870

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/java/org/dependencytrack/parser/nvd/NvdParser.java

+8-3
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,15 @@ public void parse(final File file) {
172172
final List<VulnerableSoftware> vulnerableSoftwareInNode = new ArrayList<>();
173173
final Operator nodeOperator = Operator.valueOf(node.getString("operator", Operator.NONE.name()));
174174
if (node.containsKey("children")) {
175+
// https://github.com/DependencyTrack/dependency-track/issues/1033
175176
final JsonArray children = node.getJsonArray("children");
176-
for (int l = 0; l < children.size(); l++) {
177-
final JsonObject child = children.getJsonObject(l);
178-
vulnerableSoftwareInNode.addAll(parseCpes(qm, child, synchronizeVulnerability));
177+
if (children.size() > 0) {
178+
for (int l = 0; l < children.size(); l++) {
179+
final JsonObject child = children.getJsonObject(l);
180+
vulnerableSoftwareInNode.addAll(parseCpes(qm, child, synchronizeVulnerability));
181+
}
182+
} else {
183+
vulnerableSoftwareInNode.addAll(parseCpes(qm, node, synchronizeVulnerability));
179184
}
180185
} else {
181186
vulnerableSoftwareInNode.addAll(parseCpes(qm, node, synchronizeVulnerability));

0 commit comments

Comments
 (0)