Browse Source

Small refactoring

#289
Decebal Suiu 5 years ago
parent
commit
6d442e97d2
  1. 3
      pf4j/src/main/java/org/pf4j/LegacyExtensionFinder.java
  2. 3
      pf4j/src/main/java/org/pf4j/ServiceProviderExtensionFinder.java
  3. 2
      pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java
  4. 2
      pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java

3
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<String> bucket) throws IOException {
try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) {
LegacyExtensionStorage.read(reader, bucket);
ExtensionStorage.read(reader, bucket);
}
}

3
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;

2
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<String> 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

2
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<String> 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

Loading…
Cancel
Save