From 2ec4789b7e12a207a210a6fb39404ea9358ef34f Mon Sep 17 00:00:00 2001 From: Bilal Al Date: Wed, 14 Aug 2024 12:14:24 -0700 Subject: [PATCH] polish --- .../split/service/SplitHttpClientKerberosImpl.java | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/client/src/main/java/io/split/service/SplitHttpClientKerberosImpl.java b/client/src/main/java/io/split/service/SplitHttpClientKerberosImpl.java index 35dd16e2..82dd9a35 100644 --- a/client/src/main/java/io/split/service/SplitHttpClientKerberosImpl.java +++ b/client/src/main/java/io/split/service/SplitHttpClientKerberosImpl.java @@ -72,7 +72,6 @@ public synchronized SplitHttpResponse get(URI uri, FetchOptions options, Map> additionalHeaders) { - InputStreamReader inputStreamReader = null; try { getHttpURLConnection.setRequestMethod("GET"); setBasicHeaders(getHttpURLConnection); @@ -100,7 +99,7 @@ public SplitHttpResponse doGet(HttpURLConnection getHttpURLConnection, FetchOpti statusMessage = getHttpURLConnection.getResponseMessage(); } - inputStreamReader = new InputStreamReader(getHttpURLConnection.getInputStream()); + InputStreamReader inputStreamReader = new InputStreamReader(getHttpURLConnection.getInputStream()); BufferedReader br = new BufferedReader(inputStreamReader); String strCurrentLine; StringBuilder bld = new StringBuilder(); @@ -108,20 +107,13 @@ public SplitHttpResponse doGet(HttpURLConnection getHttpURLConnection, FetchOpti bld.append(strCurrentLine); } String responseBody = bld.toString(); + inputStreamReader.close(); return new SplitHttpResponse(responseCode, statusMessage, responseBody, getResponseHeaders(getHttpURLConnection)); } catch (Exception e) { throw new IllegalStateException(String.format("Problem in http get operation: %s", e), e); - } finally { - try { - if (inputStreamReader != null) { - inputStreamReader.close(); - } - } catch (Exception e) { - _log.error(String.format("Could not close HTTP Stream: %s", e), e); - } } }