mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 07:02:02 +01:00
[pushbullet] Replace deprecated URL constructor (#17982)
Signed-off-by: Jeremy Setton <jeremy.setton@gmail.com>
This commit is contained in:
parent
df1ee5fda3
commit
33b19419b6
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user