Update NativeUtils.java

This commit is contained in:
Mohanned Anwar 2023-04-02 05:29:42 +03:00 committed by GitHub
parent ec83d01dca
commit 66c5597dce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@ import java.util.Locale;
public final class NativeUtils { public final class NativeUtils {
private static final int MIN_PREFIX_LENGTH = 3; private static final short MIN_PREFIX_LENGTH = 3;
public static final String NATIVE_FOLDER_PATH_PREFIX = "nativeutils"; public static final String NATIVE_FOLDER_PATH_PREFIX = "nativeutils";
public static File temporaryDir; public static File temporaryDir;
@ -19,12 +19,12 @@ public final class NativeUtils {
} }
private static File unpackLibraryFromJarInternal(String path) throws IOException { private static File unpackLibraryFromJarInternal(String path) throws IOException {
if (null == path || !path.startsWith("/")) { if (path == null || !path.startsWith("/")) {
throw new IllegalArgumentException("The path has to be absolute (start with '/')."); throw new IllegalArgumentException("The path has to be absolute (start with '/').");
} }
String[] parts = path.split("/"); String[] parts = path.split("/");
String filename = (parts.length > 1) ? parts[parts.length - 1] : null; String filename = parts.length > 1 ? parts[parts.length - 1] : null;
if (filename == null || filename.length() < MIN_PREFIX_LENGTH) { if (filename == null || filename.length() < MIN_PREFIX_LENGTH) {
throw new IllegalArgumentException("The filename has to be at least 3 characters long."); throw new IllegalArgumentException("The filename has to be at least 3 characters long.");