From 33b19419b6ccb7b4a69771cc5bcf6f85de69292f Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 28 Dec 2024 20:02:33 -0500 Subject: [PATCH] [pushbullet] Replace deprecated URL constructor (#17982) 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 cd45afc12a6..d1266246b2f 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 @@ package org.openhab.binding.pushbullet.internal.handler; 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 @@ public class PushbulletHandler extends BaseThingHandler { 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;