Skip to content

Commit

Permalink
Prevent errors in log when URI host is null (openhab#11893)
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
  • Loading branch information
cweitkamp authored and andrasU committed Nov 12, 2022
1 parent 197734c commit ffbbcb6
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,17 @@ private void updateImage(Map<String, Object> metadata) {

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) {
Expand Down

0 comments on commit ffbbcb6

Please sign in to comment.