mirror of https://github.com/apache/nifi.git
NIFI-3633 This closes #1705. Adding a try with resources so the OkHttp response is properly closed
Signed-off-by: joewitt <joewitt@apache.org>
This commit is contained in:
parent
726d15d1f7
commit
49a9bc88c6
|
@ -226,12 +226,13 @@ public class HttpNotificationService extends AbstractNotificationService {
|
|||
final OkHttpClient httpClient = httpClientReference.get();
|
||||
|
||||
final Call call = httpClient.newCall(request);
|
||||
final Response response = call.execute();
|
||||
try (final Response response = call.execute()) {
|
||||
|
||||
if (!response.isSuccessful()) {
|
||||
throw new NotificationFailedException("Failed to send Http Notification. Received an unsuccessful status code response '" + response.code() +"'. The message was '" +
|
||||
response.message() + "'");
|
||||
}
|
||||
if (!response.isSuccessful()) {
|
||||
throw new NotificationFailedException("Failed to send Http Notification. Received an unsuccessful status code response '" + response.code() + "'. The message was '" +
|
||||
response.message() + "'");
|
||||
}
|
||||
}
|
||||
} catch (NotificationFailedException e){
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
|
|
Loading…
Reference in New Issue