From 235896b5c1c63509189edd6fe5d511278ccdea1b Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Sat, 3 Feb 2018 00:16:00 +0200 Subject: [PATCH] Resolve #200 --- .../main/java/org/pf4j/processor/LegacyExtensionStorage.java | 5 +++-- .../org/pf4j/processor/ServiceProviderExtensionStorage.java | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java b/pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java index d664e4e..9adfd66 100644 --- a/pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java +++ b/pf4j/src/main/java/org/pf4j/processor/LegacyExtensionStorage.java @@ -23,6 +23,7 @@ import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.IOException; import java.io.Reader; +import java.nio.file.NoSuchFileException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -68,8 +69,8 @@ public class LegacyExtensionStorage extends ExtensionStorage { Set entries = new HashSet<>(); read(file.openReader(true), entries); extensions.put(null, entries); - } catch (FileNotFoundException e) { - // ignore + } catch (FileNotFoundException | NoSuchFileException e) { + // doesn't exist, ignore } catch (FilerException e) { // re-opening the file for reading or after writing is ignorable } catch (IOException e) { diff --git a/pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java b/pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java index 135063f..65c9a2c 100644 --- a/pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java +++ b/pf4j/src/main/java/org/pf4j/processor/ServiceProviderExtensionStorage.java @@ -23,6 +23,7 @@ import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.IOException; import java.io.Reader; +import java.nio.file.NoSuchFileException; import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -69,7 +70,7 @@ public class ServiceProviderExtensionStorage extends ExtensionStorage { Set entries = new HashSet<>(); read(file.openReader(true), entries); extensions.put(extensionPoint, entries); - } catch (FileNotFoundException e) { + } catch (FileNotFoundException | NoSuchFileException e) { // doesn't exist, ignore } catch (FilerException e) { // re-opening the file for reading or after writing is ignorable