From f3f2da922ef95fae0c7bc29555ce33c641fd3bd2 Mon Sep 17 00:00:00 2001 From: miryamfoiferCX Date: Sun, 24 Nov 2024 22:15:38 +0200 Subject: [PATCH] fix for SpotBugs - 2 --- .../java/com/checkmarx/jenkins/tools/CheckmarxInstaller.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/com/checkmarx/jenkins/tools/CheckmarxInstaller.java b/src/main/java/com/checkmarx/jenkins/tools/CheckmarxInstaller.java index 0901cdb..d923f67 100644 --- a/src/main/java/com/checkmarx/jenkins/tools/CheckmarxInstaller.java +++ b/src/main/java/com/checkmarx/jenkins/tools/CheckmarxInstaller.java @@ -219,6 +219,9 @@ public static void copyURLToFile(URL source, String proxyStr, File destination, Request request = new Request.Builder().url(source).build(); Response response = client.newCall(request).execute(); ResponseBody responseBody = response.body(); + if (responseBody == null) { + throw new IOException("Response body is null"); + } InputStream stream = responseBody.byteStream(); try { FileUtils.copyInputStreamToFile(stream, destination);