From cefb46d0fcc08d3a1e2b8f4d42f0b9933bcbbef2 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 28 Nov 2017 11:29:47 -0500 Subject: [PATCH] Throw UOE from compressible bytes stream reset A compressible bytes output stream is a stream output which supports a reset method. However, compressible bytes output streams are unusual in that the current implementation sometimes supports a reset (if the stream is not compressed) and sometimes does not support a rest (if the stream is compressed). This inconsistent behavior is puzzling and instead we should simply always throw an unsupported operation exception. Relates #27564 --- .../elasticsearch/transport/CompressibleBytesOutputStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/transport/CompressibleBytesOutputStream.java b/core/src/main/java/org/elasticsearch/transport/CompressibleBytesOutputStream.java index 7689806220a..4b4923ab1f8 100644 --- a/core/src/main/java/org/elasticsearch/transport/CompressibleBytesOutputStream.java +++ b/core/src/main/java/org/elasticsearch/transport/CompressibleBytesOutputStream.java @@ -104,6 +104,6 @@ final class CompressibleBytesOutputStream extends StreamOutput { @Override public void reset() throws IOException { - stream.reset(); + throw new UnsupportedOperationException(); } }