Skip to content

Commit c1933cb

Browse files
author
Bilal Al
committed
polish
1 parent aa40aca commit c1933cb

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public synchronized SplitHttpResponse get(URI uri, FetchOptions options, Map<Str
5959
throw new IllegalStateException(String.format("Problem in http get operation: %s", e), e);
6060
} finally {
6161
try {
62-
getHttpURLConnection.disconnect();
63-
} catch (NullPointerException e) {
64-
_log.error(String.format("HTTP URL Connection is not initialized: %s", e), e);
62+
if (getHttpURLConnection != null) {
63+
getHttpURLConnection.disconnect();
64+
}
6565
} catch (Exception e) {
6666
_log.error(String.format("Could not close HTTP URL Connection: %s", e), e);
6767
}
@@ -112,9 +112,9 @@ public SplitHttpResponse _get(HttpURLConnection getHttpURLConnection, FetchOptio
112112
throw new IllegalStateException(String.format("Problem in http get operation: %s", e), e);
113113
} finally {
114114
try {
115-
inputStreamReader.close();
116-
} catch (NullPointerException e) {
117-
_log.error(String.format("HTTP Stream is not initialized: %s", e), e);
115+
if (inputStreamReader != null) {
116+
inputStreamReader.close();
117+
}
118118
} catch (Exception e) {
119119
_log.error(String.format("Could not close HTTP Stream: %s", e), e);
120120
}
@@ -130,9 +130,9 @@ public synchronized SplitHttpResponse post(URI uri, HttpEntity entity, Map<Strin
130130
throw new IllegalStateException(String.format("Problem in http post operation: %s", e), e);
131131
} finally {
132132
try {
133-
postHttpURLConnection.disconnect();
134-
} catch (NullPointerException e) {
135-
_log.error(String.format("URL Connection is not initialized: %s", e), e);
133+
if (postHttpURLConnection != null) {
134+
postHttpURLConnection.disconnect();
135+
}
136136
} catch (Exception e) {
137137
_log.error(String.format("Could not close URL Connection: %s", e), e);
138138
}

0 commit comments

Comments
 (0)