Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 44a3f16

Browse files
dabalGrzegorz Dabrowski
andauthored
fix: issue 5452 - ConcurrentModificationException in NodePackageAnalyzer.processDependencies - adding synchronized block (#6501)
Co-authored-by: Grzegorz Dabrowski <[email protected]>
1 parent 873289e commit 44a3f16

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

core/src/main/java/org/owasp/dependencycheck/analyzer/NodePackageAnalyzer.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -458,18 +458,19 @@ private void processDependencies(JsonObject json, File baseDir, File rootFile,
458458
LOGGER.debug("Unable to build package url for `" + packagePath + "`", ex);
459459
}
460460
}
461-
462-
final Dependency existing = findDependency(engine, name, version);
463-
if (existing != null) {
464-
if (existing.isVirtual()) {
465-
DependencyMergingAnalyzer.mergeDependencies(child, existing, null);
466-
engine.removeDependency(existing);
467-
engine.addDependency(child);
461+
synchronized (this) {
462+
final Dependency existing = findDependency(engine, name, version);
463+
if (existing != null) {
464+
if (existing.isVirtual()) {
465+
DependencyMergingAnalyzer.mergeDependencies(child, existing, null);
466+
engine.removeDependency(existing);
467+
engine.addDependency(child);
468+
} else {
469+
DependencyBundlingAnalyzer.mergeDependencies(existing, child, null);
470+
}
468471
} else {
469-
DependencyBundlingAnalyzer.mergeDependencies(existing, child, null);
472+
engine.addDependency(child);
470473
}
471-
} else {
472-
engine.addDependency(child);
473474
}
474475
}
475476
}

0 commit comments

Comments
 (0)