Skip to content

Commit ead88fe

Browse files
committed
Correct array copy
1 parent 9752996 commit ead88fe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

google-cloud-spanner/src/main/java/com/google/cloud/spanner/PartitionedDmlTransaction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import io.grpc.Status;
4242
import java.time.Duration;
4343
import java.time.temporal.ChronoUnit;
44-
import java.util.Arrays;
4544
import java.util.Map;
4645
import java.util.concurrent.TimeUnit;
4746
import java.util.logging.Level;
@@ -82,8 +81,9 @@ long executeStreamingPartitionedUpdate(
8281
Stopwatch stopwatch = Stopwatch.createStarted(ticker);
8382
XGoogSpannerRequestId reqId =
8483
session.getRequestIdCreator().nextRequestId(session.getChannel(), 1);
85-
UpdateOption[] allOptions = Arrays.copyOf(updateOptions, updateOptions.length + 1);
86-
allOptions[updateOptions.length] = new Options.RequestIdOption(reqId);
84+
UpdateOption[] allOptions = new UpdateOption[updateOptions.length + 1];
85+
System.arraycopy(updateOptions, 0, allOptions, 0, updateOptions.length);
86+
allOptions[allOptions.length - 1] = new Options.RequestIdOption(reqId);
8787
Options options = Options.fromUpdateOptions(allOptions);
8888

8989
try {

0 commit comments

Comments
 (0)