Skip to content

Commit

Permalink
Native libraries: Fixed `IllegalArgumentException: URI scheme is not …
Browse files Browse the repository at this point in the history
…"file"` when using FlatLaf in WebStart. (issue #668; regression in FlatLaf 3.1)
  • Loading branch information
DevCharly committed Apr 17, 2023
1 parent 4afb150 commit 65a0f46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ FlatLaf Change Log
"Material Theme UI Lite" themes; issue #667; regression in FlatLaf 3.1).
- Fixed too large tree row height in "Carbon", "Dark Purple", "Gray",
"Material Design Dark", "Monokai Pro", "One Dark" and "Spacegray" themes.
- Native libraries: Fixed `IllegalArgumentException: URI scheme is not "file"`
when using FlatLaf in WebStart. (issue #668; regression in FlatLaf 3.1)


## 3.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.io.File;
import java.net.URL;
import java.security.CodeSource;
import com.formdev.flatlaf.FlatSystemProperties;
import com.formdev.flatlaf.util.LoggingFacade;
import com.formdev.flatlaf.util.NativeLibrary;
Expand Down Expand Up @@ -128,10 +129,15 @@ private static NativeLibrary createNativeLibrary( String classifier, String ext
private static File findLibraryBesideJar( String classifier, String ext ) {
try {
// get location of FlatLaf jar
URL jarUrl = FlatNativeLibrary.class.getProtectionDomain().getCodeSource().getLocation();
CodeSource codeSource = FlatNativeLibrary.class.getProtectionDomain().getCodeSource();
URL jarUrl = (codeSource != null) ? codeSource.getLocation() : null;
if( jarUrl == null )
return null;

// if url is not a file, then we're running in a special environment (e.g. WebStart)
if( !"file".equals( jarUrl.getProtocol() ) )
return null;

File jarFile = new File( jarUrl.toURI() );

// if jarFile is a directory, then we're in a development environment
Expand Down

0 comments on commit 65a0f46

Please sign in to comment.