As a continuation of #4464, the flattened-reader setup in FormatReaderTest wraps ImageReader in a Memoizer configured with new File("").
An empty path is not a stable or portable way to disable caching.
On Temurin 21.0.12 its directory and writable checks are false, so Memoizer rejects it.
On Temurin 25.0.3 both checks are true, so Memoizer uses the current working directory and ordinary data tests unexpectedly exercise the cache path.
These tests are intended to validate direct reader behavior. Memoizer already has explicit coverage in testMemoFileUsage, where a unique temporary cache directory is used.
Steps to reproduce
-
Start JShell from a writable checkout on Temurin 21.0.12 and 25.0.3 and run:
import java.io.File;
var cache = new File("");
System.out.println(cache.getAbsolutePath());
System.out.println(cache.isDirectory());
System.out.println(cache.canWrite());
-
Both JDKs print the checkout for the absolute path. Temurin 21 prints false and false; Temurin 25 prints true and true.
-
With the old Memoizer stack, call getMemoFile for a temporary source. It returns null on Java 21 and a non-null .bfmemo path on Java 25.
-
Run a flattened standard data test on Java 25. It can now take the memoized path or write cache content below the working directory.
Expected behavior
Standard reader tests use BufferedImageReader(ImageReader) directly and do not create memo cache content.
Memoizer behavior is tested only by the dedicated memo test with an isolated cache directory.
As a continuation of #4464, the flattened-reader setup in
FormatReaderTestwrapsImageReaderin a Memoizer configured withnew File("").An empty path is not a stable or portable way to disable caching.
On Temurin 21.0.12 its directory and writable checks are false, so Memoizer rejects it.
On Temurin 25.0.3 both checks are true, so Memoizer uses the current working directory and ordinary data tests unexpectedly exercise the cache path.
These tests are intended to validate direct reader behavior. Memoizer already has explicit coverage in
testMemoFileUsage, where a unique temporary cache directory is used.Steps to reproduce
Start JShell from a writable checkout on Temurin 21.0.12 and 25.0.3 and run:
Both JDKs print the checkout for the absolute path. Temurin 21 prints
falseandfalse; Temurin 25 printstrueandtrue.With the old
Memoizerstack, callgetMemoFilefor a temporary source. It returnsnullon Java 21 and a non-null.bfmemopath on Java 25.Run a flattened standard data test on Java 25. It can now take the memoized path or write cache content below the working directory.
Expected behavior
Standard reader tests use
BufferedImageReader(ImageReader)directly and do not create memo cache content.Memoizer behavior is tested only by the dedicated memo test with an isolated cache directory.