From 4148246aacb7ee2a8b3f6f5023ed799e0f37ff9b Mon Sep 17 00:00:00 2001 From: Jeremy Setton Date: Sat, 28 Dec 2024 19:42:29 -0500 Subject: [PATCH] [pushbullet] Replace deprecated URL constructor Signed-off-by: Jeremy Setton --- .../pushbullet/internal/handler/PushbulletHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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;