From a1d21a112528f87777217fc9db057306e808c8cb Mon Sep 17 00:00:00 2001 From: Colin Alworth Date: Fri, 31 May 2024 08:57:18 -0500 Subject: [PATCH] Restore constant field for max array length to fix tests Follow-up #9961 --- .../user/server/rpc/impl/ServerSerializationStreamWriter.java | 4 +++- .../server/rpc/impl/ServerSerializationStreamWriterTest.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriter.java b/user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriter.java index 93d2771f874..56e68398925 100644 --- a/user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriter.java +++ b/user/src/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriter.java @@ -48,11 +48,13 @@ public final class ServerSerializationStreamWriter extends * array literals. */ public static class LengthConstrainedArray { + public static final int MAXIMUM_ARRAY_LENGTH_DEFAULT = 1 << 15; private static final String POSTLUDE = "])"; private static final String PRELUDE = "].concat(["; private final StringBuffer buffer; - private final int maximumArrayLength = Integer.getInteger("gwt.rpc.maxPayloadChunkSize", 1 << 15); + private final int maximumArrayLength = Integer.getInteger("gwt.rpc.maxPayloadChunkSize", + MAXIMUM_ARRAY_LENGTH_DEFAULT); private int count = 0; private boolean needsComma = false; private int total = 0; diff --git a/user/test/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriterTest.java b/user/test/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriterTest.java index 1655966341d..9ac3f148766 100644 --- a/user/test/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriterTest.java +++ b/user/test/com/google/gwt/user/server/rpc/impl/ServerSerializationStreamWriterTest.java @@ -136,7 +136,7 @@ public void testVersion8Fallbacks() { // Fallbacks to 7 if array size reached maximum int maxArrayLength = - ServerSerializationStreamWriter.LengthConstrainedArray.MAXIMUM_ARRAY_LENGTH + 100; + ServerSerializationStreamWriter.LengthConstrainedArray.MAXIMUM_ARRAY_LENGTH_DEFAULT + 100; writer = new ServerSerializationStreamWriter(null, 8); for (int i = 0; i < maxArrayLength; i++) { writer.writeInt(i);