RFR: 8321159: SymbolLookup.libraryLookup(Path, Arena) Assumes default Filesystem [v3]

Alan Bateman alanb at openjdk.org
Mon Dec 4 10:15:43 UTC 2023


On Mon, 4 Dec 2023 09:10:07 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> This PR proposes to reject paths provided to the `SymbolLookup.libraryLookup(Path path, Arena arena)` method if a path is not in the default file system.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add fail statement

test/jdk/java/foreign/LibraryLookupTest.java line 128:

> 126:             }
> 127:         }
> 128:         throw new AssertionError("Unable to create file system from " + clazz);

Using a class from testng.jar is a good idea. An alternative to decoding the composite URL is to use the code source from the protection domain, e.g.

URI uri = clazz.getProtectionDomain().getCodeSource().getLocation().toURI();
return FileSystems.newFileSystem(Path.of(uri));

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16944#discussion_r1413645073


More information about the core-libs-dev mailing list