From ecb1ddac0f0fecbdbf6c61f31dfced8052720807 Mon Sep 17 00:00:00 2001 From: Stephan Richter Date: Sun, 17 Aug 2025 22:34:13 +0200 Subject: [PATCH] fixed exception handling Signed-off-by: Stephan Richter --- .../main/java/de/srsoftware/umbrella/core/Util.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/de/srsoftware/umbrella/core/Util.java b/core/src/main/java/de/srsoftware/umbrella/core/Util.java index f14a830..62125a2 100644 --- a/core/src/main/java/de/srsoftware/umbrella/core/Util.java +++ b/core/src/main/java/de/srsoftware/umbrella/core/Util.java @@ -136,12 +136,12 @@ public class Util { } var method = query == null ? GET : POST; try { - LOG.log(DEBUG,"sending {0} request ({1}) to {2}",method,postMime == null ? "empty" : postMime,target); - LOG.log(TRACE,"postData = {0}",query); + LOG.log(DEBUG, "sending {0} request ({1}) to {2}", method, postMime == null ? "empty" : postMime, target); + LOG.log(TRACE, "postData = {0}", query); var conn = open(target); conn.setRequestMethod(method); conn.setRequestProperty(CONTENT_TYPE, postMime); - if (auth != null) conn.setRequestProperty(AUTHORIZATION,auth); + if (auth != null) conn.setRequestProperty(AUTHORIZATION, auth); if (query != null) { conn.setDoOutput(true); var out = conn.getOutputStream(); @@ -161,8 +161,10 @@ public class Util { var is = conn.getErrorStream(); is.transferTo(bos); is.close(); - throw new UmbrellaException(500,bos.toString(UTF_8)); + throw new UmbrellaException(500, bos.toString(UTF_8)); } + } catch (UmbrellaException e){ + throw e; } catch (Exception e) { LOG.log(WARNING,"Request to {0} failed: {1}",target,e.getMessage()); throw new UmbrellaException(500,"Request to {0} failed!",target).causedBy(e);