RFR: 8331467: ImageReaderFactory can cause a ClassNotFoundException if the default FileSystemProvider is not the system-default provider [v7]

liyazzi duke at openjdk.org
Sat Dec 14 06:29:36 UTC 2024


> For two cases:
> 
> 1. When the ImageReaderFactory was loaded by local jdk,that means the ImageReaderFactory was loaded by boot class loader,then init the `Path BOOT_MODULES_JIMAGE` by using `sun.nio.fs.DefaultFileSystemProvider` which is obtained through reflection,due to it is in jdk internal.
> 2. When loaded by a target jdk, such as jdk8 runtime, then use the Java 8 compatible APIs: `FileSystems.getDefault()` to init the `BOOT_MODULES_JIMAGE` field.
> Then we can avoid the circular dependencies in class loading caused by loading the defaultSystemProvider.

liyazzi has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 14 additional commits since the last revision:

 - Merge branch 'openjdk:master' into 8331467
 - add test case in test/jdk/java/nio/file/spi/SetDefaultProvider.java as the test of this issue
 - add '\s' to avoid trailing whiteSpace
 - empty commit
 - remove the '\s' and trailing whitespace
 - add test.jdk value log
 - deal with trailing whitespace
 - use LF
 - delete foo
 - turn CRLF to CR
 - ... and 4 more: https://git.openjdk.org/jdk/compare/aef8c30b...c97dba99

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/22628/files
  - new: https://git.openjdk.org/jdk/pull/22628/files/e3c336c7..c97dba99

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=22628&range=06
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=22628&range=05-06

  Stats: 16537 lines in 2747 files changed: 9445 ins; 2127 del; 4965 mod
  Patch: https://git.openjdk.org/jdk/pull/22628.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22628/head:pull/22628

PR: https://git.openjdk.org/jdk/pull/22628


More information about the core-libs-dev mailing list