Native window decorations: catch UnsatisfiedLinkError when trying to load jawt.dll to avoid an application crash (Java 8 on Windows 10 only)

This commit is contained in:
Karl Tauber
2021-10-14 18:59:26 +02:00
parent ae28c595f9
commit efcbc1fbdb
2 changed files with 13 additions and 0 deletions

View File

@@ -1,6 +1,14 @@
FlatLaf Change Log
==================
## 1.6.1-SNAPSHOT
#### Fixed bugs
- Native window decorations: Catch `UnsatisfiedLinkError` when trying to load
`jawt.dll` to avoid an application crash (Java 8 on Windows 10 only).
## 1.6
#### New features and improvements

View File

@@ -96,6 +96,11 @@ class FlatWindowsNativeWindowBorder
// Java 9 and later does not have this problem.
try {
System.loadLibrary( "jawt" );
} catch( UnsatisfiedLinkError ex ) {
// log error only if native library jawt.dll not already loaded
String message = ex.getMessage();
if( message == null || !message.contains( "already loaded in another classloader" ) )
LoggingFacade.INSTANCE.logSevere( null, ex );
} catch( Exception ex ) {
LoggingFacade.INSTANCE.logSevere( null, ex );
}