Add and use AbstractDecoderTestCase

Introduce new base test case for decoder tests, and use it.

Issue: SPR-17449
This commit is contained in:
Arjen Poutsma
2018-11-16 10:56:21 +01:00
parent 0f2d9df79f
commit 39ce989d1a
20 changed files with 1047 additions and 567 deletions

View File

@@ -124,15 +124,15 @@ public class ProtobufDecoder extends ProtobufCodecSupport implements Decoder<Mes
try {
Message.Builder builder = getMessageBuilder(elementType.toClass());
builder.mergeFrom(CodedInputStream.newInstance(dataBuffer.asByteBuffer()), this.extensionRegistry);
Message message = builder.build();
DataBufferUtils.release(dataBuffer);
return message;
return builder.build();
}
catch (IOException ex) {
throw new DecodingException("I/O error while parsing input stream", ex);
}
catch (Exception ex) {
throw new DecodingException("Could not read Protobuf message: " + ex.getMessage(), ex);
} finally {
DataBufferUtils.release(dataBuffer);
}
}
);