From dc6decac93c672c971d390bf97562dfe60c931fa Mon Sep 17 00:00:00 2001 From: Aurelien Date: Fri, 23 Jan 2026 17:28:39 +0100 Subject: [PATCH] TDB-19854 - Removed Gretty to get rid of vulnerable dependencies, use an embedded jetty 12 instance instead - Fixed SpotBugs issues - Fixed SpotBugs issues - Upgraded assertj - Upgraded mockito - Upgraded commons-beanutils - Upgraded terracotta platform - Upgraded terracotta core --- .../conventions/CheckstyleConvention.java | 18 +++++ .../build/conventions/JavaConvention.java | 10 +++ .../build/conventions/SpotbugsConvention.java | 10 ++- .../DefaultClusteringServiceDestroyTest.java | 6 +- .../common/internal/store/ValueWrapper.java | 1 - clustered/osgi-test/build.gradle | 6 +- .../internal/store/SPIStoreTester.java | 31 +++++++++ .../internal/store/StoreContainsKeyTest.java | 9 +-- .../ehcache/internal/store/StoreGetTest.java | 9 +-- .../internal/store/StorePutIfAbsentTest.java | 18 ++--- .../ehcache/internal/store/StorePutTest.java | 18 +---- .../internal/store/StoreRemoveKeyTest.java | 9 +-- .../store/StoreRemoveKeyValueTest.java | 18 +---- .../store/StoreReplaceKeyValueTest.java | 18 +---- demos/00-NoCache/build.gradle | 7 ++ .../ehcache/demos/peeper/PeeperServer.java | 26 +++++++ .../ehcache/demos/peeper/PeeperServlet.java | 10 +-- .../peeper/PeeperServletContextListener.java | 6 +- demos/01-CacheAside/build.gradle | 7 ++ .../ehcache/demos/peeper/PeeperServer.java | 26 +++++++ .../ehcache/demos/peeper/PeeperServlet.java | 10 +-- .../peeper/PeeperServletContextListener.java | 6 +- demos/build.gradle | 69 ++++++------------- demos/config/checkstyle-suppressions.xml | 9 +++ .../demos/server/EmbeddedPeeperServer.java | 55 +++++++++++++++ docs/src/docs/asciidoc/user/examples.adoc | 6 +- .../org/ehcache/core/EhcacheManagerTest.java | 25 ++++--- .../builders/UserManagedCacheBuilder.java | 2 +- .../internal/store/tiering/TieredStore.java | 6 +- .../ehcache/impl/persistence/FileUtils.java | 1 - .../store/tiering/TieredStoreTest.java | 9 +-- ehcache/build.gradle | 10 +-- gradle.properties | 9 +-- osgi-test/build.gradle | 6 +- 34 files changed, 291 insertions(+), 195 deletions(-) create mode 100644 demos/00-NoCache/build.gradle create mode 100644 demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServer.java create mode 100644 demos/01-CacheAside/build.gradle create mode 100644 demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServer.java create mode 100644 demos/config/checkstyle-suppressions.xml create mode 100644 demos/src/main/java/org/ehcache/demos/server/EmbeddedPeeperServer.java diff --git a/build-logic/src/main/java/org/ehcache/build/conventions/CheckstyleConvention.java b/build-logic/src/main/java/org/ehcache/build/conventions/CheckstyleConvention.java index 0973fc1237..e4e5f0c88d 100644 --- a/build-logic/src/main/java/org/ehcache/build/conventions/CheckstyleConvention.java +++ b/build-logic/src/main/java/org/ehcache/build/conventions/CheckstyleConvention.java @@ -13,10 +13,28 @@ public void apply(Project project) { project.getPlugins().apply(CheckstylePlugin.class); project.getExtensions().configure(CheckstyleExtension.class, checkstyle -> { + checkstyle.setToolVersion("10.18.1"); checkstyle.setConfigFile(project.getRootProject().file("config/checkstyle.xml")); Map properties = checkstyle.getConfigProperties(); properties.put("projectDir", project.getProjectDir()); properties.put("rootDir", project.getRootDir()); }); + + project.getConfigurations().named("checkstyle", config -> { + config.getResolutionStrategy().dependencySubstitution(subs -> { + subs.substitute(subs.module("org.codehaus.plexus:plexus-utils:3.1.1")) + .using(subs.module("org.codehaus.plexus:plexus-utils:3.3.0")) + .because("Checkstyle 10.18.1 pulls mismatched plexus-utils versions"); + subs.substitute(subs.module("org.apache.commons:commons-lang3:3.7")) + .using(subs.module("org.apache.commons:commons-lang3:3.8.1")) + .because("Checkstyle transitives mix commons-lang3 versions"); + subs.substitute(subs.module("org.apache.httpcomponents:httpcore:4.4.13")) + .using(subs.module("org.apache.httpcomponents:httpcore:4.4.14")) + .because("Align httpcore to latest bugfix release"); + subs.substitute(subs.module("commons-codec:commons-codec:1.11")) + .using(subs.module("commons-codec:commons-codec:1.15")) + .because("Checkstyle transitive dependencies depend on different commons-codec versions"); + }); + }); } } diff --git a/build-logic/src/main/java/org/ehcache/build/conventions/JavaConvention.java b/build-logic/src/main/java/org/ehcache/build/conventions/JavaConvention.java index 736002f349..65ca29a34a 100644 --- a/build-logic/src/main/java/org/ehcache/build/conventions/JavaConvention.java +++ b/build-logic/src/main/java/org/ehcache/build/conventions/JavaConvention.java @@ -22,6 +22,8 @@ public void apply(Project project) { dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "junit:junit:" + project.property("junitVersion")); dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.assertj:assertj-core:" + project.property("assertjVersion")); + dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "net.bytebuddy:byte-buddy:" + project.property("byteBuddyVersion")); + dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "net.bytebuddy:byte-buddy-agent:" + project.property("byteBuddyVersion")); dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.hamcrest:hamcrest:" + project.property("hamcrestVersion")); dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.mockito:mockito-core:" + project.property("mockitoVersion")); ModuleDependency md = (ModuleDependency)dependencies.add(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, "org.terracotta:terracotta-utilities-test-tools:" + project.property("terracottaUtilitiesVersion")); @@ -35,6 +37,14 @@ public void apply(Project project) { subs.substitute(subs.module("org.hamcrest:hamcrest-library:1.3")).with(subs.module("org.hamcrest:hamcrest-library:" + project.property("hamcrestVersion"))); subs.substitute(subs.module("junit:junit:4.12")).using(subs.module("junit:junit:4.13.1")); }); + config.getResolutionStrategy().eachDependency(details -> { + String group = details.getRequested().getGroup(); + String name = details.getRequested().getName(); + if ("net.bytebuddy".equals(group) && ("byte-buddy".equals(name) || "byte-buddy-agent".equals(name))) { + details.useVersion(project.property("byteBuddyVersion").toString()); + details.because("Align Byte Buddy family versions across AssertJ and Mockito"); + } + }); }); } } diff --git a/build-logic/src/main/java/org/ehcache/build/conventions/SpotbugsConvention.java b/build-logic/src/main/java/org/ehcache/build/conventions/SpotbugsConvention.java index 9815385453..c48c6093b3 100644 --- a/build-logic/src/main/java/org/ehcache/build/conventions/SpotbugsConvention.java +++ b/build-logic/src/main/java/org/ehcache/build/conventions/SpotbugsConvention.java @@ -17,8 +17,8 @@ public void apply(Project project) { SpotBugsExtension spotbugs = project.getExtensions().getByType(SpotBugsExtension.class); spotbugs.getIgnoreFailures().set(false); - // Later versions of Spotbugs have stupid heuristics for EI_EXPOSE_REP* - spotbugs.getToolVersion().set("4.2.3"); + spotbugs.getToolVersion().set("4.9.8"); + spotbugs.getOmitVisitors().addAll("FindReturnRef", "ConstructorThrow"); project.getPlugins().withType(JavaBasePlugin.class).configureEach(plugin -> { @@ -46,6 +46,12 @@ public void apply(Project project) { subs.substitute(subs.module("org.apache.commons:commons-lang3:3.11")) .using(subs.module("org.apache.commons:commons-lang3:3.12.0")) .because("Spotbugs has dependency divergences"); + subs.substitute(subs.module("org.apache.commons:commons-lang3:3.18.0")) + .using(subs.module("org.apache.commons:commons-lang3:3.19.0")) + .because("Spotbugs 4.9.8 has dependency divergences"); + subs.substitute(subs.module("org.apache.logging.log4j:log4j-core:2.25.2")) + .using(subs.module("org.apache.logging.log4j:log4j-core:2.25.3")) + .because("Security vulnerability fix"); }); }); diff --git a/clustered/ehcache-client/src/test/java/org/ehcache/clustered/client/internal/service/DefaultClusteringServiceDestroyTest.java b/clustered/ehcache-client/src/test/java/org/ehcache/clustered/client/internal/service/DefaultClusteringServiceDestroyTest.java index b9c346e6ea..67bd01bda3 100644 --- a/clustered/ehcache-client/src/test/java/org/ehcache/clustered/client/internal/service/DefaultClusteringServiceDestroyTest.java +++ b/clustered/ehcache-client/src/test/java/org/ehcache/clustered/client/internal/service/DefaultClusteringServiceDestroyTest.java @@ -55,6 +55,8 @@ import static org.mockito.Mockito.when; import static org.mockito.Mockito.withSettings; +import org.mockito.quality.Strictness; + /** * DefaultClusteringServiceDestroyTest */ @@ -194,7 +196,7 @@ public void testDestroyOnPartialDestroyState() throws Exception { private void mockLockForWriteLockSuccess() throws org.terracotta.exception.EntityNotProvidedException, org.terracotta.exception.EntityNotFoundException, org.terracotta.exception.EntityVersionMismatchException { when(connection.getEntityRef(same(VoltronReadWriteLockClient.class), eq(1L), any())).thenReturn(lockEntityRef); - VoltronReadWriteLockClient lockClient = mock(VoltronReadWriteLockClient.class, withSettings().lenient()); + VoltronReadWriteLockClient lockClient = mock(VoltronReadWriteLockClient.class, withSettings().strictness(Strictness.LENIENT)); when(lockEntityRef.fetchEntity(null)).thenReturn(lockClient); when(lockClient.tryLock(LockMessaging.HoldType.WRITE)).thenReturn(true); @@ -203,7 +205,7 @@ private void mockLockForWriteLockSuccess() throws org.terracotta.exception.Entit private void mockLockForReadLockSuccess() throws org.terracotta.exception.EntityNotProvidedException, org.terracotta.exception.EntityNotFoundException, org.terracotta.exception.EntityVersionMismatchException { when(connection.getEntityRef(same(VoltronReadWriteLockClient.class), eq(1L), any())).thenReturn(lockEntityRef); - VoltronReadWriteLockClient lockClient = mock(VoltronReadWriteLockClient.class, withSettings().lenient()); + VoltronReadWriteLockClient lockClient = mock(VoltronReadWriteLockClient.class, withSettings().strictness(Strictness.LENIENT)); when(lockEntityRef.fetchEntity(null)).thenReturn(lockClient); when(lockClient.tryLock(LockMessaging.HoldType.READ)).thenReturn(true); diff --git a/clustered/ehcache-common-api/src/main/java/org/ehcache/clustered/common/internal/store/ValueWrapper.java b/clustered/ehcache-common-api/src/main/java/org/ehcache/clustered/common/internal/store/ValueWrapper.java index e74444ef2e..1d87fcefd9 100644 --- a/clustered/ehcache-common-api/src/main/java/org/ehcache/clustered/common/internal/store/ValueWrapper.java +++ b/clustered/ehcache-common-api/src/main/java/org/ehcache/clustered/common/internal/store/ValueWrapper.java @@ -25,7 +25,6 @@ /** * ValueWrapper */ -@SuppressFBWarnings("EI_EXPOSE_REP") public class ValueWrapper implements Serializable { private static final long serialVersionUID = -4794738044295644587L; diff --git a/clustered/osgi-test/build.gradle b/clustered/osgi-test/build.gradle index 5442ffe29c..aab59fabf8 100644 --- a/clustered/osgi-test/build.gradle +++ b/clustered/osgi-test/build.gradle @@ -65,8 +65,10 @@ configurations.all { substitute(module('org.ops4j.pax.url:pax-url-link:2.6.8')) .using(module('org.ops4j.pax.url:pax-url-link:2.6.11')) substitute(module('org.ops4j.pax.url:pax-url-aether:2.6.8')) - // the 2 line has CVE-2025-48924 which is preventing build - .using(module('org.ops4j.pax.url:pax-url-aether:3.0.1')) + .using(module('org.ops4j.pax.url:pax-url-aether:2.6.17')) + substitute(module('org.apache.commons:commons-lang3:3.12.0')) + .using(module('org.apache.commons:commons-lang3:3.18.0')) + .because('CVE-2025-48924') substitute(module('org.osgi:org.osgi.util.function:1.1.0')) .using(module('org.osgi:org.osgi.util.function:1.2.0')) .because('Dependency divergence in org.osgi:org.osgi.util.promise:1.2.0') diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/SPIStoreTester.java b/core-spi-test/src/main/java/org/ehcache/internal/store/SPIStoreTester.java index 1f7697e5b2..4cc5063f96 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/SPIStoreTester.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/SPIStoreTester.java @@ -18,6 +18,8 @@ package org.ehcache.internal.store; import org.ehcache.core.spi.store.Store; +import org.ehcache.spi.resilience.StoreAccessException; +import org.ehcache.spi.test.LegalSPITesterException; import org.ehcache.spi.test.SPITester; /** @@ -30,10 +32,39 @@ public class SPIStoreTester extends SPITester { + protected static final String SPI_WARNING = "Warning, an exception is thrown due to the SPI test"; + protected final StoreFactory factory; public SPIStoreTester(final StoreFactory factory) { this.factory = factory; } + @FunctionalInterface + protected interface StoreRunnable { + void run() throws StoreAccessException; + } + + protected T expectException(Class expected, StoreRunnable action) + throws LegalSPITesterException { + try { + action.run(); + } catch (Throwable throwable) { + if (expected.isInstance(throwable)) { + return expected.cast(throwable); + } + if (throwable instanceof StoreAccessException) { + throw new LegalSPITesterException(SPI_WARNING, throwable); + } + if (throwable instanceof RuntimeException) { + throw (RuntimeException) throwable; + } + if (throwable instanceof Error) { + throw (Error) throwable; + } + throw new AssertionError("Unexpected checked exception", throwable); + } + throw new AssertionError("Expected " + expected.getSimpleName() + " to be thrown"); + } + } diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreContainsKeyTest.java b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreContainsKeyTest.java index a8ffcd0881..a11ed0557a 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreContainsKeyTest.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreContainsKeyTest.java @@ -73,14 +73,7 @@ public void nullKeyThrowsException() K key = null; - try { - kvStore.containsKey(key); - throw new AssertionError("Expected NullPointerException because the key is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.containsKey(key)); } @SPITest diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreGetTest.java b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreGetTest.java index a2401b2994..51036b5a3a 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreGetTest.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreGetTest.java @@ -115,14 +115,7 @@ public void nullKeyThrowsException() K key = null; - try { - kvStore.get(key); - throw new AssertionError("Expected NullPointerException because the key is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.get(key)); } @SPITest diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/StorePutIfAbsentTest.java b/core-spi-test/src/main/java/org/ehcache/internal/store/StorePutIfAbsentTest.java index 0a47012335..cfabea7622 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/StorePutIfAbsentTest.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/StorePutIfAbsentTest.java @@ -97,34 +97,24 @@ public void doesntMapKeyToValueWhenMappingExists() @SPITest public void nullKeyThrowsException() - throws StoreAccessException, IllegalAccessException, InstantiationException { + throws IllegalAccessException, InstantiationException, LegalSPITesterException { kvStore = factory.newStore(); K key = null; V value = factory.createValue(1); - try { - kvStore.putIfAbsent(key, value, b -> {}); - throw new AssertionError("Expected NullPointerException because the key is null"); - } catch (NullPointerException e) { - // expected - } + expectException(NullPointerException.class, () -> kvStore.putIfAbsent(key, value, b -> {})); } @SPITest public void nullValueThrowsException() - throws StoreAccessException, IllegalAccessException, InstantiationException { + throws IllegalAccessException, InstantiationException, LegalSPITesterException { kvStore = factory.newStore(); K key = factory.createKey(1); V value = null; - try { - kvStore.putIfAbsent(key, value, b -> {}); - throw new AssertionError("Expected NullPointerException because the value is null"); - } catch (NullPointerException e) { - // expected - } + expectException(NullPointerException.class, () -> kvStore.putIfAbsent(key, value, b -> {})); } @SPITest diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/StorePutTest.java b/core-spi-test/src/main/java/org/ehcache/internal/store/StorePutTest.java index 772eb6349f..b77da2b1fd 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/StorePutTest.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/StorePutTest.java @@ -64,14 +64,7 @@ public void nullKeyThrowsException() K key = null; V value = factory.createValue(1); - try { - kvStore.put(key, value); - throw new AssertionError("Expected NullPointerException because the key is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.put(key, value)); } @SPITest @@ -82,14 +75,7 @@ public void nullValueThrowsException() K key = factory.createKey(1); V value = null; - try { - kvStore.put(key, value); - throw new AssertionError("Expected NullPointerException because the value is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.put(key, value)); } @SPITest diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreRemoveKeyTest.java b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreRemoveKeyTest.java index 942de9385b..cb50228a4a 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreRemoveKeyTest.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreRemoveKeyTest.java @@ -89,14 +89,7 @@ public void nullKeyThrowsException() throws IllegalAccessException, InstantiationException, LegalSPITesterException { kvStore = factory.newStore(); - try { - kvStore.remove(null); - throw new AssertionError("Expected NullPointerException because the key is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.remove(null)); } @SPITest diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreRemoveKeyValueTest.java b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreRemoveKeyValueTest.java index 5958a439c3..158563b266 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreRemoveKeyValueTest.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreRemoveKeyValueTest.java @@ -164,14 +164,7 @@ public void nullKeyThrowsException() K key = null; V value = factory.createValue(1); - try { - kvStore.remove(key, value); - throw new AssertionError("Expected NullPointerException because the key is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.remove(key, value)); } @SPITest @@ -182,14 +175,7 @@ public void nullValueThrowsException() K key = factory.createKey(1); V value = null; - try { - kvStore.remove(key, value); - throw new AssertionError("Expected NullPointerException because the value is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.remove(key, value)); } @SPITest diff --git a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreReplaceKeyValueTest.java b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreReplaceKeyValueTest.java index df62e0b0a7..d47801084a 100644 --- a/core-spi-test/src/main/java/org/ehcache/internal/store/StoreReplaceKeyValueTest.java +++ b/core-spi-test/src/main/java/org/ehcache/internal/store/StoreReplaceKeyValueTest.java @@ -117,14 +117,7 @@ public void nullKeyThrowsException() K key = null; V value = factory.createValue(1); - try { - kvStore.replace(key, value); - throw new AssertionError("Expected NullPointerException because the key is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.replace(key, value)); } @SPITest @@ -134,14 +127,7 @@ public void nullValueThrowsException() K key = factory.createKey(1); - try { - kvStore.replace(key, null); - throw new AssertionError("Expected NullPointerException because the value is null"); - } catch (NullPointerException e) { - // expected - } catch (StoreAccessException e) { - throw new LegalSPITesterException("Warning, an exception is thrown due to the SPI test"); - } + expectException(NullPointerException.class, () -> kvStore.replace(key, null)); } @SPITest diff --git a/demos/00-NoCache/build.gradle b/demos/00-NoCache/build.gradle new file mode 100644 index 0000000000..60a75d213e --- /dev/null +++ b/demos/00-NoCache/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'application' +} + +application { + mainClass = 'org.ehcache.demos.peeper.PeeperServer' +} diff --git a/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServer.java b/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServer.java new file mode 100644 index 0000000000..7c4317b4cb --- /dev/null +++ b/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServer.java @@ -0,0 +1,26 @@ +/* + * Copyright Terracotta, Inc. + * Copyright IBM Corp. 2024, 2025 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.ehcache.demos.peeper; + +import org.ehcache.demos.server.EmbeddedPeeperServer; + +public class PeeperServer { + + public static void main(String[] args) throws Exception { + EmbeddedPeeperServer.run(PeeperServletContextListener::new, PeeperServlet::new); + } +} diff --git a/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServlet.java b/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServlet.java index 9fb8ca1436..524adeaddc 100755 --- a/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServlet.java +++ b/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServlet.java @@ -16,11 +16,11 @@ */ package org.ehcache.demos.peeper; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.List; diff --git a/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServletContextListener.java b/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServletContextListener.java index efb905a8a4..a3efb3d2a3 100755 --- a/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServletContextListener.java +++ b/demos/00-NoCache/src/main/java/org/ehcache/demos/peeper/PeeperServletContextListener.java @@ -16,9 +16,9 @@ */ package org.ehcache.demos.peeper; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.annotation.WebListener; /** * @author Ludovic Orban diff --git a/demos/01-CacheAside/build.gradle b/demos/01-CacheAside/build.gradle new file mode 100644 index 0000000000..60a75d213e --- /dev/null +++ b/demos/01-CacheAside/build.gradle @@ -0,0 +1,7 @@ +plugins { + id 'application' +} + +application { + mainClass = 'org.ehcache.demos.peeper.PeeperServer' +} diff --git a/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServer.java b/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServer.java new file mode 100644 index 0000000000..7c4317b4cb --- /dev/null +++ b/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServer.java @@ -0,0 +1,26 @@ +/* + * Copyright Terracotta, Inc. + * Copyright IBM Corp. 2024, 2025 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.ehcache.demos.peeper; + +import org.ehcache.demos.server.EmbeddedPeeperServer; + +public class PeeperServer { + + public static void main(String[] args) throws Exception { + EmbeddedPeeperServer.run(PeeperServletContextListener::new, PeeperServlet::new); + } +} diff --git a/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServlet.java b/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServlet.java index 4a0e115e18..4348afad68 100755 --- a/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServlet.java +++ b/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServlet.java @@ -16,11 +16,11 @@ */ package org.ehcache.demos.peeper; -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.util.List; diff --git a/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServletContextListener.java b/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServletContextListener.java index efb905a8a4..a3efb3d2a3 100755 --- a/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServletContextListener.java +++ b/demos/01-CacheAside/src/main/java/org/ehcache/demos/peeper/PeeperServletContextListener.java @@ -16,9 +16,9 @@ */ package org.ehcache.demos.peeper; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import javax.servlet.annotation.WebListener; +import jakarta.servlet.ServletContextEvent; +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.annotation.WebListener; /** * @author Ludovic Orban diff --git a/demos/build.gradle b/demos/build.gradle index b84e1bfb38..694353a014 100644 --- a/demos/build.gradle +++ b/demos/build.gradle @@ -1,60 +1,31 @@ plugins { + id 'org.ehcache.build.conventions.java-library' id 'org.ehcache.build.conventions.war' apply false - id 'org.gretty' apply false } -subprojects { - apply plugin: 'org.ehcache.build.conventions.war' - apply plugin: 'org.gretty' - - gretty { - httpPort = 8080 - contextPath = '/' - servletContainer = 'jetty9' - } +def jettyVersion = '12.1.5' - dependencies { - implementation project(':ehcache-impl') - implementation 'javax.servlet:javax.servlet-api:3.1.0' - runtimeOnly 'ch.qos.logback:logback-classic:1.2.13' - runtimeOnly 'com.h2database:h2:1.4.196' - } +dependencies { + api platform("org.eclipse.jetty:jetty-bom:${jettyVersion}") + api 'jakarta.servlet:jakarta.servlet-api:6.0.0' + api 'org.eclipse.jetty:jetty-server' + api "org.eclipse.jetty.ee10:jetty-ee10-servlet:${jettyVersion}" +} - configurations.all { - resolutionStrategy { - dependencySubstitution { - substitute(module('org.slf4j:slf4j-api')) - .because('org.gretty:gretty-runner-jetty declares a very old version of slf4j') - .with(module('org.slf4j:slf4j-api:' + project.property('slf4jVersion'))) - } - } +configurations.configureEach { + resolutionStrategy { + force "org.slf4j:slf4j-api:${project.property('slf4jVersion')}" } +} - /* - * This substitution is solely to permit the 'dependencies' task to complete normally -- - * the Jetty 8 environment provided by gretty is not used in this module. - */ - configurations.named('grettyRunnerJetty8') { - resolutionStrategy { - dependencySubstitution { - substitute(module('org.eclipse.jetty.orbit:javax.servlet.jsp:2.1.0.v201105211820')) - .because('gretty plug-in pulls in older version for Jetty8') - .with(module('org.eclipse.jetty.orbit:javax.servlet.jsp:2.2.0.v201112011158')) - } - } - } +subprojects { + apply plugin: 'org.ehcache.build.conventions.war' - /* - * This substitution is solely to permit the 'dependencies' task to complete normally -- - * the Jetty 9.3 environment provided by gretty is not used in this module. - */ - configurations.named('grettyRunnerJetty93') { - resolutionStrategy { - dependencySubstitution { - substitute(module('org.eclipse.jetty.toolchain:jetty-schemas:3.1.M0')) - .because('gretty plug-in pulls in older version for Jetty9.3') - .with(module('org.eclipse.jetty.toolchain:jetty-schemas:3.1')) - } - } + dependencies { + implementation project(':demos') + implementation project(':ehcache-impl') + implementation 'jakarta.servlet:jakarta.servlet-api:6.0.0' + runtimeOnly 'ch.qos.logback:logback-classic:1.5.26' + runtimeOnly 'com.h2database:h2:2.4.240' } } diff --git a/demos/config/checkstyle-suppressions.xml b/demos/config/checkstyle-suppressions.xml new file mode 100644 index 0000000000..be989c924a --- /dev/null +++ b/demos/config/checkstyle-suppressions.xml @@ -0,0 +1,9 @@ + + + + + + + \ No newline at end of file diff --git a/demos/src/main/java/org/ehcache/demos/server/EmbeddedPeeperServer.java b/demos/src/main/java/org/ehcache/demos/server/EmbeddedPeeperServer.java new file mode 100644 index 0000000000..b0039d1480 --- /dev/null +++ b/demos/src/main/java/org/ehcache/demos/server/EmbeddedPeeperServer.java @@ -0,0 +1,55 @@ +/* + * Copyright Terracotta, Inc. + * Copyright IBM Corp. 2024, 2025 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.ehcache.demos.server; + +import jakarta.servlet.ServletContextListener; +import jakarta.servlet.http.HttpServlet; +import java.util.Objects; +import java.util.function.Supplier; +import org.eclipse.jetty.ee10.servlet.ServletContextHandler; +import org.eclipse.jetty.ee10.servlet.ServletHolder; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; + +public final class EmbeddedPeeperServer { + + private EmbeddedPeeperServer() { + } + + public static void run(Supplier listenerSupplier, + Supplier servletSupplier) throws Exception { + Objects.requireNonNull(listenerSupplier, "listenerSupplier"); + Objects.requireNonNull(servletSupplier, "servletSupplier"); + + Server server = new Server(); + + ServerConnector connector = new ServerConnector(server); + connector.setPort(8080); + connector.setHost(System.getenv().getOrDefault("HOST", "0.0.0.0")); + server.addConnector(connector); + + ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); + context.setContextPath("/"); + context.addEventListener(listenerSupplier.get()); + context.addServlet(new ServletHolder(servletSupplier.get()), "/*"); + + server.setHandler(context); + + server.start(); + server.join(); + } +} diff --git a/docs/src/docs/asciidoc/user/examples.adoc b/docs/src/docs/asciidoc/user/examples.adoc index 81bf6d26e1..6de5184a11 100644 --- a/docs/src/docs/asciidoc/user/examples.adoc +++ b/docs/src/docs/asciidoc/user/examples.adoc @@ -39,8 +39,7 @@ from the database to display the Peeper web page. To run this implementation: [source,bash] ---- -cd ehcache3/demos/00-NoCache -../../gradlew appStart +./gradlew :demos:00-NoCache:run ---- This builds the necessary components, starts a http://eclipse.org/jetty/[Jetty] web service, @@ -73,8 +72,7 @@ the cache is cleared. To run this implementation: [source,bash] ---- -cd ehcache3/demos/01-CacheAside -../../gradlew appStart +./gradlew :demos:01-CacheAside:run ---- This builds the necessary components, starts a http://eclipse.org/jetty/[Jetty] web service, diff --git a/ehcache-core/src/test/java/org/ehcache/core/EhcacheManagerTest.java b/ehcache-core/src/test/java/org/ehcache/core/EhcacheManagerTest.java index 03d6f93a9b..b93a22b331 100644 --- a/ehcache-core/src/test/java/org/ehcache/core/EhcacheManagerTest.java +++ b/ehcache-core/src/test/java/org/ehcache/core/EhcacheManagerTest.java @@ -117,7 +117,7 @@ public void testCanDestroyAndClose() throws Exception { Store store = mock(Store.class); CacheEventDispatcherFactory cacheEventNotificationListenerServiceProvider = mock(CacheEventDispatcherFactory.class); - when(storeProvider.createStore(any(Store.Configuration.class), ArgumentMatchers.any())).thenReturn(store); + when(storeProvider.createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(store); when(store.getConfigurationChangeListeners()).thenReturn(new ArrayList<>()); when(cacheEventNotificationListenerServiceProvider.createCacheEventDispatcher(store)).thenReturn(mock(CacheEventDispatcher.class)); @@ -200,7 +200,7 @@ public void testNoClassLoaderSpecified() { final Collection services = getServices(storeProvider, cenlProvider); when(storeProvider - .createStore(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(mock); + .createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(mock); EhcacheManager cacheManager = new EhcacheManager(config, services); cacheManager.init(); assertSame(ClassLoading.getDefaultClassLoader(), cacheManager.getClassLoader()); @@ -240,7 +240,7 @@ public ClassLoader getClassLoader() { final Collection services = getServices(storeProvider, cenlProvider); when(storeProvider - .createStore(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(mock); + .createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(mock); EhcacheManager cacheManager = new EhcacheManager(config, services); cacheManager.init(); assertSame(cl1, cacheManager.getClassLoader()); @@ -274,7 +274,7 @@ public void testThrowsWhenAddingExistingCache() { final Collection services = getServices(storeProvider, cenlProvider); when(storeProvider - .createStore(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(mock); + .createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(mock); Map> caches = newCacheMap(); caches.put("bar", cacheConfiguration); @@ -303,7 +303,7 @@ public void testThrowsWhenNotInitialized() { final Collection services = getServices(storeProvider, cenlProvider); when(storeProvider - .createStore(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(mock); + .createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(mock); final CacheConfiguration cacheConfiguration = new TestCacheConfig<>(Integer.class, String.class); Map> caches = newCacheMap(); @@ -341,7 +341,7 @@ public void testThrowsWhenRetrievingCacheWithWrongTypes() { final Collection services = getServices(storeProvider, cenlProvider); when(storeProvider - .createStore(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(mock); + .createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(mock); final CacheConfiguration cacheConfiguration = new TestCacheConfig<>(Integer.class, String.class); Map> caches = newCacheMap(); @@ -406,7 +406,7 @@ public void testLifeCyclesCacheLoaders() throws Exception { when(cenlProvider.createCacheEventDispatcher(mock)).thenReturn(cenlServiceMock); Collection services = getServices(cacheLoaderWriterProvider, decoratorLoaderWriterProvider, storeProvider, cenlProvider); when(storeProvider - .createStore(ArgumentMatchers.any(), ArgumentMatchers.any())).thenReturn(mock); + .createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(mock); EhcacheManager manager = new EhcacheManager(cfg, services); manager.init(); @@ -494,8 +494,7 @@ InternalCache createNewEhcache(final String alias, final CacheConfi final InternalCache ehcache = super.createNewEhcache(alias, config, keyType, valueType); caches.add(alias); if(caches.size() == 1) { - when(storeProvider.createStore( - ArgumentMatchers.>any(), ArgumentMatchers.>any())) + when(storeProvider.createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))) .thenThrow(thrown); } return ehcache; @@ -669,7 +668,7 @@ public void testChangesToManagerAreReflectedInConfig() { Store store = mock(Store.class); CacheEventDispatcherFactory cacheEventNotificationListenerServiceProvider = mock(CacheEventDispatcherFactory.class); - when(storeProvider.createStore(any(Store.Configuration.class), ArgumentMatchers.any())).thenReturn(store); + when(storeProvider.createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(store); when(store.getConfigurationChangeListeners()).thenReturn(new ArrayList<>()); when(cacheEventNotificationListenerServiceProvider.createCacheEventDispatcher(store)).thenReturn(mock(CacheEventDispatcher.class)); @@ -716,7 +715,7 @@ public void testCachesAddedAtRuntimeGetReInited() { Store store = mock(Store.class); CacheEventDispatcherFactory cacheEventNotificationListenerServiceProvider = mock(CacheEventDispatcherFactory.class); - when(storeProvider.createStore(any(Store.Configuration.class), ArgumentMatchers.any())).thenReturn(store); + when(storeProvider.createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class))).thenReturn(store); when(store.getConfigurationChangeListeners()).thenReturn(new ArrayList<>()); when(cacheEventNotificationListenerServiceProvider.createCacheEventDispatcher(store)).thenReturn(mock(CacheEventDispatcher.class)); @@ -754,7 +753,7 @@ public void testCachesAddedAtRuntimeGetReInited() { public void testCloseWhenRuntimeCacheCreationFails() throws Exception { Store.Provider storeProvider = mock(Store.Provider.class); when(storeProvider.rank(any(Set.class), any(Collection.class))).thenReturn(1); - doThrow(new Error("Test EhcacheManager close.")).when(storeProvider).createStore(any(Store.Configuration.class), ArgumentMatchers.any()); + doThrow(new Error("Test EhcacheManager close.")).when(storeProvider).createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class)); Map> caches = newCacheMap(); DefaultConfiguration config = new DefaultConfiguration(caches, null); @@ -788,7 +787,7 @@ public void testCloseWhenRuntimeCacheCreationFails() throws Exception { public void testCloseWhenCacheCreationFailsDuringInitialization() throws Exception { Store.Provider storeProvider = mock(Store.Provider.class); when(storeProvider.rank(any(Set.class), any(Collection.class))).thenReturn(1); - doThrow(new Error("Test EhcacheManager close.")).when(storeProvider).createStore(any(Store.Configuration.class), ArgumentMatchers.any()); + doThrow(new Error("Test EhcacheManager close.")).when(storeProvider).createStore(any(Store.Configuration.class), any(ServiceConfiguration[].class)); CacheConfiguration cacheConfiguration = new TestCacheConfig<>(Long.class, String.class); Map> caches = newCacheMap(); diff --git a/ehcache-impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java b/ehcache-impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java index ce20ee2ced..5ceb07101b 100644 --- a/ehcache-impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java +++ b/ehcache-impl/src/main/java/org/ehcache/config/builders/UserManagedCacheBuilder.java @@ -121,7 +121,7 @@ public class UserManagedCacheBuilder> imp private boolean useValueSerializingCopier; private Serializer keySerializer; private Serializer valueSerializer; - private int dispatcherConcurrency = 4; + private volatile int dispatcherConcurrency = 4; private List> eventListenerConfigurations = new ArrayList<>(); private ExecutorService unOrderedExecutor; private ExecutorService orderedExecutor; diff --git a/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java b/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java index 5f503ca55d..36d75d884f 100644 --- a/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java +++ b/ehcache-impl/src/main/java/org/ehcache/impl/internal/store/tiering/TieredStore.java @@ -222,10 +222,10 @@ private void swapCachingTiers() { } private void swapBackCachingTiers() { - if(!cachingTierRef.compareAndSet(noopCachingTier, realCachingTier)) { - throw new AssertionError("Something bad happened"); - } synchronized (noopCachingTier) { + if(!cachingTierRef.compareAndSet(noopCachingTier, realCachingTier)) { + throw new AssertionError("Something bad happened"); + } noopCachingTier.notify(); } } diff --git a/ehcache-impl/src/main/java/org/ehcache/impl/persistence/FileUtils.java b/ehcache-impl/src/main/java/org/ehcache/impl/persistence/FileUtils.java index ca831aeff3..d90c7e4851 100644 --- a/ehcache-impl/src/main/java/org/ehcache/impl/persistence/FileUtils.java +++ b/ehcache-impl/src/main/java/org/ehcache/impl/persistence/FileUtils.java @@ -110,7 +110,6 @@ static boolean tryRecursiveDelete(File file) { } } - @SuppressFBWarnings("DM_GC") private static void gc() { System.gc(); System.runFinalization(); diff --git a/ehcache-impl/src/test/java/org/ehcache/impl/internal/store/tiering/TieredStoreTest.java b/ehcache-impl/src/test/java/org/ehcache/impl/internal/store/tiering/TieredStoreTest.java index 9dcad09ee4..9afa8d8a14 100644 --- a/ehcache-impl/src/test/java/org/ehcache/impl/internal/store/tiering/TieredStoreTest.java +++ b/ehcache-impl/src/test/java/org/ehcache/impl/internal/store/tiering/TieredStoreTest.java @@ -34,6 +34,7 @@ import org.ehcache.impl.internal.store.heap.OnHeapStore; import org.ehcache.impl.internal.store.offheap.OffHeapStore; import org.ehcache.spi.service.Service; +import org.ehcache.spi.service.ServiceConfiguration; import org.ehcache.spi.service.ServiceProvider; import org.hamcrest.Matchers; import org.junit.Test; @@ -867,15 +868,15 @@ public void testReleaseStoreFlushes() throws Exception { OnHeapStore.Provider onHeapStoreProvider = mock(OnHeapStore.Provider.class); Set> cachingResources = Collections.>singleton( ResourceType.Core.HEAP); when(onHeapStoreProvider.rankCachingTier(eq(cachingResources), any(Collection.class))).thenReturn(1); - when(onHeapStoreProvider.createCachingTier(eq(cachingResources), any(Store.Configuration.class), - ArgumentMatchers.any())) + when(onHeapStoreProvider.createCachingTier(any(Set.class), any(Store.Configuration.class), + any(ServiceConfiguration[].class))) .thenReturn(stringCachingTier); OffHeapStore.Provider offHeapStoreProvider = mock(OffHeapStore.Provider.class); Set> authorityResources = Collections.>singleton( ResourceType.Core.OFFHEAP); when(offHeapStoreProvider.rankAuthority(eq(authorityResources), any(Collection.class))).thenReturn(1); - when(offHeapStoreProvider.createAuthoritativeTier(eq(authorityResources), - any(Store.Configuration.class), ArgumentMatchers.any())) + when(offHeapStoreProvider.createAuthoritativeTier(any(Set.class), + any(Store.Configuration.class), any(ServiceConfiguration[].class))) .thenReturn(stringAuthoritativeTier); Store.Configuration configuration = mock(Store.Configuration.class); diff --git a/ehcache/build.gradle b/ehcache/build.gradle index 1dfba7def1..379d1e8b7a 100644 --- a/ehcache/build.gradle +++ b/ehcache/build.gradle @@ -69,8 +69,8 @@ configurations { jakartaContents { exclude group:'jakarta.xml.bind' } - javadocAdd - jakartaJavadocAdd + javadocAdd + jakartaJavadocAdd } dependencies { @@ -97,10 +97,10 @@ dependencies { } jakartaRuntimeOnly 'org.glassfish.jaxb:jaxb-runtime:[3,3.1)' - javadocAdd 'com.github.spotbugs:spotbugs-annotations:4.2.3' + javadocAdd 'com.github.spotbugs:spotbugs-annotations:4.9.8' javadocAdd 'javax.xml.bind:jaxb-api:[2.2,3)' - - jakartaJavadocAdd 'com.github.spotbugs:spotbugs-annotations:4.2.3' + + jakartaJavadocAdd 'com.github.spotbugs:spotbugs-annotations:4.9.8' jakartaJavadocAdd 'jakarta.xml.bind:jakarta.xml.bind-api:[3,4)' } diff --git a/gradle.properties b/gradle.properties index 223afa0b00..5862693f42 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,15 +9,16 @@ slf4jVersion = 2.0.17 sizeofVersion = 0.4.4 # Terracotta clustered -terracottaPlatformVersion = 5.11.6 -terracottaCoreVersion = 5.12.15 +terracottaPlatformVersion = 5.11.7 +terracottaCoreVersion = 5.12.18 terracottaUtilitiesVersion = 0.0.19 # Test lib versions junitVersion = 4.13.1 -assertjVersion = 3.22.0 +assertjVersion = 3.27.7 +byteBuddyVersion = 1.18.3 hamcrestVersion = 2.2 -mockitoVersion = 4.3.1 +mockitoVersion = 5.12.0 jcacheTckVersion = 1.1.0 sonatypeUser = OVERRIDE_ME diff --git a/osgi-test/build.gradle b/osgi-test/build.gradle index bda397a097..3c2d84691d 100644 --- a/osgi-test/build.gradle +++ b/osgi-test/build.gradle @@ -79,8 +79,10 @@ configurations.all { substitute(module('org.ops4j.pax.url:pax-url-link:2.6.8')) .using(module('org.ops4j.pax.url:pax-url-link:2.6.11')) substitute(module('org.ops4j.pax.url:pax-url-aether:2.6.8')) - // the 2 line has CVE-2025-48924 which is preventing build - .using(module('org.ops4j.pax.url:pax-url-aether:3.0.1')) + .using(module('org.ops4j.pax.url:pax-url-aether:2.6.17')) + substitute(module('org.apache.commons:commons-lang3:3.12.0')) + .using(module('org.apache.commons:commons-lang3:3.18.0')) + .because('CVE-2025-48924') substitute(module('org.osgi:org.osgi.util.function:1.1.0')) .using(module('org.osgi:org.osgi.util.function:1.2.0')) .because('Dependency divergence in org.osgi:org.osgi.util.promise:1.2.0')