Skip to content

Commit 3c6671c

Browse files
authored
Merge pull request #1101 from guardian/ja-java-upgrade
Upgrade to Java 21
2 parents 2441346 + 7980a59 commit 3c6671c

5 files changed

Lines changed: 9 additions & 20 deletions

File tree

.java-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
java corretto-11.0.25.9.1
1+
java corretto-21

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Running locally
6969
------------------------------
7070
1. Get Deploy Tools Janus credentials.
7171
2. Run `./scripts/setup`
72-
3. Ensure you are running Java 11
72+
3. Ensure you are running Java 21
7373
4. Run `sbt`
7474
5. Start the application: `sbt:prism> run`
7575

app/agent/origin.scala

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package agent
22

33
import java.io.FileNotFoundException
4-
import java.net.{URI, URL, URLConnection, URLStreamHandler}
4+
import java.net.URI
55

66
import collectors.Instance
77
import conf.{AWS, PrismConfiguration}
@@ -206,17 +206,6 @@ case class JsonOrigin(
206206
crawlRate: Map[String, CrawlRate]
207207
) extends Origin
208208
with Logging {
209-
private val classpathHandler = new URLStreamHandler {
210-
override def openConnection(u: URL): URLConnection = {
211-
Option(getClass.getResource(u.getPath))
212-
.map(_.openConnection())
213-
.getOrElse {
214-
throw new FileNotFoundException(
215-
"%s not found on classpath" format u.getPath
216-
)
217-
}
218-
}
219-
}
220209

221210
def credsFromS3Url(url: URI): AwsCredentialsProvider = {
222211
Option(url.getUserInfo) match {
@@ -237,10 +226,11 @@ case class JsonOrigin(
237226
url.replace("%resource%", resource.name)
238227
) match {
239228
case classPathLocation if classPathLocation.getScheme == "classpath" =>
240-
Source.fromURL(
241-
new URL(null, classPathLocation.toString, classpathHandler),
242-
"utf-8"
243-
)
229+
val path = classPathLocation.getPath
230+
val resourceURL = Option(getClass.getResource(path)).getOrElse {
231+
throw new FileNotFoundException(s"$path not found on classpath")
232+
}
233+
Source.fromURL(resourceURL, "utf-8")
244234
case s3Location if s3Location.getScheme == "s3" =>
245235
val s3Client = S3Client.builder
246236
.credentialsProvider(credsFromS3Url(s3Location))

cdk/lib/prism.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class Prism extends GuStack {
8989
applicationLogging: {
9090
enabled: true,
9191
},
92-
imageRecipe: 'arm64-focal-java11-deploy-infrastructure',
92+
imageRecipe: 'arm64-jammy-java21-deploy-infrastructure',
9393
instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MEDIUM),
9494
userData,
9595
certificateProps: {

0 commit comments

Comments
 (0)