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

liyazzi duke at openjdk.org
Wed Dec 11 09:51:38 UTC 2024


On Tue, 10 Dec 2024 09:07:32 GMT, liyazzi <duke at openjdk.org> wrote:

>> 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 incrementally with one additional commit since the last revision:
> 
>   add test case in test/jdk/java/nio/file/spi/SetDefaultProvider.java as the test of this issue

In [macos-x64 / test (jdk/tier1 part 1)](https://github.com/liyazzi/jdk/actions/runs/12252749523/job/34182811710),`jdk/internal/vm/Continuation/Fuzz.java#preserve-fp]: Fuzz tests for jdk.internal.vm.Continuation` failed, Does it matter?
The log is going this:

 Compilation status for: int Fuzz.com_int(int,int)
isMethodCompiled: false isMethodCompilable: true isMethodQueuedForCompilation: false getMethodCompilationLevel: 0
----------System.err:(28/1898)----------
java.lang.AssertionError: Failed to compile int Fuzz.com_int(int,int) in 20000ms
	at Fuzz.waitForCompilation(Fuzz.java:324)
	at Fuzz.compile(Fuzz.java:358)
	at Fuzz.testTrace(Fuzz.java:215)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215)
	at java.base/java.nio.file.FileChannelLinesSpliterator.forEachRemaining(FileChannelLinesSpliterator.java:130)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:153)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:176)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:636)
	at Fuzz.testStream(Fuzz.java:205)
	at Fuzz.testFile(Fuzz.java:190)
	at Fuzz.runTests(Fuzz.java:112)
	at Fuzz.main(Fuzz.java:106)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1447)

JavaTest Message: Test threw exception: java.lang.AssertionError: Failed to compile int Fuzz.com_int(int,int) in 20000ms
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.AssertionError: Failed to compile int Fuzz.com_int(int,int) in 20000ms

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

PR Comment: https://git.openjdk.org/jdk/pull/22628#issuecomment-2535342144


More information about the core-libs-dev mailing list