From: Decebal Suiu Date: Wed, 22 Apr 2020 04:11:58 +0000 (+0300) Subject: Little optimization X-Git-Tag: release-3.4.0~10 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a01cd8ac5b0b73dfb1c7a43d24be261aa2f13405;p=pf4j.git Little optimization --- diff --git a/pf4j/src/main/java/org/pf4j/util/FileUtils.java b/pf4j/src/main/java/org/pf4j/util/FileUtils.java index 2a0ca85..7baaad4 100644 --- a/pf4j/src/main/java/org/pf4j/util/FileUtils.java +++ b/pf4j/src/main/java/org/pf4j/util/FileUtils.java @@ -46,6 +46,8 @@ public class FileUtils { private static final Logger log = LoggerFactory.getLogger(FileUtils.class); + private static final boolean IS_WINDOWS_OS = System.getProperty("os.name").startsWith("Windows"); + public static List readLines(Path path, boolean ignoreComments) throws IOException { File file = path.toFile(); if (!file.isFile()) { @@ -232,8 +234,7 @@ public class FileUtils { public static Path getPath(URI uri, String first, String... more) throws IOException { FileSystem fileSystem = getFileSystem(uri); Path path = fileSystem.getPath(first, more); - boolean isWindowsOS = System.getProperty("os.name").startsWith("Windows"); - if (isWindowsOS && "jar".equals(uri.getScheme())) { + if (IS_WINDOWS_OS && "jar".equals(uri.getScheme())) { // it's a ZipFileSystem fileSystem.close(); }