From cf86044580b9e98c6dd24aad404a427d0cc84f42 Mon Sep 17 00:00:00 2001 From: Christoph Weitkamp Date: Thu, 30 Dec 2021 13:53:24 +0100 Subject: [PATCH] Prevent errors in log when URI host is null (#11893) Signed-off-by: Christoph Weitkamp --- .../internal/ChromecastStatusUpdater.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bundles/org.openhab.binding.chromecast/src/main/java/org/openhab/binding/chromecast/internal/ChromecastStatusUpdater.java b/bundles/org.openhab.binding.chromecast/src/main/java/org/openhab/binding/chromecast/internal/ChromecastStatusUpdater.java index 1ce09bf5c6..3eccf32291 100644 --- a/bundles/org.openhab.binding.chromecast/src/main/java/org/openhab/binding/chromecast/internal/ChromecastStatusUpdater.java +++ b/bundles/org.openhab.binding.chromecast/src/main/java/org/openhab/binding/chromecast/internal/ChromecastStatusUpdater.java @@ -267,11 +267,17 @@ public class ChromecastStatusUpdater { private @Nullable RawType downloadImage(String url) { logger.debug("Trying to download the content of URL '{}'", url); - RawType downloadedImage = HttpUtil.downloadImage(url); - if (downloadedImage == null) { - logger.debug("Failed to download the content of URL '{}'", url); + try { + RawType downloadedImage = HttpUtil.downloadImage(url); + if (downloadedImage == null) { + logger.debug("Failed to download the content of URL '{}'", url); + } + return downloadedImage; + } catch (IllegalArgumentException e) { + // we catch this exception to avoid confusion errors in the log file + // see https://github.com/openhab/openhab-core/issues/2494#issuecomment-970162025 } - return downloadedImage; + return null; } private @Nullable RawType downloadImageFromCache(String url) { -- 2.47.3