services: make BinlogHelper compatible with lite runtime

This commit makes a small change to BinlogHelper to make it compatible with the Protobuf Java Lite runtime.

In the Lite runtime, the `addXBuilder` for repeated fields is not available. Instead, the `addX` method must be used with a manually-constructed Builder.
This commit is contained in:
Eli Lipsitz 2023-12-06 12:13:30 -05:00 committed by Eric Anderson
parent 55a9c012c3
commit 3e3ba56838
1 changed files with 3 additions and 3 deletions

View File

@ -53,6 +53,7 @@ import io.grpc.binarylog.v1.Address;
import io.grpc.binarylog.v1.GrpcLogEntry;
import io.grpc.binarylog.v1.GrpcLogEntry.EventType;
import io.grpc.binarylog.v1.Message;
import io.grpc.binarylog.v1.MetadataEntry;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
@ -851,9 +852,8 @@ final class BinlogHelper {
truncated = true;
continue;
}
metaBuilder.addEntryBuilder()
.setKey(key)
.setValue(ByteString.copyFrom(value));
metaBuilder.addEntry(
MetadataEntry.newBuilder().setKey(key).setValue(ByteString.copyFrom(value)));
if (!forceInclude) {
// force included keys do not count towards the size limit
curBytes = bytesAfterAdd;