Skip to content

Commit

Permalink
[pushbullet] Replace deprecated URL constructor (#17982)
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremy Setton <[email protected]>
  • Loading branch information
jsetton authored Dec 29, 2024
1 parent df1ee5f commit 33b1941
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 33b1941

Please sign in to comment.