RFR: 8282444: Module finder incorrectly assumes default file system path-separator character [v3]
Daniel Fuchs
dfuchs at openjdk.java.net
Tue Mar 1 09:58:06 UTC 2022
On Tue, 1 Mar 2022 08:13:57 GMT, Chris Hegarty <chegar at openjdk.org> wrote:
>> The module finder implementation incorrectly uses the path-separator
>> character from the default file system, when mapping the relative path
>> of an entry in an exploded module to a package name. This causes
>> problems on Windows [*] when using a module finder with a custom file
>> system that has a path-separator character that differs from that of the
>> default file system, e.g. the zip file system (which uses '/',
>> rather than '\' ).
>>
>> Rather than adding a new test for this, I deciced to just modify an
>> existing one. The existing test exercises the module finder with a
>> custom file system, but does so with modules have trivial single-level
>> packages names. I just expanded the module to have a subpackage. This
>> is sufficient to reproduce the bug, and verify the fix.
>>
>> [*]
>>
>> java.lang.module.FindException: Error reading module: /m2
>> at java.base/jdk.internal.module.ModulePath.readModule(ModulePath.java:350)
>> at java.base/jdk.internal.module.ModulePath.scanDirectory(ModulePath.java:284)
>> at java.base/jdk.internal.module.ModulePath.scan(ModulePath.java:232)
>> at java.base/jdk.internal.module.ModulePath.scanNextEntry(ModulePath.java:190)
>> at java.base/jdk.internal.module.ModulePath.findAll(ModulePath.java:166)
>> at ModulesInCustomFileSystem.listAllModules(ModulesInCustomFileSystem.java:108)
>> at ModulesInCustomFileSystem.testZipFileSystem(ModulesInCustomFileSystem.java:97)
>> at ModulesInCustomFileSystem.testExplodedModulesInZipFileSystem(ModulesInCustomFileSystem.java:68)
>> at ...
>> Caused by: java.lang.module.InvalidModuleDescriptorException: Package q.r not found in module
>> at java.base/jdk.internal.module.ModuleInfo.invalidModuleDescriptor(ModuleInfo.java:1212)
>> at java.base/jdk.internal.module.ModuleInfo.doRead(ModuleInfo.java:330)
>> at java.base/jdk.internal.module.ModuleInfo.read(ModuleInfo.java:129)
>> at java.base/jdk.internal.module.ModulePath.readExplodedModule(ModulePath.java:689)
>> at java.base/jdk.internal.module.ModulePath.readModule(ModulePath.java:320)
>> ... 36 more
>
> Chris Hegarty 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 four additional commits since the last revision:
>
> - Merge branch 'openjdk:master' into modulefinder_separator_win
> - update copyright year
> - add tag with OrigBugId 8178380, and bugFixId 8282444
> - fix file separator in module finder with custom fs
Not an expert of the area but the proposed changes look good to me.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7632
More information about the core-libs-dev
mailing list