Skip to content

Commit 2ec4789

Browse files
author
Bilal Al
committed
polish
1 parent 4a7079a commit 2ec4789

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

client/src/main/java/io/split/service/SplitHttpClientKerberosImpl.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ public synchronized SplitHttpResponse get(URI uri, FetchOptions options, Map<Str
7272
}
7373
}
7474
public SplitHttpResponse doGet(HttpURLConnection getHttpURLConnection, FetchOptions options, Map<String, List<String>> additionalHeaders) {
75-
InputStreamReader inputStreamReader = null;
7675
try {
7776
getHttpURLConnection.setRequestMethod("GET");
7877
setBasicHeaders(getHttpURLConnection);
@@ -100,28 +99,21 @@ public SplitHttpResponse doGet(HttpURLConnection getHttpURLConnection, FetchOpti
10099
statusMessage = getHttpURLConnection.getResponseMessage();
101100
}
102101

103-
inputStreamReader = new InputStreamReader(getHttpURLConnection.getInputStream());
102+
InputStreamReader inputStreamReader = new InputStreamReader(getHttpURLConnection.getInputStream());
104103
BufferedReader br = new BufferedReader(inputStreamReader);
105104
String strCurrentLine;
106105
StringBuilder bld = new StringBuilder();
107106
while ((strCurrentLine = br.readLine()) != null) {
108107
bld.append(strCurrentLine);
109108
}
110109
String responseBody = bld.toString();
110+
inputStreamReader.close();
111111
return new SplitHttpResponse(responseCode,
112112
statusMessage,
113113
responseBody,
114114
getResponseHeaders(getHttpURLConnection));
115115
} catch (Exception e) {
116116
throw new IllegalStateException(String.format("Problem in http get operation: %s", e), e);
117-
} finally {
118-
try {
119-
if (inputStreamReader != null) {
120-
inputStreamReader.close();
121-
}
122-
} catch (Exception e) {
123-
_log.error(String.format("Could not close HTTP Stream: %s", e), e);
124-
}
125117
}
126118
}
127119

0 commit comments

Comments
 (0)