File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
src/main/java/net/snowflake/client/core Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -368,13 +368,14 @@ public static StmtOutput execute(
368368 execTimeData .setGzipStart ();
369369 // SNOW-18057: compress the post body in gzip
370370 ByteArrayOutputStream baos = new ByteArrayOutputStream ();
371- GZIPOutputStream gzos = new GZIPOutputStream (baos );
372- byte [] bytes = json .getBytes ("UTF-8" );
373- gzos .write (bytes );
374- gzos .finish ();
375- input = new ByteArrayEntity (baos .toByteArray ());
376- httpRequest .addHeader ("content-encoding" , "gzip" );
377- execTimeData .setGzipEnd ();
371+ try (GZIPOutputStream gzos = new GZIPOutputStream (baos )) {
372+ byte [] bytes = json .getBytes ("UTF-8" );
373+ gzos .write (bytes );
374+ gzos .finish ();
375+ input = new ByteArrayEntity (baos .toByteArray ());
376+ httpRequest .addHeader ("content-encoding" , "gzip" );
377+ execTimeData .setGzipEnd ();
378+ }
378379 } else {
379380 input = new ByteArrayEntity (json .getBytes ("UTF-8" ));
380381 }
You can’t perform that action at this time.
0 commit comments