From: Christoph Weitkamp Date: Thu, 30 Dec 2021 12:53:24 +0000 (+0100) Subject: Prevent errors in log when URI host is null (#11893) X-Git-Url: https://git.basschouten.com/?a=commitdiff_plain;h=cf86044580b9e98c6dd24aad404a427d0cc84f42;p=openhab-addons.git Prevent errors in log when URI host is null (#11893) Signed-off-by: Christoph Weitkamp --- 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) {