From f38605432b9ad9d91dbb479dcf08a5f53f0fc285 Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Wed, 20 Mar 2019 23:05:33 +0200 Subject: [PATCH] Fix warning --- pf4j/src/main/java/org/pf4j/util/FileUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pf4j/src/main/java/org/pf4j/util/FileUtils.java b/pf4j/src/main/java/org/pf4j/util/FileUtils.java index a3e955e..5c84b2a 100644 --- a/pf4j/src/main/java/org/pf4j/util/FileUtils.java +++ b/pf4j/src/main/java/org/pf4j/util/FileUtils.java @@ -77,7 +77,7 @@ public class FileUtils { * @throws IOException if something goes wrong */ public static void delete(Path path) throws IOException { - Files.walkFileTree(path, new SimpleFileVisitor() { + Files.walkFileTree(path, new SimpleFileVisitor<>() { @Override public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) throws IOException { @@ -172,7 +172,8 @@ public class FileUtils { FileTime pluginZipDate = Files.getLastModifiedTime(filePath); String fileName = filePath.getFileName().toString(); - Path pluginDirectory = filePath.resolveSibling(fileName.substring(0, fileName.lastIndexOf("."))); + String directoryName = fileName.substring(0, fileName.lastIndexOf(".")); + Path pluginDirectory = filePath.resolveSibling(directoryName); if (!Files.exists(pluginDirectory) || pluginZipDate.compareTo(Files.getLastModifiedTime(pluginDirectory)) > 0) { // do not overwrite an old version, remove it -- 2.39.5