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