Skip to content

Commit

Permalink
Merge pull request #42561 from gsmet/ignore-no-such-file-exception
Browse files Browse the repository at this point in the history
Properly handle case when quarkus-extension.yaml doesn't exist
  • Loading branch information
gsmet committed Aug 15, 2024
2 parents 1466fcc + 2c87bb5 commit cbebd63
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import java.io.UncheckedIOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Map;
Expand Down Expand Up @@ -158,9 +159,14 @@ public Optional<Map<String, Object>> getExtensionMetadata() {

return Optional.of(extensionMetadata);
}
} catch (NoSuchFileException e) {
// ignore
// we could get the URI, create a Path and check that the path exists but it seems a bit overkill
return Optional.empty();
} catch (IOException e) {
processingEnv.getMessager().printMessage(Kind.WARNING,
"Unable to read extension metadata file: " + extensionMetadataDescriptor + " because of " + e.getMessage());
"Unable to read extension metadata file: " + extensionMetadataDescriptor + " because of "
+ e.getClass().getName() + ": " + e.getMessage());
return Optional.empty();
}
}
Expand Down

0 comments on commit cbebd63

Please sign in to comment.