Support for Protobuf 4.x

This commit compiles our Protobuf against 4.27, effectively raising our
baseline to 3.9+.

This commit also re-generates all the Java messages from the .proto spec
using the latest protoc binary.

Closes gh-33011
This commit is contained in:
Brian Clozel
2024-06-11 14:12:55 +02:00
parent 2a680934ee
commit a6fb7e99a0
18 changed files with 1545 additions and 1362 deletions

View File

@@ -203,7 +203,6 @@ public class ProtobufHttpMessageConverter extends AbstractHttpMessageConverter<M
(this.protobufFormatSupport != null && this.protobufFormatSupport.supportsWriteOnly(mediaType)));
}
@SuppressWarnings("deprecation")
@Override
protected void writeInternal(Message message, HttpOutputMessage outputMessage)
throws IOException, HttpMessageNotWritableException {
@@ -226,7 +225,7 @@ public class ProtobufHttpMessageConverter extends AbstractHttpMessageConverter<M
}
else if (TEXT_PLAIN.isCompatibleWith(contentType)) {
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(outputMessage.getBody(), charset);
TextFormat.print(message, outputStreamWriter); // deprecated on Protobuf 3.9
TextFormat.printer().print(message, outputStreamWriter);
outputStreamWriter.flush();
outputMessage.getBody().flush();
}