Deep in the bowels of `System.loadLibrary`, `File.getCanonicalPath()` was 
called on the target library file before it was passed to the system library 
loading APIs. In JDK-8003887, `File.getCanonicalPath` was altered to resolve 
symlinks on Windows. This had unintended consequences for passing a symlink to 
`System.loadLibrary` on Windows. The underlying Windows `LoadLibrary` API 
inspects the file name passed to it and adds a `.dll` extension if the it is 
not already present. Thus, if `System.loadLibrary` was given a symlink to a 
file and that file didn't have a `.dll` extension, `LoadLibrary` try to load 
nonexistent file and fail.

Fix this problem by using `File.getAbsolutePath()` instead of 
`File.getCanonicalPath()` in `NativeLibraries.java`.

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

Commit messages:
 - 8348828: Windows dll loading now resolves symlinks

Changes: https://git.openjdk.org/jdk/pull/24694/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24694&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8348828
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/24694.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24694/head:pull/24694

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

Reply via email to