From 6d442e97d200b01a2546e61a01a6e530eb9e1cf2 Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Fri, 15 Nov 2019 19:55:49 +0200 Subject: [PATCH] Small refactoring --- pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java | 3 ++- .../src/main/java/org/pf4j/ServiceProviderExtensionFinder.java | 3 ++- .../main/java/org/pf4j/processor/LegacyExtensionStorage.java | 2 +- .../org/pf4j/processor/ServiceProviderExtensionStorage.java | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java b/pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java index 33adc27..7c7ce09 100644 --- a/pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java +++ b/pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java @@ -15,6 +15,7 @@ */ package org.pf4j; +import org.pf4j.processor.ExtensionStorage; import org.pf4j.processor.LegacyExtensionStorage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -113,7 +114,7 @@ public class LegacyExtensionFinder extends AbstractExtensionFinder { private void collectExtensions(InputStream inputStream, Set bucket) throws IOException { try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { - LegacyExtensionStorage.read(reader, bucket); + ExtensionStorage.read(reader, bucket); } } diff --git a/pf4j/src/main/java/org/pf4j/ServiceProviderExtensionFinder.java b/pf4j/src/main/java/org/pf4j/ServiceProviderExtensionFinder.java index 21f683c..48483fc 100644 --- a/pf4j/src/main/java/org/pf4j/ServiceProviderExtensionFinder.java +++ b/pf4j/src/main/java/org/pf4j/ServiceProviderExtensionFinder.java @@ -15,6 +15,7 @@ */ package org.pf4j; +import org.pf4j.processor.ExtensionStorage; import org.pf4j.processor.ServiceProviderExtensionStorage; import org.pf4j.util.FileUtils; import org.slf4j.Logger; @@ -139,7 +140,7 @@ public class ServiceProviderExtensionFinder extends AbstractExtensionFinder { public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { log.debug("Read '{}'", file); try (Reader reader = Files.newBufferedReader(file, StandardCharsets.UTF_8)) { - ServiceProviderExtensionStorage.read(reader, result); + ExtensionStorage.read(reader, result); } return FileVisitResult.CONTINUE; diff --git a/pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java b/pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java index 3abde8d..67bd2d6 100644 --- a/pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java +++ b/pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java @@ -48,7 +48,7 @@ public class LegacyExtensionStorage extends ExtensionStorage { FileObject file = getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", EXTENSIONS_RESOURCE); // TODO try to calculate the extension point Set entries = new HashSet<>(); - read(file.openReader(true), entries); + ExtensionStorage.read(file.openReader(true), entries); extensions.put(null, entries); } catch (FileNotFoundException | NoSuchFileException e) { // doesn't exist, ignore diff --git a/pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java b/pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java index e2bf397..6a3ec59 100644 --- a/pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java +++ b/pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java @@ -49,7 +49,7 @@ public class ServiceProviderExtensionStorage extends ExtensionStorage { FileObject file = getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", EXTENSIONS_RESOURCE + "/" + extensionPoint); Set entries = new HashSet<>(); - read(file.openReader(true), entries); + ExtensionStorage.read(file.openReader(true), entries); extensions.put(extensionPoint, entries); } catch (FileNotFoundException | NoSuchFileException e) { // doesn't exist, ignore