Skip to content

Commit

Permalink
Raise baseline Java version to 21
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <[email protected]>
  • Loading branch information
nscuro committed May 7, 2024
1 parent 16cfd7c commit 63d9021
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/_meta-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v4.2.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
cache: 'maven'

- name: Setup CycloneDX CLI
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v4.2.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
cache: 'maven'

- name: Set Version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # tag=v4.2.1
with:
distribution: 'temurin'
java-version: '17'
java-version: '21'
cache: 'maven'

- name: Execute unit tests
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This document primarily covers the API server. Please refer to the frontend repo

There are a few things you'll need on your journey:

* JDK 17+ ([Temurin](https://adoptium.net/temurin/releases) distribution recommended)
* JDK 21+ ([Temurin](https://adoptium.net/temurin/releases) distribution recommended)
* Maven (comes bundled with IntelliJ and Eclipse)
* A Java IDE of your preference (we recommend IntelliJ, but any other IDE is fine as well)
* Docker (optional)
Expand Down
53 changes: 53 additions & 0 deletions docs/_posts/2024-xx-xx-v4.12.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: v4.12.0
type: major
---

**Features:**

* Raise baseline Java version to 21 - [apiserver/#3682]

**Fixes:**

**Upgrade Notes:**

* The API server now requires Java 21 or newer. Users deploying Dependency-Track via containers
don't have to do anything, since those have been shipped with Java 21 since version 4.10.0.
Users deploying Dependency-Track as JAR will need to upgrade their Java installation accordingly.

For a complete list of changes, refer to the respective GitHub milestones:

* [API server milestone 4.12.0](https://github.com/DependencyTrack/dependency-track/milestone/27?closed=1)
* [Frontend milestone 4.12.0](https://github.com/DependencyTrack/frontend/milestone/21?closed=1)

We thank all organizations and individuals who contributed to this release, from logging issues to taking part in discussions on GitHub & Slack to testing of fixes.

Special thanks to everyone who contributed code to implement enhancements and fix defects:

###### dependency-track-apiserver.jar

| Algorithm | Checksum |
|:----------|:---------|
| SHA-1 | |
| SHA-256 | |

###### dependency-track-bundled.jar

| Algorithm | Checksum |
|:----------|:---------|
| SHA-1 | |
| SHA-256 | |

###### frontend-dist.zip

| Algorithm | Checksum |
|:----------|:---------|
| SHA-1 | |
| SHA-256 | |

###### Software Bill of Materials (SBOM)

* API Server: [bom.json](https://github.com/DependencyTrack/dependency-track/releases/download/4.12.0/bom.json)
* Frontend: [bom.json](https://github.com/DependencyTrack/frontend/releases/download/4.12.0/bom.json)

[apiserver/#3682]: https://github.com/DependencyTrack/dependency-track/pull/3682
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
</ciManagement>

<properties>
<!-- Java Version -->
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>

<!-- Dependency Versions -->
<frontend.version>4.11.0</frontend.version>
<lib.alpine.version>${project.parent.version}</lib.alpine.version>
Expand Down
25 changes: 1 addition & 24 deletions src/main/java/org/dependencytrack/tasks/NistApiMirrorTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,12 @@ public void inform(final Event e) {
.namingPattern(getClass().getSimpleName() + "-%d")
.uncaughtExceptionHandler(new LoggableUncaughtExceptionHandler())
.build();
final var executor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), factory);

final long startTimeNs = System.nanoTime();
final var numMirrored = new AtomicInteger(0);
ZonedDateTime lastModified;
try (final NvdCveClient client = createApiClient(apiUrl, apiKey, lastModifiedEpochSeconds)) {
try {
try (final var executor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), factory)) {
while (client.hasNext()) {
for (final DefCveItem defCveItem : client.next()) {
final CveItem cveItem = defCveItem.getCve();
Expand Down Expand Up @@ -186,28 +185,6 @@ public void inform(final Event e) {
});
}
}
} finally {
// Copied from ExecutorService#close (available since JDK 19).
// This code can be replaced with try-with-resources after upgrade to Java 21.
// https://github.com/openjdk/jdk/blob/890adb6410dab4606a4f26a942aed02fb2f55387/src/java.base/share/classes/java/util/concurrent/ExecutorService.java#L410-L429
boolean terminated = executor.isTerminated();
if (!terminated) {
executor.shutdown();
boolean interrupted = false;
while (!terminated) {
try {
terminated = executor.awaitTermination(1L, TimeUnit.DAYS);
} catch (InterruptedException ex) {
if (!interrupted) {
executor.shutdownNow();
interrupted = true;
}
}
}
if (interrupted) {
Thread.currentThread().interrupt();
}
}
}

lastModified = client.getLastUpdated();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class ManagedHttpClientFactoryTest {

@Before
public void before() {
environmentVariables.set("http_proxy", "http://acme\\username:[email protected]:1080");
environmentVariables.set("http_proxy", "http://acme%5Cusername:[email protected]:1080");
environmentVariables.set("no_proxy", "localhost:443,127.0.0.1:8080,example.com,www.example.net");
}

Expand Down

0 comments on commit 63d9021

Please sign in to comment.