diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
index c4af5889ba3..374bc039f3f 100644
--- a/.github/workflows/maven.yml
+++ b/.github/workflows/maven.yml
@@ -1,27 +1,44 @@
name: Java CI
-on: [push, pull_request]
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+env:
+ MAVEN_VERSION: 3.9.4
jobs:
build:
runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ java:
+ - '17'
+ - '20'
+ - '21-ea'
steps:
- - uses: actions/checkout@v1
+ - uses: actions/checkout@v4
+
+ - name: Setup Temurin JDK
+ uses: actions/setup-java@v3
+ with:
+ distribution: 'temurin'
+ java-version: ${{ matrix.java }}
- name: Apt update
run: sudo apt update
- - name: Install Java & Puppeteer's dependencies
- run: sudo apt-get install -y openjdk-17-jdk chromium-browser fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libappindicator3-1 libgbm1
+ - name: Install Puppeteer's dependencies
+ run: sudo apt-get install -y chromium-browser fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget libappindicator3-1 libgbm1
- name: Install Maven
run: |
- MAVEN_VERSION=3.8.7
wget https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz
tar -xzf apache-maven-${MAVEN_VERSION}-bin.tar.gz
- export PATH=$PWD/apache-maven-${MAVEN_VERSION}/bin:$PATH
- name: Cache Maven packages
uses: actions/cache@v3
@@ -32,8 +49,5 @@ jobs:
- name: Build with Maven
run: |
- export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
- export PATH=$JAVA_HOME/bin:$PATH
java -version
- mvn -version
- mvn clean verify -Pjs-test
+ ./apache-maven-${MAVEN_VERSION}/bin/mvn --show-version clean verify -Pjs-test
diff --git a/pom.xml b/pom.xml
index af1d00e45f1..b32e74f4f0e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -140,7 +140,7 @@
1.9.19
3.24.2
1.74
- 1.14.2
+ 1.14.7
4.1.0
4.4
2.0.0-M1
@@ -170,7 +170,7 @@
7.0.5.Final
1.7.3
4.2.17
- 5.2.0
+ 5.5.0
3.3
1.0.12
2.0.6
@@ -192,7 +192,7 @@
3.0.1
3.1.0
3.3.0
- 3.4.1
+ 3.5.0
3.4.1
3.0.0-M7
3.0.0
@@ -1489,6 +1489,32 @@
+
+ java21
+
+
+
+ org.apache.maven.plugins
+ maven-toolchains-plugin
+ ${maven-toolchains-plugin.version}
+
+
+
+ toolchain
+
+
+
+
+
+
+ 21
+
+
+
+
+
+
+
on-jdk-11-or-12
@@ -1501,7 +1527,7 @@
on-jdk-early-access
- [18,)
+ [21,)
https://download.java.net/java/early_access/jdk${java.specification.version}/docs/api/
diff --git a/wicket-migration/pom.xml b/wicket-migration/pom.xml
index 17683fe6949..e5b834994df 100644
--- a/wicket-migration/pom.xml
+++ b/wicket-migration/pom.xml
@@ -15,16 +15,34 @@
jakarta.activation-api
1.2.2
+
+ com.google.errorprone
+ error_prone_annotations
+ 2.18.0
+ test
+
+
+ org.checkerframework
+ checker-qual
+ 3.19.0
+ test
+
+
+ org.jetbrains
+ annotations
+ 24.0.1
+ test
+
org.junit-pioneer
junit-pioneer
- 2.0.0
+ 2.1.0
test
org.openrewrite.recipe
rewrite-recipe-bom
- 1.17.0
+ 2.2.1
pom
import
diff --git a/wicket-util/src/test/java/org/apache/wicket/util/convert/converter/LocalDateTimeConverterTest.java b/wicket-util/src/test/java/org/apache/wicket/util/convert/converter/LocalDateTimeConverterTest.java
index 9b3d0be3eb1..9eb1a3f1110 100644
--- a/wicket-util/src/test/java/org/apache/wicket/util/convert/converter/LocalDateTimeConverterTest.java
+++ b/wicket-util/src/test/java/org/apache/wicket/util/convert/converter/LocalDateTimeConverterTest.java
@@ -18,6 +18,8 @@
import org.apache.wicket.util.convert.ConversionException;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.EnabledOnJre;
+import org.junit.jupiter.api.condition.JRE;
import java.time.LocalDateTime;
import java.util.Locale;
@@ -30,18 +32,36 @@
public class LocalDateTimeConverterTest
{
@Test
- public void convertToString() {
+ @EnabledOnJre({JRE.JAVA_17, JRE.JAVA_18, JRE.JAVA_19})
+ public void convertToString_upto_jdk19() {
LocalDateTimeConverter converter = new LocalDateTimeConverter();
String date = converter.convertToString(LocalDateTime.of(2016, 7, 11, 1, 2, 3), Locale.ENGLISH);
assertEquals("Jul 11, 2016, 1:02:03 AM", date);
}
@Test
- public void convertToObject() {
+ @EnabledOnJre({JRE.JAVA_20, JRE.JAVA_21}) // See https://bugs.openjdk.org/browse/JDK-8304925
+ public void convertToString_jdk20_and_newer() {
+ LocalDateTimeConverter converter = new LocalDateTimeConverter();
+ String date = converter.convertToString(LocalDateTime.of(2016, 7, 11, 1, 2, 3), Locale.ENGLISH);
+ assertEquals("Jul 11, 2016, 1:02:03 AM", date);
+ }
+
+ @Test
+ @EnabledOnJre({JRE.JAVA_17, JRE.JAVA_18, JRE.JAVA_19})
+ public void convertToObject_upto_jdk19() {
LocalDateTimeConverter converter = new LocalDateTimeConverter();
LocalDateTime date = converter.convertToObject("Jul 11, 2016, 1:02:03 AM", Locale.ENGLISH);
assertEquals(date, LocalDateTime.of(2016, 7, 11, 1, 2, 3));
}
+
+ @Test
+ @EnabledOnJre({JRE.JAVA_20, JRE.JAVA_21}) // See https://bugs.openjdk.org/browse/JDK-8304925
+ public void convertToObject_jdk20_and_newer() {
+ LocalDateTimeConverter converter = new LocalDateTimeConverter();
+ LocalDateTime date = converter.convertToObject("Jul 11, 2016, 1:02:03 AM", Locale.ENGLISH);
+ assertEquals(date, LocalDateTime.of(2016, 7, 11, 1, 2, 3));
+ }
@Test
public void convertFails() {
diff --git a/wicket-util/src/test/java/org/apache/wicket/util/convert/converter/ZonedDateTimeConverterTest.java b/wicket-util/src/test/java/org/apache/wicket/util/convert/converter/ZonedDateTimeConverterTest.java
index add4fdf0e36..e7722435699 100644
--- a/wicket-util/src/test/java/org/apache/wicket/util/convert/converter/ZonedDateTimeConverterTest.java
+++ b/wicket-util/src/test/java/org/apache/wicket/util/convert/converter/ZonedDateTimeConverterTest.java
@@ -36,19 +36,37 @@ public class ZonedDateTimeConverterTest
private final ZoneId zoneUTC = ZoneId.of("Etc/UTC");
@Test
- public void convertToString() {
+ @EnabledOnJre({JRE.JAVA_17, JRE.JAVA_18, JRE.JAVA_19})
+ public void convertToString_upto_jdk19() {
ZonedDateTimeConverter converter = new ZonedDateTimeConverter();
String date = converter.convertToString(ZonedDateTime.of(2016, 7, 11, 1, 2, 3, 0, zoneUCT), Locale.ENGLISH);
assertEquals("Jul 11, 2016, 1:02:03 AM Coordinated Universal Time", date);
}
@Test
- public void convertToObject() {
+ @EnabledOnJre({JRE.JAVA_20, JRE.JAVA_21}) // See https://bugs.openjdk.org/browse/JDK-8304925
+ public void convertToString_jdk20_and_newer() {
+ ZonedDateTimeConverter converter = new ZonedDateTimeConverter();
+ String date = converter.convertToString(ZonedDateTime.of(2016, 7, 11, 1, 2, 3, 0, zoneUCT), Locale.ENGLISH);
+ assertEquals("Jul 11, 2016, 1:02:03 AM Coordinated Universal Time", date);
+ }
+
+ @Test
+ @EnabledOnJre({JRE.JAVA_17, JRE.JAVA_18, JRE.JAVA_19})
+ public void convertToObject_upto_jdk19() {
ZonedDateTimeConverter converter = new ZonedDateTimeConverter();
ZonedDateTime date = converter.convertToObject("Jul 11, 2016, 1:02:03 AM Coordinated Universal Time", Locale.ENGLISH);
assertEquals(ZonedDateTime.of(2016, 7, 11, 1, 2, 3, 0, zoneUTC), date);
}
+ @Test
+ @EnabledOnJre({JRE.JAVA_20, JRE.JAVA_21}) // See https://bugs.openjdk.org/browse/JDK-8304925
+ public void convertToObject_jdk20_and_newer() {
+ ZonedDateTimeConverter converter = new ZonedDateTimeConverter();
+ ZonedDateTime date = converter.convertToObject("Jul 11, 2016, 1:02:03 AM Coordinated Universal Time", Locale.ENGLISH);
+ assertEquals(ZonedDateTime.of(2016, 7, 11, 1, 2, 3, 0, zoneUTC), date);
+ }
+
@Test
public void convertFails() {
ZonedDateTimeConverter converter = new ZonedDateTimeConverter();
diff --git a/wicket-util/src/test/java/org/apache/wicket/util/file/FilesTest.java b/wicket-util/src/test/java/org/apache/wicket/util/file/FilesTest.java
index 2b9986b6aee..30de8724ce8 100644
--- a/wicket-util/src/test/java/org/apache/wicket/util/file/FilesTest.java
+++ b/wicket-util/src/test/java/org/apache/wicket/util/file/FilesTest.java
@@ -93,13 +93,24 @@ private java.io.File getFolder()
@Test
public void dontWaitTooMuchIfCantDelete()
{
- java.io.File f = mock(java.io.File.class);
- when(f.isFile()).thenReturn(true);
- when(f.delete()).thenReturn(false);
+ java.io.File f = new java.io.File("dummy/path")
+ {
+ @Override
+ public boolean isFile()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean delete()
+ {
+ return false;
+ }
+ };
long start = currentTimeMillis();
Files.remove(f);
long end = currentTimeMillis();
- assertTrue((end - start) < 5000l);
+ assertTrue((end - start) < 5000L);
}
/**