File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
server/src/main/java/org/elasticsearch/common/compress Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -229,9 +229,10 @@ public void close() throws IOException {
229229 public BytesReference uncompress (BytesReference bytesReference ) throws IOException {
230230 final BytesStreamOutput buffer = baos .get ();
231231 final Inflater inflater = inflaterRef .get ();
232- inflater .reset ();
233232 try (InflaterOutputStream ios = new InflaterOutputStream (buffer , inflater )) {
234233 bytesReference .slice (HEADER .length , bytesReference .length () - HEADER .length ).writeTo (ios );
234+ } finally {
235+ inflater .reset ();
235236 }
236237 final BytesReference res = buffer .copyBytes ();
237238 buffer .reset ();
@@ -245,11 +246,12 @@ public BytesReference uncompress(BytesReference bytesReference) throws IOExcepti
245246 @ Override
246247 public BytesReference compress (BytesReference bytesReference ) throws IOException {
247248 final BytesStreamOutput buffer = baos .get ();
248- final Deflater deflater = deflaterRef .get ();
249- deflater .reset ();
250249 buffer .write (HEADER );
250+ final Deflater deflater = deflaterRef .get ();
251251 try (DeflaterOutputStream dos = new DeflaterOutputStream (buffer , deflater , true )) {
252252 bytesReference .writeTo (dos );
253+ } finally {
254+ deflater .reset ();
253255 }
254256 final BytesReference res = buffer .copyBytes ();
255257 buffer .reset ();
You can’t perform that action at this time.
0 commit comments