]> source.dussan.org Git - pf4j.git/commitdiff
Fix warning
authorDecebal Suiu <decebal.suiu@gmail.com>
Wed, 20 Mar 2019 21:05:33 +0000 (23:05 +0200)
committerDecebal Suiu <decebal.suiu@gmail.com>
Wed, 20 Mar 2019 21:05:33 +0000 (23:05 +0200)
pf4j/src/main/java/org/pf4j/util/FileUtils.java

index a3e955eb63728ca35d8b9abd97a581aed2f883df..5c84b2a9ed9443b457e95d57ebd108b2e244e8af 100644 (file)
@@ -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<Path>() {
+        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