diff --git a/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/handler/PushbulletHandler.java b/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/handler/PushbulletHandler.java index cd45afc12a6e9..d1266246b2fad 100644 --- a/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/handler/PushbulletHandler.java +++ b/bundles/org.openhab.binding.pushbullet/src/main/java/org/openhab/binding/pushbullet/internal/handler/PushbulletHandler.java @@ -15,8 +15,8 @@ import static org.openhab.binding.pushbullet.internal.PushbulletBindingConstants.*; import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collection; @@ -280,11 +280,11 @@ private boolean sendPush(PushRequest request) { return IMAGE_FILE_NAME; } try { - Path fileName = Path.of(content.startsWith("http") ? new URL(content).getPath() : content).getFileName(); + Path fileName = Path.of(content.startsWith("http") ? new URI(content).getPath() : content).getFileName(); if (fileName != null) { return fileName.toString(); } - } catch (MalformedURLException e) { + } catch (URISyntaxException e) { logger.debug("Malformed url content: {}", e.getMessage()); } return null;