No-op: move position updating to end of method for consistency

Other methods are now updating position at the end of the method.

Also, it's good practice to limit the scope of try { } blocks.

This is a partial roll-forward of cl/673588324

PiperOrigin-RevId: 681673291
pull/18598/head
Mark Hansen 2 months ago committed by Copybara-Service
parent ee391369e6
commit dd78f0ac12
  1. 2
      java/core/src/main/java/com/google/protobuf/CodedOutputStream.java

@ -1433,10 +1433,10 @@ public abstract class CodedOutputStream extends ByteOutput {
public final void write(byte[] value, int offset, int length) throws IOException {
try {
System.arraycopy(value, offset, buffer, position, length);
position += length;
} catch (IndexOutOfBoundsException e) {
throw new OutOfSpaceException(position, limit, length, e);
}
position += length;
}
@Override

Loading…
Cancel
Save