diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 0b4271a3a355b..ce9cce9dbe232 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -51,7 +51,7 @@ 3.10.0 4.1.0 4.0.0 - 4.0.0 + 4.0.1 2.11.0 6.6.1 4.6.0 diff --git a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java index c8f0178cb4218..315d85bee835a 100644 --- a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java +++ b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java @@ -935,10 +935,18 @@ Map.> entry("YAML", openAPI::toYAML)) } }); - @SuppressWarnings("deprecation") + openApiDocumentProducer.produce(new OpenApiDocumentBuildItem(toOpenApiDocument(finalOpenAPI))); + } + + /** + * We need to use the deprecated OpenApiDocument as long as + * OpenApiDocumentBuildItem needs to be produced. + */ + @SuppressWarnings("deprecation") + OpenApiDocument toOpenApiDocument(SmallRyeOpenAPI finalOpenAPI) { OpenApiDocument output = OpenApiDocument.newInstance(); output.set(finalOpenAPI.model()); - openApiDocumentProducer.produce(new OpenApiDocumentBuildItem(output)); + return output; } @BuildStep @@ -1099,16 +1107,24 @@ private Stream loadResources(String path, List i } private InputStream loadResource(String path, URL url) { - try (InputStream inputStream = url.openStream()) { - if (inputStream != null) { - byte[] contents = IoUtil.readBytes(inputStream); - return new ByteArrayInputStream(contents); - } + Supplier msg = () -> "An error occurred while processing %s for %s".formatted(url, path); + + try { + return ClassPathUtils.readStream(url, inputStream -> { + if (inputStream != null) { + try { + byte[] contents = IoUtil.readBytes(inputStream); + return new ByteArrayInputStream(contents); + } catch (IOException ioe) { + throw new UncheckedIOException(msg.get(), ioe); + } + } + + return null; + }); } catch (IOException e) { - throw new UncheckedIOException("An error occurred while processing %s for %s".formatted(url, path), e); + throw new UncheckedIOException(msg.get(), e); } - - return null; } private boolean shouldIgnore(List ignorePatterns, String url) { @@ -1136,6 +1152,7 @@ private List getResourceFiles(Path resourcePath, Path target) { } } else { ClassLoader cl = Thread.currentThread().getContextClassLoader(); + // QuarkusClassLoader will return a ByteArrayInputStream of directory entry names try (InputStream inputStream = cl.getResourceAsStream(resourceName)) { if (inputStream != null) { try (BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))) {