Skip to content

Commit ee02662

Browse files
change deprecated stuff
1 parent 9db28b3 commit ee02662

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

application/src/main/java/org/togetherjava/tjbot/features/mathcommands/wolframalpha/WolframAlphaImages.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55

66
import javax.imageio.ImageIO;
77

8-
import java.awt.Color;
9-
import java.awt.Font;
10-
import java.awt.Graphics;
8+
import java.awt.*;
119
import java.awt.font.FontRenderContext;
1210
import java.awt.geom.AffineTransform;
1311
import java.awt.geom.Rectangle2D;
@@ -16,7 +14,8 @@
1614
import java.io.ByteArrayOutputStream;
1715
import java.io.IOException;
1816
import java.io.UncheckedIOException;
19-
import java.net.URL;
17+
import java.net.URI;
18+
import java.net.URISyntaxException;
2019
import java.util.ArrayList;
2120
import java.util.Collection;
2221
import java.util.List;
@@ -66,10 +65,10 @@ static BufferedImage renderSubPod(SubPod subPod) {
6665
Graphics graphics = destinationImage.getGraphics();
6766

6867
try {
69-
graphics.drawImage(ImageIO.read(new URL(sourceImage.getSource())), IMAGE_MARGIN_PX,
70-
IMAGE_MARGIN_PX, null);
71-
} catch (IOException e) {
72-
throw new UncheckedIOException(e);
68+
graphics.drawImage(ImageIO.read(new URI(sourceImage.getSource()).toURL()),
69+
IMAGE_MARGIN_PX, IMAGE_MARGIN_PX, null);
70+
} catch (IOException | URISyntaxException e) {
71+
throw new RuntimeException(e);
7372
}
7473

7574
return destinationImage;

0 commit comments

Comments
 (0)