From 795e143b57cb809c1b8ef823bb5bc8748885ae57 Mon Sep 17 00:00:00 2001 From: Andreas Hager Date: Wed, 6 Mar 2024 13:03:56 +0100 Subject: [PATCH] Fix NullPointerException when trying to close a non-existing response, for instance after a Socket Timeout --- src/main/java/net/avalara/avatax/rest/client/RestCall.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/avalara/avatax/rest/client/RestCall.java b/src/main/java/net/avalara/avatax/rest/client/RestCall.java index 9dfccce..35a974b 100644 --- a/src/main/java/net/avalara/avatax/rest/client/RestCall.java +++ b/src/main/java/net/avalara/avatax/rest/client/RestCall.java @@ -204,7 +204,10 @@ public T call() throws Exception { } finally { // Finally, log all the information related to request, response, error, etc logInfo(logObject); - response.close(); + + if (response != null) { + response.close(); + } } return obj; }