Skip to content

Commit

Permalink
sync collection
Browse files Browse the repository at this point in the history
yegor256 committed Feb 2, 2025

Verified

This commit was signed with the committer’s verified signature.
yegor256 Yegor Bugayenko
1 parent 13a2875 commit b47cb12
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/main/java/org/xembly/Directives.java
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import lombok.EqualsAndHashCode;
import org.w3c.dom.Attr;
import org.w3c.dom.NamedNodeMap;
@@ -110,7 +111,7 @@ public Directives(final String text) {
*/
@SuppressWarnings("PMD.ConstructorOnlyInitializesOrCallOtherConstructors")
public Directives(final Iterable<Directive> dirs) {
this.all = Directives.toCollection(dirs);
this.all = new CopyOnWriteArrayList<>(Directives.toCollection(dirs));
}

@Override
@@ -218,9 +219,7 @@ public static Iterable<Directive> copyOf(final Node node) {
* @since 0.11
*/
public Directives append(final Iterable<Directive> dirs) {
synchronized (this.all) {
this.all.addAll(Directives.toCollection(dirs));
}
this.all.addAll(Directives.toCollection(dirs));
return this;
}

0 comments on commit b47cb12

Please sign in to comment.