From 248a4a16eab6e0a3d22416a003ab79e077dcc9ba Mon Sep 17 00:00:00 2001 From: Bartek Nowotarski Date: Thu, 18 Feb 2016 11:11:14 +0100 Subject: [PATCH] Make Transaction.Builder.addOperation thread safe --- src/main/java/org/stellar/sdk/Transaction.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/stellar/sdk/Transaction.java b/src/main/java/org/stellar/sdk/Transaction.java index 4b57b7ebc..82d53cd2e 100644 --- a/src/main/java/org/stellar/sdk/Transaction.java +++ b/src/main/java/org/stellar/sdk/Transaction.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import static com.google.common.base.Preconditions.checkArgument; @@ -180,7 +181,7 @@ public static class Builder { public Builder(TransactionBuilderAccount sourceAccount) { checkNotNull(sourceAccount, "sourceAccount cannot be null"); mSourceAccount = sourceAccount; - mOperations = new ArrayList(); + mOperations = Collections.synchronizedList(new ArrayList()); } /**