From 66c5597dce3c1da1b26230c6ee768f5e9375a48a Mon Sep 17 00:00:00 2001 From: Mohanned Anwar <92345336+Muhanned-Anwar@users.noreply.github.com> Date: Sun, 2 Apr 2023 05:29:42 +0300 Subject: [PATCH] Update NativeUtils.java --- ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java b/ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java index 424d28890..ea406b62b 100644 --- a/ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java +++ b/ann/src/main/java/com/twitter/ann/faiss/NativeUtils.java @@ -10,7 +10,7 @@ import java.util.Locale; 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 File temporaryDir; @@ -19,12 +19,12 @@ public final class NativeUtils { } 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 '/')."); } 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) { throw new IllegalArgumentException("The filename has to be at least 3 characters long.");