From 47a1122f04544ee60850ffea998ffd85520e06b8 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Tue, 7 Dec 2021 00:39:28 +0100 Subject: [PATCH] Window decorations: do not exit application with `UnsatisfiedLinkError` in case that FlatLaf DLL cannot be executed because of restrictions on temporary directory (issue #436) --- CHANGELOG.md | 6 +++++- .../flatlaf/ui/FlatWindowsNativeWindowBorder.java | 15 +++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b35cfd52..8c51ce27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ FlatLaf Change Log #### Fixed bugs -- Linux: Fixed font problems when running on Oracle Java 8 (OpenJDK 8 is not +- Linux: Fixed font problems when running on Oracle Java (OpenJDK is not affected): - oversized text if system font is "Inter" (issue #427) - missing text if system font is "Cantarell" (on Fedora) @@ -14,6 +14,10 @@ FlatLaf Change Log on AWT thread. (issue #432) - macOS: Fixed `NullPointerException` when using AWT component `java.awt.Choice`. (issue #439) +- Native window decorations: Do not exit application with `UnsatisfiedLinkError` + in case that FlatLaf DLL cannot be executed because of restrictions on + temporary directory. Instead, continue with default window decorations. (issue + #436) ## 1.6.4 diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatWindowsNativeWindowBorder.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatWindowsNativeWindowBorder.java index 311e46c3..5af5b1ed 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatWindowsNativeWindowBorder.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatWindowsNativeWindowBorder.java @@ -163,11 +163,18 @@ class FlatWindowsNativeWindowBorder return; // install - WndProc wndProc = new WndProc( window ); - if( wndProc.hwnd == 0 ) - return; + try { + WndProc wndProc = new WndProc( window ); + if( wndProc.hwnd == 0 ) + return; - windowsMap.put( window, wndProc ); + windowsMap.put( window, wndProc ); + } catch( UnsatisfiedLinkError ex ) { + // catch for the case that the operating system prevents execution of DLL + // (e.g. if DLLs in temp folder are restricted) + // --> continue application without custom decorations + LoggingFacade.INSTANCE.logSevere( null, ex ); + } } private void uninstall( Window window ) {