From 01f1d27451121352e33b1b993ab5f294ac3a41e7 Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Thu, 9 Nov 2023 13:27:47 +0100 Subject: [PATCH] cleanup - do not throw checked exception --- .../main/java/de/itvsh/kop/common/test/TestUtils.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/kop-common-test/src/main/java/de/itvsh/kop/common/test/TestUtils.java b/kop-common-test/src/main/java/de/itvsh/kop/common/test/TestUtils.java index 200b8b2..47a8ee8 100644 --- a/kop-common-test/src/main/java/de/itvsh/kop/common/test/TestUtils.java +++ b/kop-common-test/src/main/java/de/itvsh/kop/common/test/TestUtils.java @@ -63,10 +63,14 @@ public class TestUtils { public static String addQuote(String str) { return Objects.isNull(str) ? "null" : String.format("\"%s\"", str); } - - public static byte[] contentStreamToByteArray(InputStream contentStream) throws IOException { + + public static byte[] contentStreamToByteArray(InputStream contentStream) { var outputStream = new ByteArrayOutputStream(); - IOUtils.copy(contentStream, outputStream); + try { + IOUtils.copy(contentStream, outputStream); + } catch (IOException e) { + throw new RuntimeException("Error on reading stream", e); + } return outputStream.toByteArray(); } -- GitLab