In InvokeHttp, moving the OkHttp Response object to a try with resources
@@ -779,8 +779,8 @@ public final class InvokeHTTP extends AbstractProcessor {
}
final long startNanos = System.nanoTime();
- Response responseHttp = okHttpClient.newCall(httpRequest).execute();
+ try (Response responseHttp = okHttpClient.newCall(httpRequest).execute()) {
// output the raw response headers (DEBUG level only)
logResponse(logger, url, responseHttp);
@@ -906,6 +906,8 @@ public final class InvokeHTTP extends AbstractProcessor {
}
route(requestFlowFile, responseFlowFile, session, context, statusCode);
+
+ }
} catch (final Exception e) {
// penalize or yield
if (requestFlowFile != null) {
