Skip to content

Commit 2b0034b

Browse files
Bump Java Version to 20 (#902)
* 19 -> 20 * change deprecated stuff * make sonar happy
1 parent c556a05 commit 2b0034b

File tree

13 files changed

+32
-29
lines changed

13 files changed

+32
-29
lines changed

.github/workflows/basic-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Basic checks
33
on: [pull_request]
44

55
env:
6-
JAVA_VERSION: 19
6+
JAVA_VERSION: 20
77

88
jobs:
99
spotless:

.github/workflows/code-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
- cron: '0 20 * * 4'
99

1010
env:
11-
JAVA_VERSION: 19
11+
JAVA_VERSION: 20
1212

1313
jobs:
1414
sonar:

.github/workflows/docker-publish.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- 'master'
88

99
env:
10-
JAVA_VERSION: 19
10+
JAVA_VERSION: 20
1111

1212
jobs:
1313
docker:

.github/workflows/docker-verify.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Docker Verify
33
on: [pull_request]
44

55
env:
6-
JAVA_VERSION: 19
6+
JAVA_VERSION: 20
77

88
jobs:
99
docker:

.github/workflows/releases.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defaults:
1010
shell: bash
1111

1212
env:
13-
JAVA_VERSION: 19
13+
JAVA_VERSION: 20
1414

1515
jobs:
1616

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# TJ-Bot
22

33
[![codefactor](https://img.shields.io/codefactor/grade/github/together-java/tj-bot)](https://www.codefactor.io/repository/github/together-java/tj-bot)
4-
![Java](https://img.shields.io/badge/Java-19-ff696c)
4+
![Java](https://img.shields.io/badge/Java-20-ff696c)
55
[![license](https://img.shields.io/github/license/Together-Java/TJ-Bot)](https://github.com/Together-Java/TJ-Bot/blob/master/LICENSE)
66
![GitHub release (latest by date)](https://img.shields.io/github/v/release/Together-Java/TJ-Bot?label=release)
77

application/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ repositories {
1818
var outputImage = 'togetherjava.org:5001/togetherjava/tjbot:' + System.getenv('BRANCH_NAME') ?: 'latest'
1919

2020
jib {
21-
from.image = 'eclipse-temurin:19'
21+
from.image = 'eclipse-temurin:20'
2222
to {
2323
image = outputImage
2424
auth {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@
1111
import org.togetherjava.tjbot.features.mathcommands.wolframalpha.api.*;
1212
import org.togetherjava.tjbot.features.mathcommands.wolframalpha.api.Error;
1313

14-
import java.awt.Color;
14+
import java.awt.*;
1515
import java.awt.image.BufferedImage;
1616
import java.io.IOException;
17-
import java.io.UncheckedIOException;
1817
import java.net.HttpURLConnection;
18+
import java.net.URISyntaxException;
1919
import java.net.http.HttpResponse;
2020
import java.util.*;
21+
import java.util.List;
2122
import java.util.function.Function;
2223
import java.util.stream.Collectors;
2324

@@ -169,7 +170,7 @@ private HandlerResponse handleSuccessfulResponse(QueryResult queryResult) {
169170
for (SubPod subPod : pod.getSubPods()) {
170171
try {
171172
images.add(WolframAlphaImages.renderSubPod(subPod));
172-
} catch (UncheckedIOException e) {
173+
} catch (IOException | URISyntaxException e) {
173174
LOGGER.error(
174175
"Failed to render sub pod (title: '{}') from pod (title: '{}') from the WolframAlpha response (for query: '{}')",
175176
subPod.getTitle(), pod.getTitle(), query, e);

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

Lines changed: 7 additions & 11 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;
@@ -55,7 +54,7 @@ static BufferedImage renderTitle(String title) {
5554
return image;
5655
}
5756

58-
static BufferedImage renderSubPod(SubPod subPod) {
57+
static BufferedImage renderSubPod(SubPod subPod) throws IOException, URISyntaxException {
5958
WolframAlphaImage sourceImage = subPod.getImage();
6059

6160
int widthPx = sourceImage.getWidth() + 2 * IMAGE_MARGIN_PX;
@@ -65,12 +64,9 @@ static BufferedImage renderSubPod(SubPod subPod) {
6564
new BufferedImage(widthPx, heightPx, BufferedImage.TYPE_4BYTE_ABGR);
6665
Graphics graphics = destinationImage.getGraphics();
6766

68-
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);
73-
}
67+
graphics.drawImage(ImageIO.read(new URI(sourceImage.getSource()).toURL()), IMAGE_MARGIN_PX,
68+
IMAGE_MARGIN_PX, null);
69+
7470

7571
return destinationImage;
7672
}

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ subprojects {
6565
options.encoding = 'UTF-8'
6666

6767
// Nails the Java-Version of every Subproject
68-
sourceCompatibility = JavaVersion.VERSION_19
69-
targetCompatibility = JavaVersion.VERSION_19
68+
sourceCompatibility = JavaVersion.VERSION_20
69+
targetCompatibility = JavaVersion.VERSION_20
7070
}
7171

7272
compileJava(compileTasks)

0 commit comments

Comments
 (0)