|
16 | 16 | import java.io.ByteArrayOutputStream;
|
17 | 17 | import java.io.IOException;
|
18 | 18 | import java.io.OutputStream;
|
19 |
| -import java.net.URL; |
| 19 | +import java.net.URI; |
| 20 | +import java.net.URISyntaxException; |
20 | 21 | import java.nio.charset.StandardCharsets;
|
21 | 22 | import java.util.Base64;
|
22 | 23 | import java.util.Collections;
|
@@ -100,11 +101,11 @@ public void showToast(
|
100 | 101 | public void showToast(
|
101 | 102 | @ActionInput(name = "icon", label = "@text/actionShowToastInputIconLabel", description = "@text/actionShowToastInputIconDesc") String icon,
|
102 | 103 | @ActionInput(name = "text", label = "@text/actionShowToastInputTextLabel", description = "@text/actionShowToastInputTextDesc") String text)
|
103 |
| - throws IOException { |
104 |
| - BufferedImage bi = ImageIO.read(new URL(icon)); |
| 104 | + throws IOException, URISyntaxException { |
| 105 | + BufferedImage bi = ImageIO.read(new URI(icon).toURL()); |
105 | 106 | try (ByteArrayOutputStream os = new ByteArrayOutputStream(); OutputStream b64 = Base64.getEncoder().wrap(os)) {
|
106 | 107 | ImageIO.write(bi, "png", b64);
|
107 |
| - String string = os.toString(StandardCharsets.UTF_8.name()); |
| 108 | + String string = os.toString(StandardCharsets.UTF_8); |
108 | 109 | getConnectedSocket().ifPresent(control -> control.showToast(text, string, "png", createResponseListener()));
|
109 | 110 | }
|
110 | 111 | }
|
@@ -261,7 +262,8 @@ public static void showToast(ThingActions actions, String text) throws IOExcepti
|
261 | 262 | ((LGWebOSActions) actions).showToast(text);
|
262 | 263 | }
|
263 | 264 |
|
264 |
| - public static void showToast(ThingActions actions, String icon, String text) throws IOException { |
| 265 | + public static void showToast(ThingActions actions, String icon, String text) |
| 266 | + throws IOException, URISyntaxException { |
265 | 267 | ((LGWebOSActions) actions).showToast(icon, text);
|
266 | 268 | }
|
267 | 269 |
|
|
0 commit comments