ArrayDecoders: tag methods as throwing more-specific exception

This is a no-op cleanup. The methods are package-private so shouldn't be an API break.

I'm about to add some more tests here. This just makes writing the tests easier , as they don't have to catch IOException any more.

PiperOrigin-RevId: 671592242
pull/18090/head
Mark Hansen 7 months ago committed by Copybara-Service
parent 4be4bf2b5c
commit 37f481c16f
  1. 21
      java/core/src/main/java/com/google/protobuf/ArrayDecoders.java

@ -455,7 +455,8 @@ final class ArrayDecoders {
/** Decodes a packed fixed32 field. Returns the position after all read values. */
static int decodePackedFixed32List(
byte[] data, int position, ProtobufList<?> list, Registers registers) throws IOException {
byte[] data, int position, ProtobufList<?> list, Registers registers)
throws InvalidProtocolBufferException {
final IntArrayList output = (IntArrayList) list;
position = decodeVarint32(data, position, registers);
final int fieldLimit = position + registers.int1;
@ -471,7 +472,8 @@ final class ArrayDecoders {
/** Decodes a packed fixed64 field. Returns the position after all read values. */
static int decodePackedFixed64List(
byte[] data, int position, ProtobufList<?> list, Registers registers) throws IOException {
byte[] data, int position, ProtobufList<?> list, Registers registers)
throws InvalidProtocolBufferException {
final LongArrayList output = (LongArrayList) list;
position = decodeVarint32(data, position, registers);
final int fieldLimit = position + registers.int1;
@ -487,7 +489,8 @@ final class ArrayDecoders {
/** Decodes a packed float field. Returns the position after all read values. */
static int decodePackedFloatList(
byte[] data, int position, ProtobufList<?> list, Registers registers) throws IOException {
byte[] data, int position, ProtobufList<?> list, Registers registers)
throws InvalidProtocolBufferException {
final FloatArrayList output = (FloatArrayList) list;
position = decodeVarint32(data, position, registers);
final int fieldLimit = position + registers.int1;
@ -503,7 +506,8 @@ final class ArrayDecoders {
/** Decodes a packed double field. Returns the position after all read values. */
static int decodePackedDoubleList(
byte[] data, int position, ProtobufList<?> list, Registers registers) throws IOException {
byte[] data, int position, ProtobufList<?> list, Registers registers)
throws InvalidProtocolBufferException {
final DoubleArrayList output = (DoubleArrayList) list;
position = decodeVarint32(data, position, registers);
final int fieldLimit = position + registers.int1;
@ -519,7 +523,8 @@ final class ArrayDecoders {
/** Decodes a packed boolean field. Returns the position after all read values. */
static int decodePackedBoolList(
byte[] data, int position, ProtobufList<?> list, Registers registers) throws IOException {
byte[] data, int position, ProtobufList<?> list, Registers registers)
throws InvalidProtocolBufferException {
final BooleanArrayList output = (BooleanArrayList) list;
position = decodeVarint32(data, position, registers);
final int fieldLimit = position + registers.int1;
@ -535,7 +540,8 @@ final class ArrayDecoders {
/** Decodes a packed sint32 field. Returns the position after all read values. */
static int decodePackedSInt32List(
byte[] data, int position, ProtobufList<?> list, Registers registers) throws IOException {
byte[] data, int position, ProtobufList<?> list, Registers registers)
throws InvalidProtocolBufferException {
final IntArrayList output = (IntArrayList) list;
position = decodeVarint32(data, position, registers);
final int fieldLimit = position + registers.int1;
@ -551,7 +557,8 @@ final class ArrayDecoders {
/** Decodes a packed sint64 field. Returns the position after all read values. */
static int decodePackedSInt64List(
byte[] data, int position, ProtobufList<?> list, Registers registers) throws IOException {
byte[] data, int position, ProtobufList<?> list, Registers registers)
throws InvalidProtocolBufferException {
final LongArrayList output = (LongArrayList) list;
position = decodeVarint32(data, position, registers);
final int fieldLimit = position + registers.int1;

Loading…
Cancel
Save