Skip to content

Commit

Permalink
Make BuildInfoRecorder.java thread safe
Browse files Browse the repository at this point in the history
The buildTimeDependencies collection is a SynchronizedCollection but like mentioned in the JavaDoc of Collections.synchrizedCollection() it is necessary to use a synchronize block by traversing the collection via iterator, what will be happen by hands over the collection to the addAll method.
  • Loading branch information
rdeangelis83 authored Sep 25, 2023
1 parent 24a8afe commit 4ef1b09
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,9 @@ private void addDependencies(MavenProject project) {

// if recordAllDependencies=true, add build time dependencies
if (conf.publisher.isRecordAllDependencies()) {
dependencies.addAll(buildTimeDependencies);
synchronized(buildTimeDependencies) {
dependencies.addAll(buildTimeDependencies);
}
}

currentModuleDependencies.set(dependencies);
Expand Down

0 comments on commit 4ef1b09

Please sign in to comment.