From ccec32c85b35c6cb6c952f9613a6e54fbafb69b8 Mon Sep 17 00:00:00 2001 From: James Netherton Date: Thu, 9 Jan 2025 11:06:14 +0000 Subject: [PATCH] Fix generated BrotliInputStream constructor Fixes #6896 --- .../httpclient5/deployment/HttpClient5Processor.java | 10 ++++------ .../httpclient5/graal/BrotliAbsentBooleanSupplier.java | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/extensions-support/httpclient5/deployment/src/main/java/org/apache/camel/quarkus/support/httpclient5/deployment/HttpClient5Processor.java b/extensions-support/httpclient5/deployment/src/main/java/org/apache/camel/quarkus/support/httpclient5/deployment/HttpClient5Processor.java index 919fa54fb7c..5586c9fd89b 100644 --- a/extensions-support/httpclient5/deployment/src/main/java/org/apache/camel/quarkus/support/httpclient5/deployment/HttpClient5Processor.java +++ b/extensions-support/httpclient5/deployment/src/main/java/org/apache/camel/quarkus/support/httpclient5/deployment/HttpClient5Processor.java @@ -73,19 +73,17 @@ void generateBrotliInputStreamClass(BuildProducer gener try (MethodCreator defaultConstructor = classCreator.getMethodCreator("", void.class)) { defaultConstructor.setModifiers(Modifier.PUBLIC); - defaultConstructor.invokeSpecialMethod( - MethodDescriptor.ofMethod(BROTLI_INPUT_STREAM_CLASS_NAME, "", void.class), + defaultConstructor.invokeSpecialMethod(MethodDescriptor.ofConstructor(InputStream.class), defaultConstructor.getThis()); - defaultConstructor.returnValue(null); + defaultConstructor.returnNull(); } try (MethodCreator constructorWithInputStreamArg = classCreator.getMethodCreator("", void.class, InputStream.class)) { constructorWithInputStreamArg.setModifiers(Modifier.PUBLIC); - constructorWithInputStreamArg.invokeSpecialMethod( - MethodDescriptor.ofMethod(BROTLI_INPUT_STREAM_CLASS_NAME, "", void.class), + constructorWithInputStreamArg.invokeSpecialMethod(MethodDescriptor.ofConstructor(InputStream.class), constructorWithInputStreamArg.getThis()); - constructorWithInputStreamArg.returnValue(null); + constructorWithInputStreamArg.returnNull(); } try (MethodCreator readMethod = classCreator.getMethodCreator("read", int.class)) { diff --git a/extensions-support/httpclient5/runtime/src/main/java/org/apache/camel/quarkus/support/httpclient5/graal/BrotliAbsentBooleanSupplier.java b/extensions-support/httpclient5/runtime/src/main/java/org/apache/camel/quarkus/support/httpclient5/graal/BrotliAbsentBooleanSupplier.java index 62b0c600d2b..ad39e64d11c 100644 --- a/extensions-support/httpclient5/runtime/src/main/java/org/apache/camel/quarkus/support/httpclient5/graal/BrotliAbsentBooleanSupplier.java +++ b/extensions-support/httpclient5/runtime/src/main/java/org/apache/camel/quarkus/support/httpclient5/graal/BrotliAbsentBooleanSupplier.java @@ -22,7 +22,7 @@ public class BrotliAbsentBooleanSupplier implements BooleanSupplier { @Override public boolean getAsBoolean() { try { - Thread.currentThread().getContextClassLoader().loadClass("org.brotli.dec.BrotliInputStream"); + Thread.currentThread().getContextClassLoader().loadClass("org.brotli.dec.Decoder"); return false; } catch (ClassNotFoundException e) { return true;