Prevent errors in log when URI host is null (#11893)

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp
2021-12-30 13:53:24 +01:00
committed by GitHub
parent 253f36abbf
commit cf86044580

View File

@@ -267,11 +267,17 @@ public class ChromecastStatusUpdater {
private @Nullable RawType downloadImage(String url) { private @Nullable RawType downloadImage(String url) {
logger.debug("Trying to download the content of URL '{}'", url); logger.debug("Trying to download the content of URL '{}'", url);
RawType downloadedImage = HttpUtil.downloadImage(url); try {
if (downloadedImage == null) { RawType downloadedImage = HttpUtil.downloadImage(url);
logger.debug("Failed to download the content of URL '{}'", 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) { private @Nullable RawType downloadImageFromCache(String url) {