From 356605f78128c32194e77961d9f91bddd1f40cae Mon Sep 17 00:00:00 2001 From: ascopes <73482956+ascopes@users.noreply.github.com> Date: Sun, 4 Feb 2024 11:31:44 +0000 Subject: [PATCH] GH-85: Fix unexpected exception being raised if no sources are found due to a missing directory/archive --- .../protobufmavenplugin/source/ProtoSourceResolver.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/io/github/ascopes/protobufmavenplugin/source/ProtoSourceResolver.java b/src/main/java/io/github/ascopes/protobufmavenplugin/source/ProtoSourceResolver.java index 0f019479..5d1a3999 100644 --- a/src/main/java/io/github/ascopes/protobufmavenplugin/source/ProtoSourceResolver.java +++ b/src/main/java/io/github/ascopes/protobufmavenplugin/source/ProtoSourceResolver.java @@ -106,6 +106,11 @@ public Collection createProtoFileListings( } public Optional createProtoFileListing(Path path) throws IOException { + if (!Files.exists(path)) { + log.debug("Skipping lookup in path {} as it does not exist", path); + return Optional.empty(); + } + if (Files.isRegularFile(path)) { return protoArchiveExtractor.extractProtoFiles(path); }