id
int64
0
10.2k
text_id
stringlengths
17
67
repo_owner
stringclasses
232 values
repo_name
stringclasses
295 values
issue_url
stringlengths
39
89
pull_url
stringlengths
37
87
comment_url
stringlengths
37
94
links_count
int64
1
2
link_keyword
stringclasses
12 values
issue_title
stringlengths
7
197
issue_body
stringlengths
45
21.3k
base_sha
stringlengths
40
40
head_sha
stringlengths
40
40
diff_url
stringlengths
120
170
diff
stringlengths
478
132k
changed_files
stringlengths
47
2.6k
changed_files_exts
stringclasses
22 values
changed_files_count
int64
1
22
java_changed_files_count
int64
1
22
kt_changed_files_count
int64
0
0
py_changed_files_count
int64
0
0
code_changed_files_count
int64
1
22
repo_symbols_count
int64
32.6k
242M
repo_tokens_count
int64
6.59k
49.2M
repo_lines_count
int64
992
6.2M
repo_files_without_tests_count
int64
12
28.1k
changed_symbols_count
int64
0
36.1k
changed_tokens_count
int64
0
6.5k
changed_lines_count
int64
0
561
changed_files_without_tests_count
int64
1
17
issue_symbols_count
int64
45
21.3k
issue_words_count
int64
2
1.39k
issue_tokens_count
int64
13
4.47k
issue_lines_count
int64
1
325
issue_links_count
int64
0
19
issue_code_blocks_count
int64
0
31
pull_create_at
timestamp[s]
stars
int64
10
44.3k
language
stringclasses
8 values
languages
stringclasses
296 values
license
stringclasses
2 values
2,746
quarkusio/quarkus/17651/17628
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17628
https://github.com/quarkusio/quarkus/pull/17651
https://github.com/quarkusio/quarkus/pull/17651
1
fixes
Hot reload fails when using custom beans validator and MP Rest Client
## Describe the bug When running in dev mode, hot reload always fails when having a MP Rest Client injected in a custom beans validator. Even if code is changed outside the validator, the reload fails. ### Expected behavior Changes to code in dev mode should reload without any failure. ### Actual behavior Getting the following stack trace: ``` java.lang.IllegalStateException: Container not running: ArcContainerImpl [id=1, running=false, beans=0, observers=0, scopes=[]] at io.quarkus.arc.impl.ArcContainerImpl.requireRunning(ArcContainerImpl.java:797) at io.quarkus.arc.impl.ArcContainerImpl.instanceSupplier(ArcContainerImpl.java:240) at io.quarkus.arc.runtime.BeanContainerImpl.instanceFactory(BeanContainerImpl.java:25) at io.quarkus.resteasy.common.runtime.QuarkusConstructorInjector.construct(QuarkusConstructorInjector.java:34) at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.injectedInstance(ResteasyProviderFactoryImpl.java:1399) at org.jboss.resteasy.microprofile.client.RestClientBuilderImpl.newInstanceOf(RestClientBuilderImpl.java:477) at org.jboss.resteasy.microprofile.client.RestClientBuilderImpl.register(RestClientBuilderImpl.java:489) at org.jboss.resteasy.microprofile.client.RestClientBuilderImpl.build(RestClientBuilderImpl.java:190) at io.quarkus.restclient.runtime.RestClientBase.create(RestClientBase.java:79) at org.acme.AgeLookupService_e9fbd2155c92de4d28b8270959d49ea60024644c_Synthetic_Bean.create(AgeLookupService_e9fbd2155c92de4d28b8270959d49ea60024644c_Synthetic_Bean.zig:189) at org.acme.AgeLookupService_e9fbd2155c92de4d28b8270959d49ea60024644c_Synthetic_Bean.get(AgeLookupService_e9fbd2155c92de4d28b8270959d49ea60024644c_Synthetic_Bean.zig:220) at org.acme.AgeLookupService_e9fbd2155c92de4d28b8270959d49ea60024644c_Synthetic_Bean.get(AgeLookupService_e9fbd2155c92de4d28b8270959d49ea60024644c_Synthetic_Bean.zig:243) at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:52) at org.acme.CustomAgeValidator_Bean.create(CustomAgeValidator_Bean.zig:252) at org.acme.CustomAgeValidator_Bean.create(CustomAgeValidator_Bean.zig:292) at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96) at io.quarkus.arc.impl.AbstractSharedContext.access$000(AbstractSharedContext.java:14) at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29) at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26) at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26) at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69) at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26) at org.acme.CustomAgeValidator_Bean.get(CustomAgeValidator_Bean.zig:324) at org.acme.CustomAgeValidator_Bean.get(CustomAgeValidator_Bean.zig:340) at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:430) at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:443) at io.quarkus.arc.impl.ArcContainerImpl.instanceHandle(ArcContainerImpl.java:413) at io.quarkus.arc.impl.ArcContainerImpl.instance(ArcContainerImpl.java:222) at io.quarkus.hibernate.validator.runtime.ArcConstraintValidatorFactoryImpl.getInstance(ArcConstraintValidatorFactoryImpl.java:29) at org.hibernate.validator.internal.engine.constraintvalidation.ClassBasedValidatorDescriptor.newInstance(ClassBasedValidatorDescriptor.java:84) at org.hibernate.validator.internal.engine.constraintvalidation.AbstractConstraintValidatorManagerImpl.createAndInitializeValidator(AbstractConstraintValidatorManagerImpl.java:89) at org.hibernate.validator.internal.engine.constraintvalidation.PredefinedScopeConstraintValidatorManagerImpl.getInitializedValidator(PredefinedScopeConstraintValidatorManagerImpl.java:60) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.<init>(ConstraintTree.java:56) at org.hibernate.validator.internal.engine.constraintvalidation.SimpleConstraintTree.<init>(SimpleConstraintTree.java:37) at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.of(ConstraintTree.java:66) at org.hibernate.validator.internal.metadata.core.MetaConstraint.<init>(MetaConstraint.java:75) at org.hibernate.validator.internal.metadata.core.MetaConstraints.create(MetaConstraints.java:74) at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getParameterMetaData(AnnotationMetaDataProvider.java:421) at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.findExecutableMetaData(AnnotationMetaDataProvider.java:308) at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getMetaData(AnnotationMetaDataProvider.java:292) at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getMethodMetaData(AnnotationMetaDataProvider.java:279) at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.retrieveBeanConfiguration(AnnotationMetaDataProvider.java:130) at org.hibernate.validator.internal.metadata.provider.AnnotationMetaDataProvider.getBeanConfiguration(AnnotationMetaDataProvider.java:120) at org.hibernate.validator.internal.metadata.PredefinedScopeBeanMetaDataManager.getBeanConfigurationForHierarchy(PredefinedScopeBeanMetaDataManager.java:183) at org.hibernate.validator.internal.metadata.PredefinedScopeBeanMetaDataManager.createBeanMetaData(PredefinedScopeBeanMetaDataManager.java:150) at org.hibernate.validator.internal.metadata.PredefinedScopeBeanMetaDataManager.<init>(PredefinedScopeBeanMetaDataManager.java:100) at org.hibernate.validator.internal.engine.PredefinedScopeValidatorFactoryImpl.<init>(PredefinedScopeValidatorFactoryImpl.java:180) at org.hibernate.validator.PredefinedScopeHibernateValidator.buildValidatorFactory(PredefinedScopeHibernateValidator.java:42) at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.buildValidatorFactory(AbstractConfigurationImpl.java:433) at io.quarkus.hibernate.validator.runtime.HibernateValidatorRecorder$1.created(HibernateValidatorRecorder.java:132) at io.quarkus.arc.runtime.ArcRecorder.initBeanContainer(ArcRecorder.java:70) at io.quarkus.deployment.steps.ArcProcessor$generateResources-1025303321.deploy_0(ArcProcessor$generateResources-1025303321.zig:138) at io.quarkus.deployment.steps.ArcProcessor$generateResources-1025303321.deploy(ArcProcessor$generateResources-1025303321.zig:40) at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:259) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at java.base/java.lang.Class.newInstance(Class.java:584) at io.quarkus.runtime.Quarkus.run(Quarkus.java:65) at io.quarkus.runtime.Quarkus.run(Quarkus.java:42) at io.quarkus.runtime.Quarkus.run(Quarkus.java:119) at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.runner.bootstrap.StartupActionImpl$3.run(StartupActionImpl.java:134) at java.base/java.lang.Thread.run(Thread.java:834) Resulted in: java.lang.RuntimeException: Error injecting org.acme.AgeLookupService org.acme.CustomAgeValidator.ageLookupService at org.acme.CustomAgeValidator_Bean.create(CustomAgeValidator_Bean.zig:269) ... 55 more Resulted in: java.lang.RuntimeException: java.lang.RuntimeException: Error injecting org.acme.AgeLookupService org.acme.CustomAgeValidator.ageLookupService at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:51) at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:145) at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:191) at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:175) at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:254) at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:64) at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:54) at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ... 1 more ``` ## To Reproduce Steps to reproduce the behavior: 1. clone https://github.com/enbohm/code-with-hotreload 2. start in dev-mode 3. open http://127.0.0.1:8080/validate?age=11 4. make a small change in the code 5. reload http://127.0.0.1:8080/validate?age=11 ### Configuration https://github.com/enbohm/code-with-hotreload/blob/master/src/main/resources/application.properties ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Darwin MacBook-Pro.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "11" 2018-09-25 OpenJDK Runtime Environment 18.9 (build 11+28) OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode) ### Quarkus version or git rev 1.13.6 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) maven 3.8 ## Additional context If adding an @ApplicationScoped annotation on the MP Rest client the reload works
cc94f11e1a1412ae4d4e883e533789190015c080
7abd7dec92271da5bdffe8aee0fca9f8707b7ba2
https://github.com/quarkusio/quarkus/compare/cc94f11e1a1412ae4d4e883e533789190015c080...7abd7dec92271da5bdffe8aee0fca9f8707b7ba2
diff --git a/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java b/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java index 4d0c9e6baee..bf4654c1a36 100644 --- a/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java +++ b/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java @@ -49,10 +49,10 @@ import io.quarkus.deployment.Capability; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; +import io.quarkus.deployment.annotations.Consume; import io.quarkus.deployment.annotations.Record; import io.quarkus.deployment.builditem.AdditionalStaticInitConfigSourceProviderBuildItem; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; -import io.quarkus.deployment.builditem.ProxyUnwrapperBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.util.ServiceUtil; import io.quarkus.resteasy.common.runtime.ResteasyInjectorFactoryRecorder; @@ -148,16 +148,11 @@ void setupGzipProviders(BuildProducer<ResteasyJaxrsProviderBuildItem> providers) } @Record(STATIC_INIT) + @Consume(BeanContainerBuildItem.class) @BuildStep - ResteasyInjectionReadyBuildItem setupResteasyInjection(List<ProxyUnwrapperBuildItem> proxyUnwrappers, - BeanContainerBuildItem beanContainerBuildItem, - Capabilities capabilities, + ResteasyInjectionReadyBuildItem setupResteasyInjection( ResteasyInjectorFactoryRecorder recorder) { - List<Function<Object, Object>> unwrappers = new ArrayList<>(); - for (ProxyUnwrapperBuildItem i : proxyUnwrappers) { - unwrappers.add(i.getUnwrapper()); - } - RuntimeValue<InjectorFactory> injectorFactory = recorder.setup(beanContainerBuildItem.getValue(), unwrappers); + RuntimeValue<InjectorFactory> injectorFactory = recorder.setup(); return new ResteasyInjectionReadyBuildItem(injectorFactory); } diff --git a/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusConstructorInjector.java b/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusConstructorInjector.java index 88723b3295d..218b5e6a3d6 100644 --- a/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusConstructorInjector.java +++ b/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusConstructorInjector.java @@ -1,6 +1,7 @@ package io.quarkus.resteasy.common.runtime; import java.lang.reflect.Constructor; +import java.util.function.Supplier; import javax.ws.rs.WebApplicationException; @@ -10,11 +11,12 @@ import org.jboss.resteasy.spi.HttpRequest; import org.jboss.resteasy.spi.HttpResponse; -import io.quarkus.arc.runtime.BeanContainer; +import io.quarkus.arc.Arc; +import io.quarkus.arc.InstanceHandle; public class QuarkusConstructorInjector implements ConstructorInjector { - private volatile BeanContainer.Factory<?> factory; + private volatile Supplier<? extends InstanceHandle<?>> factory; private final ConstructorInjector delegate; @@ -27,31 +29,27 @@ public QuarkusConstructorInjector(Constructor<?> ctor, ConstructorInjector deleg @Override public Object construct(boolean unwrapAsync) { - if (QuarkusInjectorFactory.CONTAINER == null) { - return this.delegate.construct(unwrapAsync); - } - if (factory == null) { - factory = QuarkusInjectorFactory.CONTAINER.instanceFactory(this.ctor.getDeclaringClass()); + if (factory != null) { + return factory.get().get(); } + factory = Arc.container().instanceSupplier(this.ctor.getDeclaringClass()); if (factory == null) { return delegate.construct(unwrapAsync); } - return factory.create().get(); + return factory.get().get(); } @Override public Object construct(HttpRequest request, HttpResponse response, boolean unwrapAsync) throws Failure, WebApplicationException, ApplicationException { - if (QuarkusInjectorFactory.CONTAINER == null) { - return delegate.construct(request, response, unwrapAsync); - } - if (factory == null) { - factory = QuarkusInjectorFactory.CONTAINER.instanceFactory(this.ctor.getDeclaringClass()); + if (factory != null) { + return factory.get().get(); } + factory = Arc.container().instanceSupplier(this.ctor.getDeclaringClass()); if (factory == null) { return delegate.construct(request, response, unwrapAsync); } - return factory.create().get(); + return factory.get().get(); } @Override diff --git a/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusInjectorFactory.java b/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusInjectorFactory.java index fb97f717713..cc4bf240826 100644 --- a/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusInjectorFactory.java +++ b/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusInjectorFactory.java @@ -18,13 +18,12 @@ import org.jboss.resteasy.spi.metadata.ResourceClass; import org.jboss.resteasy.spi.metadata.ResourceConstructor; -import io.quarkus.arc.runtime.BeanContainer; +import io.quarkus.arc.runtime.ClientProxyUnwrapper; public class QuarkusInjectorFactory extends InjectorFactoryImpl { private static final Logger log = Logger.getLogger("io.quarkus.resteasy.runtime"); - static volatile BeanContainer CONTAINER = null; - static volatile Function<Object, Object> PROXY_UNWRAPPER; + static final Function<Object, Object> PROXY_UNWRAPPER = new ClientProxyUnwrapper(); @SuppressWarnings("rawtypes") @Override diff --git a/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/ResteasyInjectorFactoryRecorder.java b/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/ResteasyInjectorFactoryRecorder.java index f3c56f7068d..a8552f9f4ea 100644 --- a/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/ResteasyInjectorFactoryRecorder.java +++ b/extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/ResteasyInjectorFactoryRecorder.java @@ -1,29 +1,14 @@ package io.quarkus.resteasy.common.runtime; -import java.util.List; -import java.util.function.Function; - import org.jboss.resteasy.spi.InjectorFactory; -import io.quarkus.arc.runtime.BeanContainer; import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.annotations.Recorder; @Recorder public class ResteasyInjectorFactoryRecorder { - public RuntimeValue<InjectorFactory> setup(BeanContainer container, List<Function<Object, Object>> propertyUnwrappers) { - QuarkusInjectorFactory.CONTAINER = container; - QuarkusInjectorFactory.PROXY_UNWRAPPER = new Function<Object, Object>() { - @Override - public Object apply(Object o) { - Object res = o; - for (Function<Object, Object> i : propertyUnwrappers) { - res = i.apply(res); - } - return res; - } - }; + public RuntimeValue<InjectorFactory> setup() { return new RuntimeValue<>(new QuarkusInjectorFactory()); } }
['extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusInjectorFactory.java', 'extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/ResteasyInjectorFactoryRecorder.java', 'extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java', 'extensions/resteasy-classic/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/QuarkusConstructorInjector.java']
{'.java': 4}
4
4
0
0
4
16,716,130
3,248,539
429,925
4,527
3,110
622
61
4
10,362
376
2,378
131
4
1
2021-06-03T01:34:51
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,747
quarkusio/quarkus/17632/17571
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17571
https://github.com/quarkusio/quarkus/pull/17632
https://github.com/quarkusio/quarkus/pull/17632
1
fixes
Option quarkus.websocket.dispatch-to-worker=true doesn't work anymore in Quarkus 1.13
## Describe the bug Setting the value of `quarkus.websocket.dispatch-to-worker` to `true` doesn't change anything. WebSockets remain on vert.x-eventloop threads. ### Expected behavior WebSockets should be executed on executor threads (like in Quarkus 1.11). ### Actual behavior WebSockets are executed on vert.x-eventloop threads instead of executor ones. ## To Reproduce 1. Start with Quarkus 1.13 WebSockets example code. 2. Add a log line in `SupersonicChatSocket#onOpen` like `LOG.info("I am a WebSocket!");` 3. Launch the program, go to http://localhost:8080, and connect with a username. 4. See in the console `2021-06-01 01:32:50,570 INFO [org.acm.und.SupersonicChatSocket] (vert.x-eventloop-thread-11) I'm a WebSocket!` notice `vert.x-eventloop-thread-11` 5. Now, set the property `quarkus.websocket.dispatch-to-worker=true` in application.properties 6. Redo step 3 and 4 and observe that it still logs a `vert.x-eventloop-thread-X` thread. You can do the same thing with Quarkus 1.11.3.Final, after setting the option to true you will see WebSocket is executed on an executor thread like it should be: `2021-06-01 01:30:27,083 INFO [org.acm.und.SupersonicChatSocket] (executor-thread-198) I am a WebSocket!`
128988b95595ab41ed6a35f5b30caf863c09a1f2
01ba4c0f9a012e7f4974b7809dcb7fbd92c5119c
https://github.com/quarkusio/quarkus/compare/128988b95595ab41ed6a35f5b30caf863c09a1f2...01ba4c0f9a012e7f4974b7809dcb7fbd92c5119c
diff --git a/extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java b/extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java index 65085d860b3..a09af85f95c 100644 --- a/extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java +++ b/extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java @@ -17,7 +17,6 @@ import io.quarkus.arc.Arc; import io.quarkus.arc.ManagedContext; import io.quarkus.arc.runtime.BeanContainer; -import io.quarkus.runtime.ExecutorRecorder; import io.quarkus.runtime.annotations.Recorder; import io.undertow.websockets.UndertowContainerProvider; import io.undertow.websockets.WebSocketDeploymentInfo; @@ -160,15 +159,10 @@ public T call(C context) throws Exception { }; } }), - false, + info.isDispatchToWorkerThread(), null, null, - new Supplier<Executor>() { - @Override - public Executor get() { - return ExecutorRecorder.getCurrent(); - } - }, + info.getExecutor(), Collections.emptyList(), info.getMaxFrameSize()); for (Class<?> i : info.getAnnotatedEndpoints()) {
['extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java']
{'.java': 1}
1
1
0
0
1
16,715,511
3,248,417
429,913
4,527
381
52
10
1
1,246
157
341
22
1
0
2021-06-02T13:11:43
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,749
quarkusio/quarkus/17605/17206
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17206
https://github.com/quarkusio/quarkus/pull/17605
https://github.com/quarkusio/quarkus/pull/17605
1
fixes
maxFramePayloadLength seems to be hardcoded when using WebSocketClient
## Describe the bug We are occasionally hitting an exception (shown below) caused due to the payload in a websocket frame being larger than 1280000 bytes while trying to read log messages from a websocket. Had tried the instructions on setting max-frame-size described in https://github.com/quarkusio/quarkus/issues/7172 without much luck. Looks like io.undertow.websockets.jsr.WebsocketConnectionBuilder has this value hardcoded as 1280000. 2021-05-13 18:41:24,350 WARN [io.net.cha.DefaultChannelPipeline] (nioEventLoopGroup-2-3) An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.: io.netty.handler.codec.http.websocketx.CorruptedWebSocketFrameException: Max frame length of 1280000 has been exceeded. at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.protocolViolation(WebSocket08FrameDecoder.java:426) at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.decode(WebSocket08FrameDecoder.java:286) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834) ### Expected behavior The maxFramePayloadLength setting should ideally be configurable. Any workaround would be much appreciated. ### Actual behavior This setting/value is hardcoded ## To Reproduce A client connecting to a websocket that sends frames with payload larger than 1280000 bytes Steps to reproduce the behavior: A client connecting to a websocket that sends frames with payload larger than 1280000 bytes ### Configuration ```properties No Specific properties required to reproduce this issue ``` ### Screenshots ## Environment (please complete the following information): ### Output of `uname -a` or `ver` ### Output of `java -version` ### GraalVM version (if different from Java) ### Quarkus version or git rev ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) ## Additional context (Add any other context about the problem here.)
13fb194d4f3cf25495758f325aee5977a80d91a4
d7a0508759f167023747f64f6a6388e23367038c
https://github.com/quarkusio/quarkus/compare/13fb194d4f3cf25495758f325aee5977a80d91a4...d7a0508759f167023747f64f6a6388e23367038c
diff --git a/extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java b/extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java index f0f16c3f1e4..65085d860b3 100644 --- a/extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java +++ b/extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java @@ -159,13 +159,18 @@ public T call(C context) throws Exception { } }; } - }), false, + }), + false, + null, + null, new Supplier<Executor>() { @Override public Executor get() { return ExecutorRecorder.getCurrent(); } - }); + }, + Collections.emptyList(), + info.getMaxFrameSize()); for (Class<?> i : info.getAnnotatedEndpoints()) { container.addEndpoint(i); }
['extensions/websockets/runtime/src/main/java/io/quarkus/undertow/websockets/runtime/WebsocketRecorder.java']
{'.java': 1}
1
1
0
0
1
16,716,476
3,248,540
429,944
4,528
243
29
9
1
3,896
270
807
65
1
1
2021-06-01T15:09:44
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,751
quarkusio/quarkus/17495/17492
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17492
https://github.com/quarkusio/quarkus/pull/17495
https://github.com/quarkusio/quarkus/pull/17495
1
resolves
IllegalAccessError invoking non-public @Scheduled method
## Describe the bug An IllegalAccessError is thrown when invoking a non-public @Scheduled method, e.g: @Scheduled(every = "PT10S", concurrentExecution = ConcurrentExecution.SKIP) void myMethod() {...} All is fine if the method is public. Call stack looks like so: 2021-05-27 15:58:27,006 ERROR (executor-thread-2) [SimpleScheduler] Error occured while executing task for trigger IntervalTrigger [id=1_my.redacted.Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4, interval=10000] java.lang.IllegalAccessError: class my.redacted.Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4 tried to access method my.redacted.Service.myMethod()V (my.redacted.Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4 is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @451b1c01; my.redacted.Service is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @6f45da6b) at my.redacted.Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4.invokeBean(Service_ScheduledInvoker_myMethod_8d0ea617bdcf7cab33987d918fbaeabfd51940d4.zig:46) at io.quarkus.arc.runtime.BeanInvoker.invoke(BeanInvoker.java:20) at io.quarkus.scheduler.runtime.SkipConcurrentExecutionInvoker.invoke(SkipConcurrentExecutionInvoker.java:37) at io.quarkus.scheduler.runtime.SkipConcurrentExecutionInvoker.invoke(SkipConcurrentExecutionInvoker.java:19) at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask$1.run(SimpleScheduler.java:251) at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:486) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1450) at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834) ### Expected behavior Expect it to work ok with default access per other Quarkus/CDI methods. ### Actual behavior Fails with IllegalAccessError. ### Quarkus version or git rev 2.0.0.CR1
fe07bc0e65757c206779f9184e89cdd20737e1d8
a5acdc95fd5e1415c224003abe2008aea5a652b8
https://github.com/quarkusio/quarkus/compare/fe07bc0e65757c206779f9184e89cdd20737e1d8...a5acdc95fd5e1415c224003abe2008aea5a652b8
diff --git a/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java b/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java index 5f85c176a1a..ad34c15f837 100644 --- a/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java +++ b/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java @@ -3,6 +3,7 @@ import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT; import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT; +import java.lang.reflect.Modifier; import java.time.Duration; import java.util.ArrayList; import java.util.Arrays; @@ -10,6 +11,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.function.Function; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationValue; @@ -88,6 +90,7 @@ public class SchedulerProcessor { Kind.CLASS); static final String INVOKER_SUFFIX = "_ScheduledInvoker"; + static final String NESTED_SEPARATOR = "$_"; @BuildStep void beans(Capabilities capabilities, BuildProducer<AdditionalBeanBuildItem> additionalBeans) { @@ -159,6 +162,12 @@ void validateScheduledBusinessMethods(SchedulerConfig config, List<ScheduledBusi for (ScheduledBusinessMethodItem scheduledMethod : scheduledMethods) { MethodInfo method = scheduledMethod.getMethod(); + if (Modifier.isPrivate(method.flags()) || Modifier.isStatic(method.flags())) { + errors.add(new IllegalStateException("@Scheduled method must be non-private and non-static: " + + method.declaringClass().name() + "#" + method.name() + "()")); + continue; + } + // Validate method params and return type List<Type> params = method.parameters(); if (params.size() > 1 @@ -198,11 +207,24 @@ public List<UnremovableBeanBuildItem> unremovableBeans() { @Record(RUNTIME_INIT) public FeatureBuildItem build(SchedulerConfig config, BuildProducer<SyntheticBeanBuildItem> syntheticBeans, SchedulerRecorder recorder, List<ScheduledBusinessMethodItem> scheduledMethods, - BuildProducer<GeneratedClassBuildItem> generatedClass, BuildProducer<ReflectiveClassBuildItem> reflectiveClass, + BuildProducer<GeneratedClassBuildItem> generatedClasses, BuildProducer<ReflectiveClassBuildItem> reflectiveClass, AnnotationProxyBuildItem annotationProxy, ExecutorBuildItem executor) { List<ScheduledMethodMetadata> scheduledMetadata = new ArrayList<>(); - ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClass, true); + ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClasses, new Function<String, String>() { + @Override + public String apply(String name) { + // org/acme/Foo_ScheduledInvoker_run_0000 -> org.acme.Foo + int idx = name.indexOf(INVOKER_SUFFIX); + if (idx != -1) { + name = name.substring(0, idx); + } + if (name.contains(NESTED_SEPARATOR)) { + name = name.replace(NESTED_SEPARATOR, "$"); + } + return name; + } + }); for (ScheduledBusinessMethodItem scheduledMethod : scheduledMethods) { ScheduledMethodMetadata metadata = new ScheduledMethodMetadata(); @@ -247,8 +269,8 @@ private String generateInvoker(ScheduledBusinessMethodItem scheduledMethod, Clas String baseName; if (bean.getImplClazz().enclosingClass() != null) { - baseName = DotNames.simpleName(bean.getImplClazz().enclosingClass()) + "_" - + DotNames.simpleName(bean.getImplClazz().name()); + baseName = DotNames.simpleName(bean.getImplClazz().enclosingClass()) + NESTED_SEPARATOR + + DotNames.simpleName(bean.getImplClazz()); } else { baseName = DotNames.simpleName(bean.getImplClazz().name()); } diff --git a/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/Scheduled.java b/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/Scheduled.java index 1bfff45c537..e3d6873b99c 100644 --- a/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/Scheduled.java +++ b/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/Scheduled.java @@ -15,6 +15,8 @@ /** * Marks a business method to be automatically scheduled and invoked by the container. * <p> + * The target business method must be non-private and non-static. + * <p> * The schedule is defined either by {@link #cron()} or by {@link #every()} attribute. If both are specified, the cron * expression takes precedence. *
['extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/Scheduled.java', 'extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java']
{'.java': 2}
2
2
0
0
2
16,600,481
3,226,031
427,110
4,502
1,823
361
32
2
2,359
130
628
37
0
0
2021-05-27T08:24:22
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,752
quarkusio/quarkus/17394/17367
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17367
https://github.com/quarkusio/quarkus/pull/17394
https://github.com/quarkusio/quarkus/pull/17394
1
close
NPE in QuarkusModelBuilder for Gradle composite builds
## Describe the bug On a project using Gradle composite build, dev mode fails to start. The project layout is the following: - composite - composite-subproject - project - utilities - my-artifactId - my-artifactId depends on utilities - utilities depends on composite-subproject - project is including composite as a Gradle composite build ### Expected behavior Quarkus dev mode should start. ### Actual behavior Quarkus dev mode fails with: ``` Caused by: java.lang.NullPointerException at io.quarkus.gradle.builder.QuarkusModelBuilder.addDevModePaths(QuarkusModelBuilder.java:402) at io.quarkus.gradle.builder.QuarkusModelBuilder.collectDependencies(QuarkusModelBuilder.java:360) at io.quarkus.gradle.builder.QuarkusModelBuilder.buildAll(QuarkusModelBuilder.java:112) at io.quarkus.gradle.extension.QuarkusPluginExtension.create(QuarkusPluginExtension.java:229) at io.quarkus.gradle.extension.QuarkusPluginExtension.getQuarkusModel(QuarkusPluginExtension.java:222) at io.quarkus.gradle.extension.QuarkusPluginExtension.getAppModelResolver(QuarkusPluginExtension.java:214) at io.quarkus.gradle.tasks.QuarkusDev.newLauncher(QuarkusDev.java:224) at io.quarkus.gradle.tasks.QuarkusDev.startDev(QuarkusDev.java:180) ... 122 more ``` Debugging shows that in `io.quarkus.gradle.builder.QuarkusModelBuilder#addDevModePaths` the project is null when it is referencing the composite module. It looks like with this setup: `IncludedBuild includedBuild = includedBuild(project, a.getName());` fails to detect the composite build. In my case `project.getGradle().includedBuild(projectName)` is checking if project _project_ is including _composite-subproject_ where it is including _composite_. ## To Reproduce Checkout https://github.com/symphony-youri/quarkus-composite Steps to reproduce the behavior: 1. Go to project/my-artifactId folder 2. Run `gradle quarkusDev --info --stacktrace` ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Darwin xxx-mbp 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64 i386 MacBookPro16,1 Darwin ### Output of `java -version` openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05, mixed mode, sharing) ### GraalVM version (if different from Java) ### Quarkus version or git rev 1.13 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 7.0.2 ## Additional context (Add any other context about the problem here.)
6fd054d65730e38d865e4cdc3b3eebee8fea66cd
99deb151e3321613475b15e5b1713b7b9e93a5e1
https://github.com/quarkusio/quarkus/compare/6fd054d65730e38d865e4cdc3b3eebee8fea66cd...99deb151e3321613475b15e5b1713b7b9e93a5e1
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java index 8b56fd43364..ff549e1b432 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java @@ -321,18 +321,22 @@ private void collectDependencies(ResolvedConfiguration configuration, final DependencyImpl dep = initDependency(a); if ((LaunchMode.DEVELOPMENT.equals(mode) || LaunchMode.TEST.equals(mode)) && a.getId().getComponentIdentifier() instanceof ProjectComponentIdentifier) { - IncludedBuild includedBuild = includedBuild(project, a.getName()); if ("test-fixtures".equals(a.getClassifier()) || "test".equals(a.getClassifier())) { //TODO: test-fixtures are broken under the new ClassLoading model dep.addPath(a.getFile()); } else { + IncludedBuild includedBuild = includedBuild(project.getRootProject(), a.getName()); if (includedBuild != null) { addSubstitutedProject(dep, includedBuild.getProjectDir()); } else { Project projectDep = project.getRootProject() .findProject( ((ProjectComponentIdentifier) a.getId().getComponentIdentifier()).getProjectPath()); - addDevModePaths(dep, a, projectDep); + if (projectDep != null) { + addDevModePaths(dep, a, projectDep); + } else { + dep.addPath(a.getFile()); + } } } } else {
['devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java']
{'.java': 1}
1
1
0
0
1
16,569,339
3,220,879
426,644
4,493
483
74
8
1
2,780
262
744
73
1
1
2021-05-20T19:06:25
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,732
quarkusio/quarkus/18061/17878
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17878
https://github.com/quarkusio/quarkus/pull/18061
https://github.com/quarkusio/quarkus/pull/18061
1
fixes
Quarkus Mongodb change stream resume token always null in native
## Describe the bug I'm building a quarkus app that uses the mongodb change streams functionality with the reactive client. If I start the application locally from Intellij everything works fine but when I build the native app and try to save the resume token it's always null. I use this command to build the native app since I need to build it locally on windows and delpoy it on heroku: mvn package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:21.0.0-java11 This is the class and method where I initialize the change stream and start the watch on the collection @Inject ReactiveMongoClient mongoClient; private void initOrderStream() { ReactiveMongoDatabase database = mongoClient.getDatabase("database"); ReactiveMongoCollection<Order> dataCollection = database.getCollection("order", Order.class); ChangeStreamOptions options = new ChangeStreamOptions().fullDocument(FullDocument.UPDATE_LOOKUP); List<Bson> pipeline = Collections.singletonList( Aggregates.match( Filters.and( Filters.eq("operationType", "insert") ) ) ); Multi<ChangeStreamDocument<Order>> publisher = dataCollection.watch(pipeline, Order.class, options); publisher.subscribe().with(eventListener.getOrderListener()); } And this is the listener method public Consumer<ChangeStreamDocument<Order>> getOrderListener() { return message -> { logger.info("Saving resume token for message " + message); EventConfig eventConfig = new EventConfig(); eventConfig.setType(eventType); eventConfig.setResumeToken(message.getResumeToken().getString("_data")); EventConfig.persistOrUpdate(eventConfig); Order order = message.getFullDocument(); saveEvent(order); }; } The problem is in the message.getResumeToken() method, if I start the application non native than the resume token is present and I can save it without problems, but when I build it native and put it in a container the resume token is always null. Without resume token the change streams are almost useless since Iit's not possible to recover missing events if a problem occurs or appplication needs to be restarted. ### Expected behavior The resume token using the _getResumeToken_ method of the ChangeStreamDocument class should not return null in native mode. ### Actual behavior The resume token using the _getResumeToken_ method of the ChangeStreamDocument class is always null in native mode. ## To Reproduce Steps to reproduce the behavior: 1. Create a quarkus app 2. Connect it to mongodb 3. Initialize change stream on a collection using the code mentioned above 4. Package the application in native mode using the maven command above 5. Start the application 4. Insert a document in the collection attached to the watcher and receive a null pointer exception because the resume token is null ## Environment (please complete the following information): ### Output of `java -version` openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06) OpenJDK 64-Bit Server VM GraalVM CE 21.0.0 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing) ### Quarkus version or git rev 1.13.6.Final
65e3aa05e088355b014d20b197086eac83ec888d
732b2a781b1659715905b9c2121be2a6f050d84f
https://github.com/quarkusio/quarkus/compare/65e3aa05e088355b014d20b197086eac83ec888d...732b2a781b1659715905b9c2121be2a6f050d84f
diff --git a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java index 8e39a69b417..3eb4fd9546e 100644 --- a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java +++ b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java @@ -135,11 +135,13 @@ List<ReflectiveClassBuildItem> addExtensionPointsToNative(CodecProviderBuildItem reflectiveClassNames.addAll(propertyCodecProviders.getPropertyCodecProviderClassNames()); reflectiveClassNames.addAll(bsonDiscriminators.getBsonDiscriminatorClassNames()); reflectiveClassNames.addAll(commandListeners.getCommandListenerClassNames()); - reflectiveClassNames.add(ChangeStreamDocument.class.getName()); - return reflectiveClassNames.stream() + List<ReflectiveClassBuildItem> reflectiveClass = reflectiveClassNames.stream() .map(s -> new ReflectiveClassBuildItem(true, true, false, s)) - .collect(Collectors.toList()); + .collect(Collectors.toCollection(() -> new ArrayList<>())); + // ChangeStreamDocument needs to be registered for reflection with its fields. + reflectiveClass.add(new ReflectiveClassBuildItem(true, true, true, ChangeStreamDocument.class.getName())); + return reflectiveClass; } @BuildStep
['extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java']
{'.java': 1}
1
1
0
0
1
17,007,472
3,304,675
437,562
4,599
568
97
8
1
3,548
397
745
81
0
0
2021-06-22T07:31:23
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,730
quarkusio/quarkus/18138/18026
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18026
https://github.com/quarkusio/quarkus/pull/18138
https://github.com/quarkusio/quarkus/pull/18138
1
fixes
ClassNotFound using SCRAM SHA 256 with Kafka extension
## Describe the bug Using the quarkus Kafka extension and using the following Kafka config: ``` kafka: bootstrap: servers: ... security: protocol: SASL_SSL sasl: mechanism: SCRAM-SHA-256 jaas: config: org.apache.kafka.common.security.scram.ScramLoginModule required username="${kafka.username}" password="${kafka.password}"; ``` Works fine in JVM mode, but when compiling to native it does not work: Caused by: java.lang.ClassNotFoundException: org.apache.kafka.common.security.scram.internals.ScramSaslClient$ScramSaslClientFactory at com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:64) at java.lang.ClassLoader.loadClass(ClassLoader.java:290) at java.security.Provider$Service.getImplClass(Provider.java:1920) ... 43 more ### Expected behavior Being able to use SCAM SHA 256 authentication with Kafka in Quarkus. ### Actual behavior From what I can see, some underlying Kafka client library classes are not included by GraalVM, and some may to work around that needs to be applied. ## To Reproduce Use Kafka client with SCRAM SHA 256 auth against a Kafka cluster. ### Configuration Relevant parts: ```properties kafka: bootstrap: servers: ... security: protocol: SASL_SSL sasl: mechanism: SCRAM-SHA-256 jaas: config: org.apache.kafka.common.security.scram.ScramLoginModule required username="${kafka.username}" password="${kafka.password}"; ``` ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Linux pteppic 5.12.10-300.fc34.x86_64 #1 SMP Thu Jun 10 14:21:36 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9, mixed mode, sharing) ### GraalVM version (if different from Java) graalvm-ce-java11-21.1.0 ### Quarkus version or git rev 2.0.0.CR3 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) ## Additional context Full stack trace: ``` 2021-06-20 19:00:25,119 INFO [org.apa.kaf.com.net.SaslChannelBuilder] (smallrye-kafka-consumer-thread-0) [Consumer clientId=kafka-consumer-telemetry-inbound, groupId=plantmonitor] Failed to create channel due to : org.apache.kafka.common.errors.SaslAuthenticationException: Failed to configure SaslClientAuthenticator Caused by: org.apache.kafka.common.errors.SaslAuthenticationException: Failed to create SaslClient with mechanism SCRAM-SHA-256 Caused by: javax.security.sasl.SaslException: Cannot instantiate service SASL/SCRAM Client Provider: SaslClientFactory.SCRAM-SHA-256 -> org.apache.kafka.common.security.scram.internals.ScramSaslClient$ScramSaslClientFactory [Caused by java.security.NoSuchAlgorithmException: class configured for SaslClientFactory (provider: SASL/SCRAM Client Provider) cannot be found.] at javax.security.sasl.Sasl.loadFactory(Sasl.java:460) at javax.security.sasl.Sasl.createSaslClient(Sasl.java:431) at org.apache.kafka.common.security.authenticator.SaslClientAuthenticator.lambda$createSaslClient$0(SaslClientAuthenticator.java:219) at java.security.AccessController.doPrivileged(AccessController.java:145) at javax.security.auth.Subject.doAs(Subject.java:36) at org.apache.kafka.common.security.authenticator.SaslClientAuthenticator.createSaslClient(SaslClientAuthenticator.java:215) at org.apache.kafka.common.security.authenticator.SaslClientAuthenticator.<init>(SaslClientAuthenticator.java:206) at org.apache.kafka.common.network.SaslChannelBuilder.buildClientAuthenticator(SaslChannelBuilder.java:287) at org.apache.kafka.common.network.SaslChannelBuilder.lambda$buildChannel$1(SaslChannelBuilder.java:228) at org.apache.kafka.common.network.KafkaChannel.<init>(KafkaChannel.java:143) at org.apache.kafka.common.network.SaslChannelBuilder.buildChannel(SaslChannelBuilder.java:236) at org.apache.kafka.common.network.Selector.buildAndAttachKafkaChannel(Selector.java:338) at org.apache.kafka.common.network.Selector.registerChannel(Selector.java:329) at org.apache.kafka.common.network.Selector.connect(Selector.java:256) at org.apache.kafka.clients.NetworkClient.initiateConnect(NetworkClient.java:987) at org.apache.kafka.clients.NetworkClient.access$600(NetworkClient.java:73) at org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.maybeUpdate(NetworkClient.java:1158) at org.apache.kafka.clients.NetworkClient$DefaultMetadataUpdater.maybeUpdate(NetworkClient.java:1046) at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:559) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:265) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:236) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.poll(ConsumerNetworkClient.java:227) at org.apache.kafka.clients.consumer.internals.ConsumerNetworkClient.awaitMetadataUpdate(ConsumerNetworkClient.java:164) at org.apache.kafka.clients.consumer.internals.AbstractCoordinator.ensureCoordinatorReady(AbstractCoordinator.java:257) at org.apache.kafka.clients.consumer.internals.ConsumerCoordinator.poll(ConsumerCoordinator.java:480) at org.apache.kafka.clients.consumer.KafkaConsumer.updateAssignmentMetadataIfNeeded(KafkaConsumer.java:1261) at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1230) at org.apache.kafka.clients.consumer.KafkaConsumer.poll(KafkaConsumer.java:1210) at io.smallrye.reactive.messaging.kafka.impl.ReactiveKafkaConsumer.lambda$poll$4(ReactiveKafkaConsumer.java:127) at io.smallrye.reactive.messaging.kafka.impl.ReactiveKafkaConsumer.lambda$runOnPollingThread$0(ReactiveKafkaConsumer.java:96) at io.smallrye.context.impl.wrappers.SlowContextualSupplier.get(SlowContextualSupplier.java:21) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromItemSupplier.subscribe(UniCreateFromItemSupplier.java:28) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.operators.uni.UniRunSubscribeOn.lambda$subscribe$0(UniRunSubscribeOn.java:27) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) at java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.lang.Thread.run(Thread.java:829) at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553) at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192) Caused by: java.security.NoSuchAlgorithmException: class configured for SaslClientFactory (provider: SASL/SCRAM Client Provider) cannot be found. at java.security.Provider$Service.getImplClass(Provider.java:1933) at java.security.Provider$Service.newInstance(Provider.java:1894) at javax.security.sasl.Sasl.loadFactory(Sasl.java:458) ... 41 more Caused by: java.lang.ClassNotFoundException: org.apache.kafka.common.security.scram.internals.ScramSaslClient$ScramSaslClientFactory at com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:64) at java.lang.ClassLoader.loadClass(ClassLoader.java:290) at java.security.Provider$Service.getImplClass(Provider.java:1920) ... 43 more ```
659ef7abf9ae2cf7ee958f96b34fec3ebf84649c
bb005a577218d59b8bedae74ceadbe4d111de1af
https://github.com/quarkusio/quarkus/compare/659ef7abf9ae2cf7ee958f96b34fec3ebf84649c...bb005a577218d59b8bedae74ceadbe4d111de1af
diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java index 5e797c4b83c..b1be4d68871 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java @@ -18,12 +18,14 @@ import org.apache.kafka.clients.producer.Partitioner; import org.apache.kafka.clients.producer.ProducerInterceptor; import org.apache.kafka.clients.producer.internals.DefaultPartitioner; +import org.apache.kafka.common.security.auth.SecurityProtocol; import org.apache.kafka.common.security.authenticator.AbstractLogin; import org.apache.kafka.common.security.authenticator.DefaultLogin; import org.apache.kafka.common.security.authenticator.SaslClientCallbackHandler; import org.apache.kafka.common.security.oauthbearer.OAuthBearerToken; import org.apache.kafka.common.security.oauthbearer.internals.OAuthBearerRefreshingLogin; import org.apache.kafka.common.security.oauthbearer.internals.OAuthBearerSaslClient; +import org.apache.kafka.common.security.scram.internals.ScramSaslClient; import org.apache.kafka.common.serialization.ByteArrayDeserializer; import org.apache.kafka.common.serialization.ByteArraySerializer; import org.apache.kafka.common.serialization.ByteBufferDeserializer; @@ -44,6 +46,7 @@ import org.apache.kafka.common.serialization.ShortSerializer; import org.apache.kafka.common.serialization.StringDeserializer; import org.apache.kafka.common.serialization.StringSerializer; +import org.eclipse.microprofile.config.ConfigProvider; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.jboss.jandex.Type; @@ -408,12 +411,21 @@ public AdditionalBeanBuildItem runtimeConfig() { @BuildStep public void withSasl(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, - BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy) { + BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, + BuildProducer<ExtensionSslNativeSupportBuildItem> sslNativeSupport) { reflectiveClass .produce(new ReflectiveClassBuildItem(false, false, AbstractLogin.DefaultLoginCallbackHandler.class)); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, SaslClientCallbackHandler.class)); reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DefaultLogin.class)); + reflectiveClass + .produce(new ReflectiveClassBuildItem(true, false, false, ScramSaslClient.ScramSaslClientFactory.class)); + + // Enable SSL support if kafka.security.protocol is set to something other than PLAINTEXT, which is the default + String securityProtocol = ConfigProvider.getConfig().getConfigValue("kafka.security.protocol").getValue(); + if (securityProtocol != null && SecurityProtocol.forName(securityProtocol) != SecurityProtocol.PLAINTEXT) { + sslNativeSupport.produce(new ExtensionSslNativeSupportBuildItem(Feature.KAFKA_CLIENT)); + } final Type loginModuleType = Type .create(DotName.createSimple(LoginModule.class.getName()), Kind.CLASS);
['extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java']
{'.java': 1}
1
1
0
0
1
17,063,021
3,315,030
438,998
4,610
1,050
200
14
1
7,631
400
1,784
137
0
3
2021-06-24T17:11:52
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,729
quarkusio/quarkus/18139/18117
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18117
https://github.com/quarkusio/quarkus/pull/18139
https://github.com/quarkusio/quarkus/pull/18139
1
close
Injecting from another module causes ClassNotFoundException in dev mode
## Describe the bug The class to be injected is located in another module in the project dependency. During the `quarkusDev`, injection fails with `java.lang.ClassNotFoundException`. Both main project and dependency have beans.xml. If the injected class is moved to the main project, injection works. It also works when running the jar directly (`java -jar service1/build/quarkus-app/quarkus-run.jar`).c So this seems to only be a dev mode issue. ### Expected behavior Class should be injected without error. ### Actual behavior `ClassNotFoundException: my.project.plugin.Plugin` ## To Reproduce `service1` in https://github.com/mweber03/quarkus-test Steps to reproduce the behavior: 1. `./gradlew build service1:quarkusDev` ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Ubuntu 20.04 ### Output of `java -version` OpenJDK 11.0.11 ### Quarkus version or git rev Quarkus 1.13.7 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 6.8.3
9ce4a096185e3c9a7553d7541e9670cb06fc095c
36fcef67b772b9e35b144f39144d994ceebab99e
https://github.com/quarkusio/quarkus/compare/9ce4a096185e3c9a7553d7541e9670cb06fc095c...36fcef67b772b9e35b144f39144d994ceebab99e
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java index b8f6e9829a2..5e45d940f74 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java @@ -51,6 +51,7 @@ import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.deployment.dev.DevModeContext; import io.quarkus.deployment.dev.QuarkusDevModeLauncher; +import io.quarkus.gradle.QuarkusPlugin; import io.quarkus.runtime.LaunchMode; public class QuarkusDev extends QuarkusTask { @@ -335,7 +336,7 @@ private void addSelfWithLocalDeps(Project project, GradleDevModeLauncher.Builder if (!visited.add(project.getPath())) { return; } - final Configuration compileCp = project.getConfigurations().findByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME); + final Configuration compileCp = project.getConfigurations().findByName(QuarkusPlugin.DEV_MODE_CONFIGURATION_NAME); if (compileCp != null) { compileCp.getIncoming().getDependencies().forEach(d -> { if (d instanceof ProjectDependency) {
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java']
{'.java': 1}
1
1
0
0
1
17,095,386
3,320,915
439,749
4,617
294
58
3
1
1,049
138
261
31
1
0
2021-06-24T19:06:20
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,710
quarkusio/quarkus/18551/18521
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18521
https://github.com/quarkusio/quarkus/pull/18551
https://github.com/quarkusio/quarkus/pull/18551
1
fix
Utf-8 graphql issue with non ascii chars
## Describe the bug Utf-8 chars like german umlauts are not usable. ### Expected behavior Special chars should work like normal chars. ### Actual behavior Special chars like german ä, ö, ü are replaced by things like ü ## To Reproduce Or attach an archive containing the reproducer to the issue. [code-with-quarkus_graphql_utf8.zip](https://github.com/quarkusio/quarkus/files/6783786/code-with-quarkus_graphql_utf8.zip) Steps to reproduce the behavior: 1. Send the example query via dev ui or intellij http request. 2. The response does contain destroyed umlauts. ``` Example Query: query test{ hello(string: "München") } Example response: { "data": { "hello": "München" } } Example Intellij http request: POST http://localhost:8080/graphql Content-Type: application/json {"query":"query test{\\n hello(string: \\"München\\")\\n}\\n","variables":null,"operationName":"test"} ### Output of `uname -a` or `ver` ### Output of `java -version` openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode) ### Quarkus version or git rev 2.0.1.Final Problem could be here: io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler#readBody return new String(bytes);
ba955f2a3f65e626a58f251fb9e4c94dd4602b3f
5c9936916e8c9dc6d86655cba62c0de11a7ebfad
https://github.com/quarkusio/quarkus/compare/ba955f2a3f65e626a58f251fb9e4c94dd4602b3f...5c9936916e8c9dc6d86655cba62c0de11a7ebfad
diff --git a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/AbstractGraphQLTest.java b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/AbstractGraphQLTest.java index fe1f8f6e67c..ba8dd7e1769 100644 --- a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/AbstractGraphQLTest.java +++ b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/AbstractGraphQLTest.java @@ -14,12 +14,17 @@ import org.hamcrest.CoreMatchers; import io.restassured.RestAssured; +import io.restassured.parsing.Parser; /** * Some shared methods */ public abstract class AbstractGraphQLTest { + static { + RestAssured.registerParser("application/graphql+json", Parser.JSON); + } + protected void pingTest() { pingPongTest("ping", "pong"); } diff --git a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLCDIContextPropagationTest.java b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLCDIContextPropagationTest.java index 7535660ca60..fed77846f4f 100644 --- a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLCDIContextPropagationTest.java +++ b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLCDIContextPropagationTest.java @@ -25,7 +25,6 @@ import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; -import io.restassured.http.ContentType; /** * Testing scenarios which require CDI context propagation to work under the hood. @@ -51,8 +50,8 @@ public void testCdiContextPropagationForBatchSources() { "}"); RestAssured.given().when() - .accept(ContentType.JSON) - .contentType(ContentType.JSON) + .accept(MEDIATYPE_JSON) + .contentType(MEDIATYPE_JSON) .body(pingRequest) .post("/graphql") .then() @@ -74,8 +73,8 @@ public void testCdiContextPropagationForBatchSourcesAsync() { "}"); RestAssured.given().when() - .accept(ContentType.JSON) - .contentType(ContentType.JSON) + .accept(MEDIATYPE_JSON) + .contentType(MEDIATYPE_JSON) .body(pingRequest) .post("/graphql") .then() @@ -98,8 +97,8 @@ public void testManualContextPropagation() { "}"); RestAssured.given().when() - .accept(ContentType.JSON) - .contentType(ContentType.JSON) + .accept(MEDIATYPE_JSON) + .contentType(MEDIATYPE_JSON) .body(pingRequest) .post("/graphql") .then() diff --git a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java index b78f7b226a3..d380916f6c9 100644 --- a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java +++ b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java @@ -2,6 +2,7 @@ import static io.quarkus.smallrye.graphql.deployment.AbstractGraphQLTest.MEDIATYPE_JSON; +import java.nio.charset.Charset; import java.util.HashMap; import java.util.Map; @@ -106,6 +107,67 @@ public void testSourcePost() { } + @Test + public void testWrongAcceptType() { + String fooRequest = getPayload("{\\n" + + " foo {\\n" + + " message\\n" + + " randomNumber{\\n" + + " value\\n" + + " }\\n" + + " list\\n" + + " }\\n" + + "}"); + + RestAssured.given().when() + .accept(MEDIATYPE_TEXT) + .contentType(MEDIATYPE_JSON) + .body(fooRequest) + .post("/graphql") + .then() + .assertThat() + .statusCode(406); + } + + @Test + public void testUTF8Charset() { + String fooRequest = getPayload("{\\n" + + " testCharset(characters:\\"óôöúüýáâäçéëí\\")\\n" + + "}"); + + byte[] response = RestAssured.given().when() + .body(fooRequest) + .post("/graphql") + .then() + .assertThat() + .statusCode(200) + .and() + .extract().body().asByteArray(); + + String decodedResponse = new String(response, Charset.forName("UTF-8")); + Assertions.assertTrue(decodedResponse.contains("{\\"data\\":{\\"testCharset\\":\\"óôöúüýáâäçéëí\\"}}")); + } + + @Test + public void testCP1250Charset() { + String fooRequest = getPayload("{\\n" + + " testCharset(characters:\\"óôöúüýáâäçéëí\\")\\n" + + "}"); + + byte[] response = RestAssured.given().when() + .accept("application/json;charset=CP1250") + .body(fooRequest) + .post("/graphql") + .then() + .assertThat() + .statusCode(200) + .and() + .extract().body().asByteArray(); + + String decodedResponse = new String(response, Charset.forName("CP1250")); + Assertions.assertTrue(decodedResponse.contains("{\\"data\\":{\\"testCharset\\":\\"óôöúüýáâäçéëí\\"}}")); + } + @Test public void testSourcePost2() { String foosRequest = getPayload("{\\n" + diff --git a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLContextTestCase.java b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLContextTestCase.java index 0d117b54bb5..2f3acec11fb 100644 --- a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLContextTestCase.java +++ b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLContextTestCase.java @@ -26,7 +26,6 @@ import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; -import io.restassured.http.ContentType; import io.smallrye.graphql.api.Context; public class SmallRyeGraphQLContextTestCase extends AbstractGraphQLTest { @@ -45,8 +44,8 @@ public void testAsyncQuery() { "}"); RestAssured.given().when() - .accept(ContentType.JSON) - .contentType(ContentType.JSON) + .accept(MEDIATYPE_JSON) + .contentType(MEDIATYPE_JSON) .body(request) .post("/graphql") .then() @@ -68,8 +67,8 @@ public void testAsyncQueryWithAsyncSource() { "}"); RestAssured.given().when() - .accept(ContentType.JSON) - .contentType(ContentType.JSON) + .accept(MEDIATYPE_JSON) + .contentType(MEDIATYPE_JSON) .body(request) .post("/graphql") .then() @@ -91,8 +90,8 @@ public void testManualPropagation() { "}"); RestAssured.given().when() - .accept(ContentType.JSON) - .contentType(ContentType.JSON) + .accept(MEDIATYPE_JSON) + .contentType(MEDIATYPE_JSON) .body(request) .post("/graphql") .then() @@ -114,8 +113,8 @@ public void testSourceMethods() { "}"); RestAssured.given().when() - .accept(ContentType.JSON) - .contentType(ContentType.JSON) + .accept(MEDIATYPE_JSON) + .contentType(MEDIATYPE_JSON) .body(request) .post("/graphql") .then() diff --git a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/TestResource.java b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/TestResource.java index e260e19c0b3..d33d00a97ea 100644 --- a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/TestResource.java +++ b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/TestResource.java @@ -61,6 +61,11 @@ public TestPojo moo(String name) { return new TestPojo(name); } + @Query + public String testCharset(String characters) { + return characters; + } + // <placeholder> public TestRandom getRandomNumber(@Source TestPojo testPojo) { diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLAbstractHandler.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLAbstractHandler.java index 648dfdb1d55..5441b0d7a8d 100644 --- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLAbstractHandler.java +++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLAbstractHandler.java @@ -3,7 +3,6 @@ import java.io.StringReader; import javax.json.Json; -import javax.json.JsonBuilderFactory; import javax.json.JsonObject; import javax.json.JsonReader; import javax.json.JsonReaderFactory; @@ -28,8 +27,7 @@ public abstract class SmallRyeGraphQLAbstractHandler implements Handler<RoutingC private volatile ExecutionService executionService; - private static final JsonBuilderFactory jsonObjectFactory = Json.createBuilderFactory(null); - private static final JsonReaderFactory jsonReaderFactory = Json.createReaderFactory(null); + protected static final JsonReaderFactory jsonReaderFactory = Json.createReaderFactory(null); public SmallRyeGraphQLAbstractHandler( CurrentIdentityAssociation currentIdentityAssociation, diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java index 99af8227e95..3f59874e910 100644 --- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java +++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java @@ -4,14 +4,13 @@ import java.io.StringReader; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; import java.util.List; import javax.json.Json; -import javax.json.JsonBuilderFactory; import javax.json.JsonObject; import javax.json.JsonObjectBuilder; import javax.json.JsonReader; -import javax.json.JsonReaderFactory; import io.quarkus.security.identity.CurrentIdentityAssociation; import io.quarkus.vertx.http.runtime.CurrentVertxRequest; @@ -34,9 +33,10 @@ public class SmallRyeGraphQLExecutionHandler extends SmallRyeGraphQLAbstractHand private static final String EXTENSIONS = "extensions"; private static final String APPLICATION_GRAPHQL = "application/graphql"; private static final String OK = "OK"; - - private static final JsonBuilderFactory jsonObjectFactory = Json.createBuilderFactory(null); - private static final JsonReaderFactory jsonReaderFactory = Json.createReaderFactory(null); + private static final String DEFAULT_RESPONSE_CONTENT_TYPE = "application/graphql+json; charset=" + + StandardCharsets.UTF_8.name(); + private static final String DEFAULT_REQUEST_CONTENT_TYPE = "application/json; charset=" + + StandardCharsets.UTF_8.name(); public SmallRyeGraphQLExecutionHandler(boolean allowGet, boolean allowPostWithQueryParameters, CurrentIdentityAssociation currentIdentityAssociation, @@ -48,25 +48,33 @@ public SmallRyeGraphQLExecutionHandler(boolean allowGet, boolean allowPostWithQu @Override protected void doHandle(final RoutingContext ctx) { - HttpServerRequest request = ctx.request(); HttpServerResponse response = ctx.response(); - response.headers().set(HttpHeaders.CONTENT_TYPE, "application/json; charset=UTF-8"); + String accept = getRequestAccept(ctx); + String requestedCharset = getCharset(accept); + + boolean isValid = isValidAcceptRequest(accept); - switch (request.method().name()) { - case "OPTIONS": - handleOptions(response); - break; - case "POST": - handlePost(response, ctx); - break; - case "GET": - handleGet(response, ctx); - break; - default: - ctx.next(); - break; + if (!isValid) { + handleInvalidAcceptRequest(response); + } else { + response.headers().set(HttpHeaders.CONTENT_TYPE, accept); + + switch (request.method().name()) { + case "OPTIONS": + handleOptions(response); + break; + case "POST": + handlePost(response, ctx, requestedCharset); + break; + case "GET": + handleGet(response, ctx, requestedCharset); + break; + default: + ctx.next(); + break; + } } } @@ -75,7 +83,7 @@ private void handleOptions(HttpServerResponse response) { response.setStatusCode(200).setStatusMessage(OK).end(); } - private void handlePost(HttpServerResponse response, RoutingContext ctx) { + private void handlePost(HttpServerResponse response, RoutingContext ctx, String requestedCharset) { try { JsonObject jsonObjectFromBody = getJsonObjectFromBody(ctx); String postResponse; @@ -87,13 +95,13 @@ private void handlePost(HttpServerResponse response, RoutingContext ctx) { } else { postResponse = doRequest(jsonObjectFromBody); } - response.setStatusCode(200).setStatusMessage(OK).end(Buffer.buffer(postResponse)); + response.setStatusCode(200).setStatusMessage(OK).end(Buffer.buffer(postResponse, requestedCharset)); } catch (IOException ex) { throw new RuntimeException(ex); } } - private void handleGet(HttpServerResponse response, RoutingContext ctx) { + private void handleGet(HttpServerResponse response, RoutingContext ctx, String requestedCharset) { if (allowGet) { try { JsonObject input = getJsonObjectFromQueryParameters(ctx); @@ -102,7 +110,7 @@ private void handleGet(HttpServerResponse response, RoutingContext ctx) { String getResponse = doRequest(input); response.setStatusCode(200) .setStatusMessage(OK) - .end(Buffer.buffer(getResponse)); + .end(Buffer.buffer(getResponse, requestedCharset)); } else { response.setStatusCode(204).end(); @@ -115,30 +123,34 @@ private void handleGet(HttpServerResponse response, RoutingContext ctx) { } } + private void handleInvalidAcceptRequest(HttpServerResponse response) { + response.setStatusCode(406).end(); + } + private JsonObject getJsonObjectFromQueryParameters(RoutingContext ctx) throws UnsupportedEncodingException { JsonObjectBuilder input = Json.createObjectBuilder(); // Query String query = stripNewlinesAndTabs(readQueryParameter(ctx, QUERY)); if (query != null && !query.isEmpty()) { - input.add(QUERY, URLDecoder.decode(query, "UTF8")); + input.add(QUERY, URLDecoder.decode(query, StandardCharsets.UTF_8.name())); } // OperationName String operationName = readQueryParameter(ctx, OPERATION_NAME); if (operationName != null && !operationName.isEmpty()) { - input.add(OPERATION_NAME, URLDecoder.decode(query, "UTF8")); + input.add(OPERATION_NAME, URLDecoder.decode(query, StandardCharsets.UTF_8.name())); } // Variables String variables = stripNewlinesAndTabs(readQueryParameter(ctx, VARIABLES)); if (variables != null && !variables.isEmpty()) { - JsonObject jsonObject = toJsonObject(URLDecoder.decode(variables, "UTF8")); + JsonObject jsonObject = toJsonObject(URLDecoder.decode(variables, StandardCharsets.UTF_8.name())); input.add(VARIABLES, jsonObject); } // Extensions String extensions = stripNewlinesAndTabs(readQueryParameter(ctx, EXTENSIONS)); if (extensions != null && !extensions.isEmpty()) { - JsonObject jsonObject = toJsonObject(URLDecoder.decode(extensions, "UTF8")); + JsonObject jsonObject = toJsonObject(URLDecoder.decode(extensions, StandardCharsets.UTF_8.name())); input.add(EXTENSIONS, jsonObject); } @@ -147,7 +159,7 @@ private JsonObject getJsonObjectFromQueryParameters(RoutingContext ctx) throws U private JsonObject getJsonObjectFromBody(RoutingContext ctx) throws IOException { - String contentType = readContentType(ctx); + String contentType = getRequestContentType(ctx); String body = stripNewlinesAndTabs(readBody(ctx)); // If the content type is application/graphql, the query is in the body @@ -167,18 +179,43 @@ private JsonObject getJsonObjectFromBody(RoutingContext ctx) throws IOException private String readBody(RoutingContext ctx) { if (ctx.getBody() != null) { - byte[] bytes = ctx.getBody().getBytes(); - return new String(bytes); + return ctx.getBodyAsString(); } return null; } - private String readContentType(RoutingContext ctx) { + private String getRequestContentType(RoutingContext ctx) { String contentType = ctx.request().getHeader("Content-Type"); - if (contentType != null && !contentType.isEmpty()) { + if (contentType != null && !contentType.isEmpty() && !contentType.startsWith("*/*")) { return contentType; } - return null; + return DEFAULT_REQUEST_CONTENT_TYPE; + } + + private String getRequestAccept(RoutingContext ctx) { + String accept = ctx.request().getHeader("Accept"); + if (accept != null && !accept.isEmpty() && !accept.startsWith("*/*")) { + return accept; + } + return DEFAULT_RESPONSE_CONTENT_TYPE; + } + + private String getCharset(String mimeType) { + if (mimeType != null && mimeType.contains(";")) { + String[] parts = mimeType.split(";"); + for (String part : parts) { + if (part.trim().startsWith("charset")) { + return part.split("=")[1]; + } + } + } + return StandardCharsets.UTF_8.name(); + } + + private boolean isValidAcceptRequest(String mimeType) { + // At this point we only accept two + return mimeType.startsWith("application/json") + || mimeType.startsWith("application/graphql+json"); } private String readQueryParameter(RoutingContext ctx, String parameterName) {
['extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/TestResource.java', 'extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLAbstractHandler.java', 'extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLCDIContextPropagationTest.java', 'extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/AbstractGraphQLTest.java', 'extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java', 'extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLContextTestCase.java', 'extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java']
{'.java': 7}
7
7
0
0
7
17,429,391
3,388,692
447,774
4,663
5,377
932
109
2
1,375
151
381
57
2
0
2021-07-09T08:00:39
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,711
quarkusio/quarkus/18523/18495
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18495
https://github.com/quarkusio/quarkus/pull/18523
https://github.com/quarkusio/quarkus/pull/18523
1
fixes
Update to 2.0.1.Final breaks working Kafka deserializer configuration in 1.x
## Describe the bug Changing pom.xml from 1.x to 2.0.1.Final prevents successful Dev Mode startup with exception. ### Expected behavior No errors during startup like before with 1.x ### Actual behavior Exception during startup is thrown: ``` 2021-07-07 17:06:06,364 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.deployment.steps.ConfigGenerationBuildStep#generateConfigClass threw an exception: java.lang.IllegalStateException: More than one default value for mp.messaging.incoming.created.value.deserializer was produced at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:64) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476) at java.base/java.lang.Thread.run(Thread.java:829) at org.jboss.threads.JBossThread.run(JBossThread.java:501) at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:414) at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:274) at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:66) at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:87) at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:448) at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:61) at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:132) at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:89) at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145) at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63) Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.deployment.steps.ConfigGenerationBuildStep#generateConfigClass threw an exception: java.lang.IllegalStateException: More than one default value for mp.messaging.incoming.created.value.deserializer was produced at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:64) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476) at java.base/java.lang.Thread.run(Thread.java:829) at org.jboss.threads.JBossThread.run(JBossThread.java:501) at io.quarkus.builder.Execution.run(Execution.java:116) at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79) at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:156) at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:412) ... 9 more Caused by: java.lang.IllegalStateException: More than one default value for mp.messaging.incoming.created.value.deserializer was produced at io.quarkus.deployment.steps.ConfigGenerationBuildStep.generateConfigClass(ConfigGenerationBuildStep.java:64) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476) at java.base/java.lang.Thread.run(Thread.java:829) at org.jboss.threads.JBossThread.run(JBossThread.java:501) ``` ## To Reproduce Could not reproduce with quarkus-quickstarts/kafka-panache-reactive-quickstart, but there isn't any quickstart utilising deserializers. ### Configuration according to [Serializing via JSON-B](https://quarkus.io/guides/kafka#jsonb-serialization) ```properties # Add your application.properties here, if applicable. # Configure the Kafka sink (we write to it) mp.messaging.outgoing.entry-created.connector=smallrye-kafka mp.messaging.outgoing.entry-created.topic=created mp.messaging.outgoing.entry-created.value.serializer=io.quarkus.kafka.client.serialization.JsonbSerializer # Configure the Kafka source (we read from it) mp.messaging.incoming.created.connector=smallrye-kafka mp.messaging.incoming.created.topic=created mp.messaging.incoming.created.broadcast=true mp.messaging.incoming.created.value.deserializer=me.cligg.dto.MyCacheEntryDeserializer ``` ### Screenshots (If applicable, add screenshots to help explain your problem.) ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Linux fedora 5.12.13-300.fc34.x86_64 #1 SMP Wed Jun 23 16:18:11 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment 18.9 (build 11.0.11+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9, mixed mode, sharing) ### GraalVM version (if different from Java) ### Quarkus version or git rev <quarkus-plugin.version>2.0.1.Final</quarkus-plugin.version> <quarkus.platform.version>2.0.1.Final</quarkus.platform.version> ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /home/torben/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1 Java version: 11.0.11, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.11.0.9-4.fc34.x86_64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.12.13-300.fc34.x86_64", arch: "amd64", family: "unix" ## Additional context (Add any other context about the problem here.)
61f3f0d1d3b43ae5a06a3f2d074f5ccd03ddb562
366573d2d4517b4442a6aed290e9089bc021e287
https://github.com/quarkusio/quarkus/compare/61f3f0d1d3b43ae5a06a3f2d074f5ccd03ddb562...366573d2d4517b4442a6aed290e9089bc021e287
diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java index f4740fe5924..b6bade7d88c 100644 --- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java +++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java @@ -19,6 +19,7 @@ class DefaultSerdeDiscoveryState { private final IndexView index; private final Map<String, Boolean> isKafkaConnector = new HashMap<>(); + private final Map<String, String> serdeConfigMap = new HashMap<>(); private Boolean hasConfluent; private Boolean hasApicurio1; @@ -40,6 +41,13 @@ boolean isKafkaConnector(boolean incoming, String channelName) { }); } + void runIfConfigIsAbsent(String key, String value, Runnable runnable) { + if (value != null && !serdeConfigMap.containsKey(key)) { + serdeConfigMap.put(key, value); + runnable.run(); + } + } + boolean isAvroGenerated(DotName className) { ClassInfo clazz = index.getClassByName(className); return clazz != null && clazz.classAnnotation(DotNames.AVRO_GENERATED) != null; diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java index 2687f5f4a0f..3fbec6398fe 100644 --- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java +++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java @@ -65,14 +65,10 @@ void discoverDefaultSerdeConfig(DefaultSerdeDiscoveryState discovery, MethodInfo method = annotation.target().asMethod(); processIncomingMethod(discovery, method, (keyDeserializer, valueDeserializer) -> { - if (keyDeserializer != null) { - config.produce(new RunTimeConfigurationDefaultBuildItem( - "mp.messaging.incoming." + channelName + ".key.deserializer", keyDeserializer)); - } - if (valueDeserializer != null) { - config.produce(new RunTimeConfigurationDefaultBuildItem( - "mp.messaging.incoming." + channelName + ".value.deserializer", valueDeserializer)); - } + produceRuntimeConfigurationDefaultBuildItem(discovery, config, + "mp.messaging.incoming." + channelName + ".key.deserializer", keyDeserializer); + produceRuntimeConfigurationDefaultBuildItem(discovery, config, + "mp.messaging.incoming." + channelName + ".value.deserializer", valueDeserializer); }); } @@ -85,14 +81,10 @@ void discoverDefaultSerdeConfig(DefaultSerdeDiscoveryState discovery, MethodInfo method = annotation.target().asMethod(); processOutgoingMethod(discovery, method, (keySerializer, valueSerializer) -> { - if (keySerializer != null) { - config.produce(new RunTimeConfigurationDefaultBuildItem( - "mp.messaging.outgoing." + channelName + ".key.serializer", keySerializer)); - } - if (valueSerializer != null) { - config.produce(new RunTimeConfigurationDefaultBuildItem( - "mp.messaging.outgoing." + channelName + ".value.serializer", valueSerializer)); - } + produceRuntimeConfigurationDefaultBuildItem(discovery, config, + "mp.messaging.outgoing." + channelName + ".key.serializer", keySerializer); + produceRuntimeConfigurationDefaultBuildItem(discovery, config, + "mp.messaging.outgoing." + channelName + ".value.serializer", valueSerializer); }); } @@ -117,29 +109,27 @@ void discoverDefaultSerdeConfig(DefaultSerdeDiscoveryState discovery, } processIncomingChannelInjectionPoint(discovery, injectionPointType, (keyDeserializer, valueDeserializer) -> { - if (keyDeserializer != null) { - config.produce(new RunTimeConfigurationDefaultBuildItem( - "mp.messaging.incoming." + channelName + ".key.deserializer", keyDeserializer)); - } - if (valueDeserializer != null) { - config.produce(new RunTimeConfigurationDefaultBuildItem( - "mp.messaging.incoming." + channelName + ".value.deserializer", valueDeserializer)); - } + produceRuntimeConfigurationDefaultBuildItem(discovery, config, + "mp.messaging.incoming." + channelName + ".key.deserializer", keyDeserializer); + produceRuntimeConfigurationDefaultBuildItem(discovery, config, + "mp.messaging.incoming." + channelName + ".value.deserializer", valueDeserializer); }); processOutgoingChannelInjectionPoint(discovery, injectionPointType, (keySerializer, valueSerializer) -> { - if (keySerializer != null) { - config.produce(new RunTimeConfigurationDefaultBuildItem( - "mp.messaging.outgoing." + channelName + ".key.serializer", keySerializer)); - } - if (valueSerializer != null) { - config.produce(new RunTimeConfigurationDefaultBuildItem( - "mp.messaging.outgoing." + channelName + ".value.serializer", valueSerializer)); - } + produceRuntimeConfigurationDefaultBuildItem(discovery, config, + "mp.messaging.outgoing." + channelName + ".key.serializer", keySerializer); + produceRuntimeConfigurationDefaultBuildItem(discovery, config, + "mp.messaging.outgoing." + channelName + ".value.serializer", valueSerializer); }); } } + void produceRuntimeConfigurationDefaultBuildItem(DefaultSerdeDiscoveryState discovery, + BuildProducer<RunTimeConfigurationDefaultBuildItem> config, String key, String value) { + discovery.runIfConfigIsAbsent(key, value, + () -> config.produce(new RunTimeConfigurationDefaultBuildItem(key, value))); + } + private void processIncomingMethod(DefaultSerdeDiscoveryState discovery, MethodInfo method, BiConsumer<String, String> deserializerAcceptor) { List<Type> parameterTypes = method.parameters(); diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java index b4c3dcfe3c3..69a35ba4c73 100644 --- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java +++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java @@ -55,7 +55,7 @@ boolean isKafkaConnector(boolean incoming, String channelName) { assertThat(configs) .extracting(RunTimeConfigurationDefaultBuildItem::getKey, RunTimeConfigurationDefaultBuildItem::getValue) - .containsOnly(expectations); + .containsExactlyInAnyOrder(expectations); } private static IndexView index(Class<?>... classes) { @@ -1977,4 +1977,62 @@ private static class FloatJsonArrayInShortByteArrayOut { @Channel("channel25") Multi<ConsumerRecord<Float, JsonArray>> consumer25; } + + @Test + void produceDefaultConfigOnce() { + // @formatter:off + Tuple[] expectations = { + tuple("mp.messaging.outgoing.channel1.value.serializer", "io.quarkus.smallrye.reactivemessaging.kafka.deployment.DefaultSerdeConfigTest$JsonbDtoSerializer"), + tuple("mp.messaging.incoming.channel2.value.deserializer", "io.quarkus.smallrye.reactivemessaging.kafka.deployment.DefaultSerdeConfigTest$JacksonDtoDeserializer"), + tuple("mp.messaging.incoming.channel3.key.deserializer", "org.apache.kafka.common.serialization.IntegerDeserializer"), + tuple("mp.messaging.incoming.channel3.value.deserializer", "io.quarkus.smallrye.reactivemessaging.kafka.deployment.DefaultSerdeConfigTest$JacksonDtoDeserializer"), + tuple("mp.messaging.outgoing.channel4.key.serializer", "org.apache.kafka.common.serialization.StringSerializer"), + tuple("mp.messaging.outgoing.channel4.value.serializer", "org.apache.kafka.common.serialization.IntegerSerializer"), + }; + // @formatter:on + + doTest(expectations, JsonbDto.class, JsonbDtoSerializer.class, JacksonDto.class, JacksonDtoDeserializer.class, + MultipleChannels.class); + } + + private static class MultipleChannels { + + @Channel("channel1") + Emitter<JsonbDto> emitter1; + + @Outgoing("channel1") + Publisher<Message<JsonbDto>> method1() { + return null; + } + + @Outgoing("channel1") + Publisher<JsonbDto> method1Duplicate() { + return null; + } + + @Channel("channel2") + Multi<JacksonDto> channel2; + + @Incoming("channel2") + void channel2Duplicate(JacksonDto jacksonDto) { + + } + + @Channel("channel3") + Multi<Record<Integer, JacksonDto>> channel3; + + @Incoming("channel3") + void channel3Duplicate(Record<Integer, JacksonDto> jacksonDto) { + + } + + @Channel("channel4") + Emitter<ProducerRecord<String, Integer>> emitterChannel4; + + @Outgoing("channel4") + ProducerRecord<String, Integer> method4() { + return null; + }; + + } }
['extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java', 'extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java', 'extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java']
{'.java': 3}
3
3
0
0
3
17,417,978
3,386,169
447,572
4,664
4,175
705
62
2
7,531
407
1,897
123
1
2
2021-07-08T11:03:25
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,712
quarkusio/quarkus/18496/18486
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18486
https://github.com/quarkusio/quarkus/pull/18496
https://github.com/quarkusio/quarkus/pull/18496
1
fixes
Quarkus 2.0.1: Reflective access broken for Jackson (de)serialization / inheritance/polymorphism
## Describe the bug We've bumped Quarkus from 2.0.0.Final to 2.0.1.Final and our integration-tests against a Quarkus native image build fail since Quarkus 2.0.1. [Nessie commit with successful CI run before the Quarkus version bump](https://github.com/projectnessie/nessie/commit/ddde10d8fffdf59ab1000a4c87e2a8cc26adccf8) [Nessie commit with failing CI run for the Quarkus version bump](https://github.com/projectnessie/nessie/commit/ddde10d8fffdf59ab1000a4c87e2a8cc26adccf8) I've bisect'ed the changes and found that 0561a58ad83a42aeaa1695d206ca22558bc4ef33 causes the bug. Since JSON deserialization only fails against a native image but works fine in a "proper JVM", it makes sense that this Quarkus commit breaks something. Jackson does some reflective access to find `builder()` and related methods. Quarkus' `ReflectiveHierarchyStep` provides the reflection-information for native images. Since Jackson cannot find these methods anymore, it errors out. It's related to polymorphism. Nessie's [`IcebergTable`](https://github.com/projectnessie/nessie/blob/main/model/src/main/java/org/projectnessie/model/IcebergTable.java) class is probably the first class being found (it's mentioned 1st in the annotations) and it's reflection-information is correctly added and (de)serialization for that class workds - but other types like [`SqlView`](https://github.com/projectnessie/nessie/blob/main/model/src/main/java/org/projectnessie/model/SqlView.java) seem to be no longer processed since that commit, have no reflection information and therefore cause (de)serialization issues. Both classes extend [`Contents`](https://github.com/projectnessie/nessie/blob/040a2955834b8a263d55c2c32c0fd26d34e639c0/model/src/main/java/org/projectnessie/model/Contents.java). Repro steps (the Quarkus version can be updated in the top-level-pom around line 135: * Clone https://github.com/projectnessie/nessie * `./mvnw clean install -DskipTests && ./mvnw clean install -Pnative -pl servers/quarkus-server/` `git bisect` log: ``` # bad: [e21b905817188d19a76886847409020d0aa6b530] Add missing nexus-staging-maven-plugin.version to bootstrap parent pom # good: [e8ceb2f63ac142ff57448aaa85279fe14ee2ab6d] Fix actionable error message in Quartz scheduling git bisect start 'e21b905817188d19a76886847409020d0aa6b530' 'e8ceb2f63ac142ff57448aaa85279fe14ee2ab6d' # good: [9c7030212f127bdd67f0907b8450d7371e00b97d] Introduce the ability to use deep mocks in @InjectMock git bisect good 9c7030212f127bdd67f0907b8450d7371e00b97d # good: [4c7618177932b16b5aa0e14a431aadb87e74f92a] Update log levels when running mvn quarkus:test git bisect good 4c7618177932b16b5aa0e14a431aadb87e74f92a # bad: [017d4fd71eb3f55d52008e018cf080b35dddbcd3] GraphQL client configuration rework git bisect bad 017d4fd71eb3f55d52008e018cf080b35dddbcd3 # good: [1d1c273de101b9e0cc24dc183054e63c83d2d7f3] Registry client config (de)serialization tests and fixes git bisect good 1d1c273de101b9e0cc24dc183054e63c83d2d7f3 # bad: [c23a65b44917d52edbdd4f7f9bcdd11c63a514ee] Add quarkus config properties for SmallRye GraphQL Client git bisect bad c23a65b44917d52edbdd4f7f9bcdd11c63a514ee # bad: [61b88690dee13bbd5112eeb706d31488865023ba] Fix native error with OTLP exporter for OpenTelemetry git bisect bad 61b88690dee13bbd5112eeb706d31488865023ba # bad: [0561a58ad83a42aeaa1695d206ca22558bc4ef33] Fixed StackOverflowError building reflective hierarchy git bisect bad 0561a58ad83a42aeaa1695d206ca22558bc4ef33 # first bad commit: [0561a58ad83a42aeaa1695d206ca22558bc4ef33] Fixed StackOverflowError building reflective hierarchy ``` /cc @aloubyansky
b6e0754b81a541ff69b0f1f8dec436067c4a5614
093a4a729bfe2ed33e7e224d0af548156982a52f
https://github.com/quarkusio/quarkus/compare/b6e0754b81a541ff69b0f1f8dec436067c4a5614...093a4a729bfe2ed33e7e224d0af548156982a52f
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ReflectiveHierarchyStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ReflectiveHierarchyStep.java index 9bddde0f2df..050e5421b2c 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ReflectiveHierarchyStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ReflectiveHierarchyStep.java @@ -120,8 +120,7 @@ private void addReflectiveHierarchy(CombinedIndexBuildItem combinedIndexBuildIte type instanceof UnresolvedTypeVariable) { return; } else if (type instanceof ClassType) { - if (reflectiveHierarchyBuildItem.getIgnoreTypePredicate().test(type.name()) - || processedReflectiveHierarchies.contains(type.name())) { + if (reflectiveHierarchyBuildItem.getIgnoreTypePredicate().test(type.name())) { return; }
['core/deployment/src/main/java/io/quarkus/deployment/steps/ReflectiveHierarchyStep.java']
{'.java': 1}
1
1
0
0
1
17,402,580
3,383,235
447,279
4,663
260
48
3
1
3,629
339
1,179
37
6
1
2021-07-07T16:33:01
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,713
quarkusio/quarkus/18472/18439
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18439
https://github.com/quarkusio/quarkus/pull/18472
https://github.com/quarkusio/quarkus/pull/18472
1
fixes
mutable-jar build breaks docker cache
## Describe the bug When the package type is set to `mutable-jar`, the resulting build-system.properties file changes trivially every build. This causes the "COPY lib" Dockerfile command to generate a duplicate layer. This causes very large layers (>150Mi) to be unnecessarily pushed to a docker repository. ### Expected behavior The Dockerfile contains the comment: > \\# We make four distinct layers so if there are application changes the library layers can be re-used This indicates that the docker library layer is intended to be reused if the libraries don't change. ### Actual behavior In the Quarkus gradle build system, while assembling the app for the `mutable-jar` package type, it collects all passed system properties that start with `quarkus.` and write them out to the file `build-system.properties` in the path `build/quarkus-app/lib/deployment/` using the built-in `java.util.Properties#store()` method. This causes a comment line to be added to the file with the current timestamp. There is no way to turn off this behaviour using this mechanism. This causes the `build-system.properties` file to be different each time and therefore defeating the docker layer cache. ## To Reproduce https://github.com/cherrydev/quarkus-docker-layer-demo Steps to reproduce the behavior: * `$ ./mvnw package -Dquarkus.package.type=mutable-jar` * Examine `target/quarkus-app/lib/deployment/built-system.properties` file. * Note the timestamp on the second line of file * re-run `$ ./mvnw package -Dquarkus.package.type=mutable-jar` * Note a different timestamp on the file ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Darwin [redacted] 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "11.0.11" 2021-04-20 LTS ### GraalVM version (if different from Java) ### Quarkus version or git rev 2.0.0.FInal ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) ## Additional context This is trivial to fix, though not very clean without re-implementing `java.util.Properties#store()`. In `JarResultBuildStep` in the `quarkus-core-deployment` project, just pass `Properties#store()` an intermediary `StringWriter`, split up the resulting string by lines and output all the lines other than the second one into the file. In my current project, this is saving 150Mi of duplicated docker layers each time I push them to my repository.
919be8756a77d9438699cfd200ddb58d8d339039
7e50de02215082244b651d607ae82592341bd0ff
https://github.com/quarkusio/quarkus/compare/919be8756a77d9438699cfd200ddb58d8d339039...7e50de02215082244b651d607ae82592341bd0ff
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java b/core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java index 28b533153b4..297a94b3752 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java @@ -3,6 +3,7 @@ import static io.quarkus.deployment.pkg.steps.JarResultBuildStep.BUILD_SYSTEM_PROPERTIES; import static io.quarkus.deployment.pkg.steps.JarResultBuildStep.DEPLOYMENT_LIB; import static io.quarkus.deployment.pkg.steps.JarResultBuildStep.LIB; +import static io.quarkus.deployment.pkg.steps.JarResultBuildStep.QUARKUS; import java.io.Closeable; import java.io.IOException; @@ -42,7 +43,7 @@ public static Closeable main(Path appRoot) throws Exception { Files.newInputStream(appRoot.resolve(LIB).resolve(DEPLOYMENT_LIB).resolve(JarResultBuildStep.APPMODEL_DAT)))) { Properties buildSystemProperties = new Properties(); try (InputStream buildIn = Files - .newInputStream(appRoot.resolve(LIB).resolve(DEPLOYMENT_LIB).resolve(BUILD_SYSTEM_PROPERTIES))) { + .newInputStream(appRoot.resolve(QUARKUS).resolve(BUILD_SYSTEM_PROPERTIES))) { buildSystemProperties.load(buildIn); } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java b/core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java index fca86f6e985..426e711b0db 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java @@ -3,6 +3,7 @@ import static io.quarkus.deployment.pkg.steps.JarResultBuildStep.BUILD_SYSTEM_PROPERTIES; import static io.quarkus.deployment.pkg.steps.JarResultBuildStep.DEPLOYMENT_LIB; import static io.quarkus.deployment.pkg.steps.JarResultBuildStep.LIB; +import static io.quarkus.deployment.pkg.steps.JarResultBuildStep.QUARKUS; import java.io.InputStream; import java.io.ObjectInputStream; @@ -26,11 +27,12 @@ public class ReaugmentTask { public static void main(Path appRoot) throws Exception { Path deploymentLib = appRoot.resolve(LIB).resolve(DEPLOYMENT_LIB); + Path buildSystemProps = appRoot.resolve(QUARKUS).resolve(BUILD_SYSTEM_PROPERTIES); try (ObjectInputStream in = new ObjectInputStream( Files.newInputStream(deploymentLib.resolve(JarResultBuildStep.APPMODEL_DAT)))) { Properties buildSystemProperties = new Properties(); try (InputStream buildIn = Files - .newInputStream(deploymentLib.resolve(BUILD_SYSTEM_PROPERTIES))) { + .newInputStream(buildSystemProps)) { buildSystemProperties.load(buildIn); } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java index d9a75305c86..1850c6ab0f8 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java @@ -4,6 +4,7 @@ import java.io.BufferedInputStream; import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -11,6 +12,7 @@ import java.io.OutputStream; import java.io.UncheckedIOException; import java.net.URL; +import java.nio.charset.StandardCharsets; import java.nio.file.FileAlreadyExistsException; import java.nio.file.FileSystem; import java.nio.file.FileVisitOption; @@ -704,6 +706,7 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, if (packageConfig.type.equalsIgnoreCase(PackageConfig.MUTABLE_JAR)) { Path deploymentLib = libDir.resolve(DEPLOYMENT_LIB); + Path buildSystemProps = quarkus.resolve(BUILD_SYSTEM_PROPERTIES); Files.createDirectories(deploymentLib); for (AppDependency appDep : curateOutcomeBuildItem.getEffectiveModel().getFullDeploymentDeps()) { copyDependency(parentFirstKeys, outputTargetBuildItem, copiedArtifacts, deploymentLib, baseLib, jars, @@ -747,9 +750,17 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem, obj.writeObject(paths); obj.close(); } - Path buildSystemProps = deploymentLib.resolve(BUILD_SYSTEM_PROPERTIES); - try (OutputStream out = Files.newOutputStream(buildSystemProps)) { - outputTargetBuildItem.getBuildSystemProperties().store(out, "The original build properties"); + //we output the properties in a reproducible manner, so we remove the date comment + //and sort them + //we still use Properties to get the escaping right though, so basically we write out the lines + //to memory, split them, discard comments, sort them, then write them to disk + ByteArrayOutputStream out = new ByteArrayOutputStream(); + outputTargetBuildItem.getBuildSystemProperties().store(out, null); + List<String> lines = Arrays.stream(new String(out.toByteArray(), StandardCharsets.UTF_8).split("\\n")) + .filter(s -> !s.startsWith("#")).sorted().collect(Collectors.toList()); + + try (OutputStream fileOutput = Files.newOutputStream(buildSystemProps)) { + fileOutput.write(String.join("\\n", lines).getBytes(StandardCharsets.UTF_8)); } }
['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/mutability/DevModeTask.java', 'core/deployment/src/main/java/io/quarkus/deployment/mutability/ReaugmentTask.java']
{'.java': 3}
3
3
0
0
3
17,256,147
3,352,554
443,710
4,655
1,962
360
24
3
2,609
356
651
41
1
0
2021-07-07T00:44:53
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,714
quarkusio/quarkus/18470/18445
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18445
https://github.com/quarkusio/quarkus/pull/18470
https://github.com/quarkusio/quarkus/pull/18470
1
fixes
Quarkus Resteasy Reactive does not respect keep-alive when using Multi<>s
## Describe the bug Quarkus Resteasy Reactive kills connections even if Connection: keep-alive is specified and acknowledged by the server. The problem only occurs when returning Multi<>s, not when returning Uni<>s or synchronous results. A simple method such as ``` @GET public Multi<String> async(){ return Multi.createFrom().item("async"); } ``` and then calling `curl http://localhost:8080 http://localhost:8080 -v -H "Connection: keep-alive` reproduces the problem. ### Expected behavior Quarkus Resteasy Reactive should behave like non-reactive and keep the connection alive. ### Actual behavior The connection is dead after the first request. ## To Reproduce Small project based on the Quarkus Reactive quick-start. https://github.com/rasmusfaber/quarkus-resteasy-reactive-connection-drop Steps to reproduce the behavior: 1. Run the included tests and notice that `testHelloEndpointAsyncMulti` fails. Or 1. Build and start the application 2. Run `curl http://localhost:8081/hello/async http://localhost:8081/hello/async -v -H "Connection: keep-alive"` 3. Notice that the second connection fails and curl needs to create a new connection (compare with `curl http://localhost:8081/hello/sync http://localhost:8081/hello/sync -v -H "Connection: keep-alive"`) ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Linux xxx 5.4.0-73-generic #82~18.04.1-Ubuntu SMP Fri Apr 16 15:10:02 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` openjdk version "15.0.2" 2021-01-19 OpenJDK Runtime Environment AdoptOpenJDK (build 15.0.2+7) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 15.0.2+7, mixed mode, sharing) ### Quarkus version or git rev 2.0.0.Final (also 1.13.3.Final) ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) apache-maven-3.6.3
bd3cf79e20c1aba1b2c33baf7700bf29616e61bc
26a2506a58d330b5dd01e655f77071988931951f
https://github.com/quarkusio/quarkus/compare/bd3cf79e20c1aba1b2c33baf7700bf29616e61bc...26a2506a58d330b5dd01e655f77071988931951f
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/stream/StreamTestCase.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/stream/StreamTestCase.java index a4a20751170..ca3de29b2cb 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/stream/StreamTestCase.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/stream/StreamTestCase.java @@ -1,9 +1,11 @@ package io.quarkus.resteasy.reactive.server.test.stream; import java.net.URI; +import java.nio.charset.StandardCharsets; import java.time.Duration; import java.util.Arrays; import java.util.List; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -28,6 +30,12 @@ import io.restassured.RestAssured; import io.smallrye.mutiny.Multi; import io.smallrye.mutiny.subscription.Cancellable; +import io.vertx.core.Handler; +import io.vertx.core.Vertx; +import io.vertx.core.http.HttpClient; +import io.vertx.core.http.HttpClientOptions; +import io.vertx.core.http.HttpClientRequest; +import io.vertx.core.http.HttpMethod; @DisabledOnOs(OS.WINDOWS) public class StreamTestCase { @@ -40,6 +48,56 @@ public class StreamTestCase { .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) .addClasses(StreamResource.class)); + @Test + public void testStreamingDoesNotCloseConnection() throws Exception { + Vertx v = Vertx.vertx(); + try { + final CompletableFuture<Object> latch = new CompletableFuture<>(); + HttpClient client = v + .createHttpClient( + new HttpClientOptions().setKeepAlive(true).setIdleTimeout(10).setIdleTimeoutUnit(TimeUnit.SECONDS)); + sendRequest(latch, client, () -> sendRequest(latch, client, () -> latch.complete(null))); + + //should not have been closed + latch.get(); + + } finally { + v.close().toCompletionStage().toCompletableFuture().get(); + } + } + + private void sendRequest(CompletableFuture<Object> latch, HttpClient client, Runnable runnable) { + Handler<Throwable> failure = latch::completeExceptionally; + client.request(HttpMethod.GET, RestAssured.port, "localhost", "/stream/text/stream") + .onFailure(failure) + .onSuccess(new Handler<HttpClientRequest>() { + @Override + public void handle(HttpClientRequest event) { + event.end(); + event.connect().onFailure(failure) + .onSuccess(response -> { + response.request().connection().closeHandler(new Handler<Void>() { + @Override + public void handle(Void event) { + latch.completeExceptionally(new Throwable("Connection was closed")); + } + }); + response.body().onFailure(failure) + .onSuccess(buffer -> { + try { + Assertions.assertEquals("foobar", + buffer.toString(StandardCharsets.US_ASCII)); + } catch (Throwable t) { + latch.completeExceptionally(t); + } + runnable.run(); + }); + }); + + } + }); + } + @Test public void testStreaming() throws Exception { RestAssured.get("/stream/text/stream") diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/PublisherResponseHandler.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/PublisherResponseHandler.java index 0b30d2e2714..edb1625f17b 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/PublisherResponseHandler.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/PublisherResponseHandler.java @@ -135,10 +135,6 @@ public void onComplete() { // no need to cancel on complete // FIXME: are we interested in async completion? requestContext.serverResponse().end(); - // so, if I don't also close the connection, the client isn't notified that the request is over - // I guess that's true of chunked responses, but not clear why I need to close the connection - // because it means it can't get reused, right? - requestContext.serverRequest().closeConnection(); requestContext.close(); }
['extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/stream/StreamTestCase.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/handlers/PublisherResponseHandler.java']
{'.java': 2}
2
2
0
0
2
17,436,385
3,389,945
447,924
4,666
339
69
4
1
1,913
229
518
56
7
1
2021-07-06T23:46:02
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,715
quarkusio/quarkus/18458/18268
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18268
https://github.com/quarkusio/quarkus/pull/18458
https://github.com/quarkusio/quarkus/pull/18458
1
fixes
Hibernate Reactive: ReactiveSessionProducer blocks event loop thread
## Describe the bug Most likely since Quarkus 2.0.0.Alpha2 with the introduction of [these changes](https://github.com/quarkusio/quarkus/pull/16923), Hibernate Reactive can sometimes block the event loop thread forever if injecting `Mutiny.Session` via the `ReactiveSessionProducer`, making the entire application unresponsive. ### Expected behavior Hibernate Reactive should properly dispose its sessions without blocking. ### Actual behavior It is actually blocking the event loop thread. See the following thread dump from one of our applications. The thread remains in this state forever. As a consequence, the entire application cannot handle any incoming requests anymore. ``` "vert.x-eventloop-thread-1" #25 prio=5 os_prio=0 cpu=3312.11ms elapsed=815.13s tid=0x00007f778f573000 nid=0x2f waiting on condition [0x00007f772698d000] java.lang.Thread.State: WAITING (parking) at jdk.internal.misc.Unsafe.park([email protected]/Native Method) - parking to wait for <0x00000000ffadedf8> (a java.util.concurrent.CompletableFuture$Signaller) at java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:194) at java.util.concurrent.CompletableFuture$Signaller.block([email protected]/CompletableFuture.java:1796) at java.util.concurrent.ForkJoinPool.managedBlock([email protected]/ForkJoinPool.java:3128) at java.util.concurrent.CompletableFuture.waitingGet([email protected]/CompletableFuture.java:1823) at java.util.concurrent.CompletableFuture.join([email protected]/CompletableFuture.java:2043) at io.smallrye.context.CompletableFutureWrapper.join(CompletableFutureWrapper.java:166) at io.quarkus.hibernate.reactive.runtime.ReactiveSessionProducer.disposeMutinySession(ReactiveSessionProducer.java:54) at io.quarkus.hibernate.reactive.runtime.ReactiveSessionProducer_ProducerMethod_createMutinySession_1321d110ee9e92bda147899150401e0a136779c7_Bean.destroy(ReactiveSessionProducer_ProducerMethod_createMutinySession_1321d110ee9e92bda147899150401e0a136779c7_Bean.zig:180) at io.quarkus.hibernate.reactive.runtime.ReactiveSessionProducer_ProducerMethod_createMutinySession_1321d110ee9e92bda147899150401e0a136779c7_Bean.destroy(ReactiveSessionProducer_ProducerMethod_createMutinySession_1321d110ee9e92bda147899150401e0a136779c7_Bean.zig:212) at io.quarkus.arc.impl.InstanceHandleImpl.destroyInternal(InstanceHandleImpl.java:90) at io.quarkus.arc.impl.ContextInstanceHandleImpl.destroy(ContextInstanceHandleImpl.java:20) at io.quarkus.arc.impl.RequestContext.destroyContextElement(RequestContext.java:184) at io.quarkus.arc.impl.RequestContext$$Lambda$538/0x0000000100730c40.accept(Unknown Source) at java.util.concurrent.ConcurrentHashMap.forEach([email protected]/ConcurrentHashMap.java:1603) at io.quarkus.arc.impl.RequestContext.destroy(RequestContext.java:170) - locked <0x00000000ffa55538> (a java.util.concurrent.ConcurrentHashMap) at io.quarkus.arc.impl.RequestContext.destroy(RequestContext.java:154) at io.quarkus.resteasy.reactive.common.runtime.ArcThreadSetupAction$1.close(ArcThreadSetupAction.java:27) at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.close(AbstractResteasyReactiveContext.java:101) at org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext.close(ResteasyReactiveRequestContext.java:358) at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:182) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run([email protected]/Thread.java:829) ``` ## To Reproduce Haven't yet been able to create a reproducer, but most likely happens when some failure happens in a reactive chain where HR was previously used (not necessarily in Hibernate itself). ### Configuration ```properties # Add your application.properties here, if applicable. ``` ### Screenshots (If applicable, add screenshots to help explain your problem.) ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Microsoft Windows [Version 10.0.18363.1556] ### Output of `java -version` OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode) ### GraalVM version (if different from Java) N/A ### Quarkus version or git rev 2.0.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.6.3 ## Additional context (Add any other context about the problem here.)
7b334561acaa30e26a4cb33ae2055b95da84919d
3e1e0a1ee1eafc5d6f3d1465de1641497be72438
https://github.com/quarkusio/quarkus/compare/7b334561acaa30e26a4cb33ae2055b95da84919d...3e1e0a1ee1eafc5d6f3d1465de1641497be72438
diff --git a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java index ead36fc3330..804aa5ae6e8 100644 --- a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java +++ b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java @@ -1,5 +1,7 @@ package io.quarkus.hibernate.reactive.runtime; +import java.util.concurrent.CompletableFuture; + import javax.enterprise.context.RequestScoped; import javax.enterprise.inject.Disposes; import javax.enterprise.inject.Produces; @@ -23,13 +25,23 @@ public Mutiny.Session createMutinySession() { public void disposeMutinySession(@Disposes Mutiny.Session reactiveSession) { if (reactiveSession != null) { - //We're ignoring the returned CompletionStage! - //This could certainly done better but it should be effective enough to - //eventually close the session: the connection pool will order the operations - //as it won't be able to return connections to other consumers when it's saturated, - //ensuring close operations are handled. - //N.B. for the Mutiny API we need to make sure to subscribe - reactiveSession.close().subscribe().asCompletionStage().join(); + //N.B. make sure to subscribe as this is a Mutiny based Session: + // operations don't happen at all if there is no subscription. + final CompletableFuture<Void> closeOperation = reactiveSession.close() + .subscribe() + .asCompletionStage(); + if (!io.vertx.core.Context.isOnVertxThread()) { + //When invoked from blocking code, behave as expected and block on the operation + //so to not starve resources with a deferred close. + closeOperation.join(); + } + // [else] no need to block. Worst that can happen is that the opening + // of a new Mutiny.Session needs to wait for an available connection, + // which implicitly orders it as "downstream" from the previous close + // to have actually happened as the connection pool is reactive. + // Also, if connections are available there is no real need to wait for + // it, so this should be good. } } + }
['extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java']
{'.java': 1}
1
1
0
0
1
17,225,705
3,346,623
443,031
4,649
1,642
303
26
1
5,080
303
1,305
78
1
2
2021-07-06T15:33:41
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,716
quarkusio/quarkus/18415/18374
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18374
https://github.com/quarkusio/quarkus/pull/18415
https://github.com/quarkusio/quarkus/pull/18415
1
fixes
Quarkus OIDC Client unable to retrieve access-token
## Describe the bug I am using quarkus-oidc-client extension to obtain token. The idea is to send client-id, client-secret and grant-type to OpenID connect provider to obtain access token. I am referring to this doc @ https://quarkus.io/guides/security-openid-connect-client I am using annotation "@OidcClientFilter" on a resource annotated using "@RegisterRestClient". The OidcClient is not able to retrieve access-token as it sends only grant_type=client_credentials to the OAuth server. I have configured the extension with following configuration ``` quarkus.oidc-client.auth-server-url=https://openid-provider.org quarkus.oidc-client.discovery-enabled=false quarkus.oidc-client.token-path=/token quarkus.oidc-client.client-id=rf3ScIceRGbm8IShjMUDUY67INhJEGRb quarkus.oidc-client.credentials.secret=************ #quarkus.oidc.authentication.scopes=EMAIL ``` ### Expected behavior OidcClient should sent HTTP post request with form having parameters "client_id", "client_secret", "grant_type" and "scopes". The response should be a HTTP 200 from OAuth server as following: { "access_token": "", "token_type": "", "expires_in": "", "issued_at": "" } Please refer to OAuth2 token response @ https://developer.okta.com/docs/reference/api/oidc/#request-example ### Actual behavior As OidcClient is NOT sending client_id and client_secret, OAuth server is returning following error: Caused by: io.quarkus.oidc.client.OidcClientException: { "error":"invalid_client", "error_description":"missing or invalid client_id or client_secret" } ## To Reproduce Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific). Or attach an archive containing the reproducer to the issue. Steps to reproduce the behavior: 1. 2. 3. ### Configuration ```properties # Add your application.properties here, if applicable. quarkus.oidc-client.auth-server-url=https://openid-provider.org quarkus.oidc-client.discovery-enabled=false quarkus.oidc-client.token-path=/token quarkus.oidc-client.client-id=rf3ScIceRGbm8IShjMUDUY67INhJEGRb quarkus.oidc-client.credentials.secret=************ quarkus.oidc.authentication.scopes=EMAIL ``` ### Screenshots (If applicable, add screenshots to help explain your problem.) ## Environment (please complete the following information): Ubuntu 18 LTS ### Output of `uname -a` or `ver` Linux inggou18 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` openjdk version "11.0.7" 2020-04-14 OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02) OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing) ### GraalVM version (if different from Java) ### Quarkus version or git rev 1.13.7 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Maven 3.6.6 ## Additional context (Add any other context about the problem here.)
142da1e8ec0371bc00a5aaeea3df644310a12065
d233b01d6145b034cbfe316aa050f26122ecf9d4
https://github.com/quarkusio/quarkus/compare/142da1e8ec0371bc00a5aaeea3df644310a12065...d233b01d6145b034cbfe316aa050f26122ecf9d4
diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java index de8fa0f2ec8..63bf8b98052 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java @@ -120,9 +120,11 @@ private Tokens emitGrantTokens(HttpResponse<Buffer> resp, boolean refresh) { JsonObject json = resp.bodyAsJsonObject(); final String accessToken = json.getString(oidcConfig.grant.accessTokenProperty); final String refreshToken = json.getString(oidcConfig.grant.refreshTokenProperty); + final Object expiresInValue = json.getValue(oidcConfig.grant.expiresInProperty); Long accessTokenExpiresAt; - Long accessTokenExpiresIn = json.getLong(oidcConfig.grant.expiresInProperty); - if (accessTokenExpiresIn != null) { + if (expiresInValue != null) { + long accessTokenExpiresIn = expiresInValue instanceof Number ? ((Number) expiresInValue).longValue() + : Long.parseLong(expiresInValue.toString()); accessTokenExpiresAt = Instant.now().getEpochSecond() + accessTokenExpiresIn; } else { accessTokenExpiresAt = getExpiresJwtClaim(accessToken); diff --git a/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java b/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java index d239dc5ef7b..a8aef8f8c2f 100644 --- a/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java +++ b/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java @@ -41,7 +41,7 @@ public Map<String, String> start() { .aResponse() .withHeader("Content-Type", MediaType.APPLICATION_JSON) .withBody( - "{\\"accessToken\\":\\"access_token_n\\", \\"expiresIn\\":4, \\"refreshToken\\":\\"refresh_token_n\\"}"))); + "{\\"accessToken\\":\\"access_token_n\\", \\"expiresIn\\":\\"4\\", \\"refreshToken\\":\\"refresh_token_n\\"}"))); server.stubFor(WireMock.post("/tokens") .withRequestBody(matching("grant_type=refresh_token&refresh_token=refresh_token_1"))
['extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java', 'integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java']
{'.java': 2}
2
2
0
0
2
17,198,460
3,341,645
442,339
4,642
464
86
6
1
3,104
321
822
84
4
2
2021-07-05T13:30:56
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,717
quarkusio/quarkus/18403/18349
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18349
https://github.com/quarkusio/quarkus/pull/18403
https://github.com/quarkusio/quarkus/pull/18403
1
fix
SmallRye GraphQL Client not working in native
`microprofile-graphql-client-quickstart` is failing in native with the following error. Apart from the fact that it needs fixing, I'm very surprised we use Jersey? Shouldn't we use one of our REST Clients? ``` Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder at javax.ws.rs.client.ClientBuilder.newBuilder(ClientBuilder.java:102) at javax.ws.rs.client.ClientBuilder.newClient(ClientBuilder.java:113) at io.smallrye.graphql.client.typesafe.jaxrs.JaxRsTypesafeGraphQLClientBuilder.client(JaxRsTypesafeGraphQLClientBuilder.java:36) at io.smallrye.graphql.client.typesafe.jaxrs.JaxRsTypesafeGraphQLClientBuilder.build(JaxRsTypesafeGraphQLClientBuilder.java:60) at io.quarkus.smallrye.graphql.client.runtime.SmallRyeGraphQLClientRecorder.lambda$typesafeClientSupplier$0(SmallRyeGraphQLClientRecorder.java:15) at ```
edd218989e40e366bfced10c81d01699d696b5d4
fcef6e7aaeba0da5a58529e7115dd41cf2d350c3
https://github.com/quarkusio/quarkus/compare/edd218989e40e366bfced10c81d01699d696b5d4...fcef6e7aaeba0da5a58529e7115dd41cf2d350c3
diff --git a/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java b/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java index 92f0035c407..aef49426390 100644 --- a/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java +++ b/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java @@ -28,6 +28,7 @@ import javax.ws.rs.ProcessingException; import javax.ws.rs.RuntimeType; import javax.ws.rs.client.AsyncInvoker; +import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.CompletionStageRxInvoker; import javax.ws.rs.client.Entity; import javax.ws.rs.client.Invocation; @@ -53,6 +54,7 @@ import org.jboss.logging.Logger; import org.jboss.resteasy.reactive.client.handlers.ClientObservabilityHandler; import org.jboss.resteasy.reactive.client.impl.AsyncInvokerImpl; +import org.jboss.resteasy.reactive.client.impl.ClientBuilderImpl; import org.jboss.resteasy.reactive.client.impl.ClientImpl; import org.jboss.resteasy.reactive.client.impl.UniInvoker; import org.jboss.resteasy.reactive.client.impl.WebTargetImpl; @@ -158,6 +160,10 @@ void addFeature(BuildProducer<FeatureBuildItem> features) { void registerClientResponseBuilder(BuildProducer<ServiceProviderBuildItem> serviceProviders) { serviceProviders.produce(new ServiceProviderBuildItem(ResponseBuilderFactory.class.getName(), ClientResponseBuilderFactory.class.getName())); + + serviceProviders.produce(new ServiceProviderBuildItem(ClientBuilder.class.getName(), + ClientBuilderImpl.class.getName())); + } @BuildStep
['extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java']
{'.java': 1}
1
1
0
0
1
17,198,404
3,341,646
442,330
4,642
260
44
6
1
904
49
216
13
0
1
2021-07-05T10:16:10
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,719
quarkusio/quarkus/18379/18018
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18018
https://github.com/quarkusio/quarkus/pull/18379
https://github.com/quarkusio/quarkus/pull/18379
1
fixes
KafkaStreams UncaughtExceptionHandler can only be set before starting the stream
## Describe the bug It is not possible to use KafkaStreams#setUncaughtExceptionHandler on the injected `KafkaStreams` instance because it is already started by the `KafkaStreamsProducer` managed by kafka-streams Quarkus extension. ### Expected behavior The kafka-streams extension calls setUncaughtExceptionHandler with an instance of `StreamsUncaughtExceptionHandler` discovered in the application the before the start, much like StateListener and StateRestoreListener Reported by @andrerigon
c377d1c517666be1eb5ff485771b83df4a34ddee
2cdafc2f3ead84ed4618f4e9a052c80c4049cc7b
https://github.com/quarkusio/quarkus/compare/c377d1c517666be1eb5ff485771b83df4a34ddee...2cdafc2f3ead84ed4618f4e9a052c80c4049cc7b
diff --git a/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java b/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java index 408fa5d0957..93ca55cbb33 100644 --- a/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java +++ b/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java @@ -39,6 +39,7 @@ import org.apache.kafka.streams.KafkaStreams.StateListener; import org.apache.kafka.streams.StreamsConfig; import org.apache.kafka.streams.Topology; +import org.apache.kafka.streams.errors.StreamsUncaughtExceptionHandler; import org.apache.kafka.streams.processor.StateRestoreListener; import org.eclipse.microprofile.config.ConfigProvider; import org.jboss.logging.Logger; @@ -73,7 +74,8 @@ public class KafkaStreamsProducer { public KafkaStreamsProducer(KafkaStreamsSupport kafkaStreamsSupport, KafkaStreamsRuntimeConfig runtimeConfig, Instance<Topology> topology, Instance<KafkaClientSupplier> kafkaClientSupplier, @Identifier("default-kafka-broker") Instance<Map<String, Object>> defaultConfiguration, - Instance<StateListener> stateListener, Instance<StateRestoreListener> globalStateRestoreListener) { + Instance<StateListener> stateListener, Instance<StateRestoreListener> globalStateRestoreListener, + Instance<StreamsUncaughtExceptionHandler> uncaughtExceptionHandlerListener) { shutdown = false; // No producer for Topology -> nothing to do if (topology.isUnsatisfied()) { @@ -104,7 +106,8 @@ public KafkaStreamsProducer(KafkaStreamsSupport kafkaStreamsSupport, KafkaStream this.executorService = Executors.newSingleThreadExecutor(); this.kafkaStreams = initializeKafkaStreams(kafkaStreamsProperties, runtimeConfig, kafkaAdminClient, topology.get(), - kafkaClientSupplier, stateListener, globalStateRestoreListener, executorService); + kafkaClientSupplier, stateListener, globalStateRestoreListener, uncaughtExceptionHandlerListener, + executorService); this.kafkaStreamsTopologyManager = new KafkaStreamsTopologyManager(kafkaAdminClient); } @@ -149,7 +152,7 @@ private static KafkaStreams initializeKafkaStreams(Properties kafkaStreamsProper KafkaStreamsRuntimeConfig runtimeConfig, Admin adminClient, Topology topology, Instance<KafkaClientSupplier> kafkaClientSupplier, Instance<StateListener> stateListener, Instance<StateRestoreListener> globalStateRestoreListener, - ExecutorService executorService) { + Instance<StreamsUncaughtExceptionHandler> uncaughtExceptionHandlerListener, ExecutorService executorService) { KafkaStreams kafkaStreams; if (kafkaClientSupplier.isUnsatisfied()) { kafkaStreams = new KafkaStreams(topology, kafkaStreamsProperties); @@ -163,6 +166,9 @@ private static KafkaStreams initializeKafkaStreams(Properties kafkaStreamsProper if (!globalStateRestoreListener.isUnsatisfied()) { kafkaStreams.setGlobalStateRestoreListener(globalStateRestoreListener.get()); } + if (!uncaughtExceptionHandlerListener.isUnsatisfied()) { + kafkaStreams.setUncaughtExceptionHandler(uncaughtExceptionHandlerListener.get()); + } executorService.execute(new Runnable() {
['extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java']
{'.java': 1}
1
1
0
0
1
17,197,441
3,341,397
442,298
4,641
980
156
12
1
503
58
100
8
0
0
2021-07-03T19:16:21
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,721
quarkusio/quarkus/18332/18330
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18330
https://github.com/quarkusio/quarkus/pull/18332
https://github.com/quarkusio/quarkus/pull/18332
1
fixes
Continuous Testing not using updated log level
## Describe the bug Quarkus 2.0.0.Final Continous Testing not applying an updated log level changed in application.properties ### Expected behavior Log level does not change. When app started with default (INFO), and then quarkus.log.level is updated to a higher log level (like TRACE or DEBUG), the logs should include the appropriate logging statements. ### Actual behavior Logging continues to log at INFO log level. ## To Reproduce 1. Clone the [reproducer git repo](https://github.com/jclingan/continuous_testing_logging). 2. `mvn quarkus:dev` 3. Press 'r' to run tests 4. Press 'o' to enable output 5. Press 'r' to run tests again. Should see: ``` FATAL [org.acm.LoggingResource] ***** JBossLogManagerLogger: FATAL ***** ERROR [org.acm.LoggingResource] ***** JBossLogManagerLogger: ERROR ***** WARN [org.acm.LoggingResource] ***** JBossLogManagerLogger: WARN ***** INFO [org.acm.LoggingResource] ***** JBossLogManagerLogger: INFO ***** INFO [io.quarkus] greeting stopped in 0.009s ``` 6. In application.properties, update quarkus.log.level to TRACE. 7. Test will automatically run, and display above text reflecting the log level is still INFO.
4340f64063b9bed8f8e1545034b3342d4921b989
cfbd8f9eeb15ce5de6b0c5c17a30899e87498661
https://github.com/quarkusio/quarkus/compare/4340f64063b9bed8f8e1545034b3342d4921b989...cfbd8f9eeb15ce5de6b0c5c17a30899e87498661
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java index edb9880e8f1..0937a796c36 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java @@ -60,6 +60,7 @@ public class QuarkusAugmentor { private final Consumer<ConfigBuilder> configCustomizer; private final boolean rebuild; private final boolean auxiliaryApplication; + private final Optional<DevModeType> auxiliaryDevModeType; QuarkusAugmentor(Builder builder) { this.classLoader = builder.classLoader; @@ -79,6 +80,7 @@ public class QuarkusAugmentor { this.rebuild = builder.rebuild; this.devModeType = builder.devModeType; this.auxiliaryApplication = builder.auxiliaryApplication; + this.auxiliaryDevModeType = Optional.ofNullable(builder.auxiliaryDevModeType); } public BuildResult run() throws Exception { @@ -143,7 +145,8 @@ public BuildResult run() throws Exception { .produce(new ShutdownContextBuildItem()) .produce(new RawCommandLineArgumentsBuildItem()) .produce(new LaunchModeBuildItem(launchMode, - devModeType == null ? Optional.empty() : Optional.of(devModeType), auxiliaryApplication)) + devModeType == null ? Optional.empty() : Optional.of(devModeType), auxiliaryApplication, + auxiliaryDevModeType)) .produce(new BuildSystemTargetBuildItem(targetDir, baseName, rebuild, buildSystemProperties == null ? new Properties() : buildSystemProperties)) .produce(new AppModelProviderBuildItem(effectiveModel)); @@ -180,6 +183,7 @@ public static Builder builder() { public static final class Builder { + public DevModeType auxiliaryDevModeType; boolean rebuild; List<PathsCollection> additionalApplicationArchives = new ArrayList<>(); Collection<Path> excludedFromIndexing = Collections.emptySet(); @@ -223,6 +227,11 @@ public Builder setAuxiliaryApplication(boolean auxiliaryApplication) { return this; } + public Builder setAuxiliaryDevModeType(DevModeType auxiliaryDevModeType) { + this.auxiliaryDevModeType = auxiliaryDevModeType; + return this; + } + public LaunchMode getLaunchMode() { return launchMode; } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java index b4e39029e80..917d62c1384 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java @@ -16,11 +16,14 @@ public final class LaunchModeBuildItem extends SimpleBuildItem { private final Optional<DevModeType> devModeType; private final boolean auxiliaryApplication; + private final Optional<DevModeType> auxiliaryDevModeType; - public LaunchModeBuildItem(LaunchMode launchMode, Optional<DevModeType> devModeType, boolean auxiliaryApplication) { + public LaunchModeBuildItem(LaunchMode launchMode, Optional<DevModeType> devModeType, boolean auxiliaryApplication, + Optional<DevModeType> auxiliaryDevModeType) { this.launchMode = launchMode; this.devModeType = devModeType; this.auxiliaryApplication = auxiliaryApplication; + this.auxiliaryDevModeType = auxiliaryDevModeType; } public LaunchMode getLaunchMode() { @@ -46,4 +49,12 @@ public Optional<DevModeType> getDevModeType() { public boolean isAuxiliaryApplication() { return auxiliaryApplication; } + + /** + * The dev mode type of the main application. + * + */ + public Optional<DevModeType> getAuxiliaryDevModeType() { + return auxiliaryDevModeType; + } } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java index 3faf23f9ce4..c57713a7d9b 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java @@ -278,7 +278,7 @@ private RuntimeUpdatesProcessor setupRuntimeCompilation(DevModeContext context, QuarkusCompiler compiler = new QuarkusCompiler(curatedApplication, compilationProviders, context); TestSupport testSupport = null; if (devModeType == DevModeType.LOCAL && context.getApplicationRoot().getTest().isPresent()) { - testSupport = new TestSupport(curatedApplication, compilationProviders, context); + testSupport = new TestSupport(curatedApplication, compilationProviders, context, devModeType); } RuntimeUpdatesProcessor processor = new RuntimeUpdatesProcessor(appRoot, context, compiler, diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java index 5c6b2ecfcfb..d41a827ab7c 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java @@ -56,7 +56,7 @@ private RuntimeUpdatesProcessor setupRuntimeCompilation(DevModeContext context, } catch (Exception e) { throw new RuntimeException("Failed to create compiler", e); } - TestSupport testSupport = new TestSupport(curatedApplication, compilationProviders, context); + TestSupport testSupport = new TestSupport(curatedApplication, compilationProviders, context, DevModeType.TEST_ONLY); RuntimeUpdatesProcessor processor = new RuntimeUpdatesProcessor(applicationRoot, context, compiler, DevModeType.TEST_ONLY, this::regenerateApplication, new BiConsumer<DevModeContext.ModuleInfo, String>() { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java index 436150fe1b9..4f85ae678fa 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java @@ -19,6 +19,7 @@ import io.quarkus.deployment.dev.DevModeContext; import io.quarkus.deployment.dev.QuarkusCompiler; import io.quarkus.deployment.dev.RuntimeUpdatesProcessor; +import io.quarkus.dev.spi.DevModeType; public class TestSupport implements TestController { @@ -29,6 +30,7 @@ public class TestSupport implements TestController { final DevModeContext context; final List<TestListener> testListeners = new CopyOnWriteArrayList<>(); final TestState testState = new TestState(); + final DevModeType devModeType; volatile CuratedApplication testCuratedApplication; volatile QuarkusCompiler compiler; @@ -45,10 +47,11 @@ public class TestSupport implements TestController { volatile TestType testType = TestType.ALL; public TestSupport(CuratedApplication curatedApplication, List<CompilationProvider> compilationProviders, - DevModeContext context) { + DevModeContext context, DevModeType devModeType) { this.curatedApplication = curatedApplication; this.compilationProviders = compilationProviders; this.context = context; + this.devModeType = devModeType; } public static Optional<TestSupport> instance() { @@ -128,6 +131,7 @@ public void init() { .setBaseClassLoader(getClass().getClassLoader()) .setTest(true) .setAuxiliaryApplication(true) + .setHostApplicationIsTestOnly(devModeType == DevModeType.TEST_ONLY) .setApplicationRoot(PathsCollection.from(paths)) .build() .bootstrap(); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java b/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java index 07f9a21f9ce..c5e18a7f8f9 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java @@ -27,6 +27,7 @@ import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem; import io.quarkus.deployment.pkg.builditem.NativeImageBuildItem; import io.quarkus.deployment.pkg.builditem.ProcessInheritIODisabled; +import io.quarkus.dev.spi.DevModeType; import io.quarkus.runtime.LaunchMode; public class JBangAugmentorImpl implements BiConsumer<CuratedApplication, Map<String, Object>> { @@ -49,7 +50,11 @@ public void accept(CuratedApplication curatedApplication, Map<String, Object> re builder.setBaseName(quarkusBootstrap.getBaseName()); } - builder.setAuxiliaryApplication(curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication()); + boolean auxiliaryApplication = curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication(); + builder.setAuxiliaryApplication(auxiliaryApplication); + builder.setAuxiliaryDevModeType( + curatedApplication.getQuarkusBootstrap().isHostApplicationIsTestOnly() ? DevModeType.TEST_ONLY + : (auxiliaryApplication ? DevModeType.LOCAL : null)); builder.setLaunchMode(LaunchMode.NORMAL); builder.setRebuild(quarkusBootstrap.isRebuild()); builder.setLiveReloadState( diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java index adbdc7aeb64..b386c6b6ade 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java @@ -36,6 +36,7 @@ import io.quarkus.deployment.metrics.MetricsCapabilityBuildItem; import io.quarkus.deployment.metrics.MetricsFactoryConsumerBuildItem; import io.quarkus.deployment.pkg.steps.NativeOrNativeSourcesBuild; +import io.quarkus.dev.spi.DevModeType; import io.quarkus.gizmo.AnnotationCreator; import io.quarkus.gizmo.BranchResult; import io.quarkus.gizmo.BytecodeCreator; @@ -132,7 +133,8 @@ LoggingSetupBuildItem setupLoggingRuntimeInit(LoggingSetupRecorder recorder, Log Optional<ConsoleFormatterBannerBuildItem> possibleBannerBuildItem, LaunchModeBuildItem launchModeBuildItem, List<LogCleanupFilterBuildItem> logCleanupFilters) { - if (!launchModeBuildItem.isAuxiliaryApplication()) { + if (!launchModeBuildItem.isAuxiliaryApplication() + || launchModeBuildItem.getAuxiliaryDevModeType().orElse(null) == DevModeType.TEST_ONLY) { final List<RuntimeValue<Optional<Handler>>> handlers = handlerBuildItems.stream() .map(LogHandlerBuildItem::getHandlerValue) .collect(Collectors.toList()); diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java index c4c6ce571e4..61712cc6096 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java +++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java @@ -326,10 +326,14 @@ public BuildResult runCustomAction(Consumer<BuildChainBuilder> chainBuild, Consu BuildChain chain = chainBuilder .build(); + boolean auxiliaryApplication = curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication(); BuildExecutionBuilder execBuilder = chain.createExecutionBuilder("main") .produce(new LaunchModeBuildItem(launchMode, devModeType == null ? Optional.empty() : Optional.of(devModeType), - curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication())) + auxiliaryApplication, + Optional.ofNullable(curatedApplication.getQuarkusBootstrap().isHostApplicationIsTestOnly() + ? DevModeType.TEST_ONLY + : (auxiliaryApplication ? DevModeType.LOCAL : null)))) .produce(new ShutdownContextBuildItem()) .produce(new RawCommandLineArgumentsBuildItem()) .produce(new LiveReloadBuildItem()); @@ -373,7 +377,11 @@ private BuildResult runAugment(boolean firstRun, Set<String> changedResources, builder.setBaseName(quarkusBootstrap.getBaseName()); } - builder.setAuxiliaryApplication(curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication()); + boolean auxiliaryApplication = curatedApplication.getQuarkusBootstrap().isAuxiliaryApplication(); + builder.setAuxiliaryApplication(auxiliaryApplication); + builder.setAuxiliaryDevModeType( + curatedApplication.getQuarkusBootstrap().isHostApplicationIsTestOnly() ? DevModeType.TEST_ONLY + : (auxiliaryApplication ? DevModeType.LOCAL : null)); builder.setLaunchMode(launchMode); builder.setDevModeType(devModeType); builder.setRebuild(quarkusBootstrap.isRebuild()); diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java index 76ea85a96be..13688fa8f34 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java @@ -90,6 +90,7 @@ public class QuarkusBootstrap implements Serializable { private final Set<AppArtifactKey> localArtifacts; private final List<ClassLoaderEventListener> classLoadListeners; private final boolean auxiliaryApplication; + private final boolean hostApplicationIsTestOnly; private final boolean flatClassPath; private final ConfiguredClassLoading classLoadingConfig; @@ -124,6 +125,7 @@ private QuarkusBootstrap(Builder builder, ConfiguredClassLoading classLoadingCon this.auxiliaryApplication = builder.auxiliaryApplication; this.flatClassPath = builder.flatClassPath; this.classLoadingConfig = classLoadingConfig; + this.hostApplicationIsTestOnly = builder.hostApplicationIsTestOnly; } public CuratedApplication bootstrap() throws BootstrapException { @@ -248,6 +250,10 @@ public boolean isAuxiliaryApplication() { return auxiliaryApplication; } + public boolean isHostApplicationIsTestOnly() { + return hostApplicationIsTestOnly; + } + public static Builder builder() { return new Builder(); } @@ -323,6 +329,7 @@ public boolean isFlatClassPath() { public static class Builder { public List<ClassLoaderEventListener> classLoadListeners = new ArrayList<>(); + public boolean hostApplicationIsTestOnly; boolean flatClassPath; boolean rebuild; PathsCollection applicationRoot; @@ -421,6 +428,11 @@ public Builder setMode(Mode mode) { return this; } + public Builder setHostApplicationIsTestOnly(boolean hostApplicationIsTestOnly) { + this.hostApplicationIsTestOnly = hostApplicationIsTestOnly; + return this; + } + public Builder setAuxiliaryApplication(boolean auxiliaryApplication) { this.auxiliaryApplication = auxiliaryApplication; return this;
['core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedTestModeMain.java', 'core/deployment/src/main/java/io/quarkus/runner/bootstrap/AugmentActionImpl.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/LaunchModeBuildItem.java', 'core/deployment/src/main/java/io/quarkus/deployment/jbang/JBangAugmentorImpl.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/QuarkusBootstrap.java', 'core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java']
{'.java': 9}
9
9
0
0
9
17,166,189
3,334,989
441,552
4,634
4,415
845
69
9
1,185
152
294
27
1
1
2021-07-02T02:29:03
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,722
quarkusio/quarkus/18291/18290
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18290
https://github.com/quarkusio/quarkus/pull/18291
https://github.com/quarkusio/quarkus/pull/18291
1
fixes
Continuous testing test count index off by 1
NOTE: Quarkus 2.0.0.Final ## Describe the bug When a test class has more than one test, the test count starts with a zero instead of 1, making it feel as if not all tests are run. For example, it feels ike only 2 of 3 tests are run and 3/3 will never be reached: ``` 2021-06-30 20:20:22,574 INFO [io.qua.test] (Test runner thread) Running 0/3. Running: org.acme.GreetingResourceTest#testRandomEndpoint() 2021-06-30 20:20:22,585 INFO [io.qua.test] (Test runner thread) Running 1/3. Running: org.acme.GreetingResourceTest#testListGreetingsEndpoint() 2021-06-30 20:20:22,624 INFO [io.qua.test] (Test runner thread) Running 2/3. Running: org.acme.GreetingResourceTest#testHelloEndpoint() ``` ### Expected behavior The output should look like the following, with 1/3, 2/3, and 3/3; ``` 2021-06-30 20:20:22,574 INFO [io.qua.test] (Test runner thread) Running 1/3. Running: org.acme.GreetingResourceTest#testRandomEndpoint() 2021-06-30 20:20:22,585 INFO [io.qua.test] (Test runner thread) Running 2/3. Running: org.acme.GreetingResourceTest#testListGreetingsEndpoint() 2021-06-30 20:20:22,624 INFO [io.qua.test] (Test runner thread) Running 3/3. Running: org.acme.GreetingResourceTest#testHelloEndpoint() ``` ## To Reproduce [Clone reproducer](https://github.com/jclingan/continuous_testing_counter_reproducer), run `mvn quarkus:dev`, then: 1. Press 'r' to resume and run all tests 2. Press 'o' to enable test output 3. Press 'r' to re-run all tests and see above output
c364ea4e28149eff4c5ba9c73c3b5130b8d83fa8
6731d59c245b30881e589571f3771e983f8ff70d
https://github.com/quarkusio/quarkus/compare/c364ea4e28149eff4c5ba9c73c3b5130b8d83fa8...6731d59c245b30881e589571f3771e983f8ff70d
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java index dc1cae84831..e510c360010 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java @@ -210,7 +210,7 @@ public void testRunStarted(Consumer<TestRunListener> listenerConsumer) { @Override public void runStarted(long toRun) { totalNoTests.set(toRun); - promptHandler.setStatus("Running 0/" + toRun + "."); + promptHandler.setStatus("Starting test run, " + toRun + " tests to run."); } @Override @@ -310,7 +310,7 @@ public void runAborted() { @Override public void testStarted(TestIdentifier testIdentifier, String className) { - String status = "Running " + methodCount.get() + "/" + totalNoTests + String status = "Running " + (methodCount.get() + 1) + "/" + totalNoTests + (failureCount.get() == 0 ? "." : ". " + failureCount + " " + pluralize("failure", "failures", failureCount) + " so far.") + " Running: "
['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java']
{'.java': 1}
1
1
0
0
1
17,127,989
3,327,421
440,551
4,625
337
77
4
1
1,499
175
476
25
1
2
2021-07-01T03:56:11
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,723
quarkusio/quarkus/18262/14812
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/14812
https://github.com/quarkusio/quarkus/pull/18262
https://github.com/quarkusio/quarkus/pull/18262
1
fixes
Hibernate Reactive with Stage API throws ContextNotActiveException on flush
**Describe the bug** The code below throws a `ContextNotActiveException` (see also reproducer below). Switching to the Mutiny API makes the problem disappear. ```java @Inject Stage.Session session; @Test @ActivateRequestContext public void test() { DefaultEntity entity = new DefaultEntity("default"); DefaultEntity retrievedEntity = session.withTransaction(tx -> session.persist(entity)) .thenCompose($ -> session.withTransaction(tx -> session.clear().find(DefaultEntity.class, entity.getId()))) .toCompletableFuture().join(); assertThat(retrievedEntity) .isNotSameAs(entity) .returns(entity.getName(), DefaultEntity::getName); } ``` Stack trace: ``` java.util.concurrent.CompletionException: javax.enterprise.context.ContextNotActiveException at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1081) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506) at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073) at org.hibernate.reactive.pool.impl.Handlers.lambda$toCompletionStage$0(Handlers.java:26) at io.vertx.sqlclient.impl.SqlResultHandler.complete(SqlResultHandler.java:98) at io.vertx.sqlclient.impl.SqlResultHandler.handle(SqlResultHandler.java:87) at io.vertx.sqlclient.impl.SqlResultHandler.handle(SqlResultHandler.java:33) at io.vertx.sqlclient.impl.SocketConnectionBase.handleMessage(SocketConnectionBase.java:241) at io.vertx.sqlclient.impl.SocketConnectionBase.lambda$init$0(SocketConnectionBase.java:88) at io.vertx.core.net.impl.NetSocketImpl.lambda$new$2(NetSocketImpl.java:101) at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:237) at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:127) at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:357) at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366) at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43) at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:229) at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:163) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436) at io.vertx.pgclient.impl.codec.PgEncoder.lambda$write$0(PgEncoder.java:78) at io.vertx.pgclient.impl.codec.PgCommandCodec.handleReadyForQuery(PgCommandCodec.java:138) at io.vertx.pgclient.impl.codec.PgDecoder.decodeReadyForQuery(PgDecoder.java:226) at io.vertx.pgclient.impl.codec.PgDecoder.channelRead(PgDecoder.java:86) at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: javax.enterprise.context.ContextNotActiveException at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:40) at io.quarkus.hibernate.reactive.runtime.ReactiveSessionProducer_ProducerMethod_createStageSession_f9b8f611ead14dce89da7dfa2d7630a8afb9b0b9_ClientProxy.arc$delegate(ReactiveSessionProducer_ProducerMethod_createStageSession_f9b8f611ead14dce89da7dfa2d7630a8afb9b0b9_ClientProxy.zig:61) at io.quarkus.hibernate.reactive.runtime.ReactiveSessionProducer_ProducerMethod_createStageSession_f9b8f611ead14dce89da7dfa2d7630a8afb9b0b9_ClientProxy.flush(ReactiveSessionProducer_ProducerMethod_createStageSession_f9b8f611ead14dce89da7dfa2d7630a8afb9b0b9_ClientProxy.zig:187) at io.quarkus.hibernate.reactive.singlepersistenceunit.SinglePersistenceUnitCdiStageSessionTest.lambda$test$1(SinglePersistenceUnitCdiStageSessionTest.java:33) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072) ... 41 more ``` **Expected behavior** I would expect the Mutiny API and the Stage API to behave similarly. Maybe the code is wrong, but in that case both APIs should throw an exception? **Actual behavior** (Describe the actual behavior clearly and concisely.) **To Reproduce** See [this branch](https://github.com/quarkusio/quarkus/compare/master...yrodiere:reactive-context-not-active#diff-c1b22d077ee2c530ae96730f751521016fda503b609ddbc2852ced4e2c95fbcdR32) where I added two tests: one with the Mutiny API and another with the Stage API. The Munity test passes, but the Stage one fails. **Configuration** N/A **Screenshots** N/A **Environment (please complete the following information):** - Output of `uname -a` or `ver`: `Linux yrodiere.redhat 5.10.8-100.fc32.x86_64 #1 SMP Sun Jan 17 19:52:43 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux` - Output of `java -version`: ``` openjdk version "11.0.9" 2020-10-20 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode) ``` - GraalVM version (if different from Java): the one built in Quarkus - Quarkus version or git rev: 63db661ad3af4dca1b63a9c9905f911e888dbde1 - Build tool (ie. output of `mvnw --version` or `gradlew --version`): ``` Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /home/yrodiere/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3 Java version: 11.0.9, vendor: AdoptOpenJDK, runtime: /home/yrodiere/tools/java/jdk-11.0.9+11 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.10.8-100.fc32.x86_64", arch: "amd64", family: "unix" ``` **Additional context** N/A
90f1b704cb5b3be527a8a7aa1dfd73e5f4094aa7
96a1993ebaeac691d7171125078c012050bbf86e
https://github.com/quarkusio/quarkus/compare/90f1b704cb5b3be527a8a7aa1dfd73e5f4094aa7...96a1993ebaeac691d7171125078c012050bbf86e
diff --git a/extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/singlepersistenceunit/SinglePersistenceUnitCdiStageSessionTest.java b/extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/singlepersistenceunit/SinglePersistenceUnitCdiStageSessionTest.java deleted file mode 100644 index fb4f969c8ee..00000000000 --- a/extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/singlepersistenceunit/SinglePersistenceUnitCdiStageSessionTest.java +++ /dev/null @@ -1,60 +0,0 @@ -package io.quarkus.hibernate.reactive.singlepersistenceunit; - -import static org.assertj.core.api.Assertions.assertThat; - -import javax.enterprise.context.control.ActivateRequestContext; -import javax.inject.Inject; - -import org.hibernate.reactive.stage.Stage; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import io.quarkus.test.QuarkusUnitTest; - -public class SinglePersistenceUnitCdiStageSessionTest { - - @RegisterExtension - static QuarkusUnitTest runner = new QuarkusUnitTest() - .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) - .addClass(DefaultEntity.class) - .addAsResource("application.properties")); - - @Inject - Stage.Session session; - - @Inject - Stage.SessionFactory sessionFactory; - - @Test - @ActivateRequestContext - public void testWithFactory() { - DefaultEntity entity = new DefaultEntity("default"); - - DefaultEntity retrievedEntity = sessionFactory.withTransaction((session, tx) -> session.persist(entity)) - .thenCompose(v -> sessionFactory.withSession(session -> session.find(DefaultEntity.class, entity.getId()))) - .toCompletableFuture().join(); - - assertThat(retrievedEntity) - .isNotSameAs(entity) - .returns(entity.getName(), DefaultEntity::getName); - } - - @Test - @Disabled("#14812: We're getting a ContextNotActiveException for some (unknown) reason") - @ActivateRequestContext - public void test() { - DefaultEntity entity = new DefaultEntity("default"); - - DefaultEntity retrievedEntity = session.withTransaction(tx -> session.persist(entity)) - .thenCompose($ -> session.withTransaction(tx -> session.clear().find(DefaultEntity.class, entity.getId()))) - .toCompletableFuture().join(); - - assertThat(retrievedEntity) - .isNotSameAs(entity) - .returns(entity.getName(), DefaultEntity::getName); - } - -} diff --git a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionFactoryProducer.java b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionFactoryProducer.java index e51781acd70..478f5a60c23 100644 --- a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionFactoryProducer.java +++ b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionFactoryProducer.java @@ -8,7 +8,6 @@ import javax.persistence.PersistenceUnit; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.quarkus.arc.DefaultBean; @@ -18,14 +17,6 @@ public class ReactiveSessionFactoryProducer { @PersistenceUnit EntityManagerFactory emf; - @Produces - @Singleton - @DefaultBean - @Typed(Stage.SessionFactory.class) - public Stage.SessionFactory reactiveSessionFactory() { - return emf.unwrap(Stage.SessionFactory.class); - } - @Produces @Singleton @DefaultBean diff --git a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java index 709835c3207..ead36fc3330 100644 --- a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java +++ b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java @@ -6,25 +6,14 @@ import javax.inject.Inject; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.quarkus.arc.DefaultBean; public class ReactiveSessionProducer { - @Inject - Stage.SessionFactory reactiveSessionFactory; - @Inject Mutiny.SessionFactory mutinySessionFactory; - @Produces - @RequestScoped - @DefaultBean - public Stage.Session createStageSession() { - return reactiveSessionFactory.openSession(); - } - @Produces @RequestScoped @DefaultBean @@ -32,17 +21,6 @@ public Mutiny.Session createMutinySession() { return mutinySessionFactory.openSession(); } - public void disposeStageSession(@Disposes Stage.Session reactiveSession) { - if (reactiveSession != null) { - //We're ignoring the returned CompletionStage! - //This could certainly done better but it should be effective enough to - //eventually close the session: the connection pool will order the operations - //as it won't be able to return connections to other consumers when it's saturated, - //ensuring close operations are handled. - reactiveSession.close().toCompletableFuture().join(); - } - } - public void disposeMutinySession(@Disposes Mutiny.Session reactiveSession) { if (reactiveSession != null) { //We're ignoring the returned CompletionStage! diff --git a/integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTestEndpoint.java b/integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTestEndpoint.java index 4ae671275e7..6c6a4ed1364 100644 --- a/integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTestEndpoint.java +++ b/integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTestEndpoint.java @@ -1,13 +1,10 @@ package io.quarkus.it.hibernate.reactive.db2; -import java.util.concurrent.CompletionStage; - import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.smallrye.mutiny.Uni; import io.vertx.mutiny.db2client.DB2Pool; @@ -18,9 +15,6 @@ @Path("/alternative-tests") public class HibernateReactiveDB2AlternativeTestEndpoint { - @Inject - Stage.Session stageSession; - @Inject Mutiny.Session mutinySession; @@ -29,14 +23,6 @@ public class HibernateReactiveDB2AlternativeTestEndpoint { @Inject DB2Pool db2Pool; - @GET - @Path("/reactiveFind") - public CompletionStage<GuineaPig> reactiveFind() { - final GuineaPig expectedPig = new GuineaPig(5, "Aloi"); - return populateDB().convert().toCompletionStage() - .thenCompose(junk -> stageSession.find(GuineaPig.class, expectedPig.getId())); - } - @GET @Path("/reactiveFindMutiny") public Uni<GuineaPig> reactiveFindMutiny() { diff --git a/integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2TestEndpoint.java b/integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2TestEndpoint.java index ac780eef29d..3ca8020f2c8 100644 --- a/integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2TestEndpoint.java +++ b/integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2TestEndpoint.java @@ -1,13 +1,10 @@ package io.quarkus.it.hibernate.reactive.db2; -import java.util.concurrent.CompletionStage; - import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.smallrye.mutiny.Uni; import io.vertx.mutiny.db2client.DB2Pool; @@ -18,9 +15,6 @@ @Path("/tests") public class HibernateReactiveDB2TestEndpoint { - @Inject - Stage.Session stageSession; - @Inject Mutiny.Session mutinySession; @@ -29,14 +23,6 @@ public class HibernateReactiveDB2TestEndpoint { @Inject DB2Pool db2Pool; - @GET - @Path("/reactiveFind") - public CompletionStage<GuineaPig> reactiveFind() { - final GuineaPig expectedPig = new GuineaPig(5, "Aloi"); - return populateDB().convert().toCompletionStage() - .thenCompose(junk -> stageSession.find(GuineaPig.class, expectedPig.getId())); - } - @GET @Path("/reactiveFindMutiny") public Uni<GuineaPig> reactiveFindMutiny() { diff --git a/integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTest.java b/integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTest.java index 291a5d18d5d..566585f4587 100644 --- a/integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTest.java +++ b/integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTest.java @@ -13,14 +13,6 @@ @QuarkusTest public class HibernateReactiveDB2AlternativeTest { - @Test - public void reactiveFind() { - RestAssured.when() - .get("/alternative-tests/reactiveFind") - .then() - .body(is("{\\"id\\":5,\\"name\\":\\"Aloi\\"}")); - } - @Test public void reactiveFindMutiny() { RestAssured.when() diff --git a/integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2Test.java b/integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2Test.java index 8007e0d770d..29c2bc4c3a1 100644 --- a/integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2Test.java +++ b/integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2Test.java @@ -13,14 +13,6 @@ @QuarkusTest public class HibernateReactiveDB2Test { - @Test - public void reactiveFind() { - RestAssured.when() - .get("/tests/reactiveFind") - .then() - .body(is("{\\"id\\":5,\\"name\\":\\"Aloi\\"}")); - } - @Test public void reactiveFindMutiny() { RestAssured.when() diff --git a/integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTestEndpoint.java b/integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTestEndpoint.java index c9048f764b1..1a8b7c51377 100644 --- a/integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTestEndpoint.java +++ b/integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTestEndpoint.java @@ -1,13 +1,10 @@ package io.quarkus.it.hibernate.reactive.mysql; -import java.util.concurrent.CompletionStage; - import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.smallrye.mutiny.Uni; import io.vertx.mutiny.mysqlclient.MySQLPool; @@ -18,9 +15,6 @@ @Path("/alternative-tests") public class HibernateReactiveMySQLAlternativeTestEndpoint { - @Inject - Stage.Session stageSession; - @Inject Mutiny.Session mutinySession; @@ -29,14 +23,6 @@ public class HibernateReactiveMySQLAlternativeTestEndpoint { @Inject MySQLPool mysqlPool; - @GET - @Path("/reactiveFind") - public CompletionStage<GuineaPig> reactiveFind() { - final GuineaPig expectedPig = new GuineaPig(5, "Aloi"); - return populateDB().convert().toCompletionStage() - .thenCompose(junk -> stageSession.find(GuineaPig.class, expectedPig.getId())); - } - @GET @Path("/reactiveFindMutiny") public Uni<GuineaPig> reactiveFindMutiny() { diff --git a/integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTestEndpoint.java b/integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTestEndpoint.java index 1c144be731a..84a90a6cd4e 100644 --- a/integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTestEndpoint.java +++ b/integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTestEndpoint.java @@ -1,13 +1,10 @@ package io.quarkus.it.hibernate.reactive.mysql; -import java.util.concurrent.CompletionStage; - import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.smallrye.mutiny.Uni; import io.vertx.mutiny.mysqlclient.MySQLPool; @@ -18,9 +15,6 @@ @Path("/tests") public class HibernateReactiveMySQLTestEndpoint { - @Inject - Stage.Session stageSession; - @Inject Mutiny.Session mutinySession; @@ -29,14 +23,6 @@ public class HibernateReactiveMySQLTestEndpoint { @Inject MySQLPool mysqlPool; - @GET - @Path("/reactiveFind") - public CompletionStage<GuineaPig> reactiveFind() { - final GuineaPig expectedPig = new GuineaPig(5, "Aloi"); - return populateDB().convert().toCompletionStage() - .thenCompose(junk -> stageSession.find(GuineaPig.class, expectedPig.getId())); - } - @GET @Path("/reactiveFindMutiny") public Uni<GuineaPig> reactiveFindMutiny() { diff --git a/integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTest.java b/integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTest.java index c98b4377b35..b583e1dc79c 100644 --- a/integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTest.java +++ b/integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTest.java @@ -13,14 +13,6 @@ @QuarkusTest public class HibernateReactiveMySQLAlternativeTest { - @Test - public void reactiveFind() { - RestAssured.when() - .get("/alternative-tests/reactiveFind") - .then() - .body(is("{\\"id\\":5,\\"name\\":\\"Aloi\\"}")); - } - @Test public void reactiveFindMutiny() { RestAssured.when() diff --git a/integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTest.java b/integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTest.java index d6e2eaee65a..2636432990c 100644 --- a/integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTest.java +++ b/integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTest.java @@ -13,14 +13,6 @@ @QuarkusTest public class HibernateReactiveMySQLTest { - @Test - public void reactiveFind() { - RestAssured.when() - .get("/tests/reactiveFind") - .then() - .body(is("{\\"id\\":5,\\"name\\":\\"Aloi\\"}")); - } - @Test public void reactiveFindMutiny() { RestAssured.when() diff --git a/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java b/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java index e3fa12b9c81..9e2f53d5533 100644 --- a/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java +++ b/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java @@ -1,13 +1,10 @@ package io.quarkus.it.hibernate.reactive.postgresql; -import java.util.concurrent.CompletionStage; - import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.smallrye.mutiny.Uni; import io.vertx.mutiny.pgclient.PgPool; @@ -18,9 +15,6 @@ @Path("/tests") public class HibernateReactiveTestEndpoint { - @Inject - Stage.Session stageSession; - @Inject Mutiny.Session mutinySession; @@ -29,14 +23,6 @@ public class HibernateReactiveTestEndpoint { @Inject PgPool pgPool; - @GET - @Path("/reactiveFind") - public CompletionStage<GuineaPig> reactiveFind() { - final GuineaPig expectedPig = new GuineaPig(5, "Aloi"); - return populateDB().convert().toCompletionStage() - .thenCompose(junk -> stageSession.find(GuineaPig.class, expectedPig.getId())); - } - @GET @Path("/reactiveFindMutiny") public Uni<GuineaPig> reactiveFindMutiny() { diff --git a/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointAlternative.java b/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointAlternative.java index f0551267f32..ec7542caea5 100644 --- a/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointAlternative.java +++ b/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointAlternative.java @@ -1,13 +1,10 @@ package io.quarkus.it.hibernate.reactive.postgresql; -import java.util.concurrent.CompletionStage; - import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.smallrye.mutiny.Uni; import io.vertx.mutiny.pgclient.PgPool; @@ -18,9 +15,6 @@ @Path("/alternative-tests") public class HibernateReactiveTestEndpointAlternative { - @Inject - Stage.Session stageSession; - @Inject Mutiny.Session mutinySession; @@ -29,14 +23,6 @@ public class HibernateReactiveTestEndpointAlternative { @Inject PgPool pgPool; - @GET - @Path("/reactiveFind") - public CompletionStage<GuineaPig> reactiveFind() { - final GuineaPig expectedPig = new GuineaPig(5, "Aloi"); - return populateDB().convert().toCompletionStage() - .thenCompose(junk -> stageSession.find(GuineaPig.class, expectedPig.getId())); - } - @GET @Path("/reactiveFindMutiny") public Uni<GuineaPig> reactiveFindMutiny() { diff --git a/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java b/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java index 8f8fdc87f9f..ff1b103592e 100644 --- a/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java +++ b/integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java @@ -1,7 +1,6 @@ package io.quarkus.it.hibernate.reactive.postgresql; import java.util.Collection; -import java.util.concurrent.CompletionStage; import javax.inject.Inject; import javax.ws.rs.GET; @@ -10,7 +9,6 @@ import javax.ws.rs.PathParam; import org.hibernate.reactive.mutiny.Mutiny; -import org.hibernate.reactive.stage.Stage; import io.quarkus.it.hibernate.reactive.postgresql.lazy.Author; import io.quarkus.it.hibernate.reactive.postgresql.lazy.Book; @@ -24,11 +22,6 @@ public class HibernateReactiveTestEndpointFetchLazy { @Inject Mutiny.Session mutinySession; - // I'm using the factory because there are some issues with an injected Stage.Session - // See issue https://github.com/quarkusio/quarkus/issues/14812 - @Inject - Stage.SessionFactory stageSessionFactory; - // Injecting a Vert.x Pool is not required, It's used to // independently validate the contents of the database for the test @Inject @@ -41,14 +34,6 @@ public Uni<Collection<Book>> findBooksWithMutiny(@PathParam("authorId") Integer .chain(author -> Mutiny.fetch(author.getBooks())); } - @GET - @Path("/findBooksWithStage/{authorId}") - public CompletionStage<Collection<Book>> findBooksWithStage(@PathParam("authorId") Integer authorId) { - return stageSessionFactory.withTransaction((session, tx) -> session - .find(Author.class, authorId) - .thenCompose(author -> Stage.fetch(author.getBooks()))); - } - @POST @Path("/prepareDb") public Uni<String> prepareDb() { diff --git a/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveAlternativeTest.java b/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveAlternativeTest.java index 9d5e37ada5a..eb795124133 100644 --- a/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveAlternativeTest.java +++ b/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveAlternativeTest.java @@ -15,14 +15,6 @@ @TestHTTPEndpoint(HibernateReactiveTestEndpointAlternative.class) public class HibernateReactiveAlternativeTest { - @Test - public void reactiveFind() { - RestAssured.when() - .get("/reactiveFind") - .then() - .body(is("{\\"id\\":5,\\"name\\":\\"Aloi\\"}")); - } - @Test public void reactiveFindMutiny() { RestAssured.when() diff --git a/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java b/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java index 38cd5a0e82f..1cb288ff860 100644 --- a/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java +++ b/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java @@ -32,20 +32,6 @@ public void fetchAfterFindWithMutiny() { assertTitles(response, "Cryptonomicon", "Snow Crash"); } - @Test - public void fetchAfterFindWithWithStage() { - RestAssured.when() - .post("/prepareDb") - .then() - .body(is("Neal Stephenson")); - - Response response = RestAssured.when() - .get("/findBooksWithStage/567") - .then() - .extract().response(); - assertTitles(response, "Cryptonomicon", "Snow Crash"); - } - private void assertTitles(Response response, String... expectedTitles) { List<Object> titles = response.jsonPath().getList("title").stream().sorted().collect(toList()); assertIterableEquals(asList(expectedTitles), titles); diff --git a/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTest.java b/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTest.java index 89fe03fbc06..b489a2ee142 100644 --- a/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTest.java +++ b/integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTest.java @@ -16,14 +16,6 @@ @TestHTTPEndpoint(HibernateReactiveTestEndpoint.class) public class HibernateReactiveTest { - @Test - public void reactiveFind() { - RestAssured.when() - .get("/reactiveFind") - .then() - .body(is("{\\"id\\":5,\\"name\\":\\"Aloi\\"}")); - } - @Test public void reactiveCowPersist() { RestAssured.when()
['integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java', 'integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveFetchLazyTest.java', 'integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2Test.java', 'integration-tests/hibernate-reactive-db2/src/test/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTest.java', 'extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/singlepersistenceunit/SinglePersistenceUnitCdiStageSessionTest.java', 'integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTestEndpoint.java', 'integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2AlternativeTestEndpoint.java', 'integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointAlternative.java', 'integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2TestEndpoint.java', 'extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java', 'extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionFactoryProducer.java', 'integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLAlternativeTest.java', 'integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveAlternativeTest.java', 'integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTestEndpoint.java', 'integration-tests/hibernate-reactive-postgresql/src/test/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTest.java', 'integration-tests/hibernate-reactive-postgresql/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpointFetchLazy.java', 'integration-tests/hibernate-reactive-mysql/src/test/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTest.java']
{'.java': 17}
17
17
0
0
17
17,106,375
3,323,152
440,019
4,620
1,124
212
31
2
7,954
357
1,927
119
1
4
2021-06-30T08:11:07
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,725
quarkusio/quarkus/18192/18190
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18190
https://github.com/quarkusio/quarkus/pull/18192
https://github.com/quarkusio/quarkus/pull/18192
1
fixes
Problem starting quarkus app in dev mode with pom dependency
## Describe the bug We do have some quarkus apps that have a pom type dependency on the 'pom.xml' (for example: https://github.com/kiegroup/kogito-apps/blob/master/task-console/pom.xml#L54). Today we started noticing that if we start them in dev mode we get a hot reload error on start up due to a missing target/classes folder in the dependent module. `Failed to run: Hot reloadable dependency org.kie.kogito:kogito-apps-ui-packages::jar:2.0.0-SNAPSHOT has not been compiled yet (the classes directory /development/kogito-apps/ui-packages/target/classes does not exist) -> [Help 1]` We found this check to be hardcoded in your DevMojo (https://github.com/quarkusio/quarkus/blob/main/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java#L663-L666). I think it would be good if this mechanism could be more flexible or at least configurable to avoid this kind of issues. ### Expected behavior The quarkus app should start in dev mode as usual ### Actual behavior The quarkus app doesn't start and shows the Hot reload error message. ## To Reproduce Steps to reproduce the behavior: 1. Git clone Git clone https://github.com/kiegroup/kogito-apps 2. Build kogito-apps 3. on a terminal go to /kogito-apps/task-console 4. try to start the app with command: `mvn clean package quarkus:dev -Dquarkus.http.port=8380 `
928d7327e965097e60ea452ee376364503e4a239
5f59b0704ba7f91eba0f4fcb8cf1143ad9cf716e
https://github.com/quarkusio/quarkus/compare/928d7327e965097e60ea452ee376364503e4a239...5f59b0704ba7f91eba0f4fcb8cf1143ad9cf716e
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/devmode/DependenciesFilter.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/devmode/DependenciesFilter.java index b21dc8a7804..ef000cec228 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/devmode/DependenciesFilter.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/devmode/DependenciesFilter.java @@ -85,7 +85,7 @@ public static List<LocalProject> filterNotReloadableDependencies(LocalProject lo if (project == null) { continue; } - if ("test".equals(a.getScope())) { + if ("test".equals(a.getScope()) || "pom".equals(a.getType())) { continue; } if (!project.getVersion().equals(a.getVersion())) {
['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/devmode/DependenciesFilter.java']
{'.java': 1}
1
1
0
0
1
17,097,159
3,321,270
439,796
4,617
124
31
2
1
1,345
175
350
22
3
0
2021-06-28T08:33:11
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,726
quarkusio/quarkus/18165/18118
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18118
https://github.com/quarkusio/quarkus/pull/18165
https://github.com/quarkusio/quarkus/pull/18165
1
fixes
NoSuchElementException when building a project with no source files
## Describe the bug I am trying to plugin libraries via CDI into a service to create a new service. So in my example my original service is `service1`, which I'd like to add `plugin2` to create `service2`. So I made a new project with no source code and only dependencies in `service1` and `plugin2`. I was hoping the REST resources from `service1` would be picked up off the classpath along with `plugin2` through CDI. But when I `quarkusBuild`, I get a `NoSuchElementException`. ### Expected behavior A successful build. ### Actual behavior ``` Caused by: java.util.NoSuchElementException at io.quarkus.deployment.builditem.ArchiveRootBuildItem.<init>(ArchiveRootBuildItem.java:97) at io.quarkus.deployment.builditem.ArchiveRootBuildItem.<init>(ArchiveRootBuildItem.java:17) at io.quarkus.deployment.builditem.ArchiveRootBuildItem$Builder.build(ArchiveRootBuildItem.java:50) at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:141) at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:394) ... 125 more ``` ## To Reproduce `service2` in https://github.com/mweber03/quarkus-test Steps to reproduce the behavior: 1. Uncomment `service2` from `settings.gradle` 2. `./gradlew service2:build` ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Ubuntu 20.04 ### Output of `java -version` OpenJDK 11.0.11 ### Quarkus version or git rev Quarkus 1.13.7 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 6.8.3
659435d6e0aa7250638d41a9db356a9c39ae8daf
cbf70d66e35eeec93203b4b9f9377c18762a8265
https://github.com/quarkusio/quarkus/compare/659435d6e0aa7250638d41a9db356a9c39ae8daf...cbf70d66e35eeec93203b4b9f9377c18762a8265
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java index 38999d1a882..e5040da4d99 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java @@ -81,20 +81,25 @@ private ArchiveRootBuildItem(Path archiveLocation, Path archiveRoot, Collection< private ArchiveRootBuildItem(Builder builder, QuarkusBuildCloseablesBuildItem buildCloseables) throws IOException { this.excludedFromIndexing = builder.excludedFromIndexing; - final PathsCollection.Builder rootDirs = PathsCollection.builder(); - final PathsCollection.Builder paths = PathsCollection.builder(); - for (Path root : builder.archiveRoots) { - paths.add(root); - if (Files.isDirectory(root)) { - rootDirs.add(root); - } else { - final FileSystem fs = buildCloseables.add(FileSystems.newFileSystem(root, null)); - fs.getRootDirectories().forEach(rootDirs::add); + if (!builder.archiveRoots.isEmpty()) { + final PathsCollection.Builder rootDirs = PathsCollection.builder(); + final PathsCollection.Builder paths = PathsCollection.builder(); + for (Path root : builder.archiveRoots) { + paths.add(root); + if (Files.isDirectory(root)) { + rootDirs.add(root); + } else { + final FileSystem fs = buildCloseables.add(FileSystems.newFileSystem(root, null)); + fs.getRootDirectories().forEach(rootDirs::add); + } } + this.rootDirs = rootDirs.build(); + this.paths = paths.build(); + this.archiveRoot = this.rootDirs.iterator().next(); + } else { + this.paths = this.rootDirs = PathsCollection.of(); + this.archiveRoot = null; } - this.rootDirs = rootDirs.build(); - this.paths = paths.build(); - this.archiveRoot = this.rootDirs.iterator().next(); } /**
['core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java']
{'.java': 1}
1
1
0
0
1
17,071,092
3,316,560
439,199
4,610
1,512
263
29
1
1,617
173
427
40
1
1
2021-06-25T12:02:45
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,727
quarkusio/quarkus/18152/18099
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18099
https://github.com/quarkusio/quarkus/pull/18152
https://github.com/quarkusio/quarkus/pull/18152
1
fixes
The QuarkusBootstrapProvider caches the AppArtifact causing problems
The `QuarkusBoostrapProvider` has a cache of `QuarkusAppBootstrapProvider` which itself has a field for the `AppArtifact`. This field is initialised with the `initAppArtifact` if not yet initialized. However, this method creates the output build directory if it does not exists. The causes problems if the cache is actually reused in a subsequent built after cleaning the project and leads to problems because the output directory has not been created. ``` ➜ log-sink git:(main) ✗ mvnd clean verify [INFO] Processing build on daemon 887b51d4[INFO] Scanning for projects... [INFO] BuildTimeEventSpy is registered. [INFO] [INFO] Using the SmartBuilder implementation with a thread count of 11 [INFO] Task segments : [clean, verify] [INFO] Build maximum degree of concurrency is 11 [INFO] Total number of projects is 1 [INFO] [INFO] --------------------------< org.bf2:log-sink >-------------------------- [INFO] Building connectors-images :: log-sink 0.1 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ log-sink --- [INFO] [INFO] --- directory-maven-plugin:0.3.1:highest-basedir (directories) @ log-sink --- [INFO] Highest basedir set to: /Users/gnodet/work/git/cos-fleet-catalog-camel [INFO] [INFO] --- quarkus-maven-plugin:2.0.0.CR3:generate-code (default) @ log-sink --- [INFO] [INFO] --- formatter-maven-plugin:2.14.0:format (format) @ log-sink --- [INFO] Using 'UTF-8' encoding to format source files. [INFO] Number of files to be formatted: 0 [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ log-sink --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ log-sink --- [INFO] No sources to compile [INFO] [INFO] --- quarkus-maven-plugin:2.0.0.CR3:generate-code-tests (default) @ log-sink --- [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ log-sink --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Users/gnodet/work/git/cos-fleet-catalog-camel/cos-fleet-catalog-connectors-images/log-sink/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ log-sink --- [INFO] No sources to compile [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ log-sink --- [INFO] No tests to run. [INFO] [INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) @ log-sink --- [INFO] Building jar: /Users/gnodet/work/git/cos-fleet-catalog-camel/cos-fleet-catalog-connectors-images/log-sink/target/log-sink-0.1.jar [INFO] [INFO] --- quarkus-maven-plugin:2.0.0.CR3:build (default) @ log-sink --- [INFO] [org.jboss.threads] JBoss Threads version 3.4.0.Final [INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 1103ms [INFO] Segment walltime 2 s, segment projects service time 2 s, effective/maximum degree of concurrency 1.00/11 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.830 s (Wall Clock) [INFO] Finished at: 2021-06-23T10:33:47+02:00 [INFO] ------------------------------------------------------------------------ ➜ log-sink git:(main) ✗ mvnd clean verify [INFO] Processing build on daemon 887b51d4[INFO] Scanning for projects... [INFO] BuildTimeEventSpy is registered. [INFO] [INFO] Using the SmartBuilder implementation with a thread count of 11 [INFO] Task segments : [clean, verify] [INFO] Build maximum degree of concurrency is 11 [INFO] Total number of projects is 1 [INFO] [INFO] --------------------------< org.bf2:log-sink >-------------------------- [INFO] Building connectors-images :: log-sink 0.1 [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ log-sink --- [INFO] Deleting /Users/gnodet/work/git/cos-fleet-catalog-camel/cos-fleet-catalog-connectors-images/log-sink/target [INFO] [INFO] --- directory-maven-plugin:0.3.1:highest-basedir (directories) @ log-sink --- [INFO] Highest basedir set to: /Users/gnodet/work/git/cos-fleet-catalog-camel [INFO] [INFO] --- quarkus-maven-plugin:2.0.0.CR3:generate-code (default) @ log-sink --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 0.724 s (Wall Clock) [INFO] Finished at: 2021-06-23T10:33:49+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.0.0.CR3:generate-code (default) on project log-sink: Quarkus code generation phase has failed: Error while reading file as JAR: /Users/gnodet/work/git/cos-fleet-catalog-camel/cos-fleet-catalog-connectors-images/log-sink/target/classes -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException ➜ log-sink git:(main) ✗ ```
659435d6e0aa7250638d41a9db356a9c39ae8daf
f6a640667f70393601752cf9af7f34aacaea58f9
https://github.com/quarkusio/quarkus/compare/659435d6e0aa7250638d41a9db356a9c39ae8daf...f6a640667f70393601752cf9af7f34aacaea58f9
diff --git a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java index 88a10542bc5..1ce97e18e35 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java @@ -290,6 +290,7 @@ public void close() { curatedApp.close(); curatedApp = null; } + appArtifact = null; quarkusBootstrap = null; } }
['devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java']
{'.java': 1}
1
1
0
0
1
17,071,092
3,316,560
439,199
4,610
32
6
1
1
5,575
550
1,519
99
1
1
2021-06-25T09:40:00
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,728
quarkusio/quarkus/18150/18125
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18125
https://github.com/quarkusio/quarkus/pull/18150
https://github.com/quarkusio/quarkus/pull/18150
1
fixes
Broken dependency when using OpenTelemetry + REST Client on main
## Describe the bug When combining `quarkus-opentelemetry-exporter-otlp` and `rest-client` extensions, Maven is unable to resolve the `io.quarkus:quarkus-opentelemetry-rest-client-deployment` dependency unless it is locally cached. ### Expected behavior Build success ### Actual behavior ``` [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:generate-code (default) on project opentelemetry-test: Quarkus code generation phase has failed: Failed to bootstrap the application: Failed to create the application model for org.acme:opentelemetry-test::jar:1.0.0-SNAPSHOT: Failed to resolve artifacts: Could not find artifact io.quarkus:quarkus-opentelemetry-rest-client-deployment:jar:999-SNAPSHOT ``` ## To Reproduce Make sure you do not have `io.quarkus:quarkus-opentelemetry-rest-client-deployment:jar:999-SNAPSHOT` in local Maven repo and a remote repo with Quarkus `999-SNAPSHOT` is available. ``` mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create \\ -DplatformArtifactId=quarkus-bom \\ -DprojectGroupId=org.acme \\ -DprojectArtifactId=opentelemetry-test \\ -Dextensions="rest-client,quarkus-opentelemetry-exporter-otlp" cd opentelemetry-test mvn clean compile ``` See also https://github.com/quarkusio/quarkus-quickstarts/tree/development/opentelemetry-quickstart, which fails in the same manner when using a remote repository. ## Environment: ``` Apache Maven 3.8.1 Java version: 11.0.10, vendor: AdoptOpenJDK Quarkus main (999-SNAPSHOT) ```
aa4bef3442fa26268f7ca34527e5ffe13b876d5a
fbf177fc9a9298c13d292e3bcf609a2e95e3b814
https://github.com/quarkusio/quarkus/compare/aa4bef3442fa26268f7ca34527e5ffe13b876d5a...fbf177fc9a9298c13d292e3bcf609a2e95e3b814
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java index 8f1a931bd58..bac243760d0 100644 --- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java +++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java @@ -546,7 +546,8 @@ void activate() throws BootstrapDependencyProcessingException { collectingTopRuntimeNodes = false; final ExtensionDependency extDep = getExtensionDependency(); final DependencyNode originalNode = collectDependencies(info.runtimeArtifact, extDep.exclusions); - final DependencyNode rtNode = extDep.runtimeNode; + final DefaultDependencyNode rtNode = (DefaultDependencyNode) extDep.runtimeNode; + rtNode.setRepositories(originalNode.getRepositories()); // if this node has conditional dependencies on its own, they may have been activated by this time // in which case they would be included into its children List<DependencyNode> currentChildren = rtNode.getChildren();
['independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java']
{'.java': 1}
1
1
0
0
1
17,080,506
3,318,171
439,405
4,611
225
40
3
1
1,525
140
409
31
1
3
2021-06-25T08:49:12
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,659
quarkusio/quarkus/19795/19701
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/19701
https://github.com/quarkusio/quarkus/pull/19795
https://github.com/quarkusio/quarkus/pull/19795
1
fixes
Fail to redeploy to Kubernetes
### Describe the bug When running `mvn clean package -Dquarkus.kubernetes.deploy=true` to update an existing deployment in Kubernetes, it fails with: ``` Build step io.quarkus.kubernetes.deployment.KubernetesDeployer#deploy threw an exception: io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: POST at: https://192.168.64.75:8443/api/v1/namespaces/default/services. Message: Service "my-app" is invalid: spec.ports[0].nodePort: Invalid value: 31084: provided port is already allocated. ``` Ths previously worked in 1.x ### Expected behavior Image is built and updated deployment rolled out to Kubernetes ### Actual behavior Exception when running `mvn clean package -Dquarkus.kubernetes.deploy=true` if application already deployed ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
008792a1155c994ce2d93538fca346617e2dcc6a
7142e7913f0f476889b7353432d339ca14b2ad12
https://github.com/quarkusio/quarkus/compare/008792a1155c994ce2d93538fca346617e2dcc6a...7142e7913f0f476889b7353432d339ca14b2ad12
diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java index c358fb29ea5..362b63ae063 100644 --- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java +++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java @@ -11,11 +11,12 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.nio.file.Path; -import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -25,6 +26,7 @@ import io.dekorate.utils.Serialization; import io.fabric8.kubernetes.api.model.HasMetadata; import io.fabric8.kubernetes.api.model.KubernetesList; +import io.fabric8.kubernetes.api.model.Service; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.KubernetesClientException; import io.fabric8.openshift.api.model.Route; @@ -42,7 +44,6 @@ import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem; import io.quarkus.kubernetes.client.deployment.KubernetesClientErrorHandler; import io.quarkus.kubernetes.client.spi.KubernetesClientBuildItem; -import io.quarkus.kubernetes.spi.KubernetesDeploymentTargetBuildItem; public class KubernetesDeployer { @@ -60,7 +61,7 @@ public void selectDeploymentTarget(ContainerImageInfoBuildItem containerImageInf Optional<String> activeContainerImageCapability = ContainerImageCapabilitiesUtil .getActiveContainerImageCapability(capabilities); - if (!activeContainerImageCapability.isPresent()) { + if (activeContainerImageCapability.isEmpty()) { // we can't thrown an exception here, because it could prevent the Kubernetes resources from being generated return; } @@ -85,10 +86,10 @@ public void deploy(KubernetesClientBuildItem kubernetesClient, return; } - if (!selectedDeploymentTarget.isPresent()) { + if (selectedDeploymentTarget.isEmpty()) { - if (!ContainerImageCapabilitiesUtil - .getActiveContainerImageCapability(capabilities).isPresent()) { + if (ContainerImageCapabilitiesUtil + .getActiveContainerImageCapability(capabilities).isEmpty()) { throw new RuntimeException( "A Kubernetes deployment was requested but no extension was found to build a container image. Consider adding one of following extensions: " + CONTAINER_IMAGE_EXTENSIONS_STR + "."); @@ -158,11 +159,6 @@ private DeploymentTargetEntry determineDeploymentTarget( return selectedTarget; } - private Optional<KubernetesDeploymentTargetBuildItem> getOptionalDeploymentTarget( - List<KubernetesDeploymentTargetBuildItem> deploymentTargets, String name) { - return deploymentTargets.stream().filter(d -> name.equals(d.getName())).findFirst(); - } - private DeploymentResultBuildItem deploy(DeploymentTargetEntry deploymentTarget, KubernetesClient client, Path outputDir, OpenshiftConfig openshiftConfig, ApplicationInfoBuildItem applicationInfo) { @@ -174,12 +170,13 @@ private DeploymentResultBuildItem deploy(DeploymentTargetEntry deploymentTarget, try (FileInputStream fis = new FileInputStream(manifest)) { KubernetesList list = Serialization.unmarshalAsList(fis); - distinct(list.getItems()).forEach(i -> { - if (KNATIVE.equals(deploymentTarget.getName().toLowerCase())) { - client.resource(i).inNamespace(namespace).deletingExisting().createOrReplace(); - } else { - client.resource(i).inNamespace(namespace).createOrReplace(); + list.getItems().stream().filter(distinctByResourceKey()).forEach(i -> { + final var r = client.resource(i).inNamespace(namespace); + if (shouldDeleteExisting(deploymentTarget, i)) { + r.delete(); + r.waitUntilCondition(Objects::isNull, 10, TimeUnit.SECONDS); } + r.createOrReplace(); log.info("Applied: " + i.getKind() + " " + i.getMetadata().getName() + "."); }); @@ -221,13 +218,15 @@ private void printExposeInformation(KubernetesClient client, KubernetesList list } } - public static Predicate<HasMetadata> distictByResourceKey() { + private static boolean shouldDeleteExisting(DeploymentTargetEntry deploymentTarget, HasMetadata resource) { + return KNATIVE.equalsIgnoreCase(deploymentTarget.getName()) + || resource instanceof Service + || (Objects.equals("v1", resource.getApiVersion()) && Objects.equals("Service", resource.getKind())); + } + + private static Predicate<HasMetadata> distinctByResourceKey() { Map<Object, Boolean> seen = new ConcurrentHashMap<>(); return t -> seen.putIfAbsent(t.getApiVersion() + "/" + t.getKind() + ":" + t.getMetadata().getName(), Boolean.TRUE) == null; } - - private static Collection<HasMetadata> distinct(Collection<HasMetadata> resources) { - return resources.stream().filter(distictByResourceKey()).collect(Collectors.toList()); - } }
['extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesDeployer.java']
{'.java': 1}
1
1
0
0
1
17,986,557
3,497,123
460,973
4,770
2,393
424
41
1
1,141
137
273
45
1
1
2021-08-31T10:04:28
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,600
quarkusio/quarkus/21096/21085
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21085
https://github.com/quarkusio/quarkus/pull/21096
https://github.com/quarkusio/quarkus/pull/21096
1
fix
SmallRye GraphQL returns multiple content-types in `Content-Type` header when requested with multiple content-types in `Accept` header
### Describe the bug When querying `/graphql` with an `Accept` HTTP-header containing multiple media types, e.g. `application/json, text/plain`, the endpoint mirrors that header's content into the response's `Content-Type` header. `application/json, text/plain` is not a valid `Content-Type` and subsequent parsing fails. ### Expected behavior Only the chosen media type is used in the response's `Content-Type` header, `application/json` in this case. ### Actual behavior The response currently is invalid, and trying to process it throws an exception. See also steps to reproduce. ### How to Reproduce? Have a GraphQL endpoint, e.g.: ```java @GraphQLApi public class GraphQLResource { @Query public String test() { return "test"; } } ``` Then query it with multiple `Accept` media types, e.g.: ```java Client client = ClientBuilder.newClient(); Response response = client .target("http://localhost:8080/graphql") .request(MediaType.APPLICATION_JSON_TYPE) .accept(MediaType.TEXT_PLAIN) // this adds a second `Accept` media type .post(Entity.entity("{\\"query\\":\\"query {test}\\"}", MediaType.APPLICATION_JSON)); return response.readEntity(String.class); // exception thrown here ``` The result is an error: ``` java.lang.IllegalArgumentException: RESTEASY003340: Failure parsing MediaType string: application/json, text/plain at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.internalParse(MediaTypeHeaderDelegate.java:118) at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.parse(MediaTypeHeaderDelegate.java:69) at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.fromString(MediaTypeHeaderDelegate.java:33) at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.fromString(MediaTypeHeaderDelegate.java:19) at javax.ws.rs.core.MediaType.valueOf(MediaType.java:172) at org.jboss.resteasy.specimpl.AbstractBuiltResponse.getMediaType(AbstractBuiltResponse.java:342) at org.jboss.resteasy.specimpl.BuiltResponse.readEntity(BuiltResponse.java:90) at org.jboss.resteasy.specimpl.AbstractBuiltResponse.readEntity(AbstractBuiltResponse.java:262) ... ``` ### Output of `java -version` ``` openjdk 17 2021-09-14 OpenJDK Runtime Environment Temurin-17+35 (build 17+35) OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing) ``` ### Quarkus version or git rev 2.4.0.Final
76e9b87721641ada41a284d962a53a4fa38d2316
d608a6e24fcbdfe41489e686a74991b85d470cbf
https://github.com/quarkusio/quarkus/compare/76e9b87721641ada41a284d962a53a4fa38d2316...d608a6e24fcbdfe41489e686a74991b85d470cbf
diff --git a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLOverHttpTest.java b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLOverHttpTest.java index ccf5ddb9ce8..7465817bed3 100644 --- a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLOverHttpTest.java +++ b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLOverHttpTest.java @@ -1,6 +1,7 @@ package io.quarkus.smallrye.graphql.deployment; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.hamcrest.CoreMatchers; @@ -77,6 +78,25 @@ public void httpPostWithQueryInQueryParamAndBodyTest() throws Exception { "{\\"data\\":{\\"user\\":{\\"id\\":\\"1\\",\\"name\\":\\"Koos\\",\\"surname\\":\\"van der Merwe\\"}}}"); // query in query parameter win } + @Test + public void httpPostWithMultipleAcceptHeaders() throws Exception { + + Map<String, String> queryparams = new HashMap<>(); + queryparams.put("query", "query ($id: ID!) { user(id:$id) { id name surname}}"); + + String variables = "{\\"id\\": \\"1\\"}"; + + String request = "query ($id: ID!) {\\n" + + " user(id:$id) {\\n" + + " name\\n" + + " }\\n" + + "}"; + + post(request, queryparams, variables, + "{\\"data\\":{\\"user\\":{\\"id\\":\\"1\\",\\"name\\":\\"Koos\\",\\"surname\\":\\"van der Merwe\\"}}}", + List.of(MEDIATYPE_JSON, MEDIATYPE_TEXT)); + } + @Test public void httpPostWithVariablesQueryParamTest() throws Exception { @@ -121,13 +141,18 @@ private static Map<String, String> configuration() { } private void post(String request, Map<String, ?> queryparams, String variables, String expected) { + post(request, queryparams, variables, expected, List.of(MEDIATYPE_JSON)); + } + + private void post(String request, Map<String, ?> queryparams, String variables, String expected, + List<String> acceptHeaders) { RequestSpecification requestSpecification = RestAssured.given(); if (queryparams != null) { requestSpecification = requestSpecification.queryParams(queryparams); } requestSpecification.when() - .accept(MEDIATYPE_JSON) + .accept(String.join(",", acceptHeaders)) .contentType(MEDIATYPE_JSON) .body(getPayload(request, variables)) .post("/graphql") diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java index 161305c4565..df03f1d40b8 100644 --- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java +++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java @@ -20,6 +20,8 @@ import io.vertx.core.http.HttpHeaders; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerResponse; +import io.vertx.ext.web.MIMEHeader; +import io.vertx.ext.web.ParsedHeaderValues; import io.vertx.ext.web.RoutingContext; /** @@ -211,9 +213,19 @@ private String getRequestContentType(RoutingContext ctx) { } private String getRequestAccept(RoutingContext ctx) { - String accept = ctx.request().getHeader("Accept"); - if (accept != null && !accept.isEmpty() && !accept.startsWith("*/*")) { - return accept; + ParsedHeaderValues parsedHeaders = ctx.parsedHeaders(); + if (parsedHeaders != null && parsedHeaders.accept() != null && !parsedHeaders.accept().isEmpty()) { + List<MIMEHeader> acceptList = parsedHeaders.accept(); + for (MIMEHeader a : acceptList) { + if (isValidAcceptRequest(a.rawValue())) { + return a.rawValue(); + } + } + // Seems like an unknown accept is passed in + String accept = ctx.request().getHeader("Accept"); + if (accept != null && !accept.isEmpty() && !accept.startsWith("*/*")) { + return accept; + } } return DEFAULT_RESPONSE_CONTENT_TYPE; }
['extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLOverHttpTest.java', 'extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java']
{'.java': 2}
2
2
0
0
2
18,982,754
3,692,645
486,801
5,007
927
182
18
1
2,532
209
556
65
1
4
2021-10-29T15:53:32
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,591
quarkusio/quarkus/21294/21145
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21145
https://github.com/quarkusio/quarkus/pull/21294
https://github.com/quarkusio/quarkus/pull/21294
1
fixes
Dev mode first hot reload request is 'ignored' if there is no active REST endpoint on the service under Ubuntu
### Describe the bug In the `intellij` terminal the first `s` triggers a manual restart when the Quarkus service has an active REST endpoint. But if it doesn't have one, then the first `s` is ignored and restart only occurs on sending the second one as well. ### Expected behavior Restart on the first request. ### Actual behavior Restarts only on the second request even if minutes pass between the two. ### How to Reproduce? A reproducer can be found at: https://github.com/tlvlp/quarkus-hot-reload-test (Note: it's only an empty, freshly generated project.) 1. Launch the service 2. Wait for the build and dev mode to load and for the service to start. 3. Make any changes to the code. 4. Select intellij's terminal 5. Press 's' and 'enter 6. Nothing happens 7. Repeat step 5. 8. The service hot-reload is triggered. ### Output of `uname -a` or `ver` Linux tux 5.11.0-34-generic #36~20.04.1-Ubuntu SMP Fri Aug 27 08:06:32 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` openjdk version "17" 2021-09-14 OpenJDK Runtime Environment (build 17+35-2724) OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing) ### GraalVM version (if different from Java) n/a ### Quarkus version or git rev 2.3.1.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Maven 3.8.1 ### Additional information Related to #20809 where the affected code segment is also mentioned. ``` Linux 5.11.0-34-generic Current Desktop: ubuntu:GNOME IntelliJ IDEA 2021.2.3 (Ultimate Edition) Build #IU-212.5457.46, built on October 12, 2021 Runtime version: 11.0.12+7-b1504.40 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. com.redhat.devtools.intellij.quarkus (1.8.0.176) ```
598534257da772dc70b645e5f62fba430751cdf2
c1bdc229616814547d14d714bcf87383b9d60cea
https://github.com/quarkusio/quarkus/compare/598534257da772dc70b645e5f62fba430751cdf2...c1bdc229616814547d14d714bcf87383b9d60cea
diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java index 2381a90dc31..f40fdeb9abb 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -12,6 +12,7 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -27,14 +28,13 @@ import java.util.Optional; import java.util.Properties; import java.util.Set; -import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import org.aesh.readline.tty.terminal.TerminalConnection; +import org.aesh.readline.terminal.impl.ExecPty; +import org.aesh.readline.terminal.impl.Pty; import org.aesh.terminal.Attributes; -import org.aesh.terminal.Connection; import org.aesh.terminal.utils.ANSI; import org.apache.maven.artifact.Artifact; import org.apache.maven.execution.MavenSession; @@ -337,7 +337,7 @@ public class DevMojo extends AbstractMojo { private Attributes attributes; private int windowsAttributes; private boolean windowsAttributesSet; - private Connection connection; + private Pty pty; private boolean windowsColorSupport; @Override @@ -438,21 +438,15 @@ private void saveTerminalState() { } } } catch (Throwable t) { + //this only works with a proper PTY based terminal + //Aesh creates an input pump thread, that will steal + //input from the dev mode process try { - //this does not work on windows - //jansi creates an input pump thread, that will steal - //input from the dev mode process - new TerminalConnection(new Consumer<Connection>() { - @Override - public void accept(Connection connection) { - attributes = connection.getAttributes(); - DevMojo.this.connection = connection; - } - }); - } catch (IOException e) { - getLog().error( - "Failed to setup console restore, console may be left in an inconsistent state if the process is killed", - e); + Pty pty = ExecPty.current(); + attributes = pty.getAttr(); + DevMojo.this.pty = pty; + } catch (Exception e) { + getLog().debug("Failed to get a local tty", e); } } } @@ -461,16 +455,21 @@ private void restoreTerminalState() { if (windowsAttributesSet) { WindowsSupport.setConsoleMode(windowsAttributes); } else { - if (attributes == null || connection == null) { + if (attributes == null || pty == null) { return; } - connection.setAttributes(attributes); - int height = connection.size().getHeight(); - connection.write(ANSI.MAIN_BUFFER); - connection.write(ANSI.CURSOR_SHOW); - connection.write("\\u001B[0m"); - connection.write("\\033[" + height + ";0H"); - connection.close(); + Pty finalPty = pty; + try (finalPty) { + finalPty.setAttr(attributes); + int height = finalPty.getSize().getHeight(); + String sb = ANSI.MAIN_BUFFER + + ANSI.CURSOR_SHOW + + "\\u001B[0m" + + "\\033[" + height + ";0H"; + finalPty.getSlaveOutput().write(sb.getBytes(StandardCharsets.UTF_8)); + } catch (IOException e) { + getLog().error("Error restoring console state", e); + } } }
['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java']
{'.java': 1}
1
1
0
0
1
19,111,360
3,716,125
489,764
5,032
2,499
470
51
1
1,751
259
525
63
1
1
2021-11-08T22:57:04
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,592
quarkusio/quarkus/21281/21280
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21280
https://github.com/quarkusio/quarkus/pull/21281
https://github.com/quarkusio/quarkus/pull/21281
1
resolves
Warnings about `@io.quarkus.arc.runtime.devconsole.Monitored` on private methods
### Describe the bug I see several warnings about `@io.quarkus.arc.runtime.devconsole.Monitored` on private methods of Infinispan classes when using Quarkus main in dev mode. Noticed when looking into https://github.com/quarkusio/quarkus/pull/21267 I think these warnings should be eliminated, it's distraction when using dev mode. ``` 2021-11-08 16:24:34,262 WARN [io.qua.arc.pro.Methods] (build-14) @io.quarkus.arc.runtime.devconsole.Monitored will have no effect on method io.quarkus.infinispan.client.runtime.InfinispanClientProducer.builderFromProperties() because the method is private 2021-11-08 16:24:34,266 WARN [io.qua.arc.pro.Methods] (build-14) @io.quarkus.arc.runtime.devconsole.Monitored will have no effect on method io.quarkus.infinispan.client.runtime.InfinispanClientProducer.getRemoteAnnotation() because the method is private 2021-11-08 16:24:34,267 WARN [io.qua.arc.pro.Methods] (build-14) @io.quarkus.arc.runtime.devconsole.Monitored will have no effect on method io.quarkus.infinispan.client.runtime.InfinispanClientProducer.initialize() because the method is private 2021-11-08 16:24:34,271 WARN [io.qua.arc.pro.Methods] (build-14) @io.quarkus.arc.runtime.devconsole.Monitored will have no effect on method io.smallrye.config.inject.ConfigProducer.lambda$produceSupplierConfigValue$0() because the method is private ``` ### Expected behavior No warnings related to `@io.quarkus.arc.runtime.devconsole.Monitored` ### Actual behavior warnings present: ``` 2021-11-08 16:24:34,262 WARN [io.qua.arc.pro.Methods] (build-14) @io.quarkus.arc.runtime.devconsole.Monitored will have no effect on method io.quarkus.infinispan.client.runtime.InfinispanClientProducer.builderFromProperties() because the method is private 2021-11-08 16:24:34,266 WARN [io.qua.arc.pro.Methods] (build-14) @io.quarkus.arc.runtime.devconsole.Monitored will have no effect on method io.quarkus.infinispan.client.runtime.InfinispanClientProducer.getRemoteAnnotation() because the method is private 2021-11-08 16:24:34,267 WARN [io.qua.arc.pro.Methods] (build-14) @io.quarkus.arc.runtime.devconsole.Monitored will have no effect on method io.quarkus.infinispan.client.runtime.InfinispanClientProducer.initialize() because the method is private 2021-11-08 16:24:34,271 WARN [io.qua.arc.pro.Methods] (build-14) @io.quarkus.arc.runtime.devconsole.Monitored will have no effect on method io.smallrye.config.inject.ConfigProducer.lambda$produceSupplierConfigValue$0() because the method is private ``` ### How to Reproduce? mvn io.quarkus.platform:quarkus-maven-plugin:999-SNAPSHOT:create -DprojectGroupId=my-groupId -DprojectArtifactId=my-app -DprojectVersion=1.0.0-SNAPSHOT -DpackageName=org.my.group -DplatformGroupId=io.quarkus -DplatformArtifactId=quarkus-bom -DplatformVersion=999-SNAPSHOT -DquarkusRegistryClient=false -Dextensions=quarkus-infinispan-client,quarkus-micrometer mvn -f my-app quarkus:dev ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` Java 17 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev main ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
306c342116e83708eb7f4bde1dd705c5f1549c7e
16450533f18d80425bae125834808f5fd55b698f
https://github.com/quarkusio/quarkus/compare/306c342116e83708eb7f4bde1dd705c5f1549c7e...16450533f18d80425bae125834808f5fd55b698f
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java index 63dd492940a..930c8f40668 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java @@ -188,6 +188,20 @@ static Set<MethodInfo> addInterceptedMethodCandidates(BeanDeployment beanDeploym List<AnnotationInstance> methodLevelBindings = methodAnnnotations.stream() .flatMap(a -> beanDeployment.extractInterceptorBindings(a).stream()) .collect(Collectors.toList()); + if (Modifier.isPrivate(method.flags()) + && !methodLevelBindings.isEmpty() + && !Annotations.contains(methodAnnnotations, DotNames.OBSERVES) + && !Annotations.contains(methodAnnnotations, DotNames.OBSERVES_ASYNC)) { + if (merged.size() == 1) { + LOGGER.warnf("%s will have no effect on method %s.%s() because the method is private", + methodLevelBindings.iterator().next(), classInfo.name(), method.name()); + } else { + LOGGER.warnf("Annotations %s will have no effect on method %s.%s() because the method is private", + methodLevelBindings.stream().map(AnnotationInstance::toString).collect(Collectors.joining(",")), + classInfo.name(), method.name()); + } + + } merged.addAll(methodLevelBindings); for (AnnotationInstance classLevelBinding : classLevelBindings) { if (methodLevelBindings.isEmpty() @@ -197,30 +211,18 @@ static Set<MethodInfo> addInterceptedMethodCandidates(BeanDeployment beanDeploym } } if (!merged.isEmpty()) { - if (Modifier.isPrivate(method.flags())) { - if (merged.size() == 1) { - LOGGER.warnf("%s will have no effect on method %s.%s() because the method is private", - merged.iterator().next(), classInfo.name(), method.name()); + boolean addToCandidates = true; + if (Modifier.isFinal(method.flags())) { + if (transformUnproxyableClasses) { + methodsFromWhichToRemoveFinal.add(NameAndDescriptor.fromMethodInfo(method)); } else { - LOGGER.warnf("Annotations %s will have no effect on method %s.%s() because the method is private", - merged.stream().map(AnnotationInstance::toString).collect(Collectors.joining(",")), - classInfo.name(), method.name()); - } - - } else { - boolean addToCandidates = true; - if (Modifier.isFinal(method.flags())) { - if (transformUnproxyableClasses) { - methodsFromWhichToRemoveFinal.add(NameAndDescriptor.fromMethodInfo(method)); - } else { - addToCandidates = false; - finalMethodsFoundAndNotChanged.add(method); - } - } - if (addToCandidates) { - candidates.computeIfAbsent(new Methods.MethodKey(method), key -> merged); + addToCandidates = false; + finalMethodsFoundAndNotChanged.add(method); } } + if (addToCandidates) { + candidates.computeIfAbsent(new Methods.MethodKey(method), key -> merged); + } } } skipPredicate.methodsProcessed();
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java']
{'.java': 1}
1
1
0
0
1
19,110,617
3,715,987
489,748
5,032
2,802
443
44
1
3,249
271
903
57
1
2
2021-11-08T15:55:13
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,593
quarkusio/quarkus/21272/21245
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21245
https://github.com/quarkusio/quarkus/pull/21272
https://github.com/quarkusio/quarkus/pull/21272
1
fix
Quarkus Tests with SmallRye Health Extension Sometimes Fail When Run In Parallel
### Describe the bug After adding extension `io.quarkus:quarkus-smallrye-health` running multiple tests in parallel sometimes causes `NoSuchFileException`. ``` Caused by: java.nio.file.NoSuchFileException: /var/folders/1z/vlh4t0fj7qx8dldd244qst9w0000gp/T/quarkus/com.example/health-ui-no-such-file/io.smallrye/smallrye-health-ui/3.1.2/healthui.js at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219) at java.base/java.nio.file.Files.newByteChannel(Files.java:371) at java.base/java.nio.file.Files.newByteChannel(Files.java:422) at java.base/java.nio.file.Files.readAllBytes(Files.java:3206) at io.quarkus.smallrye.health.deployment.SmallRyeHealthProcessor.updateApiUrl(SmallRyeHealthProcessor.java:500) at io.quarkus.smallrye.health.deployment.SmallRyeHealthProcessor.registerUiExtension(SmallRyeHealthProcessor.java:436) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:821) ``` Best I can tell digging through the source, ui resources are being extracted from the `smallrye-health-ui` jar and put into a temporary directory, but that location is not unique per test and is being cleaned prior to extraction, so tests running in parallel can cause already extracted files to be deleted and subsequent errors on read. I'm running multiple tests in parallel in gradle with: ``` test { maxParallelForks = 4 } ``` This is still an issue even with the health ui is disabled via `quarkus.smallrye-health.ui.enable = false` ### Expected behavior Tests run in parallel do not fail due to the extension `io.quarkus:quarkus-smallrye-health` being applied. ### Actual behavior Build fails with above exception. ### How to Reproduce? [health-ui-no-such-file.zip](https://github.com/quarkusio/quarkus/files/7489383/health-ui-no-such-file.zip) The above project reproduces the issue pretty consistently for me just running `./gradlew build` ### Output of `uname -a` or `ver` Darwin WMac5205964 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "11.0.11" 2021-04-20 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.1.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 7.2 ### Additional information _No response_
c0d72e6aedee01365d4b1a0f6ae005ae61813b71
fa6d0200cfabab67bc3f6f611d4b322a30b9fc38
https://github.com/quarkusio/quarkus/compare/c0d72e6aedee01365d4b1a0f6ae005ae61813b71...fa6d0200cfabab67bc3f6f611d4b322a30b9fc38
diff --git a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java index cf0bac72245..efa2a2e4045 100644 --- a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java +++ b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java @@ -61,6 +61,7 @@ import io.quarkus.kubernetes.spi.KubernetesHealthReadinessPathBuildItem; import io.quarkus.kubernetes.spi.KubernetesHealthStartupPathBuildItem; import io.quarkus.maven.dependency.ResolvedDependency; +import io.quarkus.runtime.LaunchMode; import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem; import io.quarkus.smallrye.health.runtime.QuarkusAsyncHealthCheckFactory; import io.quarkus.smallrye.health.runtime.ShutdownReadinessListener; @@ -433,8 +434,10 @@ void registerUiExtension( Path tempPath = WebJarUtil.copyResourcesForDevOrTest(liveReloadBuildItem, curateOutcomeBuildItem, launchMode, artifact, HEALTH_UI_WEBJAR_PREFIX); - updateApiUrl(tempPath.resolve(JS_FILE_TO_UPDATE), healthPath); - updateApiUrl(tempPath.resolve(INDEX_FILE_TO_UPDATE), healthPath); + if (launchMode.equals(LaunchMode.DEVELOPMENT)) { + updateApiUrl(tempPath.resolve(JS_FILE_TO_UPDATE), healthPath); + updateApiUrl(tempPath.resolve(INDEX_FILE_TO_UPDATE), healthPath); + } smallRyeHealthBuildProducer .produce(new SmallRyeHealthBuildItem(tempPath.toAbsolutePath().toString(), healthUiPath));
['extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java']
{'.java': 1}
1
1
0
0
1
19,108,066
3,715,413
489,665
5,030
457
88
7
1
3,023
249
784
71
1
2
2021-11-08T13:25:56
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,594
quarkusio/quarkus/21270/21044
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21044
https://github.com/quarkusio/quarkus/pull/21270
https://github.com/quarkusio/quarkus/pull/21270
1
fix
Reactive routes incorrect json serialization
### Describe the bug Reactive routes resources returning invalid json when using `@RolesAllowed` annotation. Without the annotation its working fine. Its working fine using Quarkus 2.3 version ### Expected behavior API should return below JSON response ```javascript [ { "message": "Hello!" }, { "message": "Hola!" }, { "message": "Bonjour!" }, { "message": "Ciao!" } ] ``` ### Actual behavior Instead its returning ```javascript {"message":"Hello!"}{"message":"Hola!"}{"message":"Bonjour!"}{"message":"Ciao!"} ``` ### How to Reproduce? Reproducer: https://github.com/MM87037/reactive-routes Steps: 1. Run `mvn clean verify` to see the failure ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` OpenJDK Runtime Environment Temurin-17+35 (build 17+35) OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.0 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 ### Additional information _No response_
7c09477c193b0571d6ddab8371b99550dd00a1b0
03e4b49e6ab8beb82d3f349e7b661900e266c38f
https://github.com/quarkusio/quarkus/compare/7c09477c193b0571d6ddab8371b99550dd00a1b0...03e4b49e6ab8beb82d3f349e7b661900e266c38f
diff --git a/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java b/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java index 209d37d1ab4..7d2474d0730 100644 --- a/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java +++ b/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java @@ -41,7 +41,9 @@ public Object handle(InvocationContext ic) throws Exception { }).subscribeAsCompletionStage(); } else if (Multi.class.isAssignableFrom(returnType)) { return constrainer.nonBlockingCheck(ic.getMethod(), ic.getParameters()) - .onItem().transformToMulti(new MultiContinuation(ic)); + // Do not use transformToMulti as we want to preserve the type of multi produced by the user method. + // This is required for Reactive Routes to handle custom Multi serialization. + .toMulti().plug(x -> new MultiContinuation(ic).apply(x)); } else { constrainer.check(ic.getMethod(), ic.getParameters()); return ic.proceed();
['extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java']
{'.java': 1}
1
1
0
0
1
19,107,582
3,715,293
489,649
5,030
375
68
4
1
1,184
146
328
67
1
2
2021-11-08T12:42:08
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,597
quarkusio/quarkus/21143/21106
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21106
https://github.com/quarkusio/quarkus/pull/21143
https://github.com/quarkusio/quarkus/pull/21143
1
close
Gradle MulitModule Project: quarkusGenerateCodeTests: java.lang.NullPointerException
### Describe the bug on my [project](https://github.com/tower-projects/tower-web-template) use quarkus 2.2.1.Final,can be start success but,when upgrade to 2.4.0.Final to build has exception ``` Caused by: java.lang.NullPointerException at io.quarkus.gradle.builder.GradleApplicationModelBuilder.initProjectModule(GradleApplicationModelBuilder.java:487) at io.quarkus.gradle.builder.GradleApplicationModelBuilder.initProjectModuleAndBuildPaths(GradleApplicationModelBuilder.java:443) at io.quarkus.gradle.builder.GradleApplicationModelBuilder.collectDependencies(GradleApplicationModelBuilder.java:393) at io.quarkus.gradle.builder.GradleApplicationModelBuilder.lambda$collectDependencies$5(GradleApplicationModelBuilder.java:320) at io.quarkus.gradle.builder.GradleApplicationModelBuilder.collectDependencies(GradleApplicationModelBuilder.java:320) at io.quarkus.gradle.builder.GradleApplicationModelBuilder.buildAll(GradleApplicationModelBuilder.java:160) at io.quarkus.gradle.extension.QuarkusPluginExtension.create(QuarkusPluginExtension.java:217) at io.quarkus.gradle.extension.QuarkusPluginExtension.getApplicationModel(QuarkusPluginExtension.java:211) at io.quarkus.gradle.tasks.QuarkusGenerateCode.prepareQuarkus(QuarkusGenerateCode.java:91) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ``` ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? 1.clone my project [email protected]:tower-projects/tower-web-template.git 2. exec: ./gradlew clean quarkusDev -p server --stacktrace -x test ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
ceb133facb9d495b440f4e9a836702fc267198c1
ab48d75165e90c05d281acd0863c579f7c8a7a9f
https://github.com/quarkusio/quarkus/compare/ceb133facb9d495b440f4e9a836702fc267198c1...ab48d75165e90c05d281acd0863c579f7c8a7a9f
diff --git a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java index 5d4c13ba673..4b4f3a9a742 100644 --- a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java +++ b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java @@ -178,7 +178,6 @@ public static ResolvedDependency getProjectArtifact(Project project, LaunchMode final DefaultWorkspaceModule mainModule = new DefaultWorkspaceModule( new GAV(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getVersion()), project.getProjectDir(), project.getBuildDir()); - initProjectModule(project, mainModule, javaConvention.getSourceSets().findByName(SourceSet.MAIN_SOURCE_SET_NAME), false); if (mode.equals(LaunchMode.TEST)) { @@ -479,12 +478,17 @@ private void processQuarkusDependency(ResolvedDependencyBuilder artifactBuilder, private static void initProjectModule(Project project, DefaultWorkspaceModule module, SourceSet sourceSet, boolean test) { + if (sourceSet == null) { + return; + } + module.setBuildFiles(PathList.of(project.getBuildFile().toPath())); final FileCollection allClassesDirs = sourceSet.getOutput().getClassesDirs(); // some plugins do not add source directories to source sets and they may be missing from sourceSet.getAllJava() // see https://github.com/quarkusio/quarkus/issues/20755 final TaskCollection<AbstractCompile> compileTasks = project.getTasks().withType(AbstractCompile.class); + compileTasks.forEach(t -> { if (!t.getEnabled()) { return;
['devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java']
{'.java': 1}
1
1
0
0
1
19,029,477
3,700,894
487,743
5,013
71
15
6
1
2,235
130
525
61
1
1
2021-11-02T10:12:44
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,599
quarkusio/quarkus/21121/21120
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21120
https://github.com/quarkusio/quarkus/pull/21121
https://github.com/quarkusio/quarkus/pull/21121
1
closes
Unpredictable reactive controller behavior.
### Describe the bug I decided to refactor one of my service written in quarkus from blocking io to reactive manner. I have many mock controller which works perfectly before refactor but now some of them throws errors: ``` java.lang.NullPointerException: Cannot invoke "org.jboss.resteasy.reactive.server.mapping.RuntimeResource.getResourceClass()" because the return value of "org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext.getTarget()" is null at org.jboss.resteasy.reactive.server.core.ExceptionMapping.logBlockingErrorIfRequired(ExceptionMapping.java:103) at org.jboss.resteasy.reactive.server.core.ExceptionMapping.mapException(ExceptionMapping.java:95) at org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext.mapExceptionIfPresent(ResteasyReactiveRequestContext.java:340) at org.jboss.resteasy.reactive.server.handlers.ExceptionHandler.handle(ExceptionHandler.java:15) at org.jboss.resteasy.reactive.server.handlers.ExceptionHandler.handle(ExceptionHandler.java:9) at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141) at org.jboss.resteasy.reactive.server.handlers.RestInitialHandler.beginProcessing(RestInitialHandler.java:47) at org.jboss.resteasy.reactive.server.vertx.ResteasyReactiveVertxHandler.handle(ResteasyReactiveVertxHandler.java:17) at org.jboss.resteasy.reactive.server.vertx.ResteasyReactiveVertxHandler.handle(ResteasyReactiveVertxHandler.java:7) at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127) at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151) at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133) at io.quarkus.vertx.http.runtime.StaticResourcesRecorder.lambda$start$1(StaticResourcesRecorder.java:67) at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127) at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151) at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$5.handle(VertxHttpRecorder.java:351) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$5.handle(VertxHttpRecorder.java:329) at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127) at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151) at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133) at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:55) at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:37) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$10.handle(VertxHttpRecorder.java:443) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$10.handle(VertxHttpRecorder.java:440) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$1.handle(VertxHttpRecorder.java:151) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$1.handle(VertxHttpRecorder.java:133) at io.vertx.core.http.impl.Http1xServerRequestHandler.handle(Http1xServerRequestHandler.java:67) at io.vertx.core.http.impl.Http1xServerRequestHandler.handle(Http1xServerRequestHandler.java:30) at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:50) at io.vertx.core.impl.DuplicatedContext.emit(DuplicatedContext.java:168) at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:143) at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:155) at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:154) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93) at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:99) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.vertx.core.http.impl.Http1xUpgradeToH2CHandler.channelRead(Http1xUpgradeToH2CHandler.java:116) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:311) at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:432) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.vertx.core.http.impl.Http1xOrH2CHandler.end(Http1xOrH2CHandler.java:61) at io.vertx.core.http.impl.Http1xOrH2CHandler.channelRead(Http1xOrH2CHandler.java:38) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:831) ``` For example this controller doesn't work: ```java package pl.test.rest.recaptcha; import io.smallrye.mutiny.Uni; import pl.test.rest.recaptcha.model.SiteVerifyResponse; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.Date; @Path("/recaptcha/api/siteverify") public class MockResource { @POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Uni<SiteVerifyResponse> siteVerify(@FormParam("response") String response , @FormParam("secret") String secret, @FormParam("remoteip") String remoteip) { return Uni.createFrom().item(SiteVerifyResponse.builder() .success(true) .score((float) 1.0) .action("ACTION") .hostname("localhost") .challengeTs(new Date()) .build()); } } ``` But this work's: ```java package pl.test.rest.dotpay; import io.smallrye.mutiny.Uni; import lombok.val; import pl.test.rest.dotpay.model.PaymentEntry; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import java.util.Collections; import java.util.List; @Path("/s2/login/api/purchase_history/") public class MockResource { @GET @Produces(MediaType.APPLICATION_JSON) public Uni<List<PaymentEntry>> api(@QueryParam("email") String email) { return Uni.createFrom().item(Collections.singletonList(createPaymentEntry())); } private PaymentEntry createPaymentEntry() { val entry = new PaymentEntry(); entry.setDate("2018-06-09T16:54:15.855823"); entry.setAmount("8.29"); entry.setCurrency("PLN"); entry.setStatus("completed"); entry.setRequestIp("188.146.162.128"); entry.setMcc("4112"); entry.setChannel("73"); entry.setMerchantId("5d51e2dc7bc76cf9841d82ba404d134646bdbd97"); return entry; } } ``` The one thing what I'am done in refactor is change the return type to new one with wrapper Uni. I found on network similar error: https://github.com/quarkusio/quarkus/runs/3204982867 ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` Linux 5.13.0-20-generic #20-Ubuntu SMP Fri Oct 15 14:21:35 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` 16.0.2 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.6.2 ### Additional information _No response_
5c3ec06e41774c9f47f09ca74bffa8512832dea3
6cd9b08cdf4e5f4889bd7840670af2413ea513a0
https://github.com/quarkusio/quarkus/compare/5c3ec06e41774c9f47f09ca74bffa8512832dea3...6cd9b08cdf4e5f4889bd7840670af2413ea513a0
diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java index 1b08a3ec8c7..adb8f41f953 100644 --- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java +++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java @@ -161,7 +161,7 @@ public void run() { if (t instanceof PreserveTargetException) { handleException(t.getCause(), true); } else { - handleException(t); + handleException(t, true); } if (aborted) { return; diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ExceptionMapping.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ExceptionMapping.java index f1d0d44ea47..db68bf80bc7 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ExceptionMapping.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ExceptionMapping.java @@ -22,6 +22,7 @@ import org.jboss.logging.Logger; import org.jboss.resteasy.reactive.ResteasyReactiveClientProblem; import org.jboss.resteasy.reactive.common.model.ResourceExceptionMapper; +import org.jboss.resteasy.reactive.server.mapping.RuntimeResource; import org.jboss.resteasy.reactive.server.spi.ResteasyReactiveAsyncExceptionMapper; import org.jboss.resteasy.reactive.server.spi.ResteasyReactiveExceptionMapper; import org.jboss.resteasy.reactive.spi.BeanFactory; @@ -99,31 +100,46 @@ public void mapException(Throwable throwable, ResteasyReactiveRequestContext con private void logBlockingErrorIfRequired(Throwable throwable, ResteasyReactiveRequestContext context) { if (isBlockingProblem(throwable)) { - log.error("A blocking operation occurred on the IO thread. This likely means you need to annotate " - + context.getTarget().getResourceClass().getName() + "#" + context.getTarget().getJavaMethodName() + "(" - + Arrays.stream(context.getTarget().getParameterTypes()).map(Objects::toString) - .collect(Collectors.joining(", ")) - + ") with @" - + Blocking.class.getName() - + ". Alternatively you can annotate the class " + context.getTarget().getResourceClass().getName() - + " to make every method on the class blocking, or annotate your sub class of the " - + Application.class.getName() + " class to make the whole application blocking"); + RuntimeResource runtimeResource = context.getTarget(); + if (runtimeResource == null) { + log.error("A blocking operation occurred on the IO thread. This likely means you need to use the @" + + Blocking.class.getName() + " annotation on the Resource method, class or " + + Application.class.getName() + " class."); + } else { + log.error("A blocking operation occurred on the IO thread. This likely means you need to annotate " + + runtimeResource.getResourceClass().getName() + "#" + runtimeResource.getJavaMethodName() + "(" + + Arrays.stream(runtimeResource.getParameterTypes()).map(Objects::toString) + .collect(Collectors.joining(", ")) + + ") with @" + + Blocking.class.getName() + + ". Alternatively you can annotate the class " + runtimeResource.getResourceClass().getName() + + " to make every method on the class blocking, or annotate your sub class of the " + + Application.class.getName() + " class to make the whole application blocking"); + } } } private void logNonBlockingErrorIfRequired(Throwable throwable, ResteasyReactiveRequestContext context) { if (isNonBlockingProblem(throwable)) { - log.error( - "An operation that needed be run on a Vert.x EventLoop thread was run on a worker pool thread. This likely means you need to annotate " - + context.getTarget().getResourceClass().getName() + "#" + context.getTarget().getJavaMethodName() - + "(" - + Arrays.stream(context.getTarget().getParameterTypes()).map(Objects::toString) - .collect(Collectors.joining(", ")) - + ") with @" - + NonBlocking.class.getName() - + ". Alternatively you can annotate the class " + context.getTarget().getResourceClass().getName() - + " to make every method on the class run on a Vert.x EventLoop thread, or annotate your sub class of the " - + Application.class.getName() + " class to affect the entire application"); + RuntimeResource runtimeResource = context.getTarget(); + if (runtimeResource == null) { + log.error( + "An operation that needed be run on a Vert.x EventLoop thread was run on a worker pool thread. This likely means you use the @" + + NonBlocking.class.getName() + " annotation on the Resource method, class or " + + Application.class.getName() + " class."); + } else { + log.error( + "An operation that needed be run on a Vert.x EventLoop thread was run on a worker pool thread. This likely means you need to annotate " + + runtimeResource.getResourceClass().getName() + "#" + runtimeResource.getJavaMethodName() + + "(" + + Arrays.stream(runtimeResource.getParameterTypes()).map(Objects::toString) + .collect(Collectors.joining(", ")) + + ") with @" + + NonBlocking.class.getName() + + ". Alternatively you can annotate the class " + runtimeResource.getResourceClass().getName() + + " to make every method on the class run on a Vert.x EventLoop thread, or annotate your sub class of the " + + Application.class.getName() + " class to affect the entire application"); + } } }
['independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ExceptionMapping.java', 'independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java']
{'.java': 2}
2
2
0
0
2
18,989,813
3,693,964
486,937
5,007
4,787
766
58
2
10,811
427
2,319
196
1
3
2021-11-01T09:01:28
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,601
quarkusio/quarkus/21086/21083
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21083
https://github.com/quarkusio/quarkus/pull/21086
https://github.com/quarkusio/quarkus/pull/21086
1
fixes
Kafka Streams extension fails to compile with Kafka clients 3.0.0
### Describe the bug Quarkus application BOM doesn't have the Kafka client version 3.0.0 yet. When forced to be used with 3.0.0 KafkaStreams extension doesn't compile because of the removal of deprecated classes such as `PartitionAssignor` and `DefaultPartitionGrouper` ### Expected behavior Kafka extensions should continue to work with Kafka clients version 3.0.0 ### Actual behavior _No response_ ### How to Reproduce? 1. In kafka-streams-quickstart/producer, force dependency org.apache.kafka:kafka-clients:3.0.0 2. Compilation fails ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
b2721483f0647b1001667d2a04137733f3ae49ec
9ddd94639f06bdaaa8a2775c3e090daeccfcc654
https://github.com/quarkusio/quarkus/compare/b2721483f0647b1001667d2a04137733f3ae49ec...9ddd94639f06bdaaa8a2775c3e090daeccfcc654
diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java index 6ea3fc40bb4..98915dad001 100644 --- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java +++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java @@ -15,7 +15,6 @@ import org.apache.kafka.clients.consumer.RangeAssignor; import org.apache.kafka.clients.consumer.RoundRobinAssignor; import org.apache.kafka.clients.consumer.StickyAssignor; -import org.apache.kafka.clients.consumer.internals.PartitionAssignor; import org.apache.kafka.clients.producer.Partitioner; import org.apache.kafka.clients.producer.ProducerInterceptor; import org.apache.kafka.clients.producer.internals.DefaultPartitioner; @@ -123,6 +122,9 @@ public class KafkaProcessor { "org.apache.kafka.common.security.oauthbearer.internals.OAuthBearerSaslClientProvider" }).collect(Collectors.toSet()); + static final DotName PARTITION_ASSIGNER = DotName + .createSimple("org.apache.kafka.clients.consumer.internals.PartitionAssignor"); + @BuildStep FeatureBuildItem feature() { return new FeatureBuildItem(Feature.KAFKA_CLIENT); @@ -188,7 +190,7 @@ public void build( collectImplementors(toRegister, indexBuildItem, Deserializer.class); collectImplementors(toRegister, indexBuildItem, Partitioner.class); // PartitionAssignor is now deprecated, replaced by ConsumerPartitionAssignor - collectImplementors(toRegister, indexBuildItem, PartitionAssignor.class); + collectImplementors(toRegister, indexBuildItem, PARTITION_ASSIGNER); collectImplementors(toRegister, indexBuildItem, ConsumerPartitionAssignor.class); collectImplementors(toRegister, indexBuildItem, ConsumerInterceptor.class); collectImplementors(toRegister, indexBuildItem, ProducerInterceptor.class); @@ -467,6 +469,10 @@ private static void collectImplementors(Set<DotName> set, CombinedIndexBuildItem collectClassNames(set, indexBuildItem.getIndex().getAllKnownImplementors(DotName.createSimple(cls.getName()))); } + private static void collectImplementors(Set<DotName> set, CombinedIndexBuildItem indexBuildItem, DotName className) { + collectClassNames(set, indexBuildItem.getIndex().getAllKnownImplementors(className)); + } + private static void collectSubclasses(Set<DotName> set, CombinedIndexBuildItem indexBuildItem, Class<?> cls) { collectClassNames(set, indexBuildItem.getIndex().getAllKnownSubclasses(DotName.createSimple(cls.getName()))); } diff --git a/extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java b/extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java index 93774a61fbe..00b6d746a29 100644 --- a/extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java +++ b/extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java @@ -11,7 +11,6 @@ import org.apache.kafka.streams.StreamsConfig; import org.apache.kafka.streams.errors.DefaultProductionExceptionHandler; import org.apache.kafka.streams.errors.LogAndFailExceptionHandler; -import org.apache.kafka.streams.processor.DefaultPartitionGrouper; import org.apache.kafka.streams.processor.FailOnInvalidTimestamp; import org.apache.kafka.streams.processor.internals.StreamsPartitionAssignor; import org.rocksdb.RocksDBException; @@ -65,7 +64,9 @@ private void registerClassesThatAreLoadedThroughReflection(BuildProducer<Reflect private void registerCompulsoryClasses(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) { reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, false, StreamsPartitionAssignor.class)); - reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, false, DefaultPartitionGrouper.class)); + // Class DefaultPartitionGrouper deprecated in Kafka 2.8.x and removed in 3.0.0 + reflectiveClasses.produce( + new ReflectiveClassBuildItem(true, false, false, "org.apache.kafka.streams.processor.DefaultPartitionGrouper")); reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, false, DefaultProductionExceptionHandler.class)); reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, false, FailOnInvalidTimestamp.class)); reflectiveClasses.produce(new ReflectiveClassBuildItem(true, true, true,
['extensions/kafka-streams/deployment/src/main/java/io/quarkus/kafka/streams/deployment/KafkaStreamsProcessor.java', 'extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java']
{'.java': 2}
2
2
0
0
2
18,982,754
3,692,645
486,801
5,007
1,047
217
15
2
881
121
219
41
0
0
2021-10-29T10:42:51
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,612
quarkusio/quarkus/20965/20934
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20934
https://github.com/quarkusio/quarkus/pull/20965
https://github.com/quarkusio/quarkus/pull/20965
1
fixes
Error occurred while destroying instance of bean io.quarkus.oidc.client.OidcClients
### Describe the bug Hi! I discovered a problem with the oidc client that occurs when you shut down an application. I am using Quarkus version 2.3.0.Final and the dependency: ``` <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-oidc-client-filter</artifactId> </dependency> ``` The application.properties is the following: ``` quarkus.oidc-client.client-enabled=false quarkus.oidc-client.CITIZEN-MAPPING.auth-server-url=${API_GATEWAY_ORIGIN} quarkus.oidc-client.CITIZEN-MAPPING.token-path=/token quarkus.oidc-client.CITIZEN-MAPPING.discovery-enabled=false quarkus.oidc-client.CITIZEN-MAPPING.client-id=${CONSUMER_KEY} quarkus.oidc-client.CITIZEN-MAPPING.credentials.secret=${CONSUMER_SECRET} ``` The code in the filter-class: ``` @RequestScoped @Priority(Priorities.AUTHENTICATION) public class CitizenMappingOAuth2Filter implements ClientRequestFilter { @Inject @NamedOidcClient("CITIZEN-MAPPING") Tokens tokens; @Override public void filter(final ClientRequestContext requestContext) { requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, "Bearer " + tokens.getAccessToken()); } } ``` The code in the service-class: ``` @Path("/1.0") @RegisterProvider(CitizenMappingOAuth2Filter.class) @RegisterRestClient(configKey = "CITIZEN-MAPPING") @ApplicationScoped public interface CitizenMappingService { @GET @Path("/citizenmapping/{personId}/personalnumber") @Produces(MediaType.TEXT_PLAIN) String getPersonalNumber(@PathParam String personId); } ``` I run my application in a docker-container and starts the container with `docker-compose up` and shutdown the application with `docker-compose down`. The problem that occurs is the following: ``` 2021-10-21 10:15:10,044 ERROR [io.qua.arc.imp.InstanceHandleImpl] (Shutdown thread) Error occurred while destroying instance of bean [io.quarkus.oidc.client.OidcClients_777be49f5563055569a690ceca758ae0746df06b_Synthetic_Bean]: io.quarkus.oidc.client.runtime.DisabledOidcClientException: 'Default' client configuration is disabled ``` The problem only occurs if I start the application, run the code that uses oidc client and then shut it down. It doesn't occurs if I just start the application and then shut it down. ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
856f4bc5ed2b38a0d0ad12af1ca1cd59a78f9123
b2c4566920135d8411f5c91d5983fd67f25f2dd6
https://github.com/quarkusio/quarkus/compare/856f4bc5ed2b38a0d0ad12af1ca1cd59a78f9123...b2c4566920135d8411f5c91d5983fd67f25f2dd6
diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java index 58c5b1e234d..70a586ce339 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java @@ -217,7 +217,6 @@ public Uni<Tokens> refreshTokens(String refreshToken) { @Override public void close() throws IOException { - throw new DisabledOidcClientException(message); } } }
['extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java']
{'.java': 1}
1
1
0
0
1
18,947,706
3,685,973
485,946
5,001
60
11
1
1
2,752
259
680
99
0
5
2021-10-25T05:03:39
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,602
quarkusio/quarkus/21071/19086
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/19086
https://github.com/quarkusio/quarkus/pull/21071
https://github.com/quarkusio/quarkus/pull/21071
1
fix
gradle module build execution fails when using composing build
### Describe the bug If I build my module with gradle [composite build](https://docs.gradle.org/current/userguide/composite_builds.html) the task fails. ### Expected behavior build task should complete without errors ### Actual behavior the task fails with the following message: ``` Execution failed for task ':my-module:quarkusGenerateCode'. > Failed to process /Users/...../somelib.jar ``` The file is actually there after the build fails, so I guess the task is looking for that file too soon. ### How to Reproduce? I do apologize, but the two projects are private so I don't have an easy way to create an environment where to reproduce the error ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` OpenJDK Runtime Environment GraalVM CE 21.0.0.2 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.0.3.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 6.8.3 ### Additional information _No response_
05c8824a607ce1bb613d56ae58b9057840a62d9a
55397b78c34efe10ece5721fcc97231f6d9f2876
https://github.com/quarkusio/quarkus/compare/05c8824a607ce1bb613d56ae58b9057840a62d9a...55397b78c34efe10ece5721fcc97231f6d9f2876
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java index 08cd5ac618d..913565876bf 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java @@ -234,16 +234,6 @@ public void execute(Task test) { testSourceSet.getJava().srcDir( new File(generatedTestSourceSet.getJava().getClassesDirectory().get().getAsFile(), provider)); } - - // enable the Panache annotation processor on the classpath, if it's found among the dependencies - configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) - .getResolutionStrategy().eachDependency(d -> { - if ("quarkus-panache-common".equals(d.getTarget().getName()) - && "io.quarkus".equals(d.getTarget().getGroup())) { - project.getDependencies().add("annotationProcessor", d.getRequested().getGroup() + ":" - + d.getRequested().getName() + ":" + d.getRequested().getVersion()); - } - }); }); project.getPlugins().withId("org.jetbrains.kotlin.jvm", plugin -> { @@ -266,6 +256,13 @@ private void registerConditionalDependencies(Project project) { .declareConditionalDependencies(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME); deploymentClasspathBuilder.createBuildClasspath(implementationExtensions, JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME); + // enable the Panache annotation processor on the classpath, if it's found among the dependencies + for (ExtensionDependency extension : implementationExtensions) { + if ("quarkus-panache-common".equals(extension.getName()) && "io.quarkus".equals(extension.getGroup())) { + project.getDependencies().add(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME, + extension.asDependencyNotation()); + } + } }); project.getConfigurations().getByName(DEV_MODE_CONFIGURATION_NAME).getIncoming().beforeResolve((devDependencies) -> { Set<ExtensionDependency> devModeExtensions = conditionalDependenciesEnabler diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java index 6b81a298736..f454df6c340 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java @@ -94,6 +94,14 @@ public String toModuleName() { return String.join(":", this.extensionId.getGroup(), this.extensionId.getName()); } + public String getGroup() { + return extensionId.getGroup(); + } + + public String getName() { + return extensionId.getName(); + } + @Override public boolean equals(Object o) { if (this == o)
['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/dependency/ExtensionDependency.java', 'devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java']
{'.java': 2}
2
2
0
0
2
18,981,927
3,692,485
486,780
5,006
1,511
241
25
2
1,063
151
260
43
1
1
2021-10-28T15:46:10
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,603
quarkusio/quarkus/21064/21025
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21025
https://github.com/quarkusio/quarkus/pull/21064
https://github.com/quarkusio/quarkus/pull/21064
1
fixes
quarkus.config.locations was 'null' at build time and is now '/mnt/app-config-map'
### Describe the bug As a workaround for https://github.com/quarkusio/quarkus/issues/20830, I've added the following entries to my pom.xml: ```xml <!-- secrets --> <quarkus.kubernetes.secret-volumes.app-secret.secret-name>my-secret</quarkus.kubernetes.secret-volumes.app-secret.secret-name> <quarkus.kubernetes.mounts.app-secret.path>/mnt/app-secret</quarkus.kubernetes.mounts.app-secret.path> <quarkus.kubernetes.env.vars.SMALLRYE_CONFIG_SOURCE_FILE_LOCATIONS>/mnt/app-secret</quarkus.kubernetes.env.vars.SMALLRYE_CONFIG_SOURCE_FILE_LOCATIONS> <!-- config map --> <quarkus.kubernetes.app-config-map>my-config</quarkus.kubernetes.app-config-map> ``` Which the `quarkus-kubernetes` extension turn into the following env var and volumes in the generated `kubernetete.yaml` file: ```yaml apiVersion: "apps/v1" kind: "Deployment" spec: spec: containers: - env: - name: "KUBERNETES_NAMESPACE" valueFrom: fieldRef: fieldPath: "metadata.namespace" - name: "SMALLRYE_CONFIG_SOURCE_FILE_LOCATIONS" value: "/mnt/app-secret" - name: "SMALLRYE_CONFIG_LOCATIONS" value: "/mnt/app-config" volumes: - name: "app-secret" secret: secretName: "my-secret" - name: "app-config" configMap: name: "my-config" ``` When the pods starts, a warning appears: ``` WARN [io.quarkus.runtime.configuration.ConfigRecorder] (main) Build time property cannot be changed at runtime: quarkus.config.locations was 'null' at build time and is now '/mnt/app-config' ``` ### Expected behavior The warning should not appear ### Actual behavior The warning appear ### How to Reproduce? - create a project with quarkus-kubernetes as described in https://quarkus.io/guides/deploying-to-kubernetes (but using 2.4.0.CR1 as platfomr version) - add the maven properties as described to the generated pom - ./mvnw package - export SMALLRYE_CONFIG_SOURCE_FILE_LOCATIONS=/tmp - export SMALLRYE_CONFIG_LOCATIONS=/tmp - java -jar target/quarkus-app/quarkus-run.jar ### Output of `uname -a` or `ver` Linux moon 5.14.10-300.fc35.x86_64 #1 SMP Thu Oct 7 20:48:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment 18.9 (build 11.0.12+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /home/luca/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1 Java version: 11.0.12, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-4.fc35.x86_64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.14.10-300.fc35.x86_64", arch: "amd64", family: "unix" ### Additional information _No response_
05c8824a607ce1bb613d56ae58b9057840a62d9a
2e38c967158010e0f00ecd00afb5d12187c92bd4
https://github.com/quarkusio/quarkus/compare/05c8824a607ce1bb613d56ae58b9057840a62d9a...2e38c967158010e0f00ecd00afb5d12187c92bd4
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java index a896fd845ef..ebdaed9d9b0 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java @@ -1,24 +1,30 @@ package io.quarkus.deployment.steps; +import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_LOCATIONS; + import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; +import org.eclipse.microprofile.config.ConfigProvider; + import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem; -import io.quarkus.runtime.ConfigConfig; import io.quarkus.runtime.LiveReloadConfig; class DevModeBuildStep { @BuildStep - List<HotDeploymentWatchedFileBuildItem> watchChanges(ConfigConfig config, LiveReloadConfig liveReloadConfig) { + List<HotDeploymentWatchedFileBuildItem> watchChanges(LiveReloadConfig liveReloadConfig) { List<String> names = new ArrayList<>(); names.add("META-INF/microprofile-config.properties"); names.add("application.properties"); names.add(Paths.get(".env").toAbsolutePath().toString()); - config.locations.ifPresent(names::addAll); + Optional<List<String>> locations = ConfigProvider.getConfig().getOptionalValues(SMALLRYE_CONFIG_LOCATIONS, + String.class); + locations.ifPresent(names::addAll); liveReloadConfig.watchedResources.ifPresent(names::addAll); return names.stream().map(HotDeploymentWatchedFileBuildItem::new).collect(Collectors.toList()); } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java index 79339c9d9ec..20400b34fb2 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java @@ -1,15 +1,19 @@ package io.quarkus.deployment.steps; +import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_LOCATIONS; + import java.nio.file.Paths; +import java.util.List; +import java.util.Optional; import org.apache.commons.io.FilenameUtils; +import org.eclipse.microprofile.config.ConfigProvider; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem; import io.quarkus.deployment.builditem.LaunchModeBuildItem; import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem; -import io.quarkus.runtime.ConfigConfig; import io.quarkus.runtime.LaunchMode; public class ProfileBuildStep { @@ -22,7 +26,6 @@ RunTimeConfigurationDefaultBuildItem defaultProfile(LaunchModeBuildItem launchMo @BuildStep void watchProfileSpecificFile(LaunchModeBuildItem launchModeBuildItem, - ConfigConfig config, BuildProducer<HotDeploymentWatchedFileBuildItem> items) { String activeProfile = getProfileValue(launchModeBuildItem.getLaunchMode()); String suffixedApplicationProperties = String.format("application-%s.properties", activeProfile); @@ -31,8 +34,10 @@ void watchProfileSpecificFile(LaunchModeBuildItem launchModeBuildItem, Paths.get(String.format(".env-%s", activeProfile)).toAbsolutePath().toString())); items.produce(new HotDeploymentWatchedFileBuildItem(Paths .get(System.getProperty("user.dir"), "config", suffixedApplicationProperties).toAbsolutePath().toString())); - if (config.locations.isPresent()) { - for (String location : config.locations.get()) { + Optional<List<String>> locations = ConfigProvider.getConfig().getOptionalValues(SMALLRYE_CONFIG_LOCATIONS, + String.class); + if (locations.isPresent()) { + for (String location : locations.get()) { items.produce(new HotDeploymentWatchedFileBuildItem(appendProfileToFilename(location, activeProfile))); } } diff --git a/core/runtime/src/main/java/io/quarkus/runtime/ConfigConfig.java b/core/runtime/src/main/java/io/quarkus/runtime/ConfigConfig.java index 6ebbd950821..1eca98398de 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/ConfigConfig.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/ConfigConfig.java @@ -14,7 +14,7 @@ * Relocation of the Config configurations to the Quarkus namespace is done in * {@link io.quarkus.runtime.configuration.ConfigUtils#configBuilder}. */ -@ConfigRoot(name = ConfigItem.PARENT, phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) +@ConfigRoot(name = ConfigItem.PARENT, phase = ConfigPhase.RUN_TIME) public class ConfigConfig { /** * Additional config locations to be loaded with the Config. The configuration support multiple locations
['core/runtime/src/main/java/io/quarkus/runtime/ConfigConfig.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java']
{'.java': 3}
3
3
0
0
3
18,981,927
3,692,485
486,780
5,006
1,421
286
27
3
3,140
286
911
94
2
3
2021-10-28T12:44:29
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,604
quarkusio/quarkus/21028/21008
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21008
https://github.com/quarkusio/quarkus/pull/21028
https://github.com/quarkusio/quarkus/pull/21028
1
resolves
Iterating over a list of enums generated by Qute Namespace Extensions no longer works
### Describe the bug We leverage Qute Namespace extensions to populate a list or dropdown with values from an enum. See https://quarkus.io/version/main/guides/qute-reference#namespace_extension_methods ```java public enum State { OPEN("Open"), CLOSED("Closed"); private final String displayName; State(String displayName) { this.displayName = displayName; } public String getDisplayName() { return displayName; } } ``` ```java @TemplateExtension(namespace = "domain") public static class DomainExtensions { static Set<State> states() { return EnumSet.allOf(State.class); } } ``` ```html <ul> {#for state in domain:states} <li>{state.displayName}</li> {/for} </ul> ``` However this now results in an exception, also when we use checked templates. ``` [1] Incorrect expression found: {state.displayName} - property/method [displayName] not found on class [java.util.Set<nl.wjglerum.SomePage$State>] nor handled by an extension method - at page.qute.html:31 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:186) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:829) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {state.displayName} - property/method [displayName] not found on class [java.util.Set<nl.wjglerum.SomePage$State>] nor handled by an extension method - at page.qute.html:31 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:166) ... 11 more ``` It does work correctly when you just want to render the enums, but as soon as you call a property from the enum it fails. It looks like Qute incorrectly tries to find this (virtual) method on the Set or List instance instead of the enum in the collection. This used to work up until version 2.4.0.CR1 but just failed on the latest snapshot build from the main branch. ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information Sample project: [quarkus-qute-enum.zip](https://github.com/quarkusio/quarkus/files/7417590/quarkus-qute-enum.zip)
fa595c735958a307b0e25563078a258e922c89ed
5a3e0b0f7a7cf8c2ccd82304b2963ca6c7ea9c00
https://github.com/quarkusio/quarkus/compare/fa595c735958a307b0e25563078a258e922c89ed...5a3e0b0f7a7cf8c2ccd82304b2963ca6c7ea9c00
diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java index 796acb8de6c..c9c68d7c169 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java @@ -674,6 +674,15 @@ static Match validateNestedExpressions(TemplateAnalysis templateAnalysis, ClassI ClassInfo returnType = index.getClassByName(method.returnType().name()); if (returnType != null) { match.setValues(returnType, method.returnType()); + if (root.hasHints()) { + // Root is a property with hint + // E.g. 'it<loop#123>' and 'STATUS<when#123>' + if (processHints(templateAnalysis, root.asHintInfo().hints, match, index, expression, + generatedIdsToMatches, incorrectExpressions)) { + // In some cases it's necessary to reset the iterator + iterator = parts.iterator(); + } + } } else { // Return type not available return putResult(match, results, expression); diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/NamespaceTemplateExtensionTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/NamespaceTemplateExtensionTest.java index 4e0525f6f58..35d7d921239 100644 --- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/NamespaceTemplateExtensionTest.java +++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/NamespaceTemplateExtensionTest.java @@ -3,10 +3,14 @@ import static io.quarkus.qute.TemplateExtension.ANY; import static org.junit.jupiter.api.Assertions.assertEquals; +import java.util.EnumSet; +import java.util.Set; + import javax.enterprise.event.TransactionPhase; import javax.inject.Inject; import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -20,6 +24,9 @@ public class NamespaceTemplateExtensionTest { @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) + .addAsResource(new StringAsset( + "{#for state in domain:states}{state.foo}{/for}"), + "templates/foo.html") .addClasses(StringExtensions.class, MyEnum.class, EnumExtensions.class)); @Inject @@ -43,6 +50,8 @@ public void testTemplateExtensions() { engine.parse("{str:quark}").render()); assertEquals("QUARKUS!", engine.parse("{str:quarkus}").render()); + assertEquals("openclosed", + engine.getTemplate("foo").render()); } @TemplateExtension(namespace = "str") @@ -73,9 +82,17 @@ static String quarkAny(String key) { } public enum MyEnum { - ONE, TWO + } + + public enum State { + OPEN, + CLOSED; + + public String getFoo() { + return toString().toLowerCase(); + } } @@ -91,6 +108,11 @@ static TransactionPhase enumValue(String value) { return TransactionPhase.valueOf(value); } + @TemplateExtension(namespace = "domain") + static Set<State> states() { + return EnumSet.allOf(State.class); + } + } }
['extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/NamespaceTemplateExtensionTest.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java']
{'.java': 2}
2
2
0
0
2
18,971,432
3,690,493
486,576
5,006
554
92
9
1
3,369
304
790
104
2
4
2021-10-27T08:06:04
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,606
quarkusio/quarkus/20997/20979
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20979
https://github.com/quarkusio/quarkus/pull/20997
https://github.com/quarkusio/quarkus/pull/20997
1
fixes
@RolesAllowed causes CompletionStage to be serialized as itself
### Describe the bug Consider the following method: @GET @Path("protected") @Produces(MediaType.APPLICATION_JSON) @RolesAllowed("protected-role") public CompletionStage<String> getProtected() { return CompletableFuture.completedFuture("{}"); } The CompletionStage is actually serialized instead of its result. ### Expected behavior The result should be serialized, that is the string `{}` should be returned by the endpoint: ``` HTTP/1.1 200 OK Content-Type: application/json content-length: 2 {} ``` ### Actual behavior The serialized JSON is that of the CompletionStage: ``` HTTP/1.1 200 OK Content-Type: application/json content-length: 85 { "cancelled": false, "done": true, "completedExceptionally": false, "numberOfDependents": 0 } ``` In a QuarkusTest I actually get a different error than while running the application: ``` 2021-10-25 13:33:02,686 ERROR [org.jbo.res.res.i18n] (executor-thread-0) RESTEASY002020: Unhandled asynchronous exception, sending back 500: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Invalid type definition for type `java.util.concurrent.CompletableFuture$MinimalStage`: Failed to construct BeanSerializer for [simple type, class java.util.concurrent.CompletableFuture$MinimalStage]: (java.lang.reflect.InaccessibleObjectException) Unable to make public boolean java.util.concurrent.CompletableFuture$MinimalStage.isCancelled() accessible: module java.base does not "opens java.util.concurrent" to unnamed module @328e4ec2 at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:72) ... ``` ### How to Reproduce? https://github.com/antoniomacri/quarkus-completionstage-rolesallowed ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` Java 11 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Maven 3.8.1 ### Additional information _No response_
e6275f1c444ced3fe18dead7de24c59605e67055
599096275581642aa15b07c29a5ce5070d40e9e4
https://github.com/quarkusio/quarkus/compare/e6275f1c444ced3fe18dead7de24c59605e67055...599096275581642aa15b07c29a5ce5070d40e9e4
diff --git a/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/CDIAccessDefaultTest.java b/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/CDIAccessDefaultTest.java index 60e9a2eb516..757223d2b5b 100644 --- a/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/CDIAccessDefaultTest.java +++ b/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/CDIAccessDefaultTest.java @@ -6,6 +6,8 @@ import static io.quarkus.security.test.utils.SecurityTestUtils.assertFailureFor; import static io.quarkus.security.test.utils.SecurityTestUtils.assertSuccess; +import java.util.concurrent.ExecutionException; + import javax.inject.Inject; import javax.inject.Named; @@ -13,6 +15,7 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import org.junit.jupiter.api.function.Executable; import io.quarkus.security.ForbiddenException; import io.quarkus.security.UnauthorizedException; @@ -73,6 +76,33 @@ public void shouldRestrictAccessToSpecificRole() { assertSuccess(() -> bean.securedMethod(), "accessibleForAdminOnly", ADMIN); } + @Test + public void shouldRestrictAccessToSpecificRoleUni() { + assertFailureFor(() -> bean.securedMethodUni().await().indefinitely(), UnauthorizedException.class, ANONYMOUS); + assertFailureFor(() -> bean.securedMethodUni().await().indefinitely(), ForbiddenException.class, USER); + assertSuccess(() -> bean.securedMethodUni().await().indefinitely(), "accessibleForAdminOnly", ADMIN); + } + + @Test + public void shouldRestrictAccessToSpecificRoleCompletionState() { + Executable executable = () -> { + try { + bean.securedMethodCompletionStage().toCompletableFuture().get(); + } catch (ExecutionException e) { + throw e.getCause(); + } + }; + assertFailureFor(executable, UnauthorizedException.class, ANONYMOUS); + assertFailureFor(executable, ForbiddenException.class, USER); + assertSuccess(() -> { + try { + return bean.securedMethodCompletionStage().toCompletableFuture().get(); + } catch (InterruptedException | ExecutionException e) { + throw new RuntimeException(e); + } + }, "accessibleForAdminOnly", ADMIN); + } + @Test public void shouldFailToAccessForbiddenOnClass() { assertFailureFor(() -> denyAllBean.noAdditionalConstraints(), UnauthorizedException.class, ANONYMOUS); diff --git a/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/app/BeanWithSecuredMethods.java b/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/app/BeanWithSecuredMethods.java index 8dca89dfe04..987620fa5e9 100644 --- a/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/app/BeanWithSecuredMethods.java +++ b/extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/app/BeanWithSecuredMethods.java @@ -1,10 +1,14 @@ package io.quarkus.security.test.cdi.app; +import java.util.concurrent.CompletionStage; + import javax.annotation.security.DenyAll; import javax.annotation.security.RolesAllowed; import javax.enterprise.context.ApplicationScoped; import javax.inject.Named; +import io.smallrye.mutiny.Uni; + /** * @author Michal Szynkiewicz, [email protected] */ @@ -23,6 +27,16 @@ public String securedMethod() { return "accessibleForAdminOnly"; } + @RolesAllowed("admin") + public Uni<String> securedMethodUni() { + return Uni.createFrom().item("accessibleForAdminOnly"); + } + + @RolesAllowed("admin") + public CompletionStage<String> securedMethodCompletionStage() { + return Uni.createFrom().item("accessibleForAdminOnly").subscribeAsCompletionStage(); + } + public String unsecuredMethod() { return "accessibleForAll"; } diff --git a/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java b/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java index 0a58e6fed97..209d37d1ab4 100644 --- a/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java +++ b/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java @@ -1,6 +1,5 @@ package io.quarkus.security.runtime.interceptor; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; import java.util.function.Function; @@ -33,8 +32,13 @@ public Object handle(InvocationContext ic) throws Exception { .onItem().transformToUni(new UniContinuation(ic)); } else if (CompletionStage.class.isAssignableFrom(returnType)) { return constrainer.nonBlockingCheck(ic.getMethod(), ic.getParameters()) - .subscribeAsCompletionStage() - .thenApply(new CompletionStageContinuation(ic)); + .onItem().transformToUni((s) -> { + try { + return Uni.createFrom().completionStage((CompletionStage<?>) ic.proceed()); + } catch (Exception e) { + throw new RuntimeException(e); + } + }).subscribeAsCompletionStage(); } else if (Multi.class.isAssignableFrom(returnType)) { return constrainer.nonBlockingCheck(ic.getMethod(), ic.getParameters()) .onItem().transformToMulti(new MultiContinuation(ic)); @@ -65,23 +69,6 @@ public Uni<?> apply(Object o) { } } - private static class CompletionStageContinuation implements Function<Object, CompletionStage<?>> { - private final InvocationContext ic; - - CompletionStageContinuation(InvocationContext invocationContext) { - ic = invocationContext; - } - - @Override - public CompletionStage<?> apply(Object o) { - try { - return (CompletionStage<?>) ic.proceed(); - } catch (Exception e) { - return CompletableFuture.failedFuture(e); - } - } - } - private static class MultiContinuation implements Function<Object, Multi<?>> { private final InvocationContext ic;
['extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/app/BeanWithSecuredMethods.java', 'extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java', 'extensions/security/deployment/src/test/java/io/quarkus/security/test/cdi/CDIAccessDefaultTest.java']
{'.java': 3}
3
3
0
0
3
18,974,131
3,691,129
486,625
5,006
1,107
173
27
1
2,133
207
494
76
1
3
2021-10-26T00:40:44
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,607
quarkusio/quarkus/20996/20866
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20866
https://github.com/quarkusio/quarkus/pull/20996
https://github.com/quarkusio/quarkus/pull/20996
1
fixes
~580 INFO messages from datasource dev service when no Docker available
### Describe the bug I see ~580 INFO messages from datasource dev service when no Docker available and running latest Quarkus in dev mode. Log messages are printed within 1 minute window, after that no new messages appear. ``` ... 2021-10-19 13:58:22,820 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:22,922 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,024 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,126 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,227 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,330 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,433 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,536 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,639 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,742 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,846 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:23,950 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:24,053 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 2021-10-19 13:58:24,155 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375 ... ``` ### Expected behavior One message about unavailable Docker could be enough. Alternative solution could be less frequent logging, e.g. once per 5 or 10 seconds. ### Actual behavior ~580 INFO messages when no Docker available, printed within 1 minute window, after that no new messages appear. `INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375` ### How to Reproduce? - Generate project with `quarkus-jdbc-postgresql` - Make sure no Docker / podman is running - run `mvn quarkus:dev` - Check the console output Look for `INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-1) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375` ### Output of `uname -a` or `ver` macOS BigSur ### Output of `java -version` Java 11 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.3.0.Final / 999-SNAPSHOT ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
5caf0dbe786c899d47f99ab1147ebf85f771f275
ffa1151a81160830b359268fbcc6d714c54fa9f2
https://github.com/quarkusio/quarkus/compare/5caf0dbe786c899d47f99ab1147ebf85f771f275...ffa1151a81160830b359268fbcc6d714c54fa9f2
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java b/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java index 2f241e9b8f5..7c10c563dfa 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java @@ -71,7 +71,10 @@ private TestContainersStrategy(boolean silent) { @Override public Result get() { - StartupLogCompressor compressor = new StartupLogCompressor("Checking Docker Environment", Optional.empty(), null); + //testcontainers uses the Unreliables library to test if docker is started + //this runs in threads that start with 'ducttape' + StartupLogCompressor compressor = new StartupLogCompressor("Checking Docker Environment", Optional.empty(), null, + (s) -> s.getName().startsWith("ducttape")); try { Class<?> dockerClientFactoryClass = Thread.currentThread().getContextClassLoader() .loadClass("org.testcontainers.DockerClientFactory"); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/console/StartupLogCompressor.java b/core/deployment/src/main/java/io/quarkus/deployment/console/StartupLogCompressor.java index 24d163e547c..75760253249 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/console/StartupLogCompressor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/console/StartupLogCompressor.java @@ -6,6 +6,7 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.BiPredicate; +import java.util.function.Predicate; import io.quarkus.deployment.dev.testing.MessageFormat; import io.quarkus.deployment.logging.LoggingSetupBuildItem; @@ -24,10 +25,19 @@ public class StartupLogCompressor implements Closeable, BiPredicate<String, Bool final StatusLine sl; final List<String> toDump = new ArrayList<>(); final AtomicInteger COUNTER = new AtomicInteger(); + final Predicate<Thread> additionalThreadPredicate; public StartupLogCompressor(String name, @SuppressWarnings("unused") Optional<ConsoleInstalledBuildItem> consoleInstalledBuildItem, @SuppressWarnings("unused") LoggingSetupBuildItem loggingSetupBuildItem) { + this(name, consoleInstalledBuildItem, loggingSetupBuildItem, (s) -> false); + } + + public StartupLogCompressor(String name, + @SuppressWarnings("unused") Optional<ConsoleInstalledBuildItem> consoleInstalledBuildItem, + @SuppressWarnings("unused") LoggingSetupBuildItem loggingSetupBuildItem, + Predicate<Thread> additionalThreadPredicate) { + this.additionalThreadPredicate = additionalThreadPredicate; if (QuarkusConsole.INSTANCE.isAnsiSupported()) { QuarkusConsole.installRedirects(); this.name = name; @@ -68,7 +78,8 @@ public boolean test(String s, Boolean errorStream) { //not installed return true; } - if (Thread.currentThread() == thread) { + Thread current = Thread.currentThread(); + if (current == this.thread || additionalThreadPredicate.test(current)) { toDump.add(s); sl.setMessage(MessageFormat.BLUE + name + MessageFormat.RESET + " " + s.replace("\\n", "")); return false;
['core/deployment/src/main/java/io/quarkus/deployment/console/StartupLogCompressor.java', 'core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java']
{'.java': 2}
2
2
0
0
2
18,973,310
3,690,985
486,605
5,006
1,203
220
18
2
4,583
405
1,338
69
0
1
2021-10-25T23:40:14
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,608
quarkusio/quarkus/20995/17034
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17034
https://github.com/quarkusio/quarkus/pull/20995
https://github.com/quarkusio/quarkus/pull/20995
1
fixes
List<PathSegment> exception on RESTEasy Reactive
## Describe the bug As I asked in [Zulip](https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/PathSegment.20exception.20on.20RESTEasy.20Reactive), I wanted to use `List<PathSegment>` with RESTEasy Reactive extension to use @PathParam and Regular Expressions. i.e. @Path("{keyword:.*}") https://docs.jboss.org/resteasy/docs/4.6.0.Final/userguide/html_single/index.html#_PathParam_and_PathSegment But I'm getting exceptions as below: https://github.com/tedwon/quarkus-resteasy-reactive-with-pathsegment/blob/master/README.adoc It is working properly with `@PathParam("id") PathSegment id`: https://github.com/tedwon/quarkus-resteasy-reactive-with-pathsegment/blob/master/src/main/java/org/acme/getting/started/ReactiveGreetingResource.java#L51-L55 However, getting errors `java.lang.RuntimeException: Failed to find converter for javax.ws.rs.core.PathSegment` with `@PathParam("keyword") List<PathSegment> keywords` while startup Quarkus. https://github.com/tedwon/quarkus-resteasy-reactive-with-pathsegment/blob/master/src/main/java/org/acme/getting/started/ReactiveGreetingResource.java#L57-L61 Note that it is working properly for the same code with List<PathSegment> on my other Quarkus app with quarkus-resteasy extension. ### Expected behavior No exception for the usage of List<PathSegment> with quarkus-resteasy extension ### Actual behavior ~~~ 2021-05-02 02:16:02,416 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor#setupEndpoints threw an exception: java.lang.RuntimeException: java.lang.RuntimeException: Failed to process method org.acme.getting.started.ReactiveGreetingResource#java.lang.String searchByKeywords(java.util.List<javax.ws.rs.core.PathSegment> keywords) at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:238) at io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor.setupEndpoints(ResteasyReactiveProcessor.java:402) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452) at java.base/java.lang.Thread.run(Thread.java:834) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Caused by: java.lang.RuntimeException: Failed to process method org.acme.getting.started.ReactiveGreetingResource#java.lang.String searchByKeywords(java.util.List<javax.ws.rs.core.PathSegment> keywords) at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:524) at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:285) at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:209) ... 11 more Caused by: java.lang.RuntimeException: Failed to find converter for javax.ws.rs.core.PathSegment at io.quarkus.resteasy.reactive.server.deployment.QuarkusServerEndpointIndexer.extractConverter(QuarkusServerEndpointIndexer.java:198) at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.handleListParam(ServerEndpointIndexer.java:277) at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.handleListParam(ServerEndpointIndexer.java:57) at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.extractParameterInfo(EndpointIndexer.java:909) at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:407) ... 13 more ~~~ ## To Reproduce Please run this reproducer project: https://github.com/tedwon/quarkus-resteasy-reactive-with-pathsegment ~~~ ./mvnw quarkus:dev ~~~ ### Quarkus version or git rev QUARKUS 1.13.3
5caf0dbe786c899d47f99ab1147ebf85f771f275
d83e522f55548a09b91fef8b8e5eff0ec77ecf98
https://github.com/quarkusio/quarkus/compare/5caf0dbe786c899d47f99ab1147ebf85f771f275...d83e522f55548a09b91fef8b8e5eff0ec77ecf98
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java index 802da5d0339..a5e08aefd1d 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java @@ -151,8 +151,8 @@ public static void generate(Map<DotName, MethodInfo> resourcesThatNeedCustomProd ResultHandle quarkusRestContextHandle = m.invokeVirtualMethod(getContextMethodCreator.getMethodDescriptor(), m.getThis()); ResultHandle extractorHandle = m.newInstance( - MethodDescriptor.ofConstructor(PathParamExtractor.class, int.class, boolean.class), - m.getMethodParam(0), m.load(false)); + MethodDescriptor.ofConstructor(PathParamExtractor.class, int.class, boolean.class, boolean.class), + m.getMethodParam(0), m.load(false), m.load(true)); ResultHandle resultHandle = m.invokeVirtualMethod(MethodDescriptor.ofMethod(PathParamExtractor.class, "extractParameter", Object.class, ResteasyReactiveRequestContext.class), extractorHandle, quarkusRestContextHandle); diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java index 4271339ce3c..43b6427f271 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java @@ -10,6 +10,7 @@ import java.util.function.Predicate; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.PathSegment; import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.ClassInfo; @@ -26,6 +27,7 @@ import org.jboss.resteasy.reactive.server.core.parameters.converters.NoopParameterConverter; import org.jboss.resteasy.reactive.server.core.parameters.converters.ParameterConverter; import org.jboss.resteasy.reactive.server.core.parameters.converters.ParameterConverterSupplier; +import org.jboss.resteasy.reactive.server.core.parameters.converters.PathSegmentParamConverter; import org.jboss.resteasy.reactive.server.core.parameters.converters.RuntimeResolvedConverter; import org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer; import org.jboss.resteasy.reactive.server.processor.ServerIndexedParameter; @@ -133,6 +135,8 @@ protected ParameterConverterSupplier extractConverter(String elementType, IndexV if (delegate == null) throw new RuntimeException("Failed to find converter for " + elementType); return delegate; + } else if (elementType.equals(PathSegment.class.getName())) { + return new PathSegmentParamConverter.Supplier(); } MethodDescriptor fromString = null; diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java index c172e743f13..900fd9752b1 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java @@ -1,7 +1,11 @@ package io.quarkus.resteasy.reactive.server.test.path; +import java.util.List; + import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.PathSegment; /** * Per spec: @@ -25,4 +29,10 @@ public String hello() { public String nested() { return "world hello"; } + + @GET + @Path("other/{keyword:.*}") + public String searchByKeywords(@PathParam("keyword") List<PathSegment> keywords) { + return keywords.toString(); + } } diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java index 96acfeb0d4f..66579e73e7c 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java @@ -25,4 +25,11 @@ public void testRestPath() { RestAssured.when().get("/app/foo/hello").then().statusCode(200).body(Matchers.is("hello")); RestAssured.when().get("/app/foo/hello/nested").then().statusCode(200).body(Matchers.is("world hello")); } + + @Test + public void testListOfPathParams() { + RestAssured.basePath = "/"; + RestAssured.when().get("/app/foo/hello/other/bar/baz/boo/bob").then().statusCode(200) + .body(Matchers.is("[bar, baz, boo, bob]")); + } } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java index 3a018f4651c..60d592571db 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java @@ -1,5 +1,6 @@ package org.jboss.resteasy.reactive.server.core.parameters; +import java.util.List; import org.jboss.resteasy.reactive.common.util.Encode; import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext; @@ -7,18 +8,24 @@ public class PathParamExtractor implements ParameterExtractor { private final int index; private final boolean encoded; + private final boolean single; - public PathParamExtractor(int index, boolean encoded) { + public PathParamExtractor(int index, boolean encoded, boolean single) { this.index = index; this.encoded = encoded; + this.single = single; } @Override public Object extractParameter(ResteasyReactiveRequestContext context) { String pathParam = context.getPathParam(index); if (encoded) { - return Encode.encodeQueryParam(pathParam); + pathParam = Encode.encodeQueryParam(pathParam); + } + if (single) { + return pathParam; + } else { + return List.of(pathParam.split("/")); } - return pathParam; } } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java index 14d865cbc55..e2c1cbe2dfe 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java @@ -536,7 +536,7 @@ public ParameterExtractor parameterExtractor(Map<String, Integer> pathParameterI extractor = new NullParamExtractor(); } } else { - extractor = new PathParamExtractor(index, encoded); + extractor = new PathParamExtractor(index, encoded, single); } return extractor; case CONTEXT:
['extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/RestPathTestCase.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/parameters/PathParamExtractor.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/startup/RuntimeResourceDeployment.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/path/HelloResource.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/CustomResourceProducersGenerator.java']
{'.java': 6}
6
6
0
0
6
18,973,310
3,690,985
486,605
5,006
1,295
227
23
4
4,459
220
1,065
61
6
0
2021-10-25T23:02:39
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,590
quarkusio/quarkus/21295/18154
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18154
https://github.com/quarkusio/quarkus/pull/21295
https://github.com/quarkusio/quarkus/pull/21295
1
fixes
Setting both test-port and test-ssl-port to 0 yields the same random port for both
## Describe the bug Setting these config properties to 0 yields the same random port for both. This also happens in Quarkus 1.13.7 but in 2.0 this can result in the following exception after a few tests have run, e.g.: ``` 2021-06-09 23:41:37,675 INFO [org.apa.htt.imp.cli.DefaultHttpClient] (main) I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {}->http://localhost:40695: The target server failed to respond 2021-06-09 23:41:37,675 INFO [org.apa.htt.imp.cli.DefaultHttpClient] (main) Retrying request to {}->http://localhost:40695 [...] org.apache.http.NoHttpResponseException: localhost:40695 failed to respond ``` ### Expected behavior Should be listening on different ports, one for insecure http and one for TLS. ### Actual behavior E.g.: ``` Listening on: http://localhost:40695 and https://localhost:40695 ``` and with Quarkus 2 it can lead to the error I posted above (after some tests). ## To Reproduce https://github.com/famod/quarkus-issue-18154 I don't think I'll be able to reproduce that error, though! (special execution order of project-specific tests) Steps to reproduce the behavior: 1. clone https://github.com/famod/quarkus-issue-18154 2. mvn verify 3. observe something like: ```INFO [io.quarkus] (main) Quarkus 1.13.7.Final on JVM started in 1.019s. Listening on: http://localhost:44237 and https://localhost:44237``` ### Configuration ```yaml http: insecure-requests: enabled test-port: 0 test-ssl-port: 0 ssl: certificate: # base path for %test is / (the path to the project) file: ./src/main/local-certs/wildcard.crt key-file: ./src/main/local-certs/wildcard.key ``` ## Environment (please complete the following information): ### Output of `uname -a` or `ver` Linux W4DEUMSY9003463 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux (Ubuntu 20.04.2 LTS via WSL2) Same happens in our Jenkins build (host VM is on CentOS 7 and build runs in Alpine based docker container). ### Output of `java -version` OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode) ### GraalVM version (if different from Java) - ### Quarkus version or git rev 2.0.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 ## Additional context https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/.5B2.2E0.2E0.2ECR3.2B.5D.20.22The.20target.20server.20failed.20to.20respond.22
598534257da772dc70b645e5f62fba430751cdf2
f81a64ca95f0fc2136265a50fb13d54203964147
https://github.com/quarkusio/quarkus/compare/598534257da772dc70b645e5f62fba430751cdf2...f81a64ca95f0fc2136265a50fb13d54203964147
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java index 609ec34135b..909aee45961 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java @@ -713,7 +713,8 @@ private static HttpServerOptions createSslOptions(HttpBuildTimeConfig buildTimeC serverOptions.setSni(sslConfig.sni); serverOptions.setHost(httpConfiguration.host); int sslPort = httpConfiguration.determineSslPort(launchMode); - serverOptions.setPort(sslPort == 0 ? -1 : sslPort); + // -2 instead of -1 (see http) to have vert.x assign two different random ports if both http and https shall be random + serverOptions.setPort(sslPort == 0 ? -2 : sslPort); serverOptions.setClientAuth(buildTimeConfig.tlsClientAuth); serverOptions.setReusePort(httpConfiguration.soReusePort); serverOptions.setTcpQuickAck(httpConfiguration.tcpQuickAck);
['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java']
{'.java': 1}
1
1
0
0
1
19,111,360
3,716,125
489,764
5,032
249
66
3
1
2,577
302
759
68
9
4
2021-11-08T23:57:14
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,589
quarkusio/quarkus/21296/18571
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18571
https://github.com/quarkusio/quarkus/pull/21296
https://github.com/quarkusio/quarkus/pull/21296
1
fixes
Sporadic EOFException when running tests in Eclipse with jacoco extension
## Describe the bug I'm seeing this frequently (but not always) in Eclipse at the end of a test execution: ``` Failed to generate Jacoco reports java.io.EOFException at java.base/java.io.DataInputStream.readUnsignedShort(DataInputStream.java:345) at java.base/java.io.DataInputStream.readUTF(DataInputStream.java:594) at java.base/java.io.DataInputStream.readUTF(DataInputStream.java:569) at org.jacoco.core.data.ExecutionDataReader.readExecutionData(ExecutionDataReader.java:149) at org.jacoco.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:116) at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.java:93) at org.jacoco.core.tools.ExecFileLoader.load(ExecFileLoader.java:60) at org.jacoco.core.tools.ExecFileLoader.load(ExecFileLoader.java:74) at io.quarkus.jacoco.runtime.ReportCreator.run(ReportCreator.java:72) at java.base/java.lang.Thread.run(Thread.java:829) ``` This doesn't make the test fail, it only looks scary. ### Expected behavior No such exception ### Actual behavior Exception is logged (not sure about the integrity of the report, though). ## To Reproduce No reproducer available (yet?). ## Environment (please complete the following information): ### Output of `uname -a` or `ver` ``` Linux W4DEUMSY9003463 5.4.72-microsoft-standard-WSL2 #1 SMP Wed Oct 28 23:40:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux ``` Ubuntu 20.04.2 LTS ### Output of `java -version` ``` OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode) ``` ### Quarkus version or git rev ``` 2.0.1.Final ``` (also seen in 2.0.0) ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Maven 3.8.1 or in this case better to say Eclipse 2021-06. ## Additional context Seems to come from a shutdown hook? Btw, Eclipse is running _in_ the WSL2 Ubuntu dist (xfce, accessed via xrdp), not on Windows host.
598534257da772dc70b645e5f62fba430751cdf2
cb26c21a9eb5f386c57a620b28f9b78eab5eae7c
https://github.com/quarkusio/quarkus/compare/598534257da772dc70b645e5f62fba430751cdf2...cb26c21a9eb5f386c57a620b28f9b78eab5eae7c
diff --git a/test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/ReportCreator.java b/test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/ReportCreator.java index 0a5956c4190..e118708a6c6 100644 --- a/test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/ReportCreator.java +++ b/test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/ReportCreator.java @@ -45,7 +45,7 @@ public void run() { long abortTime = System.currentTimeMillis() + 10000; Path datafile = Paths.get(reportInfo.dataFile); while (System.currentTimeMillis() < abortTime) { - if (Files.exists(datafile)) { + if (Files.exists(datafile) && Files.size(datafile) > 0) { break; } Thread.sleep(100);
['test-framework/jacoco/runtime/src/main/java/io/quarkus/jacoco/runtime/ReportCreator.java']
{'.java': 1}
1
1
0
0
1
19,111,360
3,716,125
489,764
5,032
121
28
2
1
1,932
198
519
55
0
4
2021-11-09T02:28:02
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,588
quarkusio/quarkus/21320/18500
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/18500
https://github.com/quarkusio/quarkus/pull/21320
https://github.com/quarkusio/quarkus/pull/21320
1
fixes
2.0 dev mode not reading application properties
## Describe the bug After switching to `2.0`, it looks like dev mode is not reading my `application.yaml` in `config/`. ### Expected behavior Successful run ### Actual behavior `NoSuchElementException: SRCFG00014: The config property name is required but it could not be found in any config source` ## To Reproduce Reproducer: `service1` after swapping the Quarkus version in https://github.com/mweber03/quarkus-test Steps to reproduce the behavior: 1. Switch to `2.0.1.Final` in `gradle.properties` 2. `./gradlew service1:quarkusDev` ### Output of `uname -a` or `ver` Ubuntu 20.04 ### Output of `java -version` OpenJDK 11.0.11 ### Quarkus version or git rev 2.0.1 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 6.9
7d4788108794b3499d89a7db9be306d0672a9424
0f6f472512287dd43c1e676c1b61380bb568ef4a
https://github.com/quarkusio/quarkus/compare/7d4788108794b3499d89a7db9be306d0672a9424...0f6f472512287dd43c1e676c1b61380bb568ef4a
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java index 6220c8e3578..1bef9fda0fb 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java @@ -959,6 +959,44 @@ Set<String> checkForFileChange(Function<DevModeContext.ModuleInfo, DevModeContex } } } + + // Mostly a copy of the code above but to handle watched files that are set with absolute path (not in the app resources) + for (String watchedFilePath : timestampSet.watchedFilePaths.keySet()) { + Path watchedFile = Paths.get(watchedFilePath); + if (watchedFile.isAbsolute()) { + if (watchedFile.toFile().exists()) { + try { + long value = Files.getLastModifiedTime(watchedFile).toMillis(); + Long existing = timestampSet.watchedFileTimestamps.get(watchedFile); + //existing can be null when running tests + //as there is both normal and test resources, but only one set of watched timestampts + if (existing != null && value > existing) { + ret.add(watchedFilePath); + //a write can be a 'truncate' + 'write' + //if the file is empty we may be seeing the middle of a write + if (Files.size(watchedFile) == 0) { + try { + Thread.sleep(200); + } catch (InterruptedException e) { + //ignore + } + } + //re-read, as we may have read the original TS if the middle of + //a truncate+write, even if the write had completed by the time + //we read the size + value = Files.getLastModifiedTime(watchedFile).toMillis(); + + log.infof("File change detected: %s", watchedFile); + timestampSet.watchedFileTimestamps.put(watchedFile, value); + } + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } else { + timestampSet.watchedFileTimestamps.put(watchedFile, 0L); + } + } + } } return ret; diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java index 05d28cf9222..accc69537ed 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java @@ -3,12 +3,15 @@ import static io.quarkus.deployment.steps.ConfigBuildSteps.SERVICES_PREFIX; import static io.quarkus.deployment.util.ServiceUtil.classNamesNamedIn; import static io.smallrye.config.ConfigMappings.ConfigClassWithPrefix.configClassWithPrefix; +import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_LOCATIONS; import static java.util.stream.Collectors.toList; import static java.util.stream.Collectors.toSet; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.lang.reflect.Modifier; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -20,6 +23,7 @@ import java.util.Set; import java.util.stream.Collectors; +import org.apache.commons.io.FilenameUtils; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.config.spi.ConfigSource; @@ -38,6 +42,7 @@ import io.quarkus.deployment.builditem.ConfigurationTypeBuildItem; import io.quarkus.deployment.builditem.GeneratedClassBuildItem; import io.quarkus.deployment.builditem.GeneratedResourceBuildItem; +import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem; import io.quarkus.deployment.builditem.LaunchModeBuildItem; import io.quarkus.deployment.builditem.LiveReloadBuildItem; import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem; @@ -58,10 +63,12 @@ import io.quarkus.runtime.annotations.StaticInitSafe; import io.quarkus.runtime.configuration.ConfigRecorder; import io.quarkus.runtime.configuration.ConfigUtils; +import io.quarkus.runtime.configuration.ProfileManager; import io.quarkus.runtime.configuration.RuntimeOverrideConfigSource; import io.smallrye.config.ConfigMappings.ConfigClassWithPrefix; import io.smallrye.config.ConfigSourceFactory; import io.smallrye.config.PropertiesLocationConfigSourceFactory; +import io.smallrye.config.SmallRyeConfig; public class ConfigGenerationBuildStep { @@ -217,6 +224,47 @@ public void setupConfigOverride( } } + @BuildStep + public void watchConfigFiles(BuildProducer<HotDeploymentWatchedFileBuildItem> watchedFiles) { + List<String> configWatchedFiles = new ArrayList<>(); + + SmallRyeConfig config = (SmallRyeConfig) ConfigProvider.getConfig(); + String userDir = System.getProperty("user.dir"); + + // Main files + configWatchedFiles.add("application.properties"); + configWatchedFiles.add("META-INF/microprofile-config.properties"); + configWatchedFiles.add(Paths.get(userDir, ".env").toAbsolutePath().toString()); + configWatchedFiles.add(Paths.get(userDir, "config", "application.properties").toAbsolutePath().toString()); + + // Profiles + String profile = ProfileManager.getActiveProfile(); + configWatchedFiles.add(String.format("application-%s.properties", profile)); + configWatchedFiles.add(String.format("META-INF/microprofile-config-%s.properties", profile)); + configWatchedFiles.add(Paths.get(userDir, String.format(".env-%s", profile)).toAbsolutePath().toString()); + configWatchedFiles.add( + Paths.get(userDir, "config", String.format("application-%s.properties", profile)).toAbsolutePath().toString()); + + Optional<List<String>> optionalLocations = config.getOptionalValues(SMALLRYE_CONFIG_LOCATIONS, String.class); + optionalLocations.ifPresent(locations -> { + for (String location : locations) { + if (!Files.isDirectory(Paths.get(location))) { + configWatchedFiles.add(location); + configWatchedFiles.add(appendProfileToFilename(location, profile)); + } + } + }); + + for (String configWatchedFile : configWatchedFiles) { + watchedFiles.produce(new HotDeploymentWatchedFileBuildItem(configWatchedFile)); + } + } + + private String appendProfileToFilename(String path, String activeProfile) { + String pathWithoutExtension = FilenameUtils.removeExtension(path); + return String.format("%s-%s.%s", pathWithoutExtension, activeProfile, FilenameUtils.getExtension(path)); + } + private void handleMembers(Config config, Map<String, String> values, Iterable<ClassDefinition.ClassMember> members, String prefix, Set<String> excludedConfigKeys) { for (ClassDefinition.ClassMember member : members) { diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java index ebdaed9d9b0..7ff4aa47ffe 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java @@ -1,30 +1,17 @@ package io.quarkus.deployment.steps; -import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_LOCATIONS; - -import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; -import java.util.Optional; import java.util.stream.Collectors; -import org.eclipse.microprofile.config.ConfigProvider; - import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem; import io.quarkus.runtime.LiveReloadConfig; class DevModeBuildStep { - @BuildStep List<HotDeploymentWatchedFileBuildItem> watchChanges(LiveReloadConfig liveReloadConfig) { List<String> names = new ArrayList<>(); - names.add("META-INF/microprofile-config.properties"); - names.add("application.properties"); - names.add(Paths.get(".env").toAbsolutePath().toString()); - Optional<List<String>> locations = ConfigProvider.getConfig().getOptionalValues(SMALLRYE_CONFIG_LOCATIONS, - String.class); - locations.ifPresent(names::addAll); liveReloadConfig.watchedResources.ifPresent(names::addAll); return names.stream().map(HotDeploymentWatchedFileBuildItem::new).collect(Collectors.toList()); } diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java index 20400b34fb2..b3c6f5ce6e8 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java @@ -1,53 +1,17 @@ package io.quarkus.deployment.steps; -import static io.smallrye.config.SmallRyeConfig.SMALLRYE_CONFIG_LOCATIONS; - -import java.nio.file.Paths; -import java.util.List; -import java.util.Optional; - -import org.apache.commons.io.FilenameUtils; -import org.eclipse.microprofile.config.ConfigProvider; - -import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; -import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem; import io.quarkus.deployment.builditem.LaunchModeBuildItem; import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem; import io.quarkus.runtime.LaunchMode; public class ProfileBuildStep { - @BuildStep RunTimeConfigurationDefaultBuildItem defaultProfile(LaunchModeBuildItem launchModeBuildItem) { return new RunTimeConfigurationDefaultBuildItem("quarkus.profile", getProfileValue(launchModeBuildItem.getLaunchMode())); } - @BuildStep - void watchProfileSpecificFile(LaunchModeBuildItem launchModeBuildItem, - BuildProducer<HotDeploymentWatchedFileBuildItem> items) { - String activeProfile = getProfileValue(launchModeBuildItem.getLaunchMode()); - String suffixedApplicationProperties = String.format("application-%s.properties", activeProfile); - items.produce(new HotDeploymentWatchedFileBuildItem(suffixedApplicationProperties)); - items.produce(new HotDeploymentWatchedFileBuildItem( - Paths.get(String.format(".env-%s", activeProfile)).toAbsolutePath().toString())); - items.produce(new HotDeploymentWatchedFileBuildItem(Paths - .get(System.getProperty("user.dir"), "config", suffixedApplicationProperties).toAbsolutePath().toString())); - Optional<List<String>> locations = ConfigProvider.getConfig().getOptionalValues(SMALLRYE_CONFIG_LOCATIONS, - String.class); - if (locations.isPresent()) { - for (String location : locations.get()) { - items.produce(new HotDeploymentWatchedFileBuildItem(appendProfileToFilename(location, activeProfile))); - } - } - } - - private String appendProfileToFilename(String path, String activeProfile) { - String pathWithoutExtension = FilenameUtils.removeExtension(path); - return String.format("%s-%s.%s", pathWithoutExtension, activeProfile, FilenameUtils.getExtension(path)); - } - private String getProfileValue(LaunchMode launchMode) { if (launchMode == LaunchMode.DEVELOPMENT) { return "dev"; diff --git a/extensions/config-yaml/deployment/src/main/java/io/quarkus/config/yaml/deployment/ConfigYamlProcessor.java b/extensions/config-yaml/deployment/src/main/java/io/quarkus/config/yaml/deployment/ConfigYamlProcessor.java index 52532751421..870999bc842 100644 --- a/extensions/config-yaml/deployment/src/main/java/io/quarkus/config/yaml/deployment/ConfigYamlProcessor.java +++ b/extensions/config-yaml/deployment/src/main/java/io/quarkus/config/yaml/deployment/ConfigYamlProcessor.java @@ -1,5 +1,9 @@ package io.quarkus.config.yaml.deployment; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + import io.quarkus.config.yaml.runtime.ApplicationYamlConfigSourceLoader; import io.quarkus.deployment.Feature; import io.quarkus.deployment.annotations.BuildProducer; @@ -32,12 +36,27 @@ public void bootstrap( } @BuildStep - void watchYamlConfig(BuildProducer<HotDeploymentWatchedFileBuildItem> items) { - items.produce(new HotDeploymentWatchedFileBuildItem("application.yaml")); - items.produce(new HotDeploymentWatchedFileBuildItem("application.yml")); + void watchYamlConfig(BuildProducer<HotDeploymentWatchedFileBuildItem> watchedFiles) { + List<String> configWatchedFiles = new ArrayList<>(); + String userDir = System.getProperty("user.dir"); + + // Main files + configWatchedFiles.add("application.yaml"); + configWatchedFiles.add("application.yml"); + configWatchedFiles.add(Paths.get(userDir, "config", "application.yaml").toAbsolutePath().toString()); + configWatchedFiles.add(Paths.get(userDir, "config", "application.yml").toAbsolutePath().toString()); + + // Profiles + String profile = ProfileManager.getActiveProfile(); + configWatchedFiles.add(String.format("application-%s.yaml", profile)); + configWatchedFiles.add(String.format("application-%s.yml", profile)); + configWatchedFiles + .add(Paths.get(userDir, "config", String.format("application-%s.yaml", profile)).toAbsolutePath().toString()); + configWatchedFiles + .add(Paths.get(userDir, "config", String.format("application-%s.yml", profile)).toAbsolutePath().toString()); - String activeProfile = ProfileManager.getActiveProfile(); - items.produce(new HotDeploymentWatchedFileBuildItem(String.format("application-%s.yml", activeProfile))); - items.produce(new HotDeploymentWatchedFileBuildItem(String.format("application-%s.yaml", activeProfile))); + for (String configWatchedFile : configWatchedFiles) { + watchedFiles.produce(new HotDeploymentWatchedFileBuildItem(configWatchedFile)); + } } }
['core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/ProfileBuildStep.java', 'extensions/config-yaml/deployment/src/main/java/io/quarkus/config/yaml/deployment/ConfigYamlProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/DevModeBuildStep.java']
{'.java': 5}
5
5
0
0
5
19,155,618
3,724,772
490,798
5,044
9,202
1,727
166
5
784
108
223
29
1
0
2021-11-09T19:35:07
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,568
quarkusio/quarkus/21924/21873
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21873
https://github.com/quarkusio/quarkus/pull/21924
https://github.com/quarkusio/quarkus/pull/21924
1
fixes
OidcClient has failed to complete the refresh_token grant request: "error_description":"Refresh token expired"
### Describe the bug It seems like there's no processing of expired refresh_tokens implemented. So "refresh token expired" error appears and oidc-client is unable to get new access_token. ### Expected behavior OidcClient could have some refresh_token processing logic. 1. Test refresh_token for being expired 2. If true , get new refresh_token, await 3. If got new refresh_token, then get new access_token ### Actual behavior oidc-client is unable to get new access_token with stale refresh_token , and refresh_token itself is not requested. ### How to Reproduce? rest-client + oidc-client (via OidcClientRequestFilter) + keycloak 12hrs refresh_token exp. https://github.com/tttomat19/quarkus-quickstarts/tree/main/rest-client-quickstart ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
52f3cc99c51ea77a2f9869cb7d69200b1d030278
1ac3ce435a7b16968469c421cd66a8a1f4ac5ed6
https://github.com/quarkusio/quarkus/compare/52f3cc99c51ea77a2f9869cb7d69200b1d030278...1ac3ce435a7b16968469c421cd66a8a1f4ac5ed6
diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/OidcClientConfig.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/OidcClientConfig.java index d751d649823..90257b7efd4 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/OidcClientConfig.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/OidcClientConfig.java @@ -113,11 +113,17 @@ public String getGrantType() { public String refreshTokenProperty = OidcConstants.REFRESH_TOKEN_VALUE; /** - * Refresh token property name in a token grant response + * Access token expiry property name in a token grant response */ @ConfigItem(defaultValue = OidcConstants.EXPIRES_IN) public String expiresInProperty = OidcConstants.EXPIRES_IN; + /** + * Refresh token expiry property name in a token grant response + */ + @ConfigItem(defaultValue = OidcConstants.REFRESH_EXPIRES_IN) + public String refreshExpiresInProperty = OidcConstants.REFRESH_EXPIRES_IN; + public Type getType() { return type; } @@ -149,6 +155,14 @@ public String getExpiresInProperty() { public void setExpiresInProperty(String expiresInProperty) { this.expiresInProperty = expiresInProperty; } + + public String getRefreshExpiresInProperty() { + return refreshExpiresInProperty; + } + + public void setRefreshExpiresInProperty(String refreshExpiresInProperty) { + this.refreshExpiresInProperty = refreshExpiresInProperty; + } } /** diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/Tokens.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/Tokens.java index 37ca13c3133..fa2a7989107 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/Tokens.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/Tokens.java @@ -12,14 +12,16 @@ public class Tokens { final private Long accessTokenExpiresAt; final private Long refreshTokenTimeSkew; final private String refreshToken; + final Long refreshTokenExpiresAt; final private JsonObject grantResponse; public Tokens(String accessToken, Long accessTokenExpiresAt, Duration refreshTokenTimeSkewDuration, String refreshToken, - JsonObject grantResponse) { + Long refreshTokenExpiresAt, JsonObject grantResponse) { this.accessToken = accessToken; this.accessTokenExpiresAt = accessTokenExpiresAt; this.refreshTokenTimeSkew = refreshTokenTimeSkewDuration == null ? null : refreshTokenTimeSkewDuration.getSeconds(); this.refreshToken = refreshToken; + this.refreshTokenExpiresAt = refreshTokenExpiresAt; this.grantResponse = grantResponse; } @@ -44,11 +46,11 @@ public Long getRefreshTokenTimeSkew() { } public boolean isAccessTokenExpired() { - if (accessTokenExpiresAt == null) { - return false; - } - final long nowSecs = System.currentTimeMillis() / 1000; - return nowSecs > accessTokenExpiresAt; + return isExpired(accessTokenExpiresAt); + } + + public boolean isRefreshTokenExpired() { + return isExpired(refreshTokenExpiresAt); } public boolean isAccessTokenWithinRefreshInterval() { @@ -58,4 +60,12 @@ public boolean isAccessTokenWithinRefreshInterval() { final long nowSecs = System.currentTimeMillis() / 1000; return nowSecs + refreshTokenTimeSkew > accessTokenExpiresAt; } + + private static boolean isExpired(Long expiresAt) { + if (expiresAt == null) { + return false; + } + final long nowSecs = System.currentTimeMillis() / 1000; + return nowSecs > expiresAt; + } } diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java index 89aa4137f2f..c87c9476866 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java @@ -124,20 +124,16 @@ private Tokens emitGrantTokens(HttpResponse<Buffer> resp, boolean refresh) { if (resp.statusCode() == 200) { LOG.debugf("%s OidcClient has %s the tokens", oidcConfig.getId().get(), (refresh ? "refreshed" : "acquired")); JsonObject json = resp.bodyAsJsonObject(); + // access token final String accessToken = json.getString(oidcConfig.grant.accessTokenProperty); + final Long accessTokenExpiresAt = getExpiresAtValue(accessToken, json.getValue(oidcConfig.grant.expiresInProperty)); + final String refreshToken = json.getString(oidcConfig.grant.refreshTokenProperty); - final Object expiresInValue = json.getValue(oidcConfig.grant.expiresInProperty); - Long accessTokenExpiresAt; - if (expiresInValue != null) { - long accessTokenExpiresIn = expiresInValue instanceof Number ? ((Number) expiresInValue).longValue() - : Long.parseLong(expiresInValue.toString()); - accessTokenExpiresAt = oidcConfig.absoluteExpiresIn ? accessTokenExpiresIn - : Instant.now().getEpochSecond() + accessTokenExpiresIn; - } else { - accessTokenExpiresAt = getExpiresJwtClaim(accessToken); - } + final Long refreshTokenExpiresAt = getExpiresAtValue(refreshToken, + json.getValue(oidcConfig.grant.refreshExpiresInProperty)); + return new Tokens(accessToken, accessTokenExpiresAt, oidcConfig.refreshTokenTimeSkew.orElse(null), refreshToken, - json); + refreshTokenExpiresAt, json); } else { String errorMessage = resp.bodyAsString(); LOG.debugf("%s OidcClient has failed to complete the %s grant request: status: %d, error message: %s", @@ -147,8 +143,19 @@ private Tokens emitGrantTokens(HttpResponse<Buffer> resp, boolean refresh) { } } - private static Long getExpiresJwtClaim(String accessToken) { - JsonObject claims = decodeJwtToken(accessToken); + private Long getExpiresAtValue(String token, Object expiresInValue) { + if (expiresInValue != null) { + long tokenExpiresIn = expiresInValue instanceof Number ? ((Number) expiresInValue).longValue() + : Long.parseLong(expiresInValue.toString()); + return oidcConfig.absoluteExpiresIn ? tokenExpiresIn + : Instant.now().getEpochSecond() + tokenExpiresIn; + } else { + return token != null ? getExpiresJwtClaim(token) : null; + } + } + + private static Long getExpiresJwtClaim(String token) { + JsonObject claims = decodeJwtToken(token); if (claims != null) { try { return claims.getLong(Claims.exp.name()); diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java index 67c05375981..ed41d5082e3 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java @@ -40,9 +40,10 @@ public Uni<Tokens> getTokens(OidcClient oidcClient) { } else { Tokens tokens = currentState.tokens; if (tokens.isAccessTokenExpired() || tokens.isAccessTokenWithinRefreshInterval()) { - newState = new TokenRequestState(prepareUni(tokens.getRefreshToken() != null - ? oidcClient.refreshTokens(tokens.getRefreshToken()) - : oidcClient.getTokens())); + newState = new TokenRequestState( + prepareUni((tokens.getRefreshToken() != null && !tokens.isRefreshTokenExpired()) + ? oidcClient.refreshTokens(tokens.getRefreshToken()) + : oidcClient.getTokens())); if (tokenRequestStateUpdater.compareAndSet(this, currentState, newState)) { return newState.tokenUni; } diff --git a/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcConstants.java b/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcConstants.java index bcb7271ed7c..8251c56579b 100644 --- a/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcConstants.java +++ b/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcConstants.java @@ -48,4 +48,5 @@ public final class OidcConstants { public static final String EXCHANGE_GRANT = "urn:ietf:params:oauth:grant-type:token-exchange"; public static final String EXPIRES_IN = "expires_in"; + public static final String REFRESH_EXPIRES_IN = "refresh_expires_in"; } diff --git a/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java b/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java index a2ca7c12116..ea8b059a722 100644 --- a/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java +++ b/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java @@ -50,7 +50,7 @@ public Map<String, String> start() { .aResponse() .withHeader("Content-Type", MediaType.APPLICATION_JSON) .withBody( - "{\\"access_token\\":\\"access_token_2\\", \\"expires_in\\":4, \\"refresh_token\\":\\"refresh_token_1\\"}"))); + "{\\"access_token\\":\\"access_token_2\\", \\"expires_in\\":4, \\"refresh_token\\":\\"refresh_token_2\\", \\"refresh_expires_in\\":1}"))); server.stubFor(WireMock.post("/refresh-token-only") .withRequestBody(matching("grant_type=refresh_token&refresh_token=shared_refresh_token")) diff --git a/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java b/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java index f5a955b8549..0a274ca502f 100644 --- a/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java +++ b/integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java @@ -30,12 +30,41 @@ public class OidcClientTest { @Test public void testEchoAndRefreshTokens() { + // access_token_1 and refresh_token_1 are acquired using a password grant request. + // access_token_1 expires in 4 seconds, refresh_token_1 has no lifespan limit as no `refresh_expires_in` property is returned. + // "Default OidcClient has acquired the tokens" record is added to the log RestAssured.when().get("/frontend/echoToken") .then() .statusCode(200) .body(equalTo("access_token_1")); - // Wait until the access token has expired + // Wait until the access_token_1 has expired + waitUntillAccessTokenHasExpired(); + + // access_token_1 has expired, refresh_token_1 is assumed to be valid and used to acquire access_token_2 and refresh_token_2. + // access_token_2 expires in 4 seconds, but refresh_token_2 - in 1 sec - it will expire by the time access_token_2 has expired + // "Default OidcClient has refreshed the tokens" record is added to the log + RestAssured.when().get("/frontend/echoToken") + .then() + .statusCode(200) + .body(equalTo("access_token_2")); + + // Wait until the access_token_2 has expired + waitUntillAccessTokenHasExpired(); + + // Both access_token_2 and refresh_token_2 have now expired therefore a password grant request is repeated, + // as opposed to using a refresh token grant. + // access_token_1 is returned again - as the same token URL and grant properties are used and Wiremock stub returns access_token_1 + // 2nd "Default OidcClient has acquired the tokens" record is added to the log + RestAssured.when().get("/frontend/echoToken") + .then() + .statusCode(200) + .body(equalTo("access_token_1")); + + checkLog(); + } + + private static void waitUntillAccessTokenHasExpired() { long expiredTokenTime = System.currentTimeMillis() + 5000; await().atMost(10, TimeUnit.SECONDS) .pollInterval(Duration.ofSeconds(3)) @@ -45,12 +74,6 @@ public Boolean call() throws Exception { return System.currentTimeMillis() > expiredTokenTime; } }); - - RestAssured.when().get("/frontend/echoToken") - .then() - .statusCode(200) - .body(equalTo("access_token_2")); - checkLog(); } @Test @@ -109,8 +132,8 @@ public void run() throws Throwable { } } - assertEquals(1, tokenAcquisitionCount, - "Log file must contain a single OidcClientImpl token acquisition confirmation"); + assertEquals(2, tokenAcquisitionCount, + "Log file must contain two OidcClientImpl token acquisition confirmations"); assertEquals(1, tokenRefreshedCount, "Log file must contain a single OidcClientImpl token refresh confirmation"); }
['integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java', 'extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcConstants.java', 'extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java', 'integration-tests/oidc-client-wiremock/src/test/java/io/quarkus/it/keycloak/KeycloakRealmResourceManager.java', 'extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/Tokens.java', 'extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientImpl.java', 'extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/OidcClientConfig.java']
{'.java': 7}
7
7
0
0
7
19,544,595
3,798,121
500,564
5,115
3,922
721
79
5
1,085
147
254
44
1
0
2021-12-03T17:15:58
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,569
quarkusio/quarkus/21910/21878
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21878
https://github.com/quarkusio/quarkus/pull/21910
https://github.com/quarkusio/quarkus/pull/21910
1
close
GRPC: Does not generate proto-based files
### Describe the bug version 2.5 gradle+scala+grpc do not generate code from my proto files version 2.4.1.Final gradle+scala+grpc generates code from my proto files ### Expected behavior java code based on my proto files is generate ### Actual behavior java files are not generated ### How to Reproduce? 1. generate project using scala, grpc, gradle, v. 2.4.1 1. create source file src/main/proto/helloworld.proto ``` syntax = "proto3"; package helloworld; message Hello { string message = 1; } ``` 1. gradle clean build 1. find . -name *.java - actual: The list contains just generated Helloworld.java file 1. Repeat the same steps using Quarkus v. 2.5 1. find . -name *.java - expected: The list contains Helloworld.java file - actual: the list is empty ### Output of `uname -a` or `ver` Linux Home1 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` openjdk version "17.0.1" 2021-10-19 LTS OpenJDK Runtime Environment Microsoft-28056 (build 17.0.1+12-LTS) OpenJDK 64-Bit Server VM Microsoft-28056 (build 17.0.1+12-LTS, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.5.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 7.2 ### Additional information _No response_
cd8fde53aff847932021258e568b8029730bc7fa
7e078aedbe0e2799e1f9993e062a10ebb7f0372a
https://github.com/quarkusio/quarkus/compare/cd8fde53aff847932021258e568b8029730bc7fa...7e078aedbe0e2799e1f9993e062a10ebb7f0372a
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java index 6445b0894d2..c2860d18b4e 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java @@ -177,6 +177,7 @@ public void execute(Task test) { }); tasks.named(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME, JavaCompile.class, compileTestJava -> { + compileTestJava.dependsOn(quarkusGenerateCode); compileTestJava.dependsOn(quarkusGenerateCodeTests); if (project.getGradle().getStartParameter().getTaskNames().contains(QUARKUS_DEV_TASK_NAME)) { compileTestJava.getOptions().setFailOnError(false); diff --git a/integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java b/integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java index bfc8c6d2514..fa25471402d 100644 --- a/integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java +++ b/integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java @@ -151,6 +151,16 @@ public void canRunTest() throws Exception { assertThat(buildResult.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME); } + @Test + public void generateCodeBeforeTests() throws Exception { + createProject(SourceType.JAVA); + + BuildResult firstBuild = runGradleWrapper(projectRoot, "test", "--stacktrace"); + assertThat(firstBuild.getOutput()).contains("Task :quarkusGenerateCode"); + assertThat(firstBuild.getOutput()).contains("Task :quarkusGenerateCodeTests"); + assertThat(firstBuild.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME); + } + private void createProject(SourceType sourceType) throws Exception { Map<String, Object> context = new HashMap<>(); context.put("path", "/greeting");
['integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java', 'devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java']
{'.java': 2}
2
2
0
0
2
19,539,505
3,797,159
500,419
5,114
80
13
1
1
1,419
204
427
56
0
1
2021-12-03T10:53:09
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,570
quarkusio/quarkus/21902/21844
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21844
https://github.com/quarkusio/quarkus/pull/21902
https://github.com/quarkusio/quarkus/pull/21902
1
fixes
Changing http.port breaks pressing 'd' or 'w' in dev mode
### Describe the bug If an application has changed `quarkus.http.port` to some other value than `8080`, pressing `w` or `d` in dev mode still uses port `8080` in the browser window it opens. ### Expected behavior If I have `quarkus.http.port=8085` in my `application.properties` I would expect that while in dev mode, pressing `d`would open http://localhost:8085/q/dev/ and pressing `w` would open http://localhost:8085/. ### Actual behavior If I have `quarkus.http.port=8085` in my `application.properties` while in dev mode, pressing `d` opens http://localhost:8080/q/dev/ and pressing `w` opens http://localhost:8080/. ### How to Reproduce? 1. Create a new app from code.quarkus.io 2. In `application.properties`, set `quarkus.http.port=8085` 3. Run dev mode 4. Press `w` or `d` ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.5.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Maven 3.8.1 ### Additional information _No response_
277523b3d53a507334727bf9289d358fcfebe730
16b29d8f3c20f0380548e79d5901a83fd516d420
https://github.com/quarkusio/quarkus/compare/277523b3d53a507334727bf9289d358fcfebe730...16b29d8f3c20f0380548e79d5901a83fd516d420
diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java index b37a1f47e35..73e30738452 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java @@ -223,7 +223,7 @@ public void handle(HttpServerRequest event) { /** * Boots the Vert.x instance used by the DevConsole, * applying some minimal tuning and customizations. - * + * * @return the initialized Vert.x instance */ private static Vertx initializeDevConsoleVertx() { @@ -465,24 +465,28 @@ void setupConsole(HttpRootPathBuildItem rp, NonApplicationRootPathBuildItem np, if (context == null) { context = ConsoleStateManager.INSTANCE.createContext("HTTP"); } + Config c = ConfigProvider.getConfig(); + String host = c.getOptionalValue("quarkus.http.host", String.class).orElse("localhost"); + String port = c.getOptionalValue("quarkus.http.port", String.class).orElse("8080"); context.reset( - new ConsoleCommand('w', "Open the application in a browser", null, () -> openBrowser(rp, np, "/")), - new ConsoleCommand('d', "Open the Dev UI in a browser", null, () -> openBrowser(rp, np, "/q/dev"))); + new ConsoleCommand('w', "Open the application in a browser", null, () -> openBrowser(rp, np, "/", host, port)), + new ConsoleCommand('d', "Open the Dev UI in a browser", null, () -> openBrowser(rp, np, "/q/dev", host, port))); } - private void openBrowser(HttpRootPathBuildItem rp, NonApplicationRootPathBuildItem np, String s) { - if (s.startsWith("/q")) { - s = np.resolvePath(s.substring(3)); + private void openBrowser(HttpRootPathBuildItem rp, NonApplicationRootPathBuildItem np, String path, String host, + String port) { + if (path.startsWith("/q")) { + path = np.resolvePath(path.substring(3)); } else { - s = rp.resolvePath(s.substring(1)); + path = rp.resolvePath(path.substring(1)); } StringBuilder sb = new StringBuilder("http://"); Config c = ConfigProvider.getConfig(); - sb.append(c.getOptionalValue("quarkus.http.host", String.class).orElse("localhost")); + sb.append(host); sb.append(":"); - sb.append(c.getOptionalValue("quarkus.http.port", String.class).orElse("8080")); - sb.append(s); + sb.append(port); + sb.append(path); String url = sb.toString(); Runtime rt = Runtime.getRuntime();
['extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java']
{'.java': 1}
1
1
0
0
1
19,513,821
3,792,138
499,790
5,108
1,566
361
24
1
1,121
159
315
42
4
0
2021-12-02T23:29:58
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,571
quarkusio/quarkus/21887/21703
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21703
https://github.com/quarkusio/quarkus/pull/21887
https://github.com/quarkusio/quarkus/pull/21887
1
fixes
Smallrye ConfigSourceFactory not loading class
### Describe the bug When using a `ConfigSourceFactory` the class is not loaded and the build (both maven and gradle) fails with: ``` [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.737 s [INFO] Finished at: 2021-11-25T11:24:15-03:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.5.0.Final:generate-code (default) on project bidder: Quarkus code generation phase has failed: InvocationTargetException: io.smallrye.config.ConfigSourceFactory: Provider com.adquick.service.athena.ConsumerConfig not found -> [Help 1] ``` Goals tested: `quarkus:dev`, `compile`, `package`. The class referenced in the `src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory` file is being loaded before its compilation. Works when using Quarkus 1.13.4. ### Expected behavior The config factory should be loaded and executed. ### Actual behavior Buidl failes with: ``` Caused by: java.util.ServiceConfigurationError: io.smallrye.config.ConfigSourceFactory: Provider com.adquick.service.athena.ConsumerConfig not found at java.util.ServiceLoader.fail (ServiceLoader.java:593) at java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass (ServiceLoader.java:1219) at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService (ServiceLoader.java:1228) at java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext (ServiceLoader.java:1273) at java.util.ServiceLoader$2.hasNext (ServiceLoader.java:1309) at java.util.ServiceLoader$3.hasNext (ServiceLoader.java:1393) ``` ### How to Reproduce? Run quarkus:dev to reproduce: ```bash ./mvnw clean compile quarkus:dev ``` A "workaround": 1. Comment the class in: ```bash src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceFactory ``` 2. Run `./mvnw compile` 3. Uncomment the class 4. Run: ```bash ./mvnw quarkus:dev ``` [bidder-maven.zip](https://github.com/quarkusio/quarkus/files/7603733/bidder-maven.zip) ### Output of `uname -a` or `ver` Darwin Andre-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.5.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) ### Additional information _No response_
57e0fa724eb82b41fb2f036323f2ab8432e26c99
a24c99d4e4c4cc0ce46bd899af41dd0cbd373155
https://github.com/quarkusio/quarkus/compare/57e0fa724eb82b41fb2f036323f2ab8432e26c99...a24c99d4e4c4cc0ce46bd899af41dd0cbd373155
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java b/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java index 112b5fe661a..39a650eebf0 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java @@ -92,7 +92,7 @@ public static boolean trigger(ClassLoader deploymentClassLoader, final PropertiesConfigSource pcs = new PropertiesConfigSource(properties, "Build system"); - final SmallRyeConfig config = ConfigUtils.configBuilder(false, launchMode) + final SmallRyeConfig config = ConfigUtils.configBuilder(false, false, launchMode) .withProfile(launchMode.getDefaultProfile()) .withSources(pcs) .build();
['core/deployment/src/main/java/io/quarkus/deployment/CodeGenerator.java']
{'.java': 1}
1
1
0
0
1
19,512,734
3,791,869
499,766
5,107
182
36
2
1
2,996
261
820
89
1
5
2021-12-02T13:05:06
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,572
quarkusio/quarkus/21877/21822
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21822
https://github.com/quarkusio/quarkus/pull/21877
https://github.com/quarkusio/quarkus/pull/21877
1
close
Adding a quarkusDev dependency on quarkus-flyway does not run migrations on start
### Describe the bug Add a dependency `quarkusDev 'io.quarkus:quarkus-flyway'` to build.gradle and set `quarkus.flyway.migrate-on-start` to true in application properties. Start the application with `./gradlew quarkusDev`. ### Expected behavior Migrations are performed when the application starts in dev mode. ### Actual behavior The migrations are not performed. Replacing the `quarkusDev` dependency with an `implementation` dependency works and the migrations are performed. ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` Darwin 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "11.0.8" 2020-07-14 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.5.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 7.3 ### Additional information _No response_
e98ec8a71d7140a4665c74314b043f3d3755e2f8
95766b7d0a64eb659bb2ef86a885e648c7edb1a2
https://github.com/quarkusio/quarkus/compare/e98ec8a71d7140a4665c74314b043f3d3755e2f8...95766b7d0a64eb659bb2ef86a885e648c7edb1a2
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java index 4cd8d5bb337..6445b0894d2 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java @@ -166,6 +166,10 @@ public void execute(Task test) { project.afterEvaluate(this::afterEvaluate); ConfigurationContainer configurations = project.getConfigurations(); + // create a custom configuration for devmode + Configuration configuration = configurations.create(DEV_MODE_CONFIGURATION_NAME) + .extendsFrom(configurations.findByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME)); + tasks.named(JavaPlugin.COMPILE_JAVA_TASK_NAME, JavaCompile.class, compileJava -> { compileJava.mustRunAfter(quarkusGenerateCode); @@ -188,9 +192,12 @@ public void execute(Task test) { quarkusGenerateCodeDev.configure(task -> task.dependsOn(resourcesTask)); quarkusGenerateCodeTests.configure(task -> task.dependsOn(resourcesTask)); - quarkusDev.configure(task -> task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask, - quarkusGenerateCodeDev, - quarkusGenerateCodeTests)); + quarkusDev.configure(task -> { + task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask, + quarkusGenerateCodeDev, + quarkusGenerateCodeTests); + task.setQuarkusDevConfiguration(configuration); + }); quarkusRemoteDev.configure(task -> task.dependsOn(classesTask, resourcesTask)); quarkusTest.configure(task -> task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask, quarkusGenerateCode, @@ -218,9 +225,6 @@ public void execute(Task test) { .plus(mainSourceSet.getOutput()) .plus(testSourceSet.getOutput())); - // create a custom configuration for devmode - configurations.create(DEV_MODE_CONFIGURATION_NAME); - // create a custom configuration to be used for the dependencies of the testNative task configurations.maybeCreate(NATIVE_TEST_IMPLEMENTATION_CONFIGURATION_NAME) .extendsFrom(configurations.findByName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME)); diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java index 19f60a14665..88ebef62663 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java @@ -24,6 +24,7 @@ import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.plugins.JavaPluginExtension; import org.gradle.api.provider.Provider; +import org.gradle.api.tasks.CompileClasspath; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputDirectory; import org.gradle.api.tasks.Optional; @@ -50,6 +51,7 @@ public class QuarkusDev extends QuarkusTask { public static final String IO_QUARKUS_DEVMODE_ARGS = "io.quarkus.devmode-args"; private Set<File> filesIncludedInClasspath = new HashSet<>(); + private Configuration quarkusDevConfiguration; private File buildDir; @@ -76,6 +78,15 @@ public QuarkusDev(String name) { super(name); } + @CompileClasspath + public Configuration getQuarkusDevConfiguration() { + return this.quarkusDevConfiguration; + } + + public void setQuarkusDevConfiguration(Configuration quarkusDevConfiguration) { + this.quarkusDevConfiguration = quarkusDevConfiguration; + } + @InputDirectory @Optional public File getBuildDir() {
['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java', 'devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java']
{'.java': 2}
2
2
0
0
2
19,509,414
3,791,164
499,690
5,106
1,428
236
27
2
1,115
145
332
46
0
0
2021-12-02T09:09:13
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,573
quarkusio/quarkus/21868/21867
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21867
https://github.com/quarkusio/quarkus/pull/21868
https://github.com/quarkusio/quarkus/pull/21868
1
fixes
OIDC JWT introspection results are not registered as SecurityIdentity attributes
### Describe the bug In most cases OIDC JWT tokens are verified locally, and sometimes (or always) they have to be introspected remotely. Opaque/binary tokens are always introspected remotely. The problem is that a `TokenIntrospection` result is only registered as a `SecurityIdentity` attribute if it is an opaque token, while JWT tokens's content is used to build `SecurityIdentity` once the introspection has succeeded - in most cases it is fine - usually `TokenIntrospection` would only return a limited subset of what can be found in JWT - but `TokenIntrospection` might have more data as well and it is also impossible to write the code around `TokenIntrospection` only if both JWT and opaque tokens are processed ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
d6d3a916af1e29d3ecd4fb201e1d0674e7673091
c746e0d9624ee90256724dd59a08cad9b8e159af
https://github.com/quarkusio/quarkus/compare/d6d3a916af1e29d3ecd4fb201e1d0674e7673091...c746e0d9624ee90256724dd59a08cad9b8e159af
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java index 59b9e61ba41..b34d04fbc62 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java @@ -161,7 +161,7 @@ public Uni<SecurityIdentity> apply(TokenVerificationResult result, Throwable t) JsonObject rolesJson = getRolesJson(vertxContext, resolvedContext, tokenCred, tokenJson, userInfo); SecurityIdentity securityIdentity = validateAndCreateIdentity(vertxContext, tokenCred, - resolvedContext, tokenJson, rolesJson, userInfo); + resolvedContext, tokenJson, rolesJson, userInfo, result.introspectionResult); if (tokenAutoRefreshPrepared(tokenJson, vertxContext, resolvedContext.oidcConfig)) { return Uni.createFrom().failure(new TokenAutoRefreshException(securityIdentity)); } else { @@ -339,7 +339,7 @@ private static Uni<SecurityIdentity> validateTokenWithoutOidcServer(TokenAuthent TokenVerificationResult result = resolvedContext.provider.verifyJwtToken(request.getToken().getToken()); return Uni.createFrom() .item(validateAndCreateIdentity(null, request.getToken(), resolvedContext, - result.localVerificationResult, result.localVerificationResult, null)); + result.localVerificationResult, result.localVerificationResult, null, null)); } catch (Throwable t) { return Uni.createFrom().failure(new AuthenticationFailedException(t)); } diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java index aa1e1ac2b1d..c61086e0e1f 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java @@ -143,7 +143,8 @@ private static List<String> convertJsonArrayToList(JsonArray claimValue) { static QuarkusSecurityIdentity validateAndCreateIdentity( RoutingContext vertxContext, TokenCredential credential, - TenantConfigContext resolvedContext, JsonObject tokenJson, JsonObject rolesJson, UserInfo userInfo) { + TenantConfigContext resolvedContext, JsonObject tokenJson, JsonObject rolesJson, UserInfo userInfo, + TokenIntrospection introspectionResult) { OidcTenantConfig config = resolvedContext.oidcConfig; QuarkusSecurityIdentity.Builder builder = QuarkusSecurityIdentity.builder(); @@ -169,6 +170,7 @@ static QuarkusSecurityIdentity validateAndCreateIdentity( setRoutingContextAttribute(builder, vertxContext); setSecurityIdentityRoles(builder, config, rolesJson); setSecurityIdentityUserInfo(builder, userInfo); + setSecurityIdentityIntrospecton(builder, introspectionResult); setSecurityIdentityConfigMetadata(builder, resolvedContext); setBlockinApiAttribute(builder, vertxContext); setTenantIdAttribute(builder, config); @@ -205,7 +207,9 @@ public static void setSecurityIdentityUserInfo(QuarkusSecurityIdentity.Builder b } public static void setSecurityIdentityIntrospecton(Builder builder, TokenIntrospection introspectionResult) { - builder.addAttribute(INTROSPECTION_ATTRIBUTE, introspectionResult); + if (introspectionResult != null) { + builder.addAttribute(INTROSPECTION_ATTRIBUTE, introspectionResult); + } } public static void setSecurityIdentityConfigMetadata(QuarkusSecurityIdentity.Builder builder, diff --git a/integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/TenantResource.java b/integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/TenantResource.java index 758140bc4b2..7a3b0cf337f 100644 --- a/integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/TenantResource.java +++ b/integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/TenantResource.java @@ -13,6 +13,7 @@ import io.quarkus.oidc.AccessTokenCredential; import io.quarkus.oidc.IdToken; import io.quarkus.oidc.OIDCException; +import io.quarkus.oidc.TokenIntrospection; import io.quarkus.oidc.UserInfo; import io.quarkus.security.identity.SecurityIdentity; @@ -54,7 +55,9 @@ public String userNameService(@PathParam("tenant") String tenant) { String response = tenant + ":" + name; if (tenant.startsWith("tenant-oidc-introspection-only")) { - response += (":" + tokenCache.getCacheSize()); + TokenIntrospection introspection = securityIdentity.getAttribute("introspection"); + response += (",active:" + introspection.getBoolean("active")); + response += (",cache-size:" + tokenCache.getCacheSize()); } return response; } diff --git a/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java b/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java index 8929327b868..7e7d6418e3d 100644 --- a/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java +++ b/integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java @@ -360,7 +360,7 @@ public void testJwtTokenIntrospectionOnlyAndUserInfo() { .when().get("/tenant/tenant-oidc-introspection-only/api/user") .then() .statusCode(200) - .body(equalTo("tenant-oidc-introspection-only:alice:0")); + .body(equalTo("tenant-oidc-introspection-only:alice,active:true,cache-size:0")); } RestAssured.when().get("/oidc/jwk-endpoint-call-count").then().body(equalTo("0")); @@ -404,7 +404,7 @@ private void verifyTokenIntrospectionAndUserInfoAreCached(String token1, int exp .when().get("/tenant/tenant-oidc-introspection-only-cache/api/user") .then() .statusCode(200) - .body(equalTo("tenant-oidc-introspection-only-cache:alice:" + expectedCacheSize)); + .body(equalTo("tenant-oidc-introspection-only-cache:alice,active:true,cache-size:" + expectedCacheSize)); } RestAssured.when().get("/oidc/introspection-endpoint-call-count").then().body(equalTo("1")); RestAssured.when().post("/oidc/introspection-endpoint-call-count").then().body(equalTo("0"));
['integration-tests/oidc-tenancy/src/test/java/io/quarkus/it/keycloak/BearerTokenAuthorizationTest.java', 'integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/TenantResource.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java']
{'.java': 4}
4
4
0
0
4
19,503,039
3,789,849
499,594
5,106
984
157
12
2
1,171
182
264
42
0
0
2021-12-01T17:53:49
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,574
quarkusio/quarkus/21797/21576
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21576
https://github.com/quarkusio/quarkus/pull/21797
https://github.com/quarkusio/quarkus/pull/21797
1
fixes
IllegalArgumentException on x-www-form-urlencoded POST with Amazon Lambda HTTP extension
### Describe the bug I run a small service on Amazon Lambda with HTTP binding and Qute templates. When POSTing form data (application/x-www-form-urlencoded), the request fails if the payload is somehow bigger than the Base64-decoding, called by the LambdaHttpHandler expects and an IllegalArgumentException is thrown. I figured out, that the String which is passed to the `Base64.decode()` method, contains some line breaks `\\r\\n` and these are causing the error. If the payload is small enough, so that there are no line-breaks, it works. If I put a breakpoint on the line and remove the line breaks manually, it also works. ### Expected behavior Quarkus can parse the request properly without errors, line-breaks in the base64 encoded payload are eliminated automatically and/or yield not in an exception. ### Actual behavior When posting a form as described above, the following exception is thrown: ``` 2021-11-19 16:50:06,111 ERROR [qua.ama.lam.http] (Lambda Thread (DEVELOPMENT)) Request Failure: java.lang.IllegalArgumentException: Illegal base64 character d at java.base/java.util.Base64$Decoder.decode0(Base64.java:746) at java.base/java.util.Base64$Decoder.decode(Base64.java:538) at java.base/java.util.Base64$Decoder.decode(Base64.java:561) at io.quarkus.amazon.lambda.http.LambdaHttpHandler.nettyDispatch(LambdaHttpHandler.java:196) at io.quarkus.amazon.lambda.http.LambdaHttpHandler.handleRequest(LambdaHttpHandler.java:61) at io.quarkus.amazon.lambda.http.LambdaHttpHandler.handleRequest(LambdaHttpHandler.java:41) at io.quarkus.amazon.lambda.runtime.AmazonLambdaRecorder$1.processRequest(AmazonLambdaRecorder.java:156) at io.quarkus.amazon.lambda.runtime.AbstractLambdaPollLoop$1.run(AbstractLambdaPollLoop.java:124) at java.base/java.lang.Thread.run(Thread.java:829) ``` This error occurs since version 2.3.0.Final as some base64 decoding is called, before, until 2.2.3.Final, no base64 decoding is called and it works. Removing the line breaks in the payload manually, as mentioned in the description above, "fixes" the error. ### How to Reproduce? I've made a small demo repo for reproducing the issue: https://github.com/dasniko/quarkus-post-bug There are two tests, one with a smaller payload which gets a 200 like expected, one with a slightly bigger payload which gets a 500, wich should not occur. ### Output of `uname -a` or `ver` Darwin Mac-mini.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment Temurin-11.0.12+7 (build 11.0.12+7) OpenJDK 64-Bit Server VM Temurin-11.0.12+7 (build 11.0.12+7, mixed mode) ### GraalVM version (if different from Java) n/a ### Quarkus version or git rev 2.4.2 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739) ### Additional information This occors with both lambda bindings `quarkus-amazon-lambda-rest` and `quarkus-amazon-lambda-http`.
394bf2b53cb8a7215a5d9c6aba07e7c1f4887af8
2d3f799b243c3c94b7963c1a23f77b876c8829a3
https://github.com/quarkusio/quarkus/compare/394bf2b53cb8a7215a5d9c6aba07e7c1f4887af8...2d3f799b243c3c94b7963c1a23f77b876c8829a3
diff --git a/extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java b/extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java index 5130a50ad37..78276861553 100644 --- a/extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java +++ b/extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java @@ -69,7 +69,7 @@ public void handleHttpRequests(RoutingContext ctx) { if (body != null) { String ct = ctx.request().getHeader("content-type"); if (ct == null || isBinary(ct)) { - String encoded = Base64.getMimeEncoder().encodeToString(body.getBytes()); + String encoded = Base64.getEncoder().encodeToString(body.getBytes()); event.setBody(encoded); event.setIsBase64Encoded(true); } else { diff --git a/extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java b/extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java index c8dfbf23c8d..83880ba6a91 100644 --- a/extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java +++ b/extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java @@ -93,7 +93,7 @@ public void handleHttpRequests(RoutingContext ctx) { if (body != null) { String ct = ctx.request().getHeader("content-type"); if (ct == null || isBinary(ct)) { - String encoded = Base64.getMimeEncoder().encodeToString(body.getBytes()); + String encoded = Base64.getEncoder().encodeToString(body.getBytes()); event.setBody(encoded); event.setIsBase64Encoded(true); } else {
['extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java', 'extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java']
{'.java': 2}
2
2
0
0
2
19,482,584
3,786,015
499,123
5,105
354
58
4
2
3,134
347
820
63
1
1
2021-11-29T18:44:43
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,575
quarkusio/quarkus/21787/21779
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21779
https://github.com/quarkusio/quarkus/pull/21787
https://github.com/quarkusio/quarkus/pull/21787
1
resolves
Qute unable to find template extension methods with @TemplateAttribute annotation
### Describe the bug I have updated my Quarkus app from 2.3.1.Final to 2.5.0.Final. Since then, Qute Template Extension no longer recognizes methods marked with an @TemplateAttribute annotation and throws the following error when launching from the app. I can confirm that the error happens from version 2.4.0.Final. I have built a small project with which the error can be reproduced: https://github.com/andlinger/quarkus-qute-namespace In the [Extensions](https://github.com/andlinger/quarkus-qute-namespace/blob/main/quarkus/src/main/java/io/i15s/quarkus/namespace/Extensions.java) class you can find two methods. `formatCountryEnglish` works perfectly. As soon as `formatCountry` is used, Quarkus produces the exception attached below. ``` java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.qute.deployment.QuteProcessor#processTemplateErrors threw an exception: io.quarkus.qute.TemplateException: Found template problems (1): [1] Incorrect expression found: {base:formatCountry("SE")} - no matching namespace [base] extension method found - at HtmlResource/test.html:5 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:194) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:833) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {base:formatCountry("SE")} - no matching namespace [base] extension method found - at HtmlResource/test.html:5 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:168) ... 11 more at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:330) at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252) at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60) at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:93) at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:450) at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:67) at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:149) at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:105) at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145) at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63) Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.qute.deployment.QuteProcessor#processTemplateErrors threw an exception: io.quarkus.qute.TemplateException: Found template problems (1): [1] Incorrect expression found: {base:formatCountry("SE")} - no matching namespace [base] extension method found - at HtmlResource/test.html:5 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:194) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:833) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {base:formatCountry("SE")} - no matching namespace [base] extension method found - at HtmlResource/test.html:5 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:168) ... 11 more at io.quarkus.builder.Execution.run(Execution.java:116) at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79) at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:161) at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:328) ... 9 more Caused by: io.quarkus.qute.TemplateException: Found template problems (1): [1] Incorrect expression found: {base:formatCountry("SE")} - no matching namespace [base] extension method found - at HtmlResource/test.html:5 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:194) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:833) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {base:formatCountry("SE")} - no matching namespace [base] extension method found - at HtmlResource/test.html:5 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:168) ... 11 more ``` ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
b9f3e744f2756ba90f23639b07c0ecf1c05998b4
15337f96b41a911c9e8550c6fc43ad1fcd35c7cd
https://github.com/quarkusio/quarkus/compare/b9f3e744f2756ba90f23639b07c0ecf1c05998b4...15337f96b41a911c9e8550c6fc43ad1fcd35c7cd
diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java index 00873e95b7f..3594df36ea8 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java @@ -111,6 +111,7 @@ import io.quarkus.qute.generator.ExtensionMethodGenerator; import io.quarkus.qute.generator.ExtensionMethodGenerator.NamespaceResolverCreator; import io.quarkus.qute.generator.ExtensionMethodGenerator.NamespaceResolverCreator.ResolveCreator; +import io.quarkus.qute.generator.ExtensionMethodGenerator.Param; import io.quarkus.qute.generator.ValueResolverGenerator; import io.quarkus.qute.runtime.ContentTypes; import io.quarkus.qute.runtime.EngineProducer; @@ -1729,31 +1730,26 @@ private static TemplateExtensionMethodBuildItem findTemplateExtensionMethod(Info // Name does not match continue; } - List<Type> parameters = extensionMethod.getMethod().parameters(); - int realParamSize = parameters.size(); - if (!extensionMethod.hasNamespace()) { - realParamSize -= 1; - } - if (TemplateExtension.ANY.equals(extensionMethod.getMatchName())) { - realParamSize -= 1; - } - if (realParamSize > 0 && !info.isVirtualMethod()) { + + List<Param> evaluatedParams = extensionMethod.getParams().evaluated(); + if (evaluatedParams.size() > 0 && !info.isVirtualMethod()) { // If method accepts additional params the info must be a virtual method continue; } if (info.isVirtualMethod()) { // For virtual method validate the number of params and attempt to validate the parameter types if available VirtualMethodPart virtualMethod = info.part.asVirtualMethod(); + boolean isVarArgs = ValueResolverGenerator.isVarArgs(extensionMethod.getMethod()); - int lastParamIdx = parameters.size() - 1; + int lastParamIdx = evaluatedParams.size() - 1; if (isVarArgs) { // For varargs methods match the minimal number of params - if ((realParamSize - 1) > virtualMethod.getParameters().size()) { + if ((evaluatedParams.size() - 1) > virtualMethod.getParameters().size()) { continue; } } else { - if (virtualMethod.getParameters().size() != realParamSize) { + if (virtualMethod.getParameters().size() != evaluatedParams.size()) { // Check number of parameters; some of params of the extension method must be ignored continue; } @@ -1761,8 +1757,7 @@ private static TemplateExtensionMethodBuildItem findTemplateExtensionMethod(Info // Check parameter types if available boolean matches = true; - // Skip base and name param if needed - int idx = parameters.size() - realParamSize; + int idx = 0; for (Expression param : virtualMethod.getParameters()) { @@ -1772,9 +1767,9 @@ private static TemplateExtensionMethodBuildItem findTemplateExtensionMethod(Info Type paramType; if (isVarArgs && (idx >= lastParamIdx)) { // Replace the type for varargs methods - paramType = parameters.get(lastParamIdx).asArrayType().component(); + paramType = evaluatedParams.get(lastParamIdx).type.asArrayType().component(); } else { - paramType = parameters.get(idx); + paramType = evaluatedParams.get(idx).type; } if (!Types.isAssignableFrom(paramType, result.type, index)) { diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplateExtensionMethodBuildItem.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplateExtensionMethodBuildItem.java index 0495521b5b4..0bd918fff92 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplateExtensionMethodBuildItem.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplateExtensionMethodBuildItem.java @@ -9,6 +9,8 @@ import io.quarkus.builder.item.MultiBuildItem; import io.quarkus.qute.Namespaces; import io.quarkus.qute.TemplateExtension; +import io.quarkus.qute.generator.ExtensionMethodGenerator; +import io.quarkus.qute.generator.ExtensionMethodGenerator.Parameters; /** * Represents a template extension method. @@ -24,6 +26,7 @@ public final class TemplateExtensionMethodBuildItem extends MultiBuildItem { private final Type matchType; private final int priority; private final String namespace; + private final Parameters params; public TemplateExtensionMethodBuildItem(MethodInfo method, String matchName, String matchRegex, Type matchType, int priority, String namespace) { @@ -34,6 +37,7 @@ public TemplateExtensionMethodBuildItem(MethodInfo method, String matchName, Str this.priority = priority; this.namespace = (namespace != null && !namespace.isEmpty()) ? Namespaces.requireValid(namespace) : namespace; this.matchPattern = (matchRegex == null || matchRegex.isEmpty()) ? null : Pattern.compile(matchRegex); + this.params = new ExtensionMethodGenerator.Parameters(method, matchPattern != null || matchesAny(), hasNamespace()); } public MethodInfo getMethod() { @@ -68,11 +72,19 @@ boolean matchesName(String name) { if (matchPattern != null) { return matchPattern.matcher(name).matches(); } - return TemplateExtension.ANY.equals(matchName) ? true : matchName.equals(name); + return matchesAny() ? true : matchName.equals(name); } - boolean hasNamespace() { + boolean matchesAny() { + return TemplateExtension.ANY.equals(matchName); + } + + public boolean hasNamespace() { return namespace != null && !namespace.isEmpty(); } + public Parameters getParams() { + return params; + } + } diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/TemplateExtensionAttributeTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/TemplateExtensionAttributeTest.java index e669dc943f6..b5b6873dc63 100644 --- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/TemplateExtensionAttributeTest.java +++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/TemplateExtensionAttributeTest.java @@ -6,6 +6,7 @@ import javax.inject.Inject; +import org.jboss.shrinkwrap.api.asset.StringAsset; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; @@ -19,6 +20,9 @@ public class TemplateExtensionAttributeTest { @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() .withApplicationRoot((jar) -> jar + .addAsResource( + new StringAsset("{ping:transform('Foo')}"), + "templates/foo.txt") .addClasses(Extensions.class)); @Inject @@ -34,6 +38,8 @@ public void testTemplateExtensions() { engine.parse("{foo.myAttr}").render()); assertEquals("OK", engine.parse("{attr:ping}").instance().setAttribute("myAttribute", "OK").render()); + assertEquals("foo::cs", + engine.getTemplate("foo").instance().setAttribute("locale", "cs").render()); } @TemplateExtension @@ -54,4 +60,13 @@ static String ping(@TemplateAttribute Object myAttribute) { } + @TemplateExtension(namespace = "ping") + public static class NamespaceExtensions { + + static String transform(@TemplateAttribute("locale") Object loc, String val) { + return val.toLowerCase() + "::" + loc.toString(); + } + + } + } diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/TemplateExtension.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/TemplateExtension.java index 7d8dbda3527..b66e07cf916 100644 --- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/TemplateExtension.java +++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/TemplateExtension.java @@ -107,7 +107,7 @@ String namespace() default ""; /** - * Used to annotated a template extension method parameter that should be obtained via + * Used to annotate a template extension method parameter that should be obtained via * {@link TemplateInstance#getAttribute(String)}. The parameter type must be {@link java.lang.Object}. * * <pre> diff --git a/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java b/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java index 508b75e9ab5..4faedb00254 100644 --- a/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java +++ b/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java @@ -670,11 +670,11 @@ static Type box(Primitive primitive) { } } - static class Parameters implements Iterable<Param> { + public static final class Parameters implements Iterable<Param> { final List<Param> params; - Parameters(MethodInfo method, boolean matchAnyOrRegex, boolean hasNamespace) { + public Parameters(MethodInfo method, boolean matchAnyOrRegex, boolean hasNamespace) { List<Type> parameters = method.parameters(); Map<Integer, String> attributeParamNames = new HashMap<>(); for (AnnotationInstance annotation : method.annotations()) { @@ -721,20 +721,20 @@ static class Parameters implements Iterable<Param> { if (matchAnyOrRegex) { Param nameParam = getFirst(ParamKind.NAME); if (nameParam == null || !nameParam.type.name().equals(DotNames.STRING)) { - throw new IllegalStateException( + throw new TemplateException( "Template extension method declared on " + method.declaringClass().name() + " must accept at least one string parameter to match the name: " + method); } } if (!hasNamespace && getFirst(ParamKind.BASE) == null) { - throw new IllegalStateException( + throw new TemplateException( "Template extension method declared on " + method.declaringClass().name() + " must accept at least one parameter to match the base object: " + method); } for (Param param : params) { if (param.kind == ParamKind.ATTR && !param.type.name().equals(DotNames.OBJECT)) { - throw new IllegalStateException( + throw new TemplateException( "Template extension method parameter annotated with @TemplateAttribute declared on " + method.declaringClass().name() + " must be of type java.lang.Object: " + method); @@ -742,7 +742,7 @@ static class Parameters implements Iterable<Param> { } } - String[] parameterTypesAsStringArray() { + public String[] parameterTypesAsStringArray() { String[] types = new String[params.size()]; for (int i = 0; i < params.size(); i++) { types[i] = params.get(i).type.name().toString(); @@ -750,7 +750,7 @@ String[] parameterTypesAsStringArray() { return types; } - Param getFirst(ParamKind kind) { + public Param getFirst(ParamKind kind) { for (Param param : params) { if (param.kind == kind) { return param; @@ -759,15 +759,15 @@ Param getFirst(ParamKind kind) { return null; } - Param get(int index) { + public Param get(int index) { return params.get(index); } - int size() { + public int size() { return params.size(); } - boolean needsEvaluation() { + public boolean needsEvaluation() { for (Param param : params) { if (param.kind == ParamKind.EVAL) { return true; @@ -776,7 +776,7 @@ boolean needsEvaluation() { return false; } - List<Param> evaluated() { + public List<Param> evaluated() { if (params.isEmpty()) { return Collections.emptyList(); } @@ -796,12 +796,12 @@ public Iterator<Param> iterator() { } - static class Param { + public static final class Param { - final String name; - final Type type; - final int position; - final ParamKind kind; + public final String name; + public final Type type; + public final int position; + public final ParamKind kind; public Param(String name, Type type, int position, ParamKind paramKind) { this.name = name;
['independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/TemplateExtension.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplateExtensionMethodBuildItem.java', 'extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/extensions/TemplateExtensionAttributeTest.java']
{'.java': 5}
5
5
0
0
5
19,481,963
3,785,958
499,111
5,105
3,896
713
77
4
7,270
425
1,766
128
2
1
2021-11-29T15:24:17
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,576
quarkusio/quarkus/21778/21759
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21759
https://github.com/quarkusio/quarkus/pull/21778
https://github.com/quarkusio/quarkus/pull/21778
1
fixes
BeanParam extending another class fails in RESTClient
### Describe the bug When a @BeanParam is used in a RESTClient and it extends another class it fails with the path param property not found. ``` Bad Request - Path parameter not provided client ``` If the class doe not extend another class or the properties are replicated in the extended class it will work fine. [beanparam.zip](https://github.com/quarkusio/quarkus/files/7613800/beanparam.zip) ### Expected behavior Classes can extend other classes and be used as @BeanParams. ### Actual behavior When the class extends another class it fails on the parents "properties" with "property not provided" Non REST clients work find using the BeanParam if it extends another class. Tried: - Public fields - Getters/Setters - Different Lombok annotations The only thing that worked was to "replicate" the properties in each of the classes. ### How to Reproduce? Reproducer attached - running the tests demonstrate the issue. There are two classes (`BaseParam` and `MethodParams`). You will get the below exception: ``` java.lang.IllegalArgumentException: Path parameter not provided base ``` Prior to modifying the old reproducer (for RESTClient does not support BeanParams), and without extending another class, the test passed. ### Output of `java -version` JDK 17 ### Quarkus version or git rev 2.5.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Maven 3.8.4 (with Lombok) ### Additional information I am still investigating this as well. Something is odd that I cannot pinpoint yet. I have other classes, used as @BeanParam that extend other classes, and they _work as expected_.
ebd6d377ea432bdc13bed47b72cb46387a7f9bbe
b44601af37883a86b7b55ed874cb00d83b9e7aa5
https://github.com/quarkusio/quarkus/compare/ebd6d377ea432bdc13bed47b72cb46387a7f9bbe...b44601af37883a86b7b55ed874cb00d83b9e7aa5
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/beanparam/BeanPathParamTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/beanparam/BeanPathParamTest.java index 1c05c09c7ac..54503b61b19 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/beanparam/BeanPathParamTest.java +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/beanparam/BeanPathParamTest.java @@ -35,6 +35,13 @@ void shouldPassPathParamFromBeanParamAndMethod() { assertThat(client.getWithBeanParam("foo", new MyBeanParam("123"))).isEqualTo("it works with method too!"); } + @Test + void shouldResolvePathParamsWhenBeanParamClassExtendsAnother() { + Client client = RestClientBuilder.newBuilder().baseUri(baseUri).build(Client.class); + assertThat(client.getWithBeanParamInheritance(new MyChildBeanParam("child", "123"))).isEqualTo( + "it works with inheritance too!"); + } + @Path("/my/{id}/resource") public interface Client { @GET @@ -43,6 +50,10 @@ public interface Client { @GET @Path("/{name}") String getWithBeanParam(@PathParam("name") String name, @BeanParam MyBeanParam beanParam); + + @GET + @Path("/item/{base}") + String getWithBeanParamInheritance(@BeanParam MyChildBeanParam beanParam); } public static class MyBeanParam { @@ -58,6 +69,40 @@ public String getId() { } } + public static class MyChildBeanParam extends MyBeanParam { + private final String base; + + public MyChildBeanParam(String base, String id) { + super(id); + this.base = base; + } + + @PathParam("base") + public String getBase() { + return base; + } + } + + public static class TestMyChildBeanParam { + private final String id; + private final String base; + + public TestMyChildBeanParam(String base, String id) { + this.id = id; + this.base = base; + } + + @PathParam("id") + public String getId() { + return id; + } + + @PathParam("base") + public String getBase() { + return base; + } + } + @Path("/my/123/resource") public static class Resource { @GET @@ -70,5 +115,11 @@ public String get() { public String getWithLongerPath() { return "it works with method too!"; } + + @Path("/item/child") + @GET + public String getWithInheritance() { + return "it works with inheritance too!"; + } } } diff --git a/independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/beanparam/BeanParamParser.java b/independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/beanparam/BeanParamParser.java index a6e66a234eb..a09a7d7e12a 100644 --- a/independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/beanparam/BeanParamParser.java +++ b/independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/beanparam/BeanParamParser.java @@ -17,10 +17,18 @@ import org.jboss.jandex.IndexView; import org.jboss.jandex.MethodInfo; import org.jboss.jandex.Type; +import org.jboss.resteasy.reactive.common.processor.JandexUtil; public class BeanParamParser { + public static List<Item> parse(ClassInfo beanParamClass, IndexView index) { List<Item> resultList = new ArrayList<>(); + + // Parse class tree recursively + if (!JandexUtil.DOTNAME_OBJECT.equals(beanParamClass.superName())) { + resultList.addAll(parse(index.getClassByName(beanParamClass.superName()), index)); + } + Map<DotName, List<AnnotationInstance>> annotations = beanParamClass.annotations(); List<AnnotationInstance> queryParams = annotations.get(QUERY_PARAM); if (queryParams != null) {
['extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/beanparam/BeanPathParamTest.java', 'independent-projects/resteasy-reactive/client/processor/src/main/java/org/jboss/resteasy/reactive/client/processor/beanparam/BeanParamParser.java']
{'.java': 2}
2
2
0
0
2
19,480,229
3,785,603
499,072
5,105
296
57
8
1
1,693
245
379
57
1
2
2021-11-29T12:37:00
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,577
quarkusio/quarkus/21773/21691
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21691
https://github.com/quarkusio/quarkus/pull/21773
https://github.com/quarkusio/quarkus/pull/21773
1
resolves
Cannot resolve config property referenced in dev-console card template
### Describe the bug I have an extension contributing a card to the dev-console. The card's `embedded.html` contains a hyperlink to an endpoint contributed by the extension like so: ```html <a href="{config:property('quarkus.http.root-path')}foo/bar" class="badge badge-light">...</a> ``` I would have to downgrade and test again, but I am fairly certain that this used to work properly prior to Quarkus 2.5.0. Now with Quarkus 2.5.0 the config property `quarkus.http.root-path` can no longer be resolved by the template expression `config:property('quarkus.http.root-path')`. I did a little bit of debugging and noticed that there are a lot of `SmallRyeConfig` objects being created. A separate one is also created once the dev-console is opened and this config object does not contain the default value for `quarkus.http.root-path` and it looks like it doesn't either contain the config source for the `application.properties` file. ### Expected behavior The `embedded.html` file for a dev-console card should be able to reference run-time config properties (and build-time config properties visible at run-time) using template expressions like `config:property('quarkus.http.root-path')`. The expression should be resolved to the value provided by the application (`application.properties`, system properties, etc.) or the default value specified by the corresponding `@BuildItem` annotated field. ### Actual behavior The `config:property()` template expression currently doesn't appear to be working properly. I get the impression that it may be using the wrong `SmallRyeConfig` instance. The whole expression is resolved to the empty string and I couldn't see any error being logged anywhere either. ### How to Reproduce? Creating a reproducer would cost me some time, but I could look into it. Basically all I did was to implement a Quarkus extension where I contribute a dev-console card with an `embedded.html` file as described above. ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.5.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
ebd6d377ea432bdc13bed47b72cb46387a7f9bbe
23dbaaee84df03675f58a815e6702776842530e9
https://github.com/quarkusio/quarkus/compare/ebd6d377ea432bdc13bed47b72cb46387a7f9bbe...23dbaaee84df03675f58a815e6702776842530e9
diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java index 14ceea76392..873c889391c 100644 --- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java +++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java @@ -323,6 +323,7 @@ public void runtimeTemplates(List<DevConsoleRuntimeTemplateInfoBuildItem> items, for (DevConsoleRuntimeTemplateInfoBuildItem i : items) { recorder.addInfo(i.getGroupId(), i.getArtifactId(), i.getName(), i.getObject()); } + recorder.initConfigFun(); } @BuildStep(onlyIf = IsDevelopment.class) @@ -567,8 +568,9 @@ private Engine buildEngine(List<DevTemplatePathBuildItem> devTemplatePaths, }); } else { return ctx.evaluate(params.get(0)).thenCompose(propertyName -> { - String val = ConfigProvider.getConfig().getOptionalValue(propertyName.toString(), String.class) - .orElse(defaultValues.get(propertyName.toString())); + // Use the function stored in the DevConsoleRecorder to make sure the config is obtained using the correct TCCL + Function<String, Optional<String>> configFun = DevConsoleManager.getGlobal("devui-config-fun"); + String val = configFun.apply(propertyName.toString()).orElse(defaultValues.get(propertyName.toString())); return CompletableFuture.completedFuture(val != null ? val : Results.NotFound.from(ctx)); }); } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleRecorder.java index 1ccfd5f276f..0242af20607 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleRecorder.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleRecorder.java @@ -9,15 +9,18 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.HashMap; import java.util.Map; +import java.util.Optional; import java.util.function.Function; import java.util.function.Supplier; +import org.eclipse.microprofile.config.ConfigProvider; import org.jboss.logging.Logger; import io.quarkus.dev.console.DevConsoleManager; import io.quarkus.dev.testing.ContinuousTestingSharedStateManager; import io.quarkus.runtime.ShutdownContext; import io.quarkus.runtime.annotations.Recorder; +import io.smallrye.config.SmallRyeConfig; import io.vertx.core.Handler; import io.vertx.ext.web.RoutingContext; @@ -38,6 +41,16 @@ public Map<String, Object> apply(String s) { data.put(name, supplier.get()); } + public void initConfigFun() { + SmallRyeConfig config = (SmallRyeConfig) ConfigProvider.getConfig(); + DevConsoleManager.setGlobal("devui-config-fun", new Function<String, Optional<String>>() { + @Override + public Optional<String> apply(String name) { + return config.getOptionalValue(name, String.class); + } + }); + } + public Handler<RoutingContext> devConsoleHandler(String devConsoleFinalDestination, ShutdownContext shutdownContext) { shutdownContext.addShutdownTask(new CleanupDevConsoleTempDirectory(devConsoleFinalDestination));
['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/devmode/DevConsoleRecorder.java', 'extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java']
{'.java': 2}
2
2
0
0
2
19,480,229
3,785,603
499,072
5,105
1,136
197
19
2
2,297
327
513
50
0
1
2021-11-29T11:03:39
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,578
quarkusio/quarkus/21695/21234
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21234
https://github.com/quarkusio/quarkus/pull/21695
https://github.com/quarkusio/quarkus/pull/21695
1
fixes
Query param name containing the '=' character is not correctly encoded by the http client on quarkus reactive
### Describe the bug Here is a RestClient (take note that we are talking about the encoding of the param name...NOT the param value) @GET @Path("ps") public Uni<Map<String, String>> ps(@QueryParam("p1") String p1, @QueryParam("p2(") String p2, @QueryParam("p3[") String p3, @QueryParam("p4?") String p4, @QueryParam("p5=") String p5, @QueryParam("p6-") String p6); the 5th param (p5=) is not sent correctly to the server, as a result the server receives null. (the other params even if they contain special characters are sent correctly) NB: this happens ONLY with the reactive libraries. Check out this repo, it has 2 branches, the master fails and the non_reactive succeeds. https://github.com/agelbess/quarkus-reactive-query-param-name-with-equals-sign ### Expected behavior @QueryParam(s) with names that contain the '=' character should be sent with the correct encoding to the server. ### Actual behavior _No response_ ### How to Reproduce? Clone the repo https://github.com/agelbess/quarkus-reactive-query-param-name-with-equals-sign and execute the commands (check the README.md for the same info) mvn compile quarkus:dev curl localhost:8080/start The response will be responds with {"p1":"1","p2":"2","p3":"3","p4":"4","p5":null,"p6":"6"} ...meaning that the 5th param was not sent correctly to the server. ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
3f0ffd4c98b672f7fbc5ab63c10d0456a213f040
e249e7508f8d1783b8b0b00f81c2871c522e52d2
https://github.com/quarkusio/quarkus/compare/3f0ffd4c98b672f7fbc5ab63c10d0456a213f040...e249e7508f8d1783b8b0b00f81c2871c522e52d2
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java index d9f47a030c0..3148c53acf5 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java @@ -2,6 +2,7 @@ import static org.assertj.core.api.Assertions.assertThat; +import java.util.Map; import java.util.Set; import javax.enterprise.context.ApplicationScoped; @@ -59,4 +60,16 @@ void shouldHelloBytes() { void shouldHelloInts() { assertThat(testBean.helloNonSimpleSyncInts()).isEqualTo(new Integer[] { 1, 2, 3 }); } + + @Test + void shouldMapQueryParamsWithSpecialCharacters() { + Map<String, String> map = testBean.helloQueryParamsToMap(); + assertThat(map).size().isEqualTo(6); + assertThat(map.get("p1")).isEqualTo("1"); + assertThat(map.get("p2")).isEqualTo("2"); + assertThat(map.get("p3")).isEqualTo("3"); + assertThat(map.get("p4")).isEqualTo("4"); + assertThat(map.get("p5")).isEqualTo("5"); + assertThat(map.get("p6")).isEqualTo("6"); + } } diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloNonSimpleClient.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloNonSimpleClient.java index d1fc232c0e0..513694dd032 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloNonSimpleClient.java +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloNonSimpleClient.java @@ -1,9 +1,13 @@ package io.quarkus.rest.client.reactive; +import java.util.Map; + import javax.ws.rs.Consumes; +import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; @@ -38,4 +42,10 @@ public interface HelloNonSimpleClient { @Produces(MediaType.APPLICATION_JSON) @Path("/ints") Uni<Integer[]> echoAsyncInts(Integer[] value); + + @GET + @Path("/query-params-to-map") + Map<String, String> echoQueryAsMap(@QueryParam("p1") String p1, @QueryParam("p2(") String p2, + @QueryParam("p3[") String p3, @QueryParam("p4?") String p4, @QueryParam("p5=") String p5, + @QueryParam("p6-") String p6); } diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java index 8c371f57473..f298c0b3030 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java @@ -1,12 +1,15 @@ package io.quarkus.rest.client.reactive; import java.time.Duration; +import java.util.HashMap; +import java.util.Map; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Request; @@ -39,6 +42,23 @@ public int[] bytes(int[] value) { return value; } + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + @Path("/query-params-to-map") + public Map<String, String> queryParamsToMap(@QueryParam("p1") String p1, @QueryParam("p2(") String p2, + @QueryParam("p3[") String p3, @QueryParam("p4?") String p4, @QueryParam("p5=") String p5, + @QueryParam("p6-") String p6) { + Map<String, String> map = new HashMap<>(); + map.put("p1", p1); + map.put("p2", p2); + map.put("p3", p3); + map.put("p4", p4); + map.put("p5", p5); + map.put("p6", p6); + return map; + } + @RestClient HelloClient2 client2; diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java index 3ae1342adb3..76d37c2e5d6 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java +++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java @@ -1,6 +1,7 @@ package io.quarkus.rest.client.reactive; import java.net.URL; +import java.util.Map; import javax.enterprise.context.ApplicationScoped; @@ -42,4 +43,8 @@ byte[] helloNonSimpleSyncBytes() { Integer[] helloNonSimpleSyncInts() { return clientNonSimple.echoSyncInts(new Integer[] { 1, 2, 3 }); } + + Map<String, String> helloQueryParamsToMap() { + return clientNonSimple.echoQueryAsMap("1", "2", "3", "4", "5", "6"); + } } diff --git a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java index 577eadfeca6..ba579b9bc3d 100644 --- a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java +++ b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java @@ -251,7 +251,7 @@ public RequestOptions apply(ServiceInstance serviceInstance) { return requestOptions.onItem() .transform(r -> r.setMethod(HttpMethod.valueOf(state.getHttpMethod())) - .setURI(uri.getPath() + (uri.getQuery() == null ? "" : "?" + uri.getQuery())) + .setURI(uri.getPath() + (uri.getRawQuery() == null ? "" : "?" + uri.getRawQuery())) .setFollowRedirects(followRedirects)) .onItem().invoke(r -> { if (readTimeout instanceof Long) {
['extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloNonSimpleClient.java', 'independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/handlers/ClientSendRequestHandler.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java']
{'.java': 5}
5
5
0
0
5
19,433,979
3,776,784
498,050
5,089
211
48
2
1
1,893
220
449
67
2
0
2021-11-25T13:03:31
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,579
quarkusio/quarkus/21636/21584
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21584
https://github.com/quarkusio/quarkus/pull/21636
https://github.com/quarkusio/quarkus/pull/21636
1
resolves
Qute: insert in for/each doesn't have the desired effect
### Describe the bug When putting a `{#insert}` section inside a for loop (or an each loop) in qute, nothing gets inserted and the default body is used instead. ### Expected behavior That one is able to write an include-able template in which a `{#insert}` section is inside a `{#for}` / `{#each}` section. ### Actual behavior The `{#insert}` section doesn't insert the template from the including template but instead uses the default body. ### How to Reproduce? Reproducer: [qute_insert_for_bug.zip](https://github.com/quarkusio/quarkus/files/7573051/qute_insert_for_bug.zip) Steps to reproduce the behavior: 1. Add an new template; name it "list_layout.html" with a following content: ``` <!DOCTYPE html> <html> <head></head> <body> {#for e : list} {#insert row name=e}No section body<br>{/} {/for} </body> </html> ``` 2. Add an second template; name it "helloworld_list.html" with following content ``` {#include list_layout} {#row} Hello world, {name}!<br> {/row} {/include} ``` 3. Write a resource/controller wich uses following code: ``` @Path("/list_helloworld") public class HelloWorldRessource { @Inject Template helloworld_list; @GET @Produces(MediaType.TEXT_HTML) public TemplateInstance helloworld() { return helloworld_list.instance().data("list", new String[] { "Tony", "Ben", "Bruce" }); } } ``` 4. Run the quarkus application and visit `http://localhost:8080/list_helloworld` in your browser. ### Output of `uname -a` or `ver` Linux 5.14.16-arch1-1 #1 SMP PREEMPT Tue, 02 Nov 2021 22:22:59 +0000 x86_64 GNU/Linux ### Output of `java -version` openjdk version "11.0.13" 2021-10-19 ### GraalVM version (if different from Java) GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05) ### Quarkus version or git rev 2.5.0.Final (using io.quarkus instead of io.quarkus.platform) ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) ### Additional information _No response_
b9b81c42defe8aa84a342b4c9cbcf640e6a7a61d
6c99e47632cdc39dc77e4462d2487987b411bff1
https://github.com/quarkusio/quarkus/compare/b9b81c42defe8aa84a342b4c9cbcf640e6a7a61d...6c99e47632cdc39dc77e4462d2487987b411bff1
diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java index 2bdc5915a1b..55986531e0e 100644 --- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java +++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java @@ -108,9 +108,9 @@ public SectionBlock getExtendingBlock(String name) { if (block != null) { return block; } - if (parent != null) { - return parent.getExtendingBlock(name); - } + } + if (parent != null) { + return parent.getExtendingBlock(name); } return null; } diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java index 0b6247b7073..ef7a6af72de 100644 --- a/independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java +++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java @@ -156,4 +156,11 @@ public void testAmbiguousInserts() { } } + @Test + public void testInsertInLoop() { + Engine engine = Engine.builder().addDefaults().build(); + engine.putTemplate("super", engine.parse("{#for i in 5}{#insert row}No row{/}{/for}")); + assertEquals("1:2:3:4:5:", engine.parse("{#include super}{#row}{i}:{/row}{/}").render()); + } + }
['independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/ResolutionContextImpl.java']
{'.java': 2}
2
2
0
0
2
19,384,908
3,767,197
496,826
5,077
223
38
6
1
2,143
255
604
76
2
3
2021-11-23T10:08:29
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,580
quarkusio/quarkus/21606/21604
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21604
https://github.com/quarkusio/quarkus/pull/21606
https://github.com/quarkusio/quarkus/pull/21606
1
fixes
ConcurrentModificationException from Micrometer extension on shutdown
### Describe the bug I've been seeing `ConcurrentModificationException`s being reported during the shutdown of tests with Quarkus 2.5.0. The problem is caused by https://github.com/quarkusio/quarkus/commit/01dc826c0744ff9a3e8a1daaec63b591deff95c1 since the Micrometer `CompositeMeterRegistry#getRegistries()` method doesn't return a copy and `Metrics#removeRegistry()` modifies the same instance in the for loop. ### Expected behavior No error on shutdown. ### Actual behavior ``` 09:25:08.146 ERROR [io.qu.ru.StartupContext] (main) Running a shutdown task failed: java.util.ConcurrentModificationException at java.base/java.util.IdentityHashMap$IdentityHashMapIterator.nextIndex(IdentityHashMap.java:735) at java.base/java.util.IdentityHashMap$KeyIterator.next(IdentityHashMap.java:826) at java.base/java.util.Collections$UnmodifiableCollection$1.next(Collections.java:1054) at io.quarkus.micrometer.runtime.MicrometerRecorder$1.run(MicrometerRecorder.java:142) at io.quarkus.runtime.StartupContext.runAllInReverseOrder(StartupContext.java:84) at io.quarkus.runtime.StartupContext.close(StartupContext.java:73) at io.quarkus.runner.ApplicationImpl.doStop(ApplicationImpl.zig:1229) at io.quarkus.runtime.Application.stop(Application.java:203) at io.quarkus.runtime.Application.stop(Application.java:155) at io.quarkus.runtime.Application.close(Application.java:137) at io.quarkus.runner.bootstrap.StartupActionImpl$4.close(StartupActionImpl.java:248) at io.quarkus.runner.bootstrap.RunningQuarkusApplicationImpl.close(RunningQuarkusApplicationImpl.java:35) at io.quarkus.test.junit.QuarkusTestExtension$4.close(QuarkusTestExtension.java:276) at io.quarkus.test.junit.QuarkusTestExtension$ExtensionState.close(QuarkusTestExtension.java:1165) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.execution.ExtensionValuesStore.lambda$closeAllStoredCloseableValues$3(ExtensionValuesStore.java:68) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395) at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at org.junit.jupiter.engine.execution.ExtensionValuesStore.closeAllStoredCloseableValues(ExtensionValuesStore.java:68) at org.junit.jupiter.engine.descriptor.AbstractExtensionContext.close(AbstractExtensionContext.java:77) at org.junit.jupiter.engine.execution.JupiterEngineExecutionContext.close(JupiterEngineExecutionContext.java:53) at org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.cleanUp(JupiterEngineDescriptor.java:67) at org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.cleanUp(JupiterEngineDescriptor.java:29) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$cleanUp$10(NodeTestTask.java:167) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.cleanUp(NodeTestTask.java:167) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:98) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:188) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:154) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:128) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548) ``` ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.5.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
c41872f2d3a1ecf97245c7f0eaaa4a18c658b07f
9acba2106c9c27be102dddaf7173bdc10a816c3b
https://github.com/quarkusio/quarkus/compare/c41872f2d3a1ecf97245c7f0eaaa4a18c658b07f...9acba2106c9c27be102dddaf7173bdc10a816c3b
diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java index 33fdf547acc..d7b79b8fc12 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java @@ -139,7 +139,8 @@ public void run() { Metrics.globalRegistry.remove(meter); } } - for (MeterRegistry meterRegistry : Metrics.globalRegistry.getRegistries()) { + // iterate over defensive copy to avoid ConcurrentModificationException + for (MeterRegistry meterRegistry : new ArrayList<>(Metrics.globalRegistry.getRegistries())) { meterRegistry.close(); Metrics.removeRegistry(meterRegistry); }
['extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java']
{'.java': 1}
1
1
0
0
1
19,317,893
3,754,863
495,323
5,060
293
49
3
1
6,693
231
1,459
98
1
1
2021-11-22T08:43:18
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,581
quarkusio/quarkus/21550/21359
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21359
https://github.com/quarkusio/quarkus/pull/21550
https://github.com/quarkusio/quarkus/pull/21550
1
fixes
Integration tests using postgresql fail to compile natively with Java 17
### Describe the bug Native compilation of integration tests using postgresql fails with GraalVM CE 21.3 Java17 (`quay.io/quarkus/ubi-quarkus-native-image:21.3-java17`) Namely the following tests fail to build: * main * jpa-db2 * jpa-mysql * jpa-postgresql * jpa-postgresql-withxml * hibernate-orm-tenancy * vault-app * smallrye-opentracing See https://github.com/graalvm/mandrel/actions/runs/1445890803 ### Expected behavior Tests should build and run. ### Actual behavior Tests fail to build with: ``` Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: sun.security.krb5.Credentials. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time. Detailed message: Trace: at parsing org.postgresql.util.internal.Unsafe.credentialCacheExists(Unsafe.java:18) Call path from entry point to org.postgresql.util.internal.Unsafe.credentialCacheExists(): at org.postgresql.util.internal.Unsafe.credentialCacheExists(Unsafe.java:17) at org.postgresql.core.v3.ConnectionFactoryImpl.credentialCacheExists(ConnectionFactoryImpl.java:413) at org.postgresql.core.v3.ConnectionFactoryImpl.enableGSSEncrypted(ConnectionFactoryImpl.java:430) at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:146) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:245) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225) at org.postgresql.Driver.makeConnection(Driver.java:466) at org.postgresql.Driver.access$100(Driver.java:63) at org.postgresql.Driver$ConnectThread.run(Driver.java:376) at java.lang.Thread.run(Thread.java:833) at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:596) at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192) at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0) ... ``` ### How to Reproduce? ``` ./mvnw -Dnative -Dnative.surefire.skip -pl integration-tests/jpa-postgresql package -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:21.3-java17 ``` ### Output of `uname -a` or `ver` 5.14.15-200.fc34.x86_64 #1 SMP Wed Oct 27 15:53:30 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` OpenJDK 64-Bit Server VM Temurin-11.0.13+8 (build 11.0.13+8, mixed mode) ### GraalVM version (if different from Java) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing) ### Quarkus version or git rev 132d9ea09b795d6027d557f46627092cfb29ce29 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) ### Additional information The issue is only reproducible on Java 17 and it seems to be resolved by passing: ``` -Dquarkus.native.additional-build-args="--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED" ``` Note that this is not a Quarkus issue. I am able to reproduce it using just GraalVM CE and https://github.com/zakkak/issue-reproducers/tree/krb5-credentials-failure-java17
6bd11e3bc6be2dff641447ee8095797bd89d85cc
ed6339ef1706116a9211a35467553ca09e030e6d
https://github.com/quarkusio/quarkus/compare/6bd11e3bc6be2dff641447ee8095797bd89d85cc...ed6339ef1706116a9211a35467553ca09e030e6d
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java index 1cf26f6762a..418c251c7c7 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java @@ -592,6 +592,15 @@ public NativeImageInvokerInfo build() { */ nativeImageArgs.add("-H:-ParseOnce"); + /** + * This makes sure the Kerberos integration module is made available in case any library + * refers to it (e.g. the PostgreSQL JDBC requires it, seems plausible that many others will as well): + * the module is not available by default on Java 17. + * No flag was introduced as this merely exposes the visibility of the module, it doesn't + * control its actual inclusion which will depend on the usual analysis. + */ + nativeImageArgs.add("-J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED"); + handleAdditionalProperties(nativeImageArgs); nativeImageArgs.add(
['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java']
{'.java': 1}
1
1
0
0
1
19,234,377
3,739,473
492,572
5,059
643
125
9
1
3,446
267
947
80
2
3
2021-11-18T20:42:27
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,582
quarkusio/quarkus/21531/21517
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21517
https://github.com/quarkusio/quarkus/pull/21531
https://github.com/quarkusio/quarkus/pull/21531
1
fixes
Health-UI call the wrong URL for health
### Describe the bug I have this dependency in my pom.xml (Quarkus 2.4.2.Final) ```` <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency> ```` if I enter this url : http://localhost:8080/q/health I'll obtain this ```` { "status": "UP", "checks": [ { "name": "SmallRye Reactive Messaging - liveness check", "status": "UP", "data": { "cleanupjob": "[OK]", "cleanupjob-completed": "[OK]" } }, { "name": "SmallRye Reactive Messaging - readiness check", "status": "UP", "data": { "cleanupjob": "[OK]", "cleanupjob-completed": "[OK]" } }, { "name": "SmallRye Reactive Messaging - startup check", "status": "UP", "data": { "cleanupjob": "[OK]", "cleanupjob-completed": "[OK]" } } ] } ```` but if I enter this : http://localhost:8080/q/health-ui/ I'll obtain this error Why the url in the UI is trying to retreive this http://localhost:8080/health instead of http://localhost:8080/q/health ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? ```` mvn io.quarkus.platform:quarkus-maven-plugin:2.4.2.Final:create \\ -DprojectGroupId=org.acme \\ -DprojectArtifactId=microprofile-health-quickstart \\ -Dextensions="smallrye-health" cd microprofile-health-quickstart mvn clean quarkus:dev http://localhost:8080/q/health/ -> works http://localhost:8080/q/health-ui/ -> fails ```` ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
7777cad163588b28f4ceca723baa1b26363efd26
b1f303248aff29fdec5e0fa9a9ee8f9c54be22d8
https://github.com/quarkusio/quarkus/compare/7777cad163588b28f4ceca723baa1b26363efd26...b1f303248aff29fdec5e0fa9a9ee8f9c54be22d8
diff --git a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java index 50b44d76a96..12802c0613a 100644 --- a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java +++ b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java @@ -414,10 +414,10 @@ void registerUiExtension( NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem, SmallRyeHealthConfig healthConfig, CurateOutcomeBuildItem curateOutcomeBuildItem, - LaunchModeBuildItem launchMode, + LaunchModeBuildItem launchModeBuildItem, LiveReloadBuildItem liveReloadBuildItem) throws Exception { - if (shouldInclude(launchMode, healthConfig)) { + if (shouldInclude(launchModeBuildItem, healthConfig)) { if ("/".equals(healthConfig.ui.rootPath)) { throw new ConfigurationException( @@ -431,11 +431,12 @@ void registerUiExtension( ResolvedDependency artifact = WebJarUtil.getAppArtifact(curateOutcomeBuildItem, HEALTH_UI_WEBJAR_GROUP_ID, HEALTH_UI_WEBJAR_ARTIFACT_ID); - if (launchMode.getLaunchMode().isDevOrTest()) { - Path tempPath = WebJarUtil.copyResourcesForDevOrTest(liveReloadBuildItem, curateOutcomeBuildItem, launchMode, + if (launchModeBuildItem.getLaunchMode().isDevOrTest()) { + Path tempPath = WebJarUtil.copyResourcesForDevOrTest(liveReloadBuildItem, curateOutcomeBuildItem, + launchModeBuildItem, artifact, HEALTH_UI_WEBJAR_PREFIX); - if (launchMode.equals(LaunchMode.DEVELOPMENT)) { + if (launchModeBuildItem.getLaunchMode().equals(LaunchMode.DEVELOPMENT)) { updateApiUrl(tempPath.resolve(JS_FILE_TO_UPDATE), healthPath); updateApiUrl(tempPath.resolve(INDEX_FILE_TO_UPDATE), healthPath); } @@ -445,7 +446,7 @@ void registerUiExtension( // Handle live reload of branding files if (liveReloadBuildItem.isLiveReload() && !liveReloadBuildItem.getChangedResources().isEmpty()) { - WebJarUtil.hotReloadBrandingChanges(curateOutcomeBuildItem, launchMode, artifact, + WebJarUtil.hotReloadBrandingChanges(curateOutcomeBuildItem, launchModeBuildItem, artifact, liveReloadBuildItem.getChangedResources()); } } else {
['extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java']
{'.java': 1}
1
1
0
0
1
19,232,717
3,739,167
492,526
5,059
1,010
215
13
1
2,143
204
537
97
6
3
2021-11-18T11:27:02
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,583
quarkusio/quarkus/21518/21490
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21490
https://github.com/quarkusio/quarkus/pull/21518
https://github.com/quarkusio/quarkus/pull/21518
1
fixes
@RolesAllowed annotation broken for resources returning a Multi
### Describe the bug `@RolesAllowed` is being ignored for endpoints returning a Multi. I think the issue introduced by #21270 ### Expected behavior When expected roles are missing, API should fail with Forbidden Error (403) ### Actual behavior Received 200 OK response ### How to Reproduce? https://github.com/mvmandapati/reactive-routes Steps: 1. Run mvn clean verify to see the failure ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` OpenJDK Runtime Environment Temurin-17+35 (build 17+35) OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.2 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 ### Additional information _No response_
9547a4da4efd354d3966a6e9875d117807dce90a
84fe327bc57b49bb65bf8633b91b19098afe23ed
https://github.com/quarkusio/quarkus/compare/9547a4da4efd354d3966a6e9875d117807dce90a...84fe327bc57b49bb65bf8633b91b19098afe23ed
diff --git a/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java b/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java index 7d2474d0730..209d37d1ab4 100644 --- a/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java +++ b/extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java @@ -41,9 +41,7 @@ public Object handle(InvocationContext ic) throws Exception { }).subscribeAsCompletionStage(); } else if (Multi.class.isAssignableFrom(returnType)) { return constrainer.nonBlockingCheck(ic.getMethod(), ic.getParameters()) - // Do not use transformToMulti as we want to preserve the type of multi produced by the user method. - // This is required for Reactive Routes to handle custom Multi serialization. - .toMulti().plug(x -> new MultiContinuation(ic).apply(x)); + .onItem().transformToMulti(new MultiContinuation(ic)); } else { constrainer.check(ic.getMethod(), ic.getParameters()); return ic.proceed();
['extensions/security/runtime/src/main/java/io/quarkus/security/runtime/interceptor/SecurityHandler.java']
{'.java': 1}
1
1
0
0
1
19,217,074
3,736,169
492,103
5,055
375
68
4
1
853
122
231
46
1
0
2021-11-17T14:05:22
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,584
quarkusio/quarkus/21513/21512
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/21512
https://github.com/quarkusio/quarkus/pull/21513
https://github.com/quarkusio/quarkus/pull/21513
1
fixes
Add support of mTLS in Spring Cloud Config Client
### Describe the bug I'd like to use Spring Cloud Config Client to connect to our Spring Cloud Config Server using mTLS. But after providing corresponding truststore.ks an keystore.ks in spring-cloud-config section I figured out that keystore.ks is used as a parameter for webClientOptions.setTrustStoreOptions instead of webClientOptions.setKeyStoreOptions. So no client certs could be sent to server. From my point of view current behavior looks like a bug. ### Expected behavior keystore.ks used as a parameter for webClientOptions.setKeyStoreOptions ### Actual behavior keystore.ks used as a parameter for webClientOptions.setTrustStoreOptions ### How to Reproduce? Setup Spring Cloud Config Client with truststore and keystore and try to connect Spring Cloud Config Server with mTLS enabled. No client certs will be provided. ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.2.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
005c2b4ddc57a894c51a1ef8d9a4c27823167eae
1d407205f6eaac5ea00d5c84f8f88fa5093386e9
https://github.com/quarkusio/quarkus/compare/005c2b4ddc57a894c51a1ef8d9a4c27823167eae...1d407205f6eaac5ea00d5c84f8f88fa5093386e9
diff --git a/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java b/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java index 39c01eb02c6..081a525469e 100644 --- a/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java +++ b/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java @@ -77,15 +77,16 @@ public static WebClient createHttpClient(Vertx vertx, SpringCloudConfigClientCon } } else if (trustAll) { skipVerify(webClientOptions); - } else if (springCloudConfig.keyStore.isPresent()) { - Path trustStorePath = springCloudConfig.keyStore.get(); - String type = determineStoreType(trustStorePath); - KeyStoreOptionsBase storeOptions = storeOptions(trustStorePath, springCloudConfig.keyStorePassword, + } + if (springCloudConfig.keyStore.isPresent()) { + Path keyStorePath = springCloudConfig.keyStore.get(); + String type = determineStoreType(keyStorePath); + KeyStoreOptionsBase storeOptions = storeOptions(keyStorePath, springCloudConfig.keyStorePassword, createStoreOptions(type)); if (isPfx(type)) { - webClientOptions.setPfxTrustOptions((PfxOptions) storeOptions); + webClientOptions.setPfxKeyCertOptions((PfxOptions) storeOptions); } else { - webClientOptions.setTrustStoreOptions((JksOptions) storeOptions); + webClientOptions.setKeyStoreOptions((JksOptions) storeOptions); } } } catch (Exception e) {
['extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java']
{'.java': 1}
1
1
0
0
1
19,215,929
3,735,943
492,086
5,055
991
185
13
1
1,169
167
265
39
0
0
2021-11-17T07:04:56
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,611
quarkusio/quarkus/20966/20609
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20609
https://github.com/quarkusio/quarkus/pull/20966
https://github.com/quarkusio/quarkus/pull/20966
1
fixes
Compilation errors are only logged in http response during hot reload
### Describe the bug I often have the problem, that I think a hot reload was sucessful, and that I can continue testing. The app successfully restarts, but has hidden compilation errors. These compilation errors are only visible as the response to the http request. But when I am testing using the frontend of the app, I will never see these compilation errors. I might not have the developer console of the browser open to see network requests. They are not logged to dev ui, and not to the terminal running quarkus. I then resort to stop quarkus, and either, dependending on what I am working on, do a full rebuild (mvn clean install), or a simple mvn quarkus:dev again. Which will show me the errors in terminal I am also not able to see errors from annotation processors because of this. ### Expected behavior The errors are logged to the terminal / dev ui. ### Actual behavior No errors visible on hot reload in the terminal / dev ui. ``` __ ____ __ _____ ___ __ ____ ______ --/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/ -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\ --\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/ 2021-10-08 07:55:40,641 INFO [io.quarkus] (Quarkus Main Thread) yaml-hot-reload 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.3.0.Final) started in 0.802s. Listening on: http://localhos t:8080 2021-10-08 07:55:40,642 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated. 2021-10-08 07:55:40,643 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, config-yaml, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, vert x] 2021-10-08 07:55:40,645 INFO [io.qua.dep.dev.RuntimeUpdatesProcessor] (vert.x-worker-thread-0) Live reload total time: 0.890s ``` ### How to Reproduce? 1) Download the reproducer: [yaml-hot-reload.zip](https://github.com/quarkusio/quarkus/files/7308919/yaml-hot-reload.zip) 2) mvn quarkus:dev 3) Change anything in the source to cause compilation to fail 4) curl -v localhost:8080/hello. The app restarts sucessfuly. No errors are visible in the terminal. The error is only visible as http response. 5) Fix the previous error. 6) curl -v localhost:8080/hello. The app restarts sucessfuly. 7) In ModelMapper.java, add `@Mapping(source = "name", target = "abc")` to the map method. This will cause mapstruct (annotation processor) to print out errors during compilation. 8) curl -v localhost:8080/hello. The app restarts sucessfuly. No errors are visible in the terminal. The error is only visible as http response. ### Output of `uname -a` or `ver` MSYS_NT-10.0-19043 NANB7NLNVP2 3.1.7-340.x86_64 2021-03-26 22:17 UTC x86_64 Msys ### Output of `java -version` openjdk version "17" 2021-09-14 OpenJDK Runtime Environment Temurin-17+35 (build 17+35) OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.3.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739) Maven home: C:\\eclipse\\tools\\apache-maven Java version: 17, vendor: Eclipse Adoptium, runtime: C:\\eclipse\\tools\\java\\17 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows" ### Additional information _No response_
856f4bc5ed2b38a0d0ad12af1ca1cd59a78f9123
e69c3bc0a4570bef0c5989c4214e60412cc87c45
https://github.com/quarkusio/quarkus/compare/856f4bc5ed2b38a0d0ad12af1ca1cd59a78f9123...e69c3bc0a4570bef0c5989c4214e60412cc87c45
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java index 1470e4ccc95..6220c8e3578 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java @@ -64,6 +64,8 @@ import io.quarkus.deployment.dev.testing.TestListener; import io.quarkus.deployment.dev.testing.TestSupport; import io.quarkus.deployment.util.FileUtil; +import io.quarkus.dev.console.QuarkusConsole; +import io.quarkus.dev.console.StatusLine; import io.quarkus.dev.spi.DevModeType; import io.quarkus.dev.spi.HotReplacementContext; import io.quarkus.dev.spi.HotReplacementSetup; @@ -83,6 +85,7 @@ public class RuntimeUpdatesProcessor implements HotReplacementContext, Closeable private final QuarkusCompiler compiler; private final DevModeType devModeType; volatile Throwable compileProblem; + volatile Throwable testCompileProblem; private volatile Predicate<ClassInfo> disableInstrumentationForClassPredicate = new AlwaysFalsePredicate<>(); private volatile Predicate<Index> disableInstrumentationForIndexPredicate = new AlwaysFalsePredicate<>(); @@ -124,6 +127,7 @@ public class RuntimeUpdatesProcessor implements HotReplacementContext, Closeable private WatchServiceFileSystemWatcher testClassChangeWatcher; private Timer testClassChangeTimer; + volatile StatusLine compileOutput; public RuntimeUpdatesProcessor(Path applicationRoot, DevModeContext context, QuarkusCompiler compiler, DevModeType devModeType, BiConsumer<Set<String>, ClassScanResult> restartCallback, @@ -293,10 +297,11 @@ private void periodicTestCompile() { TestScanningLock.lockForTests(); try { ClassScanResult changedTestClassResult = compileTestClasses(); - ClassScanResult changedApp = checkForChangedClasses(compiler, DevModeContext.ModuleInfo::getMain, false, test); + ClassScanResult changedApp = checkForChangedClasses(compiler, DevModeContext.ModuleInfo::getMain, false, test, + true); if (changedApp.compilationHappened) { - if (compileProblem != null) { - testSupport.testCompileFailed(compileProblem); + if (testCompileProblem != null) { + testSupport.testCompileFailed(testCompileProblem); } else { testSupport.testCompileSucceeded(); } @@ -308,11 +313,11 @@ private void periodicTestCompile() { ClassScanResult merged = ClassScanResult.merge(changedTestClassResult, changedApp); if (configFileRestartNeeded) { - if (compileProblem == null) { + if (testCompileProblem == null) { testSupport.runTests(null); } } else if (merged.isChanged()) { - if (compileProblem == null) { + if (testCompileProblem == null) { testSupport.runTests(merged); } } @@ -327,10 +332,9 @@ private ClassScanResult compileTestClasses() { ClassScanResult changedTestClassResult = new ClassScanResult(); try { changedTestClassResult = checkForChangedClasses(testCompiler, - m -> m.getTest().orElse(DevModeContext.EMPTY_COMPILATION_UNIT), false, test); + m -> m.getTest().orElse(DevModeContext.EMPTY_COMPILATION_UNIT), false, test, true); if (compileProblem != null) { testSupport.testCompileFailed(compileProblem); - compileProblem = null; //we don't want to block the app over a test problem } else { if (changedTestClassResult.isChanged()) { testSupport.testCompileSucceeded(); @@ -368,6 +372,18 @@ public Throwable getDeploymentProblem() { @Override public void setRemoteProblem(Throwable throwable) { compileProblem = throwable; + getCompileOutput().setMessage(throwable.getMessage()); + } + + private StatusLine getCompileOutput() { + if (compileOutput == null) { + synchronized (this) { + if (compileOutput == null) { + compileOutput = QuarkusConsole.INSTANCE.registerStatusLine(QuarkusConsole.COMPILE_ERROR); + } + } + } + return compileOutput; } @Override @@ -417,7 +433,7 @@ public boolean doScan(boolean userInitiated, boolean forceRestart) { } ClassScanResult changedClassResults = checkForChangedClasses(compiler, DevModeContext.ModuleInfo::getMain, false, - main); + main, false); Set<String> filesChanged = checkForFileChange(DevModeContext.ModuleInfo::getMain, main); boolean configFileRestartNeeded = forceRestart || filesChanged.stream().map(main.watchedFilePaths::get) @@ -477,6 +493,9 @@ public boolean doScan(boolean userInitiated, boolean forceRestart) { } } } + if (compileProblem != null) { + return false; + } //if there is a deployment problem we always restart on scan //this is because we can't setup the config file watches @@ -582,7 +601,8 @@ public Set<String> syncState(Map<String, String> fileHashes) { } ClassScanResult checkForChangedClasses(boolean firstScan) { - ClassScanResult classScanResult = checkForChangedClasses(compiler, DevModeContext.ModuleInfo::getMain, firstScan, main); + ClassScanResult classScanResult = checkForChangedClasses(compiler, DevModeContext.ModuleInfo::getMain, firstScan, main, + false); if (firstScan) { test.merge(main); } @@ -595,7 +615,7 @@ ClassScanResult checkForChangedTestClasses(boolean firstScan) { } ClassScanResult ret = checkForChangedClasses(testSupport.getCompiler(), s -> s.getTest().orElse(DevModeContext.EMPTY_COMPILATION_UNIT), firstScan, - test); + test, true); if (firstScan) { startTestScanningTimer(); } @@ -611,7 +631,7 @@ ClassScanResult checkForChangedTestClasses(boolean firstScan) { */ ClassScanResult checkForChangedClasses(QuarkusCompiler compiler, Function<DevModeContext.ModuleInfo, DevModeContext.CompilationUnit> cuf, boolean firstScan, - TimestampSet timestampSet) { + TimestampSet timestampSet, boolean compilingTests) { ClassScanResult classScanResult = new ClassScanResult(); boolean ignoreFirstScanChanges = firstScan; @@ -670,8 +690,17 @@ && sourceFileWasRecentModified(p, ignoreFirstScanChanges, firstScan)) compiler.compile(sourcePath.toString(), changedSourceFiles.stream() .collect(groupingBy(this::getFileExtension, Collectors.toSet()))); compileProblem = null; + if (compilingTests) { + testCompileProblem = null; + } + getCompileOutput().setMessage(null); } catch (Exception e) { - compileProblem = e; + if (compilingTests) { + testCompileProblem = e; + } else { + compileProblem = e; + } + getCompileOutput().setMessage(e.getMessage()); return classScanResult; } boolean timestampsChanged = false; diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java index 00d6f6c75fd..764b66944c3 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java @@ -49,7 +49,6 @@ public class TestConsoleHandler implements TestListener { private volatile ConsoleStateManager.ConsoleContext consoleContext; private volatile StatusLine resultsOutput; private volatile StatusLine testsStatusOutput; - private volatile StatusLine testsCompileOutput; public TestConsoleHandler(DevModeType devModeType) { this.devModeType = devModeType; @@ -79,7 +78,6 @@ public void listenerRegistered(TestController testController) { this.consoleContext = ConsoleStateManager.INSTANCE.createContext("Continuous Testing"); this.resultsOutput = QuarkusConsole.INSTANCE.registerStatusLine(QuarkusConsole.TEST_RESULTS); this.testsStatusOutput = QuarkusConsole.INSTANCE.registerStatusLine(QuarkusConsole.TEST_STATUS); - this.testsCompileOutput = QuarkusConsole.INSTANCE.registerStatusLine(QuarkusConsole.COMPILE_ERROR); setupPausedConsole(); } @@ -145,16 +143,6 @@ public void testsDisabled() { setupPausedConsole(); } - @Override - public void testCompileFailed(String message) { - testsCompileOutput.setMessage(message); - } - - @Override - public void testCompileSucceeded() { - testsCompileOutput.setMessage(null); - } - @Override public void testRunStarted(Consumer<TestRunListener> listenerConsumer) { diff --git a/core/devmode-spi/src/main/java/io/quarkus/dev/console/BasicConsole.java b/core/devmode-spi/src/main/java/io/quarkus/dev/console/BasicConsole.java index 6d82fd3c2b8..8c146c4ff21 100644 --- a/core/devmode-spi/src/main/java/io/quarkus/dev/console/BasicConsole.java +++ b/core/devmode-spi/src/main/java/io/quarkus/dev/console/BasicConsole.java @@ -114,6 +114,7 @@ public void setMessage(String message) { return; } if (message == null) { + old = null; return; } if (message.equals(old)) {
['core/devmode-spi/src/main/java/io/quarkus/dev/console/BasicConsole.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java']
{'.java': 3}
3
3
0
0
3
18,947,706
3,685,973
485,946
5,001
3,197
573
66
3
3,400
484
1,018
71
2
1
2021-10-25T05:44:48
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,613
quarkusio/quarkus/20947/20945
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20945
https://github.com/quarkusio/quarkus/pull/20947
https://github.com/quarkusio/quarkus/pull/20947
1
fixes
Neo4j Dev Service image cannot be substituted with custom-built image
### Describe the bug The Neo4j dev service has a property `quarkus.neo4j.devservices.image-name` to substitute the used Neo4j Docker image with a custom one. However, this property is currently only of limit usefulness, because the dev service -- in contrast to other dev services -- does not declare the provided image as a compatible subsitution to testcontainers. ### Expected behavior Any image that I deliberately provide as a Neo4j substitution is accepted and used. ### Actual behavior ``` java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.neo4j.deployment.Neo4jDevServicesProcessor#startNeo4jDevService threw an exception: java.lang.RuntimeException: java.lang.IllegalStateException: Failed to verify that image 'registry.gitlab.com/xxx/neo4j-with-plugins:v4.4.9' is a compatible substitute for 'neo4j'. This generally means that you are trying to use an image that Testcontainers has not been designed to use. If this is deliberate, and if you are confident that the image is compatible, you should declare compatibility in code using the `asCompatibleSubstituteFor` method. For example: DockerImageName myImage = DockerImageName.parse("registry.gitlab.com/xxx/neo4j-with-plugins:v4.4.9").asCompatibleSubstituteFor("neo4j"); and then use `myImage` instead. at io.quarkus.neo4j.deployment.Neo4jDevServicesProcessor.startNeo4jDevService(Neo4jDevServicesProcessor.java:86) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:829) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Caused by: java.lang.IllegalStateException: Failed to verify that image 'registry.gitlab.com/xxx/neo4j-with-plugins:v4.4.9' is a compatible substitute for 'neo4j'. This generally means that you are trying to use an image that Testcontainers has not been designed to use. If this is deliberate, and if you are confident that the image is compatible, you should declare compatibility in code using the `asCompatibleSubstituteFor` method. For example: DockerImageName myImage = DockerImageName.parse("registry.gitlab.com/xxx/neo4j-with-plugins:v4.4.9").asCompatibleSubstituteFor("neo4j"); and then use `myImage` instead. at org.testcontainers.utility.DockerImageName.assertCompatibleWith(DockerImageName.java:248) at org.testcontainers.containers.Neo4jContainer.<init>(Neo4jContainer.java:91) at org.testcontainers.containers.Neo4jContainer.<init>(Neo4jContainer.java:77) at io.quarkus.neo4j.deployment.Neo4jDevServicesProcessor.startNeo4j(Neo4jDevServicesProcessor.java:130) at io.quarkus.neo4j.deployment.Neo4jDevServicesProcessor.startNeo4jDevService(Neo4jDevServicesProcessor.java:72) ... 11 more ``` ### How to Reproduce? ```sh mvn io.quarkus.platform:quarkus-maven-plugin:2.3.1.Final:create \\ -DprojectGroupId=org.acme \\ -DprojectArtifactId=neo4j-quickstart \\ -DclassName="org.acme.datasource.GreetingResource" \\ -Dextensions="resteasy,neo4j,resteasy-jackson,neo4j" cd neo4j-quickstart echo "quarkus.neo4j.devservices.image-name = debian:buster" >> ./src/main/resources/application.properties mvn verify ``` ### Output of `uname -a` or `ver` Linux pres 5.10.75-1-lts #1 SMP Wed, 20 Oct 2021 11:02:09 +0000 x86_64 GNU/Linux ### Output of `java -version` openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7) OpenJDK 64-Bit Server VM (build 11.0.12+7, mixed mode) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev see commands above ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) maven ### Additional information Something like https://github.com/quarkusio/quarkus/blob/main/extensions/devservices/postgresql/src/main/java/io/quarkus/devservices/postgresql/deployment/PostgresqlDevServicesProcessor.java#L68 is missing for the Neo4j dev service. Support for any kind of image substitution seems to have been added for other dev services with https://github.com/quarkusio/quarkus/pull/15939 but Neo4j didn't exist at that point in time.
8e5722d2474fed6de992efc56a3a458f84c23686
f7938fbf98d99ec9068b370a66e9f77995bdf1f4
https://github.com/quarkusio/quarkus/compare/8e5722d2474fed6de992efc56a3a458f84c23686...f7938fbf98d99ec9068b370a66e9f77995bdf1f4
diff --git a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java index 4084ef36dab..4a8928af2b6 100644 --- a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java +++ b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java @@ -10,6 +10,7 @@ import org.jboss.logging.Logger; import org.testcontainers.containers.Neo4jContainer; +import org.testcontainers.utility.DockerImageName; import io.quarkus.deployment.IsNormal; import io.quarkus.deployment.annotations.BuildProducer; @@ -127,7 +128,8 @@ private Neo4jContainer<?> startNeo4j(Neo4jDevServiceConfig configuration, Launch return null; } - var neo4jContainer = new Neo4jContainer<>(configuration.imageName); + var neo4jContainer = new Neo4jContainer<>( + DockerImageName.parse(configuration.imageName).asCompatibleSubstituteFor("neo4j")); configuration.additionalEnv.forEach(neo4jContainer::addEnv); neo4jContainer.start(); return neo4jContainer;
['extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java']
{'.java': 1}
1
1
0
0
1
18,947,035
3,685,849
485,927
5,001
281
60
4
1
4,866
407
1,241
77
2
2
2021-10-22T08:49:44
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,647
quarkusio/quarkus/20112/20153
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20153
https://github.com/quarkusio/quarkus/pull/20112
https://github.com/quarkusio/quarkus/pull/20112
1
close
Gradle - quarkusDependency runs for all submodules when attempting to build one
### Describe the bug In a monorepo with multiple subprojects, any build will cause `quarkusDependency` and `quarkusDependencyCopy` tasks to always run for all subprojects. This is particularly concerning in a 30 project monorepo when trying to build a single project (i.e. `./gradlew project:build`), which takes 3-4 minutes on every build. ### Expected behavior The `quarkusDependency` and `quarkusDependencyCopy` taks should only run for the individual project and any project dependencies. ### Actual behavior All subprojects run `quarkusDependency` and `quarkusDependencyCopy` always. ### How to Reproduce? 1. Create a multiproject repository 2. Run a single project: `./gradlew project:build` ### Output of `uname -a` or `ver` Ubuntu 20.04 ### Output of `java -version` OpenJDK 11.0.11 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2.2 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 7.1.1 ### Additional information _No response_
5d77d270c81160f4ea88043efcae87e7c725d916
4749536b2ca221d61114da9615705734b76420e5
https://github.com/quarkusio/quarkus/compare/5d77d270c81160f4ea88043efcae87e7c725d916...4749536b2ca221d61114da9615705734b76420e5
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java index 370a14f9533..1dc5149b41b 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java @@ -33,6 +33,7 @@ import io.quarkus.gradle.builder.QuarkusModelBuilder; import io.quarkus.gradle.dependency.ApplicationDeploymentClasspathBuilder; import io.quarkus.gradle.dependency.ConditionalDependenciesEnabler; +import io.quarkus.gradle.dependency.ExtensionDependency; import io.quarkus.gradle.extension.QuarkusPluginExtension; import io.quarkus.gradle.extension.SourceSetExtension; import io.quarkus.gradle.tasks.QuarkusAddExtension; @@ -82,11 +83,6 @@ public class QuarkusPlugin implements Plugin<Project> { public static final String NATIVE_TEST_IMPLEMENTATION_CONFIGURATION_NAME = "nativeTestImplementation"; public static final String NATIVE_TEST_RUNTIME_ONLY_CONFIGURATION_NAME = "nativeTestRuntimeOnly"; - private static final String[] CONDITIONAL_DEPENDENCY_LOOKUP = new String[] { - JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, - DEV_MODE_CONFIGURATION_NAME - }; - private final ToolingModelBuilderRegistry registry; @Inject @@ -193,9 +189,7 @@ public void execute(Task test) { .plus(testSourceSet.getOutput())); // create a custom configuration for devmode - configurations.create(DEV_MODE_CONFIGURATION_NAME).extendsFrom( - configurations.getByName(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME), - configurations.getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)); + configurations.create(DEV_MODE_CONFIGURATION_NAME); // create a custom configuration to be used for the dependencies of the testNative task configurations.maybeCreate(NATIVE_TEST_IMPLEMENTATION_CONFIGURATION_NAME) @@ -239,6 +233,31 @@ public void execute(Task test) { }); } + private void registerConditionalDependencies(Project project) { + ConditionalDependenciesEnabler conditionalDependenciesEnabler = new ConditionalDependenciesEnabler(project); + ApplicationDeploymentClasspathBuilder deploymentClasspathBuilder = new ApplicationDeploymentClasspathBuilder( + project); + project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME).getIncoming() + .beforeResolve((dependencies) -> { + Set<ExtensionDependency> implementationExtensions = conditionalDependenciesEnabler + .declareConditionalDependencies(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME); + deploymentClasspathBuilder.createBuildClasspath(implementationExtensions, + JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true); + }); + project.getConfigurations().getByName(DEV_MODE_CONFIGURATION_NAME).getIncoming().beforeResolve((devDependencies) -> { + Set<ExtensionDependency> devModeExtensions = conditionalDependenciesEnabler + .declareConditionalDependencies(DEV_MODE_CONFIGURATION_NAME); + deploymentClasspathBuilder.createBuildClasspath(devModeExtensions, DEV_MODE_CONFIGURATION_NAME, false); + }); + project.getConfigurations().getByName(JavaPlugin.TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME).getIncoming() + .beforeResolve((testDependencies) -> { + Set<ExtensionDependency> testExtensions = conditionalDependenciesEnabler + .declareConditionalDependencies(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME); + deploymentClasspathBuilder.createBuildClasspath(testExtensions, + JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME, false); + }); + } + private Set<Path> getSourcesParents(SourceSet mainSourceSet) { Set<File> srcDirs = mainSourceSet.getJava().getSrcDirs(); return srcDirs.stream() @@ -270,18 +289,7 @@ private void configureBuildNativeTask(Project project) { private void afterEvaluate(Project project) { - ConditionalDependenciesEnabler conditionalDependenciesEnabler = new ConditionalDependenciesEnabler(project); - ApplicationDeploymentClasspathBuilder deploymentClasspathBuilder = new ApplicationDeploymentClasspathBuilder(project); - - conditionalDependenciesEnabler - .declareConditionalDependencies(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME); - deploymentClasspathBuilder.createBuildClasspath(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true); - - for (String baseConfiguration : CONDITIONAL_DEPENDENCY_LOOKUP) { - conditionalDependenciesEnabler - .declareConditionalDependencies(baseConfiguration); - deploymentClasspathBuilder.createBuildClasspath(baseConfiguration, false); - } + registerConditionalDependencies(project); final HashSet<String> visited = new HashSet<>(); ConfigurationContainer configurations = project.getConfigurations(); @@ -297,7 +305,6 @@ private void afterEvaluate(Project project) { .sourceSetExtension(); if (sourceSetExtension.extraNativeTest() != null) { - SourceSetContainer sourceSets = project.getConvention().getPlugin(JavaPluginConvention.class) .getSourceSets(); SourceSet nativeTestSourceSets = sourceSets.getByName(NATIVE_TEST_SOURCE_SET_NAME); diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java index 79f279557a9..1be45e06907 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java @@ -55,14 +55,23 @@ public class QuarkusModelBuilder implements ParameterizedToolingModelBuilder<Mod private static final String MAIN_RESOURCES_OUTPUT = "build/resources/main"; private static final String CLASSES_OUTPUT = "build/classes"; - private static final String DEPLOYMENT_CONFIGURATION = "deploymentConfiguration"; + private static final String DEPLOYMENT_CONFIGURATION = "quarkusDeploymentConfiguration"; + private static final String CLASSPATH_CONFIGURATION = "quarkusClasspathConfiguration"; private static Configuration classpathConfig(Project project, LaunchMode mode) { if (LaunchMode.TEST.equals(mode)) { return project.getConfigurations().getByName(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME); } if (LaunchMode.DEVELOPMENT.equals(mode)) { - return project.getConfigurations().getByName(QuarkusPlugin.DEV_MODE_CONFIGURATION_NAME); + Configuration classpathConfiguration = project.getConfigurations().findByName(CLASSPATH_CONFIGURATION); + if (classpathConfiguration != null) { + project.getConfigurations().remove(classpathConfiguration); + } + + return project.getConfigurations().create(CLASSPATH_CONFIGURATION).extendsFrom( + project.getConfigurations().getByName(QuarkusPlugin.DEV_MODE_CONFIGURATION_NAME), + project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME), + project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)); } return project.getConfigurations().getByName(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME); } @@ -76,16 +85,29 @@ private static Configuration deploymentClasspathConfig(Project project, LaunchMo } deploymentConfiguration = project.getConfigurations().create(DEPLOYMENT_CONFIGURATION) - .withDependencies(ds -> ds.addAll(platforms)) - .extendsFrom(project.getConfigurations().getByName(ApplicationDeploymentClasspathBuilder - .toDeploymentConfigurationName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME))); + .withDependencies(ds -> ds.addAll(platforms)); + Configuration implementationDeployment = project.getConfigurations().findByName(ApplicationDeploymentClasspathBuilder + .toDeploymentConfigurationName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME)); + if (implementationDeployment != null) { + deploymentConfiguration.extendsFrom(implementationDeployment); + } + if (LaunchMode.TEST.equals(mode)) { - deploymentConfiguration.extendsFrom(project.getConfigurations().getByName(ApplicationDeploymentClasspathBuilder - .toDeploymentConfigurationName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME))); + Configuration testDeploymentConfiguration = project.getConfigurations() + .findByName(ApplicationDeploymentClasspathBuilder + .toDeploymentConfigurationName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME)); + if (testDeploymentConfiguration != null) { + deploymentConfiguration.extendsFrom(testDeploymentConfiguration); + } } if (LaunchMode.DEVELOPMENT.equals(mode)) { - deploymentConfiguration.extendsFrom(project.getConfigurations().getByName(ApplicationDeploymentClasspathBuilder - .toDeploymentConfigurationName(QuarkusPlugin.DEV_MODE_CONFIGURATION_NAME))); + Configuration devDeploymentConfiguration = project.getConfigurations() + .findByName(ApplicationDeploymentClasspathBuilder + .toDeploymentConfigurationName(QuarkusPlugin.DEV_MODE_CONFIGURATION_NAME)); + if (devDeploymentConfiguration != null) { + deploymentConfiguration.extendsFrom(devDeploymentConfiguration); + } + } return deploymentConfiguration; } diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java b/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java index f49fe94a713..6d9332c6d74 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java @@ -22,14 +22,12 @@ public static String toDeploymentConfigurationName(String baseConfigurationName) return baseConfigurationName + DEPLOYMENT_CONFIGURATION_SUFFIX; } - public void createBuildClasspath(String baseConfigurationName, boolean common) { + public void createBuildClasspath(Set<ExtensionDependency> extensions, String baseConfigurationName, boolean common) { String deploymentConfigurationName = toDeploymentConfigurationName(baseConfigurationName); project.getConfigurations().create(deploymentConfigurationName); DependencyHandler dependencies = project.getDependencies(); - Set<ExtensionDependency> firstLevelExtensions = DependencyUtils.loadQuarkusExtension(project, - project.getConfigurations().findByName(baseConfigurationName)); - for (ExtensionDependency extension : firstLevelExtensions) { + for (ExtensionDependency extension : extensions) { if (common) { commonExtensions.add(extension); } else if (commonExtensions.contains(extension)) { diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ConditionalDependenciesEnabler.java b/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ConditionalDependenciesEnabler.java index 39414d74335..bf621a7225b 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ConditionalDependenciesEnabler.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ConditionalDependenciesEnabler.java @@ -17,24 +17,32 @@ public class ConditionalDependenciesEnabler { private final Map<String, ExtensionDependency> featureVariants = new HashMap<>(); - + private final Set<ExtensionDependency> allExtensions = new HashSet<>(); private final Project project; public ConditionalDependenciesEnabler(Project project) { this.project = project; } - public void declareConditionalDependencies(String baseConfigurationName) { + public Set<ExtensionDependency> declareConditionalDependencies(String baseConfigurationName) { featureVariants.clear(); - - Configuration resolvedConfiguration = DependencyUtils.duplicateConfiguration(project, - project.getConfigurations().getByName(baseConfigurationName)); - + allExtensions.clear(); + Configuration baseConfiguration = project.getConfigurations().getByName(baseConfigurationName); + if (baseConfiguration.getIncoming().getDependencies().isEmpty()) { + return Collections.emptySet(); + } + Configuration resolvedConfiguration = DependencyUtils.duplicateConfiguration(project, baseConfiguration); Set<ResolvedArtifact> runtimeArtifacts = resolvedConfiguration.getResolvedConfiguration().getResolvedArtifacts(); + List<ExtensionDependency> extensions = collectExtensionsForResolution(runtimeArtifacts); + if (extensions.isEmpty()) { + return allExtensions; + } + featureVariants.putAll(extractFeatureVariants(extensions)); - resolveConditionalDependencies(extensions, resolvedConfiguration, baseConfigurationName); + resolveConditionalDependencies(extensions, runtimeArtifacts, baseConfigurationName); + return allExtensions; } private List<ExtensionDependency> collectExtensionsForResolution(Set<ResolvedArtifact> runtimeArtifacts) { @@ -42,6 +50,7 @@ private List<ExtensionDependency> collectExtensionsForResolution(Set<ResolvedArt for (ResolvedArtifact artifact : runtimeArtifacts) { ExtensionDependency extension = DependencyUtils.getExtensionInfoOrNull(project, artifact); if (extension != null) { + allExtensions.add(extension); if (!extension.conditionalDependencies.isEmpty()) { if (extension.needsResolution(runtimeArtifacts)) { firstLevelExtensions.add(extension); @@ -53,18 +62,26 @@ private List<ExtensionDependency> collectExtensionsForResolution(Set<ResolvedArt } private void resolveConditionalDependencies(List<ExtensionDependency> conditionalExtensions, - Configuration existingDependencies, String baseConfigurationName) { - final Configuration conditionalDeps = createConditionalDependenciesConfiguration(existingDependencies, - conditionalExtensions); + Set<ResolvedArtifact> runtimeArtifacts, String baseConfigurationName) { + boolean hasChanged = false; List<ExtensionDependency> newConditionalDependencies = new ArrayList<>(); - newConditionalDependencies.addAll(conditionalExtensions); - for (ResolvedArtifact artifact : conditionalDeps.getResolvedConfiguration().getResolvedArtifacts()) { + + final Configuration conditionalDeps = createConditionalDependenciesConfiguration(project, + conditionalExtensions); + Set<ResolvedArtifact> resolvedArtifacts = conditionalDeps.getResolvedConfiguration().getResolvedArtifacts(); + + Set<ResolvedArtifact> availableRuntimeArtifacts = new HashSet<>(); + availableRuntimeArtifacts.addAll(runtimeArtifacts); + availableRuntimeArtifacts.addAll(resolvedArtifacts); + + for (ResolvedArtifact artifact : resolvedArtifacts) { ExtensionDependency extensionDependency = DependencyUtils.getExtensionInfoOrNull(project, artifact); if (extensionDependency != null) { - if (DependencyUtils.exist(conditionalDeps.getResolvedConfiguration().getResolvedArtifacts(), + if (DependencyUtils.exist(availableRuntimeArtifacts, extensionDependency.dependencyConditions)) { enableConditionalDependency(extensionDependency.extensionId); + allExtensions.add(extensionDependency); if (!extensionDependency.conditionalDependencies.isEmpty()) { featureVariants.putAll(extractFeatureVariants(Collections.singletonList(extensionDependency))); } @@ -76,12 +93,13 @@ private void resolveConditionalDependencies(List<ExtensionDependency> conditiona } } - Configuration enhancedDependencies = DependencyUtils.duplicateConfiguration(project, - project.getConfigurations().getByName(baseConfigurationName)); - if (hasChanged) { if (!newConditionalDependencies.isEmpty()) { - resolveConditionalDependencies(newConditionalDependencies, enhancedDependencies, baseConfigurationName); + Configuration enhancedDependencies = DependencyUtils.duplicateConfiguration(project, + project.getConfigurations().getByName(baseConfigurationName)); + Set<ResolvedArtifact> enhancedRuntimeArtifacts = enhancedDependencies.getResolvedConfiguration() + .getResolvedArtifacts(); + resolveConditionalDependencies(newConditionalDependencies, enhancedRuntimeArtifacts, baseConfigurationName); } } } @@ -96,11 +114,10 @@ private Map<String, ExtensionDependency> extractFeatureVariants(List<ExtensionDe return possibleVariant; } - private Configuration createConditionalDependenciesConfiguration(Configuration existingDeps, + private Configuration createConditionalDependenciesConfiguration(Project project, List<ExtensionDependency> extensions) { - Configuration newConfiguration = existingDeps.copy(); - newConfiguration.getDependencies().addAll(collectConditionalDependencies(extensions)); - return newConfiguration; + Set<Dependency> dependencies = collectConditionalDependencies(extensions); + return project.getConfigurations().detachedConfiguration(dependencies.toArray(new Dependency[0])); } private Set<Dependency> collectConditionalDependencies(List<ExtensionDependency> extensionDependencies) { diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/DependencyUtils.java b/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/DependencyUtils.java index 91e17dbe0bf..0c0a1ceb647 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/DependencyUtils.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/dependency/DependencyUtils.java @@ -87,21 +87,6 @@ public static boolean exists(Set<ResolvedArtifact> runtimeArtifacts, Dependency return false; } - public static Set<ExtensionDependency> loadQuarkusExtension(Project project, Configuration configuration) { - Set<ExtensionDependency> extensions = new HashSet<>(); - Configuration configurationCopy = duplicateConfiguration(project, configuration); - - Set<ResolvedArtifact> resolvedArtifacts = configurationCopy.getResolvedConfiguration().getResolvedArtifacts(); - for (ResolvedArtifact artifact : resolvedArtifacts) { - ExtensionDependency extension = getExtensionInfoOrNull(project, artifact); - if (extension != null) { - extensions.add(extension); - } - } - - return extensions; - } - public static boolean isTestFixtureDependency(Dependency dependency) { if (!(dependency instanceof ModuleDependency)) { return false; diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java index f28c8bca01a..ba5888e3c6b 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java @@ -52,7 +52,6 @@ import io.quarkus.bootstrap.resolver.AppModelResolverException; import io.quarkus.deployment.dev.DevModeContext; import io.quarkus.deployment.dev.QuarkusDevModeLauncher; -import io.quarkus.gradle.QuarkusPlugin; import io.quarkus.runtime.LaunchMode; public class QuarkusDev extends QuarkusTask { @@ -353,7 +352,7 @@ private void addSelfWithLocalDeps(Project project, GradleDevModeLauncher.Builder if (!visited.add(project.getPath())) { return; } - final Configuration compileCp = project.getConfigurations().findByName(QuarkusPlugin.DEV_MODE_CONFIGURATION_NAME); + final Configuration compileCp = project.getConfigurations().findByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME); if (compileCp != null) { compileCp.getIncoming().getDependencies().forEach(d -> { if (d instanceof ProjectDependency) { diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java index 8c6ccbd33e2..73a4764e7b6 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java @@ -4,8 +4,11 @@ import java.util.Collections; import org.gradle.api.GradleException; +import org.gradle.api.file.FileCollection; +import org.gradle.api.tasks.CompileClasspath; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.Optional; +import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; @@ -30,6 +33,16 @@ public String getFile() { return file; } + /** + * Create a dependency on classpath resolution. This makes sure included build are build this task runs. + * + * @return resolved compile classpath + */ + @CompileClasspath + public FileCollection getClasspath() { + return QuarkusGradleUtils.getSourceSet(getProject(), SourceSet.MAIN_SOURCE_SET_NAME).getCompileClasspath(); + } + @Option(description = "The name of the file to generate", option = "file") public void setFile(String file) { this.file = file;
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java', 'devtools/gradle/src/main/java/io/quarkus/gradle/builder/QuarkusModelBuilder.java', 'devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ConditionalDependenciesEnabler.java', 'devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java', 'devtools/gradle/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java', 'devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java', 'devtools/gradle/src/main/java/io/quarkus/gradle/dependency/DependencyUtils.java']
{'.java': 7}
7
7
0
0
7
18,370,151
3,572,431
470,668
4,823
12,208
1,892
185
7
1,033
145
277
40
0
0
2021-09-13T19:12:01
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,638
quarkusio/quarkus/20390/16448
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/16448
https://github.com/quarkusio/quarkus/pull/20390
https://github.com/quarkusio/quarkus/pull/20390
1
fixes
Misleading exception message on @Transactional(Transactional.TxType.NEVER)
## Describe the bug When method marked with `@Transactional(Transactional.TxType.NEVER)` is called inside the transaction, exception is thrown with "ARJUNA016110: Transaction is required for invocation", but the situation is opposite, it requires no transaction for invocation This line requires new message - [TransactionalInterceptorNever.java:36](https://github.com/quarkusio/quarkus/blob/923ee07ef48cf209b282395a7118925ebeccbe2b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorNever.java#L36)
b1c714755be333a60ea2167e9ad10d880ab725fc
c899e637fc873b90fd3fdc0f4baf376ec26b42af
https://github.com/quarkusio/quarkus/compare/b1c714755be333a60ea2167e9ad10d880ab725fc...c899e637fc873b90fd3fdc0f4baf376ec26b42af
diff --git a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorNever.java b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorNever.java index 4d98d450f27..e55cec7473b 100644 --- a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorNever.java +++ b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorNever.java @@ -10,8 +10,6 @@ import javax.transaction.Transactional; import javax.transaction.TransactionalException; -import com.arjuna.ats.jta.logging.jtaLogger; - /** * @author [email protected] 25/05/2013 */ @@ -33,7 +31,7 @@ public Object intercept(InvocationContext ic) throws Exception { @Override protected Object doIntercept(TransactionManager tm, Transaction tx, InvocationContext ic) throws Exception { if (tx != null) { - throw new TransactionalException(jtaLogger.i18NLogger.get_tx_required(), new InvalidTransactionException()); + throw new TransactionalException("Transaction is not allowed for invocation", new InvalidTransactionException()); } return invokeInNoTx(ic); }
['extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorNever.java']
{'.java': 1}
1
1
0
0
1
18,599,020
3,619,100
477,007
4,914
296
55
4
1
568
42
137
5
1
0
2021-09-24T22:26:56
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,639
quarkusio/quarkus/20386/20375
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20375
https://github.com/quarkusio/quarkus/pull/20386
https://github.com/quarkusio/quarkus/pull/20386
1
fixes
Hibernate Validator: `@ApplicationScoped` custom `ValueExtractor` bean lead to `ValueExtractorDefinitionException`
### Describe the bug Even after we fix #20347, custom `ValueExtractor` implementations provided as CDI beans can only have the `@Singleton` scope or `@Dependent` pseudo-scope. Any scope requiring instantiation will lead to an exception on startup complaining about "parallel definitions of value extractors on a given class", even though that's not the case. ### Expected behavior A value extractor annotated with `@ApplicationScoped` should be correctly added to the `ValidatorFactory`, and be used automatically to constraints on extracted elements (e.g. `Container<@NotBlank String>`). ### Actual behavior Exception on startup: ``` java.lang.ExceptionInInitializerError at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:398) at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:215) at io.quarkus.test.QuarkusUnitTest.beforeAll(QuarkusUnitTest.java:509) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$10(ClassBasedTestDescriptor.java:381) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:381) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:205) at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:80) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67) at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86) at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86) at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:188) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:154) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:128) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548) Caused by: java.lang.RuntimeException: Failed to start quarkus at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:236) ... 46 more Caused by: javax.validation.valueextraction.ValueExtractorDefinitionException: HV000218: Having parallel definitions of value extractors on a given class is not allowed: io.quarkus.hibernate.validator.test.valueextractor.ApplicationScopedCustomValueExtractorTest_ApplicationScopedContainerValueExtractor_ClientProxy. at org.hibernate.validator.internal.engine.valueextraction.ValueExtractorDescriptor.getValueExtractorDefinition(ValueExtractorDescriptor.java:142) at org.hibernate.validator.internal.engine.valueextraction.ValueExtractorDescriptor.<init>(ValueExtractorDescriptor.java:45) at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.addValueExtractor(AbstractConfigurationImpl.java:271) at org.hibernate.validator.internal.engine.AbstractConfigurationImpl.addValueExtractor(AbstractConfigurationImpl.java:80) at io.quarkus.hibernate.validator.runtime.HibernateValidatorRecorder$2.created(HibernateValidatorRecorder.java:143) at io.quarkus.arc.runtime.ArcRecorder.initBeanContainer(ArcRecorder.java:70) at io.quarkus.deployment.steps.ArcProcessor$generateResources-1025303321.deploy_0(ArcProcessor$generateResources-1025303321.zig:128) at io.quarkus.deployment.steps.ArcProcessor$generateResources-1025303321.deploy(ArcProcessor$generateResources-1025303321.zig:40) at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:194) ... 46 more ``` ### How to Reproduce? I'm going to add a disabled test as part of the PR for #20347. Look for `ApplicationScopedCustomValueExtractorTest` in the codebase. ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.3.0.CR1, f0aba8594140c708c7c477d3b1efd4a0b29a3095 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information I believe the cause is a bug in `org.hibernate.validator.internal.engine.valueextraction.ValueExtractorDescriptor#determineValueExtractorDefinitions`. It gets passed the proxy class, which extends the actual implementation class. And for some reason, when passed a class that extends another class that implements `ValueExtractor`, it behaves as if `ValueExtractor` was implemented multiple times, both by the superclass and the subclass. It seems caused by the fact that `java.lang.Class#getAnnotatedInterfaces` returns annotated interfaces of the class **and its superclasses**, which means `determineValueExtractorDefinitions` should not be walking through superclasses to collect all annotated interfaces (when it does, it collects duplicates).
cf07662f4574e3eb6774ae1e44b1b3c0433b48d7
30f382ea18d4eb38787515404ea8c7fc6b24bca8
https://github.com/quarkusio/quarkus/compare/cf07662f4574e3eb6774ae1e44b1b3c0433b48d7...30f382ea18d4eb38787515404ea8c7fc6b24bca8
diff --git a/extensions/hibernate-validator/deployment/src/test/java/io/quarkus/hibernate/validator/test/valueextractor/ApplicationScopedCustomValueExtractorTest.java b/extensions/hibernate-validator/deployment/src/test/java/io/quarkus/hibernate/validator/test/valueextractor/ApplicationScopedCustomValueExtractorTest.java index 6daaa7a8b40..3065ac937e1 100644 --- a/extensions/hibernate-validator/deployment/src/test/java/io/quarkus/hibernate/validator/test/valueextractor/ApplicationScopedCustomValueExtractorTest.java +++ b/extensions/hibernate-validator/deployment/src/test/java/io/quarkus/hibernate/validator/test/valueextractor/ApplicationScopedCustomValueExtractorTest.java @@ -11,13 +11,11 @@ import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; -@Disabled("Reproduces https://github.com/quarkusio/quarkus/issues/20375, not yet fixed") public class ApplicationScopedCustomValueExtractorTest { @Inject diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AsmUtilCopy.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AsmUtilCopy.java index 4602c12ea37..89513c0dc75 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AsmUtilCopy.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AsmUtilCopy.java @@ -164,48 +164,35 @@ else if (erased) /** * Returns the Java bytecode signature of a given Jandex Class using the given type argument mappings. - * For example, given this class: - * + * + * For example, given this superclass: + * * <pre> * {@code * public class Foo<R> extends Bar<R> implements List<String> { * } * </pre> - * - * This will return <tt>&lt;R:Ljava/lang/Object;>LBar&lt;TR;>;Ljava/util/List&lt;Ljava/lang/String;>;</tt>. - * - * @param klass the class you want the signature for. - * - * @return a bytecode signature for that class. - */ - public static String getSignature(ClassInfo klass) { - return getSignature(klass, NO_ARG_MAPPER); - } - - /** - * Returns the Java bytecode signature of a given Jandex Class using the given type argument mappings. - * For example, given this class: - * + * + * This will return <tt>&lt;R:Ljava/lang/Object;>LFoo&lt;TR;>;</tt>. + * {@code Bar} and {@code List} will be ignored, as they won't be part of the signature of the generated subclass. + * + * All will be as if the generated subclass was declared like this: + * * <pre> * {@code - * public class Foo<R> extends Bar<R> implements List<String> { + * public class MyGeneratedClass<R> extends Foo<R> { * } * </pre> + * + * @param superClass the superclass of the type you want to generate the signature for. * - * This will return <tt>&lt;R:Ljava/lang/Object;>LBar&lt;TR;>;Ljava/util/List&lt;Ljava/lang/String;>;</tt>. - * - * @param klass the class you want the signature for. - * - * @param typeArgMapper a mapping between type variables and their resolved type. + * @param superClassAsType the superclass as a Jandex Type. * @return a bytecode signature for that class. */ - public static String getSignature(ClassInfo klass, Function<TypeVariable, Type> typeArgMapper) { - StringBuilder signature = new StringBuilder(""); - toSignature(signature, klass.typeParameters(), typeArgMapper, false); - toSignature(signature, klass.superClassType(), typeArgMapper, false); - for (Type superinterface : klass.interfaceTypes()) { - toSignature(signature, superinterface, typeArgMapper, false); - } + public static String getGeneratedSubClassSignature(ClassInfo superClass, Type superClassAsType) { + StringBuilder signature = new StringBuilder(); + toSignature(signature, superClass.typeParameters(), NO_ARG_MAPPER, false); + toSignature(signature, superClassAsType, NO_ARG_MAPPER, false); return signature.toString(); } @@ -224,21 +211,6 @@ private static void toSignature(StringBuilder sb, List<TypeVariable> typeParamet sb.append(">"); } - /** - * Returns true if the given class has type parameters or if its superclass or superinterfaces require a signature - */ - public static boolean needsSignature(ClassInfo klass) { - if (!klass.typeParameters().isEmpty() - || needsSignature(klass.superClassType())) { - return true; - } - for (Type type : klass.interfaceTypes()) { - if (needsSignature(type)) - return true; - } - return false; - } - /** * Returns true if the given method has type parameters or if its return type or parameter types require a signature */ diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java index 5720e8a9302..7eb5be95ff0 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java @@ -111,8 +111,16 @@ Collection<Resource> generate(BeanInfo bean, String beanClassName, ClassCreator clientProxy = ClassCreator.builder().classOutput(classOutput).className(generatedName) .superClass(superClass) .interfaces(interfaces.toArray(new String[0])).build(); - if (AsmUtilCopy.needsSignature(providerClass)) { - clientProxy.setSignature(AsmUtilCopy.getSignature(providerClass)); + // See https://docs.oracle.com/javase/specs/jvms/se14/html/jvms-4.html#jvms-4.7.9.1 + // Essentially a signature is needed if a class has type parameters or extends/implements parameterized type. + // We're generating a subtype (subclass or subinterface) of "providerClass". + // The only way for that generated subtype to have type parameters or to extend/implement a parameterized type + // is if providerClass has type parameters. + // Whether supertypes or superinterfaces of providerClass have type parameters is irrelevant: + // as long as those type parameters are bound in providerClass, + // they won't affect the need for a signature in the generated subtype. + if (!providerClass.typeParameters().isEmpty()) { + clientProxy.setSignature(AsmUtilCopy.getGeneratedSubClassSignature(providerClass, bean.getProviderType())); } Map<ClassInfo, Map<TypeVariable, Type>> resolvedTypeVariables = Types.resolvedTypeVariables(providerClass, bean.getDeployment()); diff --git a/independent-projects/arc/processor/src/test/java/io/quarkus/arc/processor/AsmUtilCopyTest.java b/independent-projects/arc/processor/src/test/java/io/quarkus/arc/processor/AsmUtilCopyTest.java deleted file mode 100644 index e11239251d1..00000000000 --- a/independent-projects/arc/processor/src/test/java/io/quarkus/arc/processor/AsmUtilCopyTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package io.quarkus.arc.processor; - -import static org.junit.jupiter.api.Assertions.assertFalse; - -import java.io.IOException; -import org.junit.jupiter.api.Test; - -public class AsmUtilCopyTest { - - @Test - public void testNeedsSignature() throws IOException { - assertFalse(AsmUtilCopy.needsSignature(Basics.index(Object.class).getClassByName(DotNames.OBJECT))); - } - -}
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AsmUtilCopy.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java', 'independent-projects/arc/processor/src/test/java/io/quarkus/arc/processor/AsmUtilCopyTest.java', 'extensions/hibernate-validator/deployment/src/test/java/io/quarkus/hibernate/validator/test/valueextractor/ApplicationScopedCustomValueExtractorTest.java']
{'.java': 4}
4
4
0
0
4
18,601,004
3,620,032
477,128
4,912
3,848
829
74
2
8,726
396
1,802
106
0
1
2021-09-24T16:33:40
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,640
quarkusio/quarkus/20368/20350
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20350
https://github.com/quarkusio/quarkus/pull/20368
https://github.com/quarkusio/quarkus/pull/20368
1
resolves
NullPointerException in MicrometerRecorder.registerMetrics
### Describe the bug Hello Quarkus-Team, great work. I'm currently moving a project from tomee to quarkus. This is a example project for my students in "database technology". So I have used a lot of your extensions for jpa, mongodb, neo4j, cassandra, ... All worked absolutly fine. In a last step I want to introduce the extension "quarkus-micrometer-registry-prometheus" to demonstrate the use of prometheus as a time series database. When I add this extension, the project doesn't start any more. The exception is: ``` 2021-09-23 08:55:32,209 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.NullPointerException at io.quarkus.micrometer.runtime.MicrometerRecorder.registerMetrics(MicrometerRecorder.java:169) at io.quarkus.deployment.steps.MicrometerProcessor$configureRegistry-2125003310.deploy_0(MicrometerProcessor$configureRegistry-2125003310.zig:123) at io.quarkus.deployment.steps.MicrometerProcessor$configureRegistry-2125003310.deploy(MicrometerProcessor$configureRegistry-2125003310.zig:40) at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:1189) at io.quarkus.runtime.Application.start(Application.java:101) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:101) ``` It seems to me, that one of my lot of extension does not work correctly and so corrupt the complete system. Is it possible, that you do a null check in the registerMetrics method (the parameter consumer is called with null)? ```java public void registerMetrics(Consumer<MetricsFactory> consumer) { consumer.accept(factory); } ``` I do a greater google search but it seems that no other people has my problem ;-) I have tried to deactivate all of the metrics in the application.properties to find the "corrupt" extension but no of these deactivations have an effect to my NullPointerProblem. ``` quarkus.micrometer.binder.jvm=false quarkus.micrometer.binder.system=false quarkus.micrometer.binder-enabled-default=false quarkus.micrometer.registry-enabled-default=false quarkus.scheduler.metrics.enabled=false quarkus.datasource.jdbc.enable-metrics=false quarkus.datasource.metrics.enabled=false quarkus.hibernate-orm.statistics=false quarkus.hibernate-orm.metrics.enabled=false quarkus.neo4j.pool.metrics.enabled=false quarkus.log.metrics.enabled=false quarkus.smallrye-graphql.metrics.enabled=false quarkus.grpc.metrics.enabled=false ``` Only when I deactivate all with "quarkus.micrometer.enabled=true" there is no NullPointerException any more. But then I also have no metrics ;-) For me, this is not a serious problem, because that is a project for students, but I want to report the problem so that you can think about a null check at this point. Bye Rolf ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.1.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
4ae3d96bbe7b497ddf14c7c40045cf1d277f4231
5ec9bcebeb9df1cf35c1be0b4c30a53b749a8b8c
https://github.com/quarkusio/quarkus/compare/4ae3d96bbe7b497ddf14c7c40045cf1d277f4231...5ec9bcebeb9df1cf35c1be0b4c30a53b749a8b8c
diff --git a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java index cc01bcb212c..8e058dcfc9d 100644 --- a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java +++ b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java @@ -235,7 +235,7 @@ void registerExtensionMetrics(MicrometerRecorder recorder, // RootMeterRegistryBuildItem is present to indicate we call this after the root registry has been initialized for (MetricsFactoryConsumerBuildItem item : metricsFactoryConsumerBuildItems) { - if (item.executionTime() == ExecutionTime.STATIC_INIT) { + if (item != null && item.executionTime() == ExecutionTime.STATIC_INIT) { recorder.registerMetrics(item.getConsumer()); } } @@ -261,7 +261,7 @@ void configureRegistry(MicrometerRecorder recorder, recorder.configureRegistries(config, typeClasses, shutdownContextBuildItem); for (MetricsFactoryConsumerBuildItem item : metricsFactoryConsumerBuildItems) { - if (item.executionTime() == ExecutionTime.RUNTIME_INIT) { + if (item != null && item.executionTime() == ExecutionTime.RUNTIME_INIT) { recorder.registerMetrics(item.getConsumer()); } }
['extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/MicrometerProcessor.java']
{'.java': 1}
1
1
0
0
1
18,589,717
3,617,214
476,816
4,913
313
68
4
1
3,322
345
775
89
0
3
2021-09-23T22:59:46
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,641
quarkusio/quarkus/20316/20301
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20301
https://github.com/quarkusio/quarkus/pull/20316
https://github.com/quarkusio/quarkus/pull/20316
1
fixes
Live reload instrumentation steps executed when instrumentation is disabled
### Describe the bug Raised off the back of this Zulip thread: https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/Live.20reload.20with.20instrumentation.20disabled When `quarkus.live-reload.instrumentation = false`, it seems that intrumentation logic still runs. ### Expected behavior Instrumentation steps are not run on live reload if it's disabled. ### Actual behavior Instrumentation steps seem to be run on live reload if when they should be disabled. ### How to Reproduce? ``` git clone https://github.com/apache/camel-quarkus-examples cd timer-log mvn quarkus:dev ``` Edit `src/main/java/org/acme/timer/TimerRoute.java` and change the log message to trigger a live reload. There's an exception due to a bug / bad implementation of the Camel `HotReplacementSetup`, but the message logged with the stack trace says `Failed to replace classes via instrumentation`. Which is unexpected if instrumentation is disabled. ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2.3.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
ebbd26f6e66c786030e287a7f50b05fded04045c
f68cea0214087e4b5adbe7d9c70297bb47207c88
https://github.com/quarkusio/quarkus/compare/ebbd26f6e66c786030e287a7f50b05fded04045c...f68cea0214087e4b5adbe7d9c70297bb47207c88
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java index b6a1a710246..dfb792b19ef 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java @@ -436,7 +436,7 @@ public boolean doScan(boolean userInitiated, boolean forceRestart) { changedFilesForRestart.addAll(changedClassResults.getDeletedClasses()); if (ClassChangeAgent.getInstrumentation() != null && lastStartIndex != null && !configFileRestartNeeded - && devModeType != DevModeType.REMOTE_LOCAL_SIDE) { + && devModeType != DevModeType.REMOTE_LOCAL_SIDE && instrumentationEnabled()) { //attempt to do an instrumentation based reload //if only code has changed and not the class structure, then we can do a reload //using the JDK instrumentation API (assuming we were started with the javaagent) @@ -455,8 +455,7 @@ public boolean doScan(boolean userInitiated, boolean forceRestart) { classTransformers.apply(name, bytes)); } Index current = indexer.complete(); - boolean ok = instrumentationEnabled() - && !disableInstrumentationForIndexPredicate.test(current); + boolean ok = !disableInstrumentationForIndexPredicate.test(current); if (ok) { for (ClassInfo clazz : current.getKnownClasses()) { ClassInfo old = lastStartIndex.getClassByName(clazz.name());
['core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java']
{'.java': 1}
1
1
0
0
1
18,572,924
3,613,921
476,459
4,908
420
66
5
1
1,285
167
310
49
2
1
2021-09-21T23:21:11
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,642
quarkusio/quarkus/20295/20293
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20293
https://github.com/quarkusio/quarkus/pull/20295
https://github.com/quarkusio/quarkus/pull/20295
1
fixes
Correct handling when empty GraphQL requests arrive
### Describe the bug When an empty POST request arrives at the `/graphql` endpoint, the client receives a `500 Internal Server Error` and this appears in the log: ``` 2021-09-21 08:53:19,800 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-4) HTTP Request to /graphql/ failed, error id: 87f1643d-a786-485b-89c4-6d105c1c1ea8-1: java.lang.NullPointerException at java.base/java.io.StringReader.<init>(StringReader.java:50) at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.getJsonObjectFromBody(SmallRyeGraphQLExecutionHandler.java:173) at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.handlePost(SmallRyeGraphQLExecutionHandler.java:89) at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLExecutionHandler.doHandle(SmallRyeGraphQLExecutionHandler.java:70) at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handleWithIdentity(SmallRyeGraphQLAbstractHandler.java:66) at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handle(SmallRyeGraphQLAbstractHandler.java:48) at io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLAbstractHandler.handle(SmallRyeGraphQLAbstractHandler.java:23) at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48) at io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:159) at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100) at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:157) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:829) ``` an empty GET request yields `204 No Content` ### Expected behavior I believe that the correct behavior for both cases is to issue `400 Bad Request`, per the spec: https://github.com/graphql/graphql-over-http/blob/40a50a351a887799b3d1550b665b2101b26dcda4/spec/GraphQLOverHTTP.md#unparseable-or-invalid-request-body ### Actual behavior _No response_ ### How to Reproduce? ``` curl -v -H"Content-Type: application/json" -X POST localhost:8080/graphql curl -v -H"Content-Type: application/json" -X GET localhost:8080/graphql/ ``` ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
0d9d2e4824c6fec1cc2bc8b0f59b471a5a62efcf
3fed6020dad22ff1471e7abb793ef9abd66c6428
https://github.com/quarkusio/quarkus/compare/0d9d2e4824c6fec1cc2bc8b0f59b471a5a62efcf...3fed6020dad22ff1471e7abb793ef9abd66c6428
diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java index babd92de9a5..161305c4565 100644 --- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java +++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java @@ -38,6 +38,7 @@ public class SmallRyeGraphQLExecutionHandler extends SmallRyeGraphQLAbstractHand + StandardCharsets.UTF_8.name(); private static final String DEFAULT_REQUEST_CONTENT_TYPE = "application/json; charset=" + StandardCharsets.UTF_8.name(); + private static final String MISSING_OPERATION = "Missing operation body"; public SmallRyeGraphQLExecutionHandler(boolean allowGet, boolean allowPostWithQueryParameters, CurrentIdentityAssociation currentIdentityAssociation, @@ -90,10 +91,23 @@ private void handlePost(HttpServerResponse response, RoutingContext ctx, String String postResponse; if (hasQueryParameters(ctx) && allowPostWithQueryParameters) { JsonObject jsonObjectFromQueryParameters = getJsonObjectFromQueryParameters(ctx); - JsonObject mergedJsonObject = Json.createMergePatch(jsonObjectFromQueryParameters).apply(jsonObjectFromBody) - .asJsonObject(); + JsonObject mergedJsonObject; + if (jsonObjectFromBody != null) { + mergedJsonObject = Json.createMergePatch(jsonObjectFromQueryParameters).apply(jsonObjectFromBody) + .asJsonObject(); + } else { + mergedJsonObject = jsonObjectFromQueryParameters; + } + if (!mergedJsonObject.containsKey(QUERY)) { + response.setStatusCode(400).end(MISSING_OPERATION); + return; + } postResponse = doRequest(mergedJsonObject); } else { + if (jsonObjectFromBody == null) { + response.setStatusCode(400).end(MISSING_OPERATION); + return; + } postResponse = doRequest(jsonObjectFromBody); } response.setStatusCode(200).setStatusMessage(OK).end(Buffer.buffer(postResponse, requestedCharset)); @@ -114,7 +128,7 @@ private void handleGet(HttpServerResponse response, RoutingContext ctx, String r .end(Buffer.buffer(getResponse, requestedCharset)); } else { - response.setStatusCode(204).end(); + response.setStatusCode(400).end(MISSING_OPERATION); } } catch (UnsupportedEncodingException uee) { throw new RuntimeException(uee); @@ -170,6 +184,9 @@ private JsonObject getJsonObjectFromBody(RoutingContext ctx) throws IOException return input.build(); // Else we expect a Json in the content } else { + if (body == null || body.isEmpty()) { + return null; + } try (StringReader bodyReader = new StringReader(body); JsonReader jsonReader = jsonReaderFactory.createReader(bodyReader)) { return jsonReader.readObject();
['extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java']
{'.java': 1}
1
1
0
0
1
18,565,759
3,612,483
476,303
4,908
1,203
183
23
1
2,975
186
753
65
1
2
2021-09-21T08:19:41
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,644
quarkusio/quarkus/20204/20064
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20064
https://github.com/quarkusio/quarkus/pull/20204
https://github.com/quarkusio/quarkus/pull/20204
1
resolves
io.quarkus.qute.i18n.MessageBundle annotated class *__Bundle not found for multi-module gradle project in test mode
### Describe the bug Kind of related to [this](https://github.com/quarkusio/quarkus/issues/20063) In a similar multi-module gradle setup, when we use a @MessageBundle annotated class @MessageBundle(value = "alert") public interface AlertMessages { @Message("") String withoutParams(); @Message("") String withParams(String name); } with several localized implementations generated from the provided messages/alert_xx.properties files we get the following error when trying to run the integration tests in the `integration-test` sub-module in test mode > Caused by: java.lang.NoClassDefFoundError: org/acme/AlertMessages_Bundle This error does not affect single module projects. ### Expected behavior The integration tets should be able to be executed in test mode as it happens in a single module project. ### Actual behavior The application fails to start in test mode > Caused by: java.lang.RuntimeException: Failed to start quarkus ... > Caused by: java.lang.NoClassDefFoundError: org/acme/AlertMessages_Bundle ### How to Reproduce? clone the following repo https://github.com/nikosk686/quarkus-message-bundle-poc checkout the `2.2.0-multi-module-integration-tests-error` branch and try to run the test located in the `integration-test` sub-module You can also check the master branch which is a single module application and test runs correctly. ### Output of `uname -a` or `ver` Linux dell-desktop 5.10.0-1045-oem #47-Ubuntu SMP Wed Aug 18 10:41:03 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` openjdk version "11.0.10" 2021-01-19 LTS OpenJDK Runtime Environment Corretto-11.0.10.9.1 (build 11.0.10+9-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2.0 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 6.9 ### Additional information The problem is not present in quarkus v1 (run the test in the `integration-test` sub-module in the `1.13.7-working-single-module` branch of the above repo, it should pass)
377c56c7904b227e3f1d38ff6701bea465a976fe
8a256a1f11bb68086c3cba6f0594df713ac84cad
https://github.com/quarkusio/quarkus/compare/377c56c7904b227e3f1d38ff6701bea465a976fe...8a256a1f11bb68086c3cba6f0594df713ac84cad
diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java index 40e4ca0488a..ed28a9e4a09 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java @@ -194,8 +194,8 @@ List<MessageBundleBuildItem> processBundles(BeanArchiveIndexBuildItem beanArchiv // Generate implementations // name -> impl class - Map<String, String> generatedImplementations = generateImplementations(bundles, - applicationArchivesBuildItem, generatedClasses, messageTemplateMethods); + Map<String, String> generatedImplementations = generateImplementations(bundles, generatedClasses, + messageTemplateMethods); // Register synthetic beans for (MessageBundleBuildItem bundle : bundles) { @@ -523,14 +523,12 @@ void generateExamplePropertiesFiles(List<MessageBundleMethodBuildItem> messageBu } private Map<String, String> generateImplementations(List<MessageBundleBuildItem> bundles, - ApplicationArchivesBuildItem applicationArchivesBuildItem, BuildProducer<GeneratedClassBuildItem> generatedClasses, BuildProducer<MessageBundleMethodBuildItem> messageTemplateMethods) throws IOException { Map<String, String> generatedTypes = new HashMap<>(); - ClassOutput defaultClassOutput = new GeneratedClassGizmoAdaptor(generatedClasses, - new AppClassPredicate(applicationArchivesBuildItem)); + ClassOutput defaultClassOutput = new GeneratedClassGizmoAdaptor(generatedClasses, new AppClassPredicate()); for (MessageBundleBuildItem bundle : bundles) { ClassInfo bundleInterface = bundle.getDefaultBundleInterface(); @@ -577,17 +575,16 @@ private Map<String, String> generateImplementations(List<MessageBundleBuildItem> String locale = entry.getKey(); ClassOutput localeAwareGizmoAdaptor = new GeneratedClassGizmoAdaptor(generatedClasses, - new AppClassPredicate(applicationArchivesBuildItem, - new Function<String, String>() { - @Override - public String apply(String className) { - String localeSuffix = "_" + locale; - if (className.endsWith(localeSuffix)) { - return className.replace(localeSuffix, ""); - } - return className; - } - })); + new AppClassPredicate(new Function<String, String>() { + @Override + public String apply(String className) { + String localeSuffix = "_" + locale; + if (className.endsWith(localeSuffix)) { + return className.replace(localeSuffix, ""); + } + return className; + } + })); generatedTypes.put(localizedFile.toString(), generateImplementation(bundle.getDefaultBundleInterface(), bundleImpl, bundleInterface, localeAwareGizmoAdaptor, @@ -1018,16 +1015,13 @@ private Set<Path> findMessageFiles(ApplicationArchivesBuildItem applicationArchi private static class AppClassPredicate implements Predicate<String> { - private final ApplicationArchivesBuildItem applicationArchives; private final Function<String, String> additionalClassNameSanitizer; - public AppClassPredicate(ApplicationArchivesBuildItem applicationArchives) { - this(applicationArchives, Function.identity()); + public AppClassPredicate() { + this(Function.identity()); } - public AppClassPredicate(ApplicationArchivesBuildItem applicationArchives, - Function<String, String> additionalClassNameSanitizer) { - this.applicationArchives = applicationArchives; + public AppClassPredicate(Function<String, String> additionalClassNameSanitizer) { this.additionalClassNameSanitizer = additionalClassNameSanitizer; } @@ -1041,8 +1035,7 @@ public boolean test(String name) { } // E.g. to match the bundle class generated for a localized file; org.acme.Foo_en -> org.acme.Foo className = additionalClassNameSanitizer.apply(className); - return applicationArchives.containingArchive(className) != null - || GeneratedClassGizmoAdaptor.isApplicationClass(name); + return GeneratedClassGizmoAdaptor.isApplicationClass(className); } } }
['extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java']
{'.java': 1}
1
1
0
0
1
18,376,413
3,573,570
470,799
4,824
2,769
388
41
1
2,169
273
578
68
2
0
2021-09-16T15:01:02
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,645
quarkusio/quarkus/20187/20179
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20179
https://github.com/quarkusio/quarkus/pull/20187
https://github.com/quarkusio/quarkus/pull/20187
1
fixes
./gradlew quarkusTest does not include the test/resources on the classpath
### Describe the bug When I load files from the `src/test/resources` in my unit tests run via `./gradlew quarkusTest` I get null back. If I run the same test using `./gradlew build` the resource is successfully loaded. The same happens when I run the test from the `quarkus dev` cli tool. ### Expected behavior When running tests with `./gradlew quarkusTest` or `quarkus dev` my tests should be able to read files in the `src/test/resources` ### Actual behavior If I read a file `src/test/resources/test.txt` from a test: ``` var test = this.getClass().getResource("test.txt"); ``` The var `test` is null if I run the test via `./gradlew quarkusTest` or `quarkus dev` but if I run it via `./gradlew build` it is not. ### How to Reproduce? https://github.com/martinffx/quarkus-bug `./gradlew build` works `./gradlew quarkusTest` fails ### Output of `uname -a` or `ver` Darwin Martin-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64 ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) penjdk version "11.0.9.1" 2020-11-04 LTS OpenJDK Runtime Environment Corretto-11.0.9.12.1 (build 11.0.9.1+12-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.9.12.1 (build 11.0.9.1+12-LTS, mixed mode) ### Quarkus version or git rev Client Version 2.2.1.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) ------------------------------------------------------------ Gradle 6.9 ------------------------------------------------------------ Build time: 2021-05-07 07:28:53 UTC Revision: afe2e24ababc7b0213ccffff44970aa18035fc0e Kotlin: 1.4.20 Groovy: 2.5.12 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 11.0.9.1 (Amazon.com Inc. 11.0.9.1+12-LTS) OS: Mac OS X 10.16 x86_64 ### Additional information _No response_
72abfe4c52060ba1cb32cd042ce35a0929bcedf6
8a7897a9e55e4c26c515e5296dd8b199d52ce796
https://github.com/quarkusio/quarkus/compare/72abfe4c52060ba1cb32cd042ce35a0929bcedf6...8a7897a9e55e4c26c515e5296dd8b199d52ce796
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java index 1e65b09d078..fd85de6413b 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java @@ -2,10 +2,11 @@ import java.nio.file.Path; import java.nio.file.Paths; -import java.util.ArrayList; import java.util.Collections; +import java.util.LinkedHashSet; import java.util.List; import java.util.Optional; +import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.regex.Pattern; @@ -121,8 +122,11 @@ public void init() { } if (testCuratedApplication == null) { try { - List<Path> paths = new ArrayList<>(); + Set<Path> paths = new LinkedHashSet<>(); paths.add(Paths.get(context.getApplicationRoot().getTest().get().getClassesPath())); + if (context.getApplicationRoot().getTest().get().getResourcesOutputPath() != null) { + paths.add(Paths.get(context.getApplicationRoot().getTest().get().getResourcesOutputPath())); + } paths.addAll(curatedApplication.getQuarkusBootstrap().getApplicationRoot().toList()); testCuratedApplication = curatedApplication.getQuarkusBootstrap().clonedBuilder() .setMode(QuarkusBootstrap.Mode.TEST)
['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java']
{'.java': 1}
1
1
0
0
1
18,370,188
3,572,441
470,670
4,823
432
80
8
1
1,931
247
608
47
1
1
2021-09-15T22:56:37
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,646
quarkusio/quarkus/20173/20111
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20111
https://github.com/quarkusio/quarkus/pull/20173
https://github.com/quarkusio/quarkus/pull/20173
1
fixes
Nullpointer at SchemaManagementIntegrator.disintegrate
### Describe the bug I upgraded from version 2.1.2.Final to version 2.2.2.Final and now I got this error on Quarkus startup: ``` java.lang.NullPointerException at java.base/java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1111) at java.base/java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1102) at io.quarkus.hibernate.orm.runtime.schema.SchemaManagementIntegrator.disintegrate(SchemaManagementIntegrator.java:50) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:410) at io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.build(FastBootEntityManagerFactoryBuilder.java:71) at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.createEntityManagerFactory(FastBootHibernatePersistenceProvider.java:67) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:80) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55) at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:149) at io.quarkus.hibernate.orm.runtime.JPAConfig$1.run(JPAConfig.java:58) at java.base/java.lang.Thread.run(Thread.java:829) ``` I'm using 2 persistences units with postgres Database. Example: ``` quarkus.datasource."PU1".db-kind=postgresql quarkus.datasource."PU1".username=<username> quarkus.datasource."PU1".password=<password> quarkus.datasource."PU1".jdbc.url=jdbc:postgresql://<ip>:<port>/<db_name> # Persistence Unit PU1 quarkus.hibernate-orm."PU1".datasource=PU1 quarkus.hibernate-orm."PU1".database.default-schema=<schema> quarkus.hibernate-orm."PU1".discriminator.ignore-explicit-for-joined=true quarkus.hibernate-orm."PU1".dialect=<custom_dialect> quarkus.hibernate-orm."PU1".fetch.max-depth=1 quarkus.hibernate-orm."PU1".packages=<package> quarkus.datasource."PU2".db-kind=postgresql quarkus.datasource."PU2".username=<username> quarkus.datasource."PU2".password=<password> quarkus.datasource."PU2".jdbc.url=jdbc:postgresql://<ip>:<port>/<db_name> # Persistence Unit PU2 quarkus.hibernate-orm."PU2".datasource=PU2 quarkus.hibernate-orm."PU2".database.default-schema=<schema> quarkus.hibernate-orm."PU2".discriminator.ignore-explicit-for-joined=true quarkus.hibernate-orm."PU2".dialect=<custom_dialect> quarkus.hibernate-orm."PU2".fetch.max-depth=1 quarkus.hibernate-orm."PU2".packages=<package> ``` I'm using cache. Example: ``` quarkus.hibernate-orm."PU1".cache."<name>".expiration.max-idle=300 quarkus.hibernate-orm."PU1".cache."<name>".memory.object-count=250000 quarkus.hibernate-orm."PU2".cache."<name>".expiration.max-idle=300 quarkus.hibernate-orm."PU2".cache."<name>".memory.object-count=250000 ``` Almost all objects attributes on method 'SchemaManagementIntegrator.disintegrate' are empty or with their default values : ``` public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { metadataMap.remove(nameCache.get(sessionFactory)); nameCache.remove(sessionFactory); } ``` ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` openjdk version "11.0.11" ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2.2.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 ### Additional information _No response_
6f609599effaa05687e2419f479e9d310716f44d
63b3277d7678d3acf54cbf61524ad838421bec15
https://github.com/quarkusio/quarkus/compare/6f609599effaa05687e2419f479e9d310716f44d...63b3277d7678d3acf54cbf61524ad838421bec15
diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java index 7894da4a866..828e5dc3d13 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java @@ -47,8 +47,10 @@ public void integrate(Metadata metadata, SessionFactoryImplementor sessionFactor @Override public void disintegrate(SessionFactoryImplementor sessionFactory, SessionFactoryServiceRegistry serviceRegistry) { - metadataMap.remove(nameCache.get(sessionFactory)); - nameCache.remove(sessionFactory); + final String name = nameCache.remove(sessionFactory); + if (name != null) { + metadataMap.remove(name); + } } public static void clearDsMap() {
['extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java']
{'.java': 1}
1
1
0
0
1
18,370,151
3,572,431
470,668
4,823
244
44
6
1
3,662
190
908
103
0
4
2021-09-15T15:04:53
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,648
quarkusio/quarkus/20104/16596
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/16596
https://github.com/quarkusio/quarkus/pull/20104
https://github.com/quarkusio/quarkus/pull/20104
1
fixes
Quarkus Gradle plugin breaks Gradle incremental compilation
## Describe the bug After upgrading to Quarkus 1.13.x I've noticed that all modules that use Quarkus plugin are fully rebuilt everytime. That increases our build times. The issue seems to be related to these fixes: https://github.com/quarkusio/quarkus/pull/16214 and https://github.com/quarkusio/quarkus/pull/15365. From Gradle logs I get: ``` Task ':server:compileJava' is not up-to-date because: Input property 'options.annotationProcessorPath' file /Users/anzes/Downloads/code-with-quarkus/library/build/libs/library-1.0.0-SNAPSHOT.jar has changed. The input changes require a full rebuild for incremental task ':server:compileJava'. ``` I think that putting whole compile classpath to annotation classpath is in general not a good idea with Gradle, but I might be wrong. ### Expected behavior Projects are built incrementally. ### Actual behavior Projects are not built incrementally. ## To Reproduce Check attached reproducer. [code-with-quarkus-example.zip](https://github.com/quarkusio/quarkus/files/6327901/code-with-quarkus-example.zip) Steps to reproduce the behavior: 1. run ./gradlew compileJava --info -> everything is rebuilt, since it's first compilation 2. run ./gradlew compileJava --info -> nothing is compiled since nothing changed 3. Change String "hello" to "hello1" in LibraryClass.java 4. run ./gradlew compileJava --info -> :library:compileJava is run, :server:compileJava is up-to-date 5. uncomment `id 'io.quarkus'` in server/build.gradle and run ./gradlew compileJava --info two time so compile task are up-to-date 6. Change String "hello1" in LibraryClass.java to "hello2" 7. run ./gradlew compileJava --info -> :library:compileJava is run and also :server:compileJava with message `The input changes require a full rebuild ` 8. Repeat ### Output of `uname -a` or `ver` MacOS ### Output of `java -version` Openjdk 11.0.7 2020-04-14 ### Quarkus version or git rev 1.13.2.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 6.8.3 Also I noticed that `quarkusGenerateCode` task is not incremental and it's run every time since it does not declare inputs and outputs. But that is unrelated issue :).
0a9bdbcc13b920842a3e7edbdd7287bb83d7da4f
f94ea77e688e0ea8d860327e15a8df7ea452d348
https://github.com/quarkusio/quarkus/compare/0a9bdbcc13b920842a3e7edbdd7287bb83d7da4f...f94ea77e688e0ea8d860327e15a8df7ea452d348
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java index c2f3d735004..370a14f9533 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java @@ -157,14 +157,6 @@ public void execute(Task test) { ConfigurationContainer configurations = project.getConfigurations(); JavaCompile compileJavaTask = (JavaCompile) tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME); - // By default, gradle looks for annotation processors in the annotationProcessor configuration. - // This configure the compile task to look for annotation processors in the compileClasspath. - Configuration annotationProcessorConfig = configurations.create(ANNOTATION_PROCESSOR_CONFIGURATION_NAME) - .extendsFrom( - configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME), - configurations.getByName(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME)); - compileJavaTask.getOptions().setAnnotationProcessorPath(annotationProcessorConfig); - compileJavaTask.dependsOn(quarkusGenerateCode); JavaCompile compileTestJavaTask = (JavaCompile) tasks.getByName(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME); @@ -229,6 +221,15 @@ public void execute(Task test) { new File(generatedTestSourceSet.getJava().getClassesDirectory().get().getAsFile(), provider)); } + // enable the Panache annotation processor on the classpath, if it's found among the dependencies + configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) + .getResolutionStrategy().eachDependency(d -> { + if ("quarkus-panache-common".equals(d.getTarget().getName()) + && "io.quarkus".equals(d.getTarget().getGroup())) { + project.getDependencies().add("annotationProcessor", d.getRequested().getGroup() + ":" + + d.getRequested().getName() + ":" + d.getRequested().getVersion()); + } + }); }); project.getPlugins().withId("org.jetbrains.kotlin.jvm", plugin -> {
['devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java']
{'.java': 1}
1
1
0
0
1
18,314,638
3,561,881
469,132
4,813
1,518
222
17
1
2,220
280
567
48
3
1
2021-09-13T16:28:51
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,614
quarkusio/quarkus/20937/20897
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20897
https://github.com/quarkusio/quarkus/pull/20937
https://github.com/quarkusio/quarkus/pull/20937
1
fix
Resteasy-reactive routing does not work for PathParam/RestPath when declared inside a bean @BeanParam when paths are shared across classes
### Describe the bug Resteasy-reactive routing does not work for PathParam/RestPath when declared inside a bean @BeanParam when paths are shared across classes. It works when is not declared inside a @BeanParam. This behavior is stopping us from upgrading to resteasy reactive. ### Expected behavior PathParam/RestPath should work when inside a @BeanParam. ### Actual behavior _No response_ ### How to Reproduce? [code-with-quarkus 2.zip](https://github.com/quarkusio/quarkus/files/7381025/code-with-quarkus.2.zip) ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
ab9ff3d201620a5d9d922f9265f672c1debce1d9
d63528cb1d12c68a9b46f42efca23012c30db046
https://github.com/quarkusio/quarkus/compare/ab9ff3d201620a5d9d922f9265f672c1debce1d9...d63528cb1d12c68a9b46f42efca23012c30db046
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/ResourceLocatorTest.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/ResourceLocatorTest.java index 020a3458cb1..b1dcf340346 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/ResourceLocatorTest.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/ResourceLocatorTest.java @@ -1,5 +1,8 @@ package io.quarkus.resteasy.reactive.server.test.resource.basic; +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.is; + import java.util.function.Supplier; import javax.ws.rs.client.Client; @@ -144,4 +147,12 @@ public void testAnnotationFreeSubresource() throws Exception { Assertions.assertEquals("posted: hello!", response.readEntity(String.class)); } } + + @Test + @DisplayName("Test @BeanParam annotation in Subresources") + public void testBeanParamsInSubresource() { + given().get("/sub3/first/resources/subresource3?value=second") + .then() + .body(is("first and second")); + } } diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorBaseResource.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorBaseResource.java index a6b50a2c5bf..8b8d305ffd8 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorBaseResource.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorBaseResource.java @@ -46,4 +46,9 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl }); } + @Path("sub3/{param}/resources") + public ResourceLocatorSubresource getSubresource() { + return new ResourceLocatorSubresource(); + } + } diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorSubresource.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorSubresource.java index 088fe7c7179..2f7563ecd5c 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorSubresource.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorSubresource.java @@ -2,12 +2,15 @@ import java.util.List; +import javax.ws.rs.BeanParam; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo; import org.jboss.logging.Logger; +import org.jboss.resteasy.reactive.RestPath; import org.junit.jupiter.api.Assertions; public class ResourceLocatorSubresource { @@ -52,4 +55,17 @@ public Object getSubresource2(@Context UriInfo uri) { LOG.debugv(" {0}", ancestor.getClass().getName()); return new ResourceLocatorSubresource2(); } + + @GET + @Path("/subresource3") + public String getValueFromBeanParam(@BeanParam Params params) { + return params.param + " and " + params.value; + } + + public static class Params { + @RestPath + String param; + @QueryParam("value") + String value; + } } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java index 4ae1a747cd1..4be7fc383e9 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java @@ -895,12 +895,20 @@ public String getPathParameter(String name, boolean encoded) { // this is a slower version than getPathParam, but we can't actually bake path indices inside // BeanParam classes (which use thismethod ) because they can be used by multiple resources that would have different // indices - Integer index = this.target.getPathParameterIndexes().get(name); + Integer index = target.getPathParameterIndexes().get(name); + String value; + if (index != null) { + value = getPathParam(index); + } else { + // Check previous resources if the path is not defined in the current target + value = getResourceLocatorPathParam(name); + } + // It's possible to inject a path param that's not defined, return null in this case - String value = index != null ? getPathParam(index) : null; if (encoded && value != null) { return Encode.encodeQueryParam(value); } + return value; }
['extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorBaseResource.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/resource/ResourceLocatorSubresource.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/resource/basic/ResourceLocatorTest.java']
{'.java': 4}
4
4
0
0
4
18,930,287
3,682,714
485,506
4,996
484
89
12
1
861
114
209
42
1
0
2021-10-21T13:54:08
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,649
quarkusio/quarkus/20048/20047
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20047
https://github.com/quarkusio/quarkus/pull/20048
https://github.com/quarkusio/quarkus/pull/20048
1
fixes
IllegalAccessError for gauges with Micrometer + MP Metrics binder
### Describe the bug Creating an annotated `org.eclipse.microprofile.metrics.annotation.Gauge` when I use the Micrometer with the MP Metrics binder causes an error during gauge registration: ``` 2021-09-10 07:40:04,106 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.IllegalAccessError: failed to access class io.quarkus.micrometer.runtime.binder.mpmetrics.MpMetadata from class org.acme.GreetingResource_GaugeAdapter_Subclass (io.quarkus.micrometer.runtime.binder.mpmetrics.MpMetadata is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @a73ea75; org.acme.GreetingResource_GaugeAdapter_Subclass is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @4fdd30b2) at org.acme.GreetingResource_GaugeAdapter_Subclass.getMetadata(GreetingResource_GaugeAdapter_Subclass.zig:732) at org.acme.GreetingResource_GaugeAdapter_ClientProxy.getMetadata(GreetingResource_GaugeAdapter_ClientProxy.zig:276) at io.quarkus.micrometer.runtime.binder.mpmetrics.MetricRegistryAdapter.bindAnnotatedGauge(MetricRegistryAdapter.java:233) at io.quarkus.micrometer.runtime.binder.mpmetrics.MpMetricsBinder.bindTo(MpMetricsBinder.java:30) at io.quarkus.micrometer.runtime.binder.mpmetrics.MpMetricsBinder_Subclass.bindTo$$superforward1(MpMetricsBinder_Subclass.zig:98) at io.quarkus.micrometer.runtime.binder.mpmetrics.MpMetricsBinder_Subclass$$function$$1.apply(MpMetricsBinder_Subclass$$function$$1.zig:33) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521) at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41) at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41) at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32) at io.quarkus.micrometer.runtime.binder.mpmetrics.MpMetricsBinder_Subclass.bindTo(MpMetricsBinder_Subclass.zig:162) at io.quarkus.micrometer.runtime.MicrometerRecorder.lambda$configureRegistries$4(MicrometerRecorder.java:130) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at io.quarkus.micrometer.runtime.MicrometerRecorder.configureRegistries(MicrometerRecorder.java:130) at io.quarkus.deployment.steps.MicrometerProcessor$configureRegistry-2125003310.deploy_0(MicrometerProcessor$configureRegistry-2125003310.zig:127) at io.quarkus.deployment.steps.MicrometerProcessor$configureRegistry-2125003310.deploy(MicrometerProcessor$configureRegistry-2125003310.zig:40) at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:766) at io.quarkus.runtime.Application.start(Application.java:101) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:101) at io.quarkus.runtime.Quarkus.run(Quarkus.java:66) at io.quarkus.runtime.Quarkus.run(Quarkus.java:42) at io.quarkus.runtime.Quarkus.run(Quarkus.java:119) at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:100) at java.base/java.lang.Thread.run(Thread.java:834) ``` ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06) OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev Quarkus 2.2.2 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information Happens only in JVM mode
4554fcd31ef866c422b2650c58266f66d10e4be8
5705eeb3509e9754533a95b30888c358c9d93d65
https://github.com/quarkusio/quarkus/compare/4554fcd31ef866c422b2650c58266f66d10e4be8...5705eeb3509e9754533a95b30888c358c9d93d65
diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/mpmetrics/MpMetadata.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/mpmetrics/MpMetadata.java index 66e95bdd4d8..f0962d19615 100644 --- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/mpmetrics/MpMetadata.java +++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/mpmetrics/MpMetadata.java @@ -7,7 +7,7 @@ import org.eclipse.microprofile.metrics.MetricType; import org.eclipse.microprofile.metrics.annotation.Metric; -class MpMetadata implements Metadata { +public class MpMetadata implements Metadata { public static MpMetadata sanitize(Metadata metadata, MetricType type) { if (metadata instanceof MpMetadata) {
['extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/binder/mpmetrics/MpMetadata.java']
{'.java': 1}
1
1
0
0
1
18,308,852
3,560,777
469,020
4,812
86
13
2
1
4,521
224
1,150
76
0
1
2021-09-10T05:58:35
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,650
quarkusio/quarkus/20032/20017
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20017
https://github.com/quarkusio/quarkus/pull/20032
https://github.com/quarkusio/quarkus/pull/20032
1
resolves
CLI commands and sub-commands are listed sort of randomly in help message
### Describe the bug CLI commands and sub-commands are listed sort of randomly in help message. For example `extension` and `registry` have add / list / remove sub-commands but they are listed in different order. Maybe everything should be alphabetically ordered for simplicity or at least the same sub-commands should have the same order in help ``` qss --help ... Commands: create Create a new project. app Create a Quarkus application project. cli Create a Quarkus command-line project. extension Create a Quarkus extension project build Build the current project. dev Run the current project in dev (live coding) mode. extension, ext Configure extensions of an existing project. list, ls List platforms and extensions. categories, cat List extension categories. add Add extension(s) to this project. remove, rm Remove extension(s) from this project. registry Configure Quarkus registry client add Add a Quarkus extension registry list List enabled Quarkus registries remove Remove a Quarkus extension registry version Display version information. completion bash/zsh completion: source <(quarkus completion) ``` ### Expected behavior Commands and sub-commands should be alphabetically ordered or at least to have some consistency in ordering for sub-commands with the same name ### Actual behavior CLI commands and sub-commands are listed sort of randomly in help message ### How to Reproduce? `qss --help` ### Output of `uname -a` or `ver` macOS BigSur ### Output of `java -version` Java 11 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev main ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
4af8f361414a3cc678f4538679621200aa47fca6
6fd453b1dc6c66333ba28334258cf6e15c5ddcca
https://github.com/quarkusio/quarkus/compare/4af8f361414a3cc678f4538679621200aa47fca6...6fd453b1dc6c66333ba28334258cf6e15c5ddcca
diff --git a/devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java b/devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java index a166379e57d..f246f4f4715 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java @@ -11,7 +11,8 @@ @CommandLine.Command(name = "extension", aliases = { "ext" }, sortOptions = false, mixinStandardHelpOptions = false, header = "Configure extensions of an existing project.", subcommands = { - ProjectExtensionsList.class, ProjectExtensionsCategories.class, + ProjectExtensionsList.class, + ProjectExtensionsCategories.class, ProjectExtensionsAdd.class, ProjectExtensionsRemove.class }, headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", optionListHeading = "Options:%n") public class ProjectExtensions extends BaseBuildCommand implements Callable<Integer> { diff --git a/devtools/cli/src/main/java/io/quarkus/cli/Registry.java b/devtools/cli/src/main/java/io/quarkus/cli/Registry.java index d46ec57f0a2..88749ccbe7f 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/Registry.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/Registry.java @@ -8,8 +8,8 @@ import picocli.CommandLine.Unmatched; @CommandLine.Command(name = "registry", sortOptions = false, mixinStandardHelpOptions = false, header = "Configure Quarkus registry client", subcommands = { - RegistryAddCommand.class, RegistryListCommand.class, + RegistryAddCommand.class, RegistryRemoveCommand.class }, headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", optionListHeading = "%nOptions:%n") public class Registry extends BaseRegistryCommand {
['devtools/cli/src/main/java/io/quarkus/cli/Registry.java', 'devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java']
{'.java': 2}
2
2
0
0
2
18,307,251
3,560,462
468,988
4,812
247
35
5
2
2,074
260
419
66
0
1
2021-09-09T15:34:18
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,651
quarkusio/quarkus/20011/19979
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/19979
https://github.com/quarkusio/quarkus/pull/20011
https://github.com/quarkusio/quarkus/pull/20011
1
resolves
CLI help message contains text for registry add command instead of extension add command
### Describe the bug CLI help message contains text for registry add command instead of extension add command. There is no `add` command listed under `registry`. ``` jbang app install --force --name qss ~/.m2/repository/io/quarkus/quarkus-cli/999-SNAPSHOT/quarkus-cli-999-SNAPSHOT-runner.jar qss --help ... extension, ext List, add, and remove extensions of an existing project. list, ls List platforms and extensions. categories, cat List extension categories. add Add a Quarkus extension registry to the registry client configuration remove, rm Remove extension(s) from this project. registry Manage extension registries. list List enabled Quarkus registries remove Remove a Quarkus extension registry from the registry client configuration version Display version information. completion bash/zsh completion: source <(quarkus completion) ``` ### Expected behavior `add` sub-command is listed for both `extension` and `registry` commands ### Actual behavior `add` sub-command is listed just for `registry` command but with text for `add` sub-command for `extension` command. ### How to Reproduce? `qss --help` or `quarkus --help` ### Output of `uname -a` or `ver` macOS BigSur ### Output of `java -version` Java 11 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev main ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information Running `qss ext --help` and `qss registry --help` gives correct info. As if cli had hard time to handle two different sub-commands with the same `name = "add"`. When I changed value of `name` attribute to `rs` in `RegistryAddCommand`, `qss --help` message got rendered properly.
19c0cee2745c16c39ba5c5adf59309a1b02cba99
1d813f2fd1c6d3b578e345215d21dbdd2b480c5c
https://github.com/quarkusio/quarkus/compare/19c0cee2745c16c39ba5c5adf59309a1b02cba99...1d813f2fd1c6d3b578e345215d21dbdd2b480c5c
diff --git a/devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java b/devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java index 39d60cba957..a166379e57d 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java @@ -10,7 +10,7 @@ import picocli.CommandLine.Unmatched; @CommandLine.Command(name = "extension", aliases = { - "ext" }, sortOptions = false, mixinStandardHelpOptions = false, header = "List, add, and remove extensions of an existing project.", subcommands = { + "ext" }, sortOptions = false, mixinStandardHelpOptions = false, header = "Configure extensions of an existing project.", subcommands = { ProjectExtensionsList.class, ProjectExtensionsCategories.class, ProjectExtensionsAdd.class, ProjectExtensionsRemove.class }, headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", optionListHeading = "Options:%n") diff --git a/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java b/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java index 3510185f290..346915aacb4 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java @@ -3,7 +3,6 @@ import static picocli.CommandLine.Model.UsageMessageSpec.SECTION_KEY_COMMAND_LIST; import java.util.Collection; -import java.util.LinkedHashMap; import java.util.Map; import java.util.concurrent.Callable; @@ -94,22 +93,28 @@ public String render(Help help) { if (spec.subcommands().isEmpty()) { return ""; } - Map<String, String> tableElements = new LinkedHashMap<>(); - addHierarchy(spec.subcommands().values(), tableElements, ""); - return help.createTextTable(tableElements).toString(); + + Help.Column commands = new Help.Column(24, 2, CommandLine.Help.Column.Overflow.SPAN); + Help.Column descriptions = new Help.Column(spec.usageMessage().width() - 24, 2, + CommandLine.Help.Column.Overflow.WRAP); + Help.TextTable textTable = Help.TextTable.forColumns(help.colorScheme(), commands, descriptions); + textTable.setAdjustLineBreaksForWideCJKCharacters(spec.usageMessage().adjustLineBreaksForWideCJKCharacters()); + + addHierarchy(spec.subcommands().values(), textTable, ""); + return textTable.toString(); } - private void addHierarchy(Collection<CommandLine> collection, Map<String, String> tableElements, + private void addHierarchy(Collection<CommandLine> collection, Help.TextTable textTable, String indent) { collection.stream().distinct().forEach(subcommand -> { // create comma-separated list of command name and aliases String names = String.join(", ", subcommand.getCommandSpec().names()); String description = description(subcommand.getCommandSpec().usageMessage()); - tableElements.put(indent + names, description); + textTable.addRowValues(indent + names, description); Map<String, CommandLine> subcommands = subcommand.getSubcommands(); if (!subcommands.isEmpty()) { - addHierarchy(subcommands.values(), tableElements, indent + " "); + addHierarchy(subcommands.values(), textTable, indent + " "); } }); } diff --git a/devtools/cli/src/main/java/io/quarkus/cli/Registry.java b/devtools/cli/src/main/java/io/quarkus/cli/Registry.java index f88d0e04c8d..d46ec57f0a2 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/Registry.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/Registry.java @@ -7,7 +7,7 @@ import picocli.CommandLine.ParseResult; import picocli.CommandLine.Unmatched; [email protected](name = "registry", sortOptions = false, mixinStandardHelpOptions = false, header = "Manage extension registries.", subcommands = { [email protected](name = "registry", sortOptions = false, mixinStandardHelpOptions = false, header = "Configure Quarkus registry client", subcommands = { RegistryAddCommand.class, RegistryListCommand.class, RegistryRemoveCommand.class }, headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", optionListHeading = "%nOptions:%n") diff --git a/devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java b/devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java index f1e6b6c31a3..73194c506c8 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java @@ -16,8 +16,8 @@ import io.quarkus.registry.config.json.RegistriesConfigMapperHelper; import picocli.CommandLine; [email protected](name = "add", sortOptions = false, showDefaultValues = true, mixinStandardHelpOptions = false, header = "Add a Quarkus extension registry to the registry client configuration", description = "%n" - + "This command will add a Quarkus extension registry to the registry client configuration unless it's already present", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", parameterListHeading = "%n", optionListHeading = "Options:%n") [email protected](name = "add", sortOptions = false, showDefaultValues = true, mixinStandardHelpOptions = false, header = "Add a Quarkus extension registry", description = "%n" + + "This command will add a Quarkus extension registry to the registry client configuration unless it's already present.", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", parameterListHeading = "%n", optionListHeading = "Options:%n") public class RegistryAddCommand extends BaseRegistryCommand { @CommandLine.Mixin diff --git a/devtools/cli/src/main/java/io/quarkus/cli/RegistryListCommand.java b/devtools/cli/src/main/java/io/quarkus/cli/RegistryListCommand.java index 96872de2fba..79879122707 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/RegistryListCommand.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/RegistryListCommand.java @@ -14,7 +14,7 @@ import picocli.CommandLine; @CommandLine.Command(name = "list", sortOptions = false, showDefaultValues = true, mixinStandardHelpOptions = false, header = "List enabled Quarkus registries", description = "%n" - + "This command will list currently enabled Quarkus extension registries", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", parameterListHeading = "%n", optionListHeading = "Options:%n") + + "This command will list currently enabled Quarkus extension registries.", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", parameterListHeading = "%n", optionListHeading = "Options:%n") public class RegistryListCommand extends BaseRegistryCommand { @CommandLine.Mixin diff --git a/devtools/cli/src/main/java/io/quarkus/cli/RegistryRemoveCommand.java b/devtools/cli/src/main/java/io/quarkus/cli/RegistryRemoveCommand.java index a3a3a649f19..6d159ce28e5 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/RegistryRemoveCommand.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/RegistryRemoveCommand.java @@ -15,8 +15,8 @@ import io.quarkus.registry.config.json.RegistriesConfigMapperHelper; import picocli.CommandLine; [email protected](name = "remove", sortOptions = false, showDefaultValues = true, mixinStandardHelpOptions = false, header = "Remove a Quarkus extension registry from the registry client configuration", description = "%n" - + "This command will remove a Quarkus extension registry from the registry client configuration", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", parameterListHeading = "%n", optionListHeading = "Options:%n") [email protected](name = "remove", sortOptions = false, showDefaultValues = true, mixinStandardHelpOptions = false, header = "Remove a Quarkus extension registry", description = "%n" + + "This command will remove a Quarkus extension registry from the registry client configuration.", headerHeading = "%n", commandListHeading = "%nCommands:%n", synopsisHeading = "%nUsage: ", parameterListHeading = "%n", optionListHeading = "Options:%n") public class RegistryRemoveCommand extends BaseRegistryCommand { @CommandLine.Mixin
['devtools/cli/src/main/java/io/quarkus/cli/Registry.java', 'devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java', 'devtools/cli/src/main/java/io/quarkus/cli/ProjectExtensions.java', 'devtools/cli/src/main/java/io/quarkus/cli/RegistryListCommand.java', 'devtools/cli/src/main/java/io/quarkus/cli/RegistryRemoveCommand.java', 'devtools/cli/src/main/java/io/quarkus/cli/QuarkusCli.java']
{'.java': 6}
6
6
0
0
6
18,299,386
3,559,119
468,838
4,812
4,351
914
33
6
1,928
243
442
65
0
1
2021-09-08T21:34:08
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,655
quarkusio/quarkus/19889/19888
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/19888
https://github.com/quarkusio/quarkus/pull/19889
https://github.com/quarkusio/quarkus/pull/19889
1
fixes
Continuous testing classloading issue
### Describe the bug Resuming tests when running `mvn quarkus:dev` leads to following error: ``` : groovy.lang.MissingMethodException: No signature of method: com.fasterxml.jackson.databind.MappingJsonFactory.createJsonGenerator() is applicable for argument types: (ByteArrayOutputStream, com.fasterxml.jackson.core.JsonEncoding) values: [, UTF8] Possible solutions: createJsonGenerator(java.io.OutputStream), createJsonGenerator(java.io.Writer), createJsonGenerator(java.io.OutputStream, com.fasterxml.jackson.core.JsonEncoding) The following classes appear as argument class and as parameter class, but are defined by different class loader: com.fasterxml.jackson.core.JsonEncoding (defined by 'QuarkusClassLoader:Quarkus Base Runtime ClassLoader: TEST@5bf4e32' and 'QuarkusClassLoader:Augmentation Class Loader: DEV@7b4cb9bd') If one of the method suggestions matches the method you wanted to call, then check your class loader setup. at io.restassured.internal.RequestSpecificationImpl.body(RequestSpecificationImpl.groovy:753) at quarkus.accounts.AccountResourceTest.testCreateAccount(AccountResourceTest.java:69) ``` ### Expected behavior Tests complete without exception ### Actual behavior _No response_ ### How to Reproduce? https://github.com/jclingan/manning-kube-native-microservices/tree/master/chapter2/account-service is the project. Run `mvn quarkus:dev`, then press "r" to resume testing. ### Output of `uname -a` or `ver` Darwin MacBook-Pro 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "11.0.11" 2021-04-20 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.1.3.Final and 2.2.1.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) ### Additional information _No response_
06f9f636ca2bffcd91f4a2ddd794ef296dfe9458
f704ef96e3a5f44f9234a4804c5ccc41d4ad1762
https://github.com/quarkusio/quarkus/compare/06f9f636ca2bffcd91f4a2ddd794ef296dfe9458...f704ef96e3a5f44f9234a4804c5ccc41d4ad1762
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java index bbbf37d8acb..1e65b09d078 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java @@ -129,7 +129,7 @@ public void init() { .setAssertionsEnabled(true) .setDisableClasspathCache(false) .setIsolateDeployment(true) - .setBaseClassLoader(getClass().getClassLoader()) + .setBaseClassLoader(getClass().getClassLoader().getParent()) .setTest(true) .setAuxiliaryApplication(true) .setHostApplicationIsTestOnly(devModeType == DevModeType.TEST_ONLY)
['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java']
{'.java': 1}
1
1
0
0
1
18,248,027
3,549,329
467,653
4,807
159
22
2
1
1,965
191
507
52
1
1
2021-09-03T00:13:42
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,656
quarkusio/quarkus/19887/19886
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/19886
https://github.com/quarkusio/quarkus/pull/19887
https://github.com/quarkusio/quarkus/pull/19887
1
fixes
[native-image] integration-tests/amazon-lambda-rest, UserException: Annotated class must be final
### Describe the bug Both `Quarkus 2.2.0.Final` and a contemporary main (head 94ae125) fail `integration-tests/amazon-lambda-rest` regardless of the native-image distribution, being it `21.3.0-devd63e6aab07 Mandrel Distribution (Java Version 11.0.13-ea+3)`, or `GraalVM Version 20.3.2 (Java Version 11.0.11+8-jvmci-20.3-b15)` or `GraalVM 21.2.0 Java 11 CE (Java Version 11.0.12+6-jvmci-21.2-b08)` with this at build time: ```bash native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace -H:-ParseOnce quarkus-integration-test-amazon-lambda-rest-999-SNAPSHOT-runner -jar quarkus-integration-test-amazon-lambda-rest-999-SNAPSHOT-runner.jar [quarkus-integration-test-amazon-lambda-rest-999-SNAPSHOT-runner:101012] classlist: 1,981.69 ms, 1.19 GB [quarkus-integration-test-amazon-lambda-rest-999-SNAPSHOT-runner:101012] setup: 462.45 ms, 1.19 GB Error: Annotated class must be final: class io.quarkus.amazon.lambda.http.graal.LambdaContainerHandlerSubstitution com.oracle.svm.core.util.UserError$UserException: Annotated class must be final: class io.quarkus.amazon.lambda.http.graal.LambdaContainerHandlerSubstitution at com.oracle.svm.core.util.UserError.abort(UserError.java:68) at com.oracle.svm.core.util.UserError.guarantee(UserError.java:96) at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:280) at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:266) at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:936) at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:868) at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530) at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:491) at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:380) at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:543) at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:119) at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:573) [quarkus-integration-test-amazon-lambda-rest-999-SNAPSHOT-runner:101012] [total]: 2,489.69 ms, 1.19 GB # Printing build artifacts to: /home/karm/workspaceRH/quarkus/integration-tests/amazon-lambda-rest/target/quarkus-integration-test-amazon-lambda-rest-999-SNAPSHOT-native-image-source-jar/quarkus-integration-test-amazon-lambda-rest-999-SNAPSHOT-runner.build_artifacts.txt Error: Image build request failed with exit status 1 ``` ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
e4073c958765b7b925e84e3bad7d2d7c707f4471
d35a89a40e5a1036de54697b45c5bad21cc7366c
https://github.com/quarkusio/quarkus/compare/e4073c958765b7b925e84e3bad7d2d7c707f4471...d35a89a40e5a1036de54697b45c5bad21cc7366c
diff --git a/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/graal/LambdaContainerHandlerSubstitution.java b/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/graal/LambdaContainerHandlerSubstitution.java index e2f2ede5795..d1c9ffebdd1 100644 --- a/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/graal/LambdaContainerHandlerSubstitution.java +++ b/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/graal/LambdaContainerHandlerSubstitution.java @@ -5,7 +5,7 @@ import com.oracle.svm.core.annotate.TargetClass; @TargetClass(LambdaContainerHandler.class) -public class LambdaContainerHandlerSubstitution { +public final class LambdaContainerHandlerSubstitution { // afterburner does not work in native mode, so let's ensure it's never registered @Substitute
['extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/graal/LambdaContainerHandlerSubstitution.java']
{'.java': 1}
1
1
0
0
1
18,196,562
3,539,873
466,583
4,801
107
17
2
1
3,813
215
1,024
63
0
1
2021-09-02T22:09:26
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,636
quarkusio/quarkus/20431/20363
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20363
https://github.com/quarkusio/quarkus/pull/20431
https://github.com/quarkusio/quarkus/pull/20431
1
fixes
Recurring redirects in OIDC against Azure AD
### Describe the bug Hey team, I am trying to enable OIDC security for my web app (`authorization_code` flow) with Azure AD being the identity provider. The problem is that endpoint declaration like below fails with recurring redirects: ```java @GET @RolesAllowed("admin-role") public Response doSmth() {} ``` The error flow goes as follows: 1. The request gets routed to the endpoint. 2. Authentication mechanism kicks in. 3. I get first proper redirect to the login page of the IDP, enter the data and press "ok". 5. Redirects start firing endlessly and are effectively killed by Chrome, endpoint returns `401`. The logs aren't too helpful and look like this: ```txt 2021-09-23 18:07:40,537 DEBUG [org.jbo.res.res.i18n] (executor-thread-0) RESTEASY002315: PathInfo: /tellme/admin 2021-09-23 18:07:40,538 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (executor-thread-0) Authentication request redirect_uri parameter: http://localhost:8080/tellme/admin 2021-09-23 18:07:40,538 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (executor-thread-0) q_auth cookie 'max-age' parameter is set to 1800 2021-09-23 18:07:40,722 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (vert.x-eventloop-thread-4) Token request redirect_uri parameter: http://localhost:8080/tellme/admin 2021-09-23 18:07:41,068 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (vert.x-eventloop-thread-4) q_session cookie 'max-age' parameter is set to 3900 2021-09-23 18:07:41,068 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (vert.x-eventloop-thread-4) Final redirect URI: http://localhost:8080/tellme/admin 2021-09-23 18:07:41,076 DEBUG [org.jbo.res.res.i18n] (executor-thread-0) RESTEASY002315: PathInfo: /tellme/admin 2021-09-23 18:07:41,077 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (executor-thread-0) Authentication request redirect_uri parameter: http://localhost:8080/tellme/admin 2021-09-23 18:07:41,077 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (executor-thread-0) q_auth cookie 'max-age' parameter is set to 1800 2021-09-23 18:07:41,234 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (vert.x-eventloop-thread-4) Token request redirect_uri parameter: http://localhost:8080/tellme/admin 2021-09-23 18:07:41,578 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (vert.x-eventloop-thread-4) q_session cookie 'max-age' parameter is set to 3900 2021-09-23 18:07:41,579 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (vert.x-eventloop-thread-4) Final redirect URI: http://localhost:8080/tellme/admin 2021-09-23 18:07:42,856 DEBUG [io.qua.oid.run.CodeAuthenticationMechanism] (vert.x-eventloop-thread-4) The state cookie is missing after a redirect from IDP, authentication has failed ``` It seems to me like something goes wrong with how `redirect_uri` parameter is passed and treated by Azure. The value of the parameter seems to be valid and does not change between redirects, though. ### Expected behavior Once I log in on the IDP page, the browser redirects me to a URI set in the `redirect_uri` parameter, which should match the endpoint I hit. ### Actual behavior Once I log in on the IDP page I get redirected to the endpoint I hit. ### How to Reproduce? To reproduce: **1. Create a simple quarkus app with Resteasy and OIDC** The only thing that matters is that the app's controller class should have an RBAC-protected endpoint. The contents of `application.properties`: ```txt quarkus.oidc.auth-server-url=https://login.microsoftonline.com/TENANT_ID/v2.0 quarkus.oidc.application-type=web_app quarkus.oidc.client-id=CLIENT_ID quarkus.oidc.credentials.secret=CLIENT_SECRET quarkus.oidc.authentication.scopes=offline_access ``` **2. Create an App in Azure, create the roles and permissions.** In Azure Portal: 1. Create a new Azure app at Azure Active Directory -> App Registrations -> New Registration. 2. From the screen at Azure Active Directory -> App Registrations -> "your-app-name" * copy "Application ID" to `CLIENT_ID`, "Directory ID" to `TENANT_ID` placeholders in `application.properties` above. * press "Client credentials", generate a secret and replace `CLIENT_SECRET` placeholder. * press "Redirect URIs" and enter the full URI to the RBAC-protected endpoint in your app. 2. Go to Azure Active Directory -> App Registrations -> "your-app-name" -> App Roles and create at least one app role. The "Value" attribute will be the name of the role included in the ID JWT. 3. Navigate to Azure Active Directory -> Enterprise Applications -> "your-app-name" -> Users and Groups -> Add User/Group and add your user account to the role created in p.2. 4. Go to Azure Active Directory -> App Registrations -> "your-app-name" -> API Permissions and press "Grant admin consent". **3. Enter the name of the created role into `@RolesAllowed` on the protected endpoint.** **4. Hit the endpoint.** ### Output of `uname -a` or `ver` Darwin C8049 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "16.0.1" 2021-04-20 OpenJDK Runtime Environment (build 16.0.1+9-24) OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing) ### GraalVM version (if different from Java) not used ### Quarkus version or git rev 2.2.3.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) ### Additional information _No response_
c84538bcbcde39a177ca74d0d3068c95aa241309
b3140f4ced387d5ee12561a4ba364b6fca2d52d9
https://github.com/quarkusio/quarkus/compare/c84538bcbcde39a177ca74d0d3068c95aa241309...b3140f4ced387d5ee12561a4ba364b6fca2d52d9
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java index 8e6e5e656fa..d72e8b7fbaa 100644 --- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java +++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java @@ -54,6 +54,7 @@ public class CodeAuthenticationMechanism extends AbstractOidcAuthenticationMecha static final String SESSION_COOKIE_NAME = "q_session"; static final String SESSION_MAX_AGE_PARAM = "session-max-age"; static final Uni<Void> VOID_UNI = Uni.createFrom().voidItem(); + static final Integer MAX_COOKIE_VALUE_LENGTH = 4096; private static final Logger LOG = Logger.getLogger(CodeAuthenticationMechanism.class); @@ -388,9 +389,21 @@ public Uni<? extends Void> apply(Void t) { @Override public Void apply(String cookieValue) { - createCookie(context, configContext.oidcConfig, + String sessionCookie = createCookie(context, configContext.oidcConfig, getSessionCookieName(configContext.oidcConfig), - cookieValue, sessionMaxAge); + cookieValue, sessionMaxAge).getValue(); + if (sessionCookie.length() >= MAX_COOKIE_VALUE_LENGTH) { + LOG.warnf( + "Session cookie length for the tenant %s is equal or greater than %d bytes." + + " Browsers may ignore this cookie which will cause a new challenge for the authenticated users." + + " Recommendations: 1. Set 'quarkus.oidc.token-state-manager.split-tokens=true'" + + " to have the ID, access and refresh tokens stored in separate cookies." + + " 2. Set 'quarkus.oidc.token-state-manager.strategy=id-refresh-tokens' if you do not need to use the access token" + + " as a source of roles or to request UserInfo or propagate it to the downstream services." + + " 3. Register a custom 'quarkus.oidc.TokenStateManager' CDI bean with the alternative priority set to 1.", + configContext.oidcConfig.tenantId.get(), + MAX_COOKIE_VALUE_LENGTH); + } fireEvent(SecurityEvent.Type.OIDC_LOGIN, securityIdentity); return null; }
['extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java']
{'.java': 1}
1
1
0
0
1
18,602,040
3,620,317
477,162
4,913
1,866
265
17
1
5,531
646
1,552
100
7
3
2021-09-28T17:04:22
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,635
quarkusio/quarkus/20439/20144
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20144
https://github.com/quarkusio/quarkus/pull/20439
https://github.com/quarkusio/quarkus/pull/20439
1
fixes
AuthorizationController is not working after 2.2.0.Final
### Describe the bug AuthorizationController is not working any more after 2.2.0.Final. ``` @Alternative @Priority(Interceptor.Priority.LIBRARY_AFTER) @ApplicationScoped public class DisabledAuthController extends AuthorizationController { .... @Override public boolean isAuthorizationEnabled() { return !disableAuthorization; } } ``` ### Expected behavior Authorization is skipped. ### Actual behavior **401Unauthorized** returned if token not provided or invalid. ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` Microsoft Windows [Version 10.0.18363.1734] ### Output of `java -version` java version "11.0.10" 2021-01-19 LTS ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2.2.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.6.3 ### Additional information This [commit](https://github.com/quarkusio/quarkus/pull/19598) could probably cause the issue
a0f110eb5b46ae1b9c1442e715ca776be2cbad2f
3e7bf2e0ca6d12ce96ea587cf10f90a1b980834c
https://github.com/quarkusio/quarkus/compare/a0f110eb5b46ae1b9c1442e715ca776be2cbad2f...3e7bf2e0ca6d12ce96ea587cf10f90a1b980834c
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/EagerSecurityHandler.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/EagerSecurityHandler.java index 47ce0b0afa4..5773bd0545c 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/EagerSecurityHandler.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/EagerSecurityHandler.java @@ -15,6 +15,7 @@ import io.quarkus.arc.InjectableInstance; import io.quarkus.security.identity.CurrentIdentityAssociation; import io.quarkus.security.identity.SecurityIdentity; +import io.quarkus.security.spi.runtime.AuthorizationController; import io.quarkus.security.spi.runtime.SecurityCheck; import io.quarkus.security.spi.runtime.SecurityCheckStorage; import io.smallrye.mutiny.subscription.UniSubscriber; @@ -31,6 +32,7 @@ public void apply(SecurityIdentity identity, Method method, Object[] parameters) private volatile InjectableInstance<CurrentIdentityAssociation> currentIdentityAssociation; private volatile SecurityCheck check; + private volatile AuthorizationController authorizationController; @Override public void handle(ResteasyReactiveRequestContext requestContext) throws Exception { @@ -46,6 +48,12 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti if (check == NULL_SENTINEL) { return; } + if (authorizationController == null) { + authorizationController = Arc.container().instance(AuthorizationController.class).get(); + } + if (!authorizationController.isAuthorizationEnabled()) { + return; + } requestContext.requireCDIRequestScope(); requestContext.suspend(); SecurityCheck theCheck = check;
['extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/EagerSecurityHandler.java']
{'.java': 1}
1
1
0
0
1
18,603,532
3,620,570
477,173
4,913
394
61
8
1
1,063
117
259
55
1
1
2021-09-29T03:54:46
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,634
quarkusio/quarkus/20442/20441
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20441
https://github.com/quarkusio/quarkus/pull/20442
https://github.com/quarkusio/quarkus/pull/20442
1
fixes
Discard providers without annotation when there are only excluded classes
### Describe the bug In the resteasy-reactive extension, if we exclude providers using build time conditions, it doesn't check anymore if the class has been annotated with `@Provider` so Arc tries instantiate them all, even those that should be instantiated by a `DynamicFeature` which leads to errors of type `javax.enterprise.inject.UnsatisfiedResolutionException`. ### Expected behavior When providers are excluded thanks to build time conditions, Arc should only instantiate providers annotated with `@Provider` ### Actual behavior When providers are excluded thanks to build time conditions, Arc instantiates all, even those that should be instantiated by a `DynamicFeature` ### How to Reproduce? Steps to reproduce 1. Add a provider annotated with a build time condition to enable the class filtering by excluded classes 2. Add a `DynamicFeature` that instantiate a filter with parameters that Arc cannot find by itself Result: You get an error of type: ``` java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type java.lang.String and qualifiers [@Default] - java member: io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7#<init>() - declared on CLASS bean [types=[io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7, java.lang.Object, javax.ws.rs.container.ContainerResponseFilter], qualifiers=[@Default, @Any], target=io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7] The following beans match by type, but none have matching qualifiers: - Bean [class=java.lang.String, qualifiers=[@ConfigProperty, @Any]] at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1149) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:266) at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129) at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:834) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type java.lang.String and qualifiers [@Default] - java member: io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7#<init>() - declared on CLASS bean [types=[io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7, java.lang.Object, javax.ws.rs.container.ContainerResponseFilter], qualifiers=[@Default, @Any], target=io.quarkus.resteasy.reactive.server.test.simple.BuildProfileTest$ResponseFilter7] The following beans match by type, but none have matching qualifiers: - Bean [class=java.lang.String, qualifiers=[@ConfigProperty, @Any]] at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:567) at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:254) ... 13 more ``` ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
7ee371b896ea088eb929f033c3763096f446c2a3
e08e1a4cf8633260ef3b51387301716f29d80ae3
https://github.com/quarkusio/quarkus/compare/7ee371b896ea088eb929f033c3763096f446c2a3...e08e1a4cf8633260ef3b51387301716f29d80ae3
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/BuildProfileTest.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/BuildProfileTest.java index ba1a6bce17a..758b78ec603 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/BuildProfileTest.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/BuildProfileTest.java @@ -60,6 +60,7 @@ void should_call_ok_of_resource_1() { .header("X-RF-4", nullValue()) .header("X-RF-5", notNullValue()) .header("X-RF-6", nullValue()) + .header("X-RF-7", notNullValue()) .body(Matchers.is("ok1")); } @@ -176,6 +177,21 @@ public void filter(ContainerRequestContext requestContext, ContainerResponseCont } } + public static class ResponseFilter7 implements ContainerResponseFilter { + + private final String value; + + public ResponseFilter7(String value) { + this.value = value; + } + + @Override + public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) + throws IOException { + responseContext.getHeaders().add("X-RF-7", value); + } + } + @IfBuildProfile("test") @Provider public static class Feature1 implements Feature { @@ -225,6 +241,7 @@ public static class DynamicFeature1 implements DynamicFeature { @Override public void configure(ResourceInfo resourceInfo, FeatureContext context) { context.register(ResponseFilter5.class); + context.register(new ResponseFilter7("Value")); } } diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ApplicationScanningResult.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ApplicationScanningResult.java index f603361330d..f01abb87935 100644 --- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ApplicationScanningResult.java +++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ApplicationScanningResult.java @@ -32,14 +32,16 @@ public ApplicationScanningResult(Set<String> allowedClasses, Set<String> singlet public KeepProviderResult keepProvider(ClassInfo providerClass) { if (filterClasses) { - // we don't care about provider annotations, they're manually registered (but for the server only) if (allowedClasses.isEmpty()) { - // we only have only classes to exclude - return excludedClasses.contains(providerClass.name().toString()) ? KeepProviderResult.DISCARD - : KeepProviderResult.SERVER_ONLY; + // we have only classes to exclude + if (excludedClasses.contains(providerClass.name().toString())) { + return KeepProviderResult.DISCARD; + } + } else { + // we don't care about provider annotations, they're manually registered (but for the server only) + return allowedClasses.contains(providerClass.name().toString()) ? KeepProviderResult.SERVER_ONLY + : KeepProviderResult.DISCARD; } - return allowedClasses.contains(providerClass.name().toString()) ? KeepProviderResult.SERVER_ONLY - : KeepProviderResult.DISCARD; } return providerClass.classAnnotation(ResteasyReactiveDotNames.PROVIDER) != null ? KeepProviderResult.NORMAL : KeepProviderResult.DISCARD; @@ -48,7 +50,7 @@ public KeepProviderResult keepProvider(ClassInfo providerClass) { public boolean keepClass(String className) { if (filterClasses) { if (allowedClasses.isEmpty()) { - // we only have only classes to exclude + // we have only classes to exclude return !excludedClasses.contains(className); } return allowedClasses.contains(className);
['independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/scanning/ApplicationScanningResult.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/BuildProfileTest.java']
{'.java': 2}
2
2
0
0
2
18,603,919
3,620,631
477,181
4,913
1,124
190
16
1
4,384
335
981
80
0
1
2021-09-29T07:33:25
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,615
quarkusio/quarkus/20932/17614
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17614
https://github.com/quarkusio/quarkus/pull/20932
https://github.com/quarkusio/quarkus/pull/20932
1
fixes
ConfigPhase.BUILD_AND_RUN_TIME_FIXED allows to set properties in JVM mode
## Describe the bug A user [has reported](https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/http.20permission.20enabled.20runtime.20or.20buildtime.20property) that [enabling the HTTP permissions](https://quarkus.io/guides/security-authorization#disabling-permissions) is allowed in the JVM mode but not in the native mode: `HttpBuildTimeConfig` -> `AuthConfig.permissions` -> `PolicyMappingConfig.enabled` `HttpBuildTimeConfig` is a `ConfigRoot` in a `ConfigPhase.BUILD_AND_RUN_TIME_FIXED` so it explains why this property is shown with a lock on the all config page. ### Expected behavior Setting properties at runtime should not work in `ConfigPhase.BUILD_AND_RUN_TIME_FIXED`. `HttpBuildTimeConfig` should be split into `HttpBuildTimeConfig` which would only keep the `ConfigPhase.BUILD_AND_RUN_TIME_FIXED` properties and `HttpConfig` which would have all other properties which may be possible to override at runtime (if it is possible in principle for some HTTP properties)
babb27d1fe92d6b36da962044a3f5e9b8fc3f167
dc3171fb034295c60fc5cec9f110628029504023
https://github.com/quarkusio/quarkus/compare/babb27d1fe92d6b36da962044a3f5e9b8fc3f167...dc3171fb034295c60fc5cec9f110628029504023
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java index 2ad341c8594..7dfe2875873 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java @@ -389,7 +389,7 @@ public static final class GenerateOperation implements AutoCloseable { cc.getFieldCreator(C_BUILD_TIME_CONFIG_SOURCE) .setModifiers(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL); final ResultHandle buildTimeConfigSource = clinit.newInstance(PCS_NEW, buildTimeValues, - clinit.load("Build time config"), clinit.load(100)); + clinit.load("Build time config"), clinit.load(Integer.MAX_VALUE)); clinit.writeStaticField(C_BUILD_TIME_CONFIG_SOURCE, buildTimeConfigSource); // the build time run time visible default values config source @@ -483,7 +483,7 @@ public void run() { reinit.load(entry.getValue())); } final ResultHandle buildTimeConfigSource = reinit.newInstance(PCS_NEW, buildTimeValues, - reinit.load("Build time config = Reloaded"), reinit.load(100)); + reinit.load("Build time config = Reloaded"), reinit.load(Integer.MAX_VALUE)); // the build time config, which is for user use only (not used by us other than for loading converters) final ResultHandle buildTimeBuilder = reinit.invokeStaticMethod(CU_CONFIG_BUILDER, reinit.load(true), reinit.load(launchMode)); diff --git a/core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java b/core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java index 964b48a7f56..dc8db706a2c 100644 --- a/core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java +++ b/core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java @@ -17,28 +17,19 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Base64; -import java.util.Collection; import java.util.HashSet; -import java.util.List; import java.util.Objects; import java.util.Set; import java.util.function.BooleanSupplier; -import javax.enterprise.context.ApplicationScoped; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; -import org.jboss.jandex.AnnotationInstance; -import org.jboss.jandex.ClassInfo; -import org.jboss.jandex.DotName; -import org.jboss.jandex.IndexView; import org.jboss.logging.Logger; import io.quarkus.arc.deployment.AdditionalBeanBuildItem; -import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem; import io.quarkus.arc.deployment.BeanContainerBuildItem; -import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.Record; @@ -54,23 +45,16 @@ import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedPackageBuildItem; import io.quarkus.extest.runtime.AdditionalStaticInitConfigSourceProvider; import io.quarkus.extest.runtime.FinalFieldReflectionObject; -import io.quarkus.extest.runtime.IConfigConsumer; import io.quarkus.extest.runtime.RuntimeXmlConfigService; -import io.quarkus.extest.runtime.TestAnnotation; import io.quarkus.extest.runtime.TestRecorder; import io.quarkus.extest.runtime.beans.CommandServlet; import io.quarkus.extest.runtime.beans.PublicKeyProducer; -import io.quarkus.extest.runtime.config.AnotherPrefixConfig; -import io.quarkus.extest.runtime.config.FooRuntimeConfig; import io.quarkus.extest.runtime.config.ObjectOfValue; import io.quarkus.extest.runtime.config.ObjectValueOf; -import io.quarkus.extest.runtime.config.PrefixConfig; import io.quarkus.extest.runtime.config.TestBuildAndRunTimeConfig; import io.quarkus.extest.runtime.config.TestBuildTimeConfig; import io.quarkus.extest.runtime.config.TestConfigRoot; -import io.quarkus.extest.runtime.config.TestRunTimeConfig; import io.quarkus.extest.runtime.config.XmlConfig; -import io.quarkus.extest.runtime.config.named.PrefixNamedConfig; import io.quarkus.extest.runtime.logging.AdditionalLogHandlerValueFactory; import io.quarkus.extest.runtime.runtimeinitializedpackage.RuntimeInitializedClass; import io.quarkus.extest.runtime.subst.DSAPublicKeyObjectSubstitution; @@ -83,8 +67,6 @@ */ public final class TestProcessor { static final Logger log = Logger.getLogger(TestProcessor.class); - static DotName TEST_ANNOTATION = DotName.createSimple(TestAnnotation.class.getName()); - static DotName TEST_ANNOTATION_SCOPE = DotName.createSimple(ApplicationScoped.class.getName()); TestConfigRoot configRoot; TestBuildTimeConfig buildTimeConfig; @@ -100,16 +82,6 @@ FeatureBuildItem featureBuildItem() { return new FeatureBuildItem("test-extension"); } - /** - * Register a custom bean defining annotation - * - * @return BeanDefiningAnnotationBuildItem - */ - @BuildStep - BeanDefiningAnnotationBuildItem registerBeanDefiningAnnotations() { - return new BeanDefiningAnnotationBuildItem(TEST_ANNOTATION, TEST_ANNOTATION_SCOPE); - } - /** * Register an additional log handler * @@ -343,59 +315,6 @@ void checkConfig() { } } - /** - * Collect the beans with our custom bean defining annotation and configure them with the runtime config - * - * @param recorder - runtime recorder - * @param beanArchiveIndex - index of type information - * @param testBeanProducer - producer for located Class<IConfigConsumer> bean types - */ - @BuildStep - @Record(STATIC_INIT) - void scanForBeans(TestRecorder recorder, BeanArchiveIndexBuildItem beanArchiveIndex, - BuildProducer<TestBeanBuildItem> testBeanProducer) { - IndexView indexView = beanArchiveIndex.getIndex(); - Collection<AnnotationInstance> testBeans = indexView.getAnnotations(TEST_ANNOTATION); - for (AnnotationInstance ann : testBeans) { - ClassInfo beanClassInfo = ann.target().asClass(); - try { - boolean isConfigConsumer = beanClassInfo.interfaceNames() - .stream() - .anyMatch(dotName -> dotName.equals(DotName.createSimple(IConfigConsumer.class.getName()))); - if (isConfigConsumer) { - Class<IConfigConsumer> beanClass = (Class<IConfigConsumer>) Class.forName(beanClassInfo.name().toString(), - true, Thread.currentThread().getContextClassLoader()); - testBeanProducer.produce(new TestBeanBuildItem(beanClass)); - log.infof("The configured bean: %s", beanClass); - } - } catch (ClassNotFoundException e) { - log.warn("Failed to load bean class", e); - } - } - } - - /** - * For each IConfigConsumer type, have the runtime recorder create a bean and pass in the runtime related configs - * - * @param recorder - runtime recorder - * @param testBeans - types of IConfigConsumer found - * @param beanContainer - bean container to create test bean in - * @param runTimeConfig - The RUN_TIME config phase root config - */ - @BuildStep - @Record(RUNTIME_INIT) - void configureBeans(TestRecorder recorder, List<TestBeanBuildItem> testBeans, - BeanContainerBuildItem beanContainer, - TestRunTimeConfig runTimeConfig, FooRuntimeConfig fooRuntimeConfig, PrefixConfig prefixConfig, - PrefixNamedConfig prefixNamedConfig, - AnotherPrefixConfig anotherPrefixConfig) { - for (TestBeanBuildItem testBeanBuildItem : testBeans) { - Class<IConfigConsumer> beanClass = testBeanBuildItem.getConfigConsumer(); - recorder.configureBeans(beanContainer.getValue(), beanClass, buildAndRunTimeConfig, runTimeConfig, - fooRuntimeConfig, prefixConfig, prefixNamedConfig, anotherPrefixConfig); - } - } - /** * Test for https://github.com/quarkusio/quarkus/issues/1633 * diff --git a/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBean.java b/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBean.java index 50f29b7b7e2..a27512b6bdc 100644 --- a/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBean.java +++ b/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBean.java @@ -1,7 +1,8 @@ package io.quarkus.extest; -import io.quarkus.extest.runtime.IConfigConsumer; -import io.quarkus.extest.runtime.TestAnnotation; +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; + import io.quarkus.extest.runtime.config.AnotherPrefixConfig; import io.quarkus.extest.runtime.config.FooRuntimeConfig; import io.quarkus.extest.runtime.config.PrefixConfig; @@ -9,34 +10,20 @@ import io.quarkus.extest.runtime.config.TestRunTimeConfig; import io.quarkus.extest.runtime.config.named.PrefixNamedConfig; -/** - * A sample bean - */ -@TestAnnotation -public class ConfiguredBean implements IConfigConsumer { - volatile TestRunTimeConfig runTimeConfig; - volatile TestBuildAndRunTimeConfig buildTimeConfig; - volatile FooRuntimeConfig fooRuntimeConfig; - volatile PrefixConfig prefixConfig; - volatile PrefixNamedConfig prefixNamedConfig; - volatile AnotherPrefixConfig anotherPrefixConfig; - - /** - * Called by runtime with the runtime config object - * - * @param runTimeConfig - */ - @Override - public void loadConfig(TestBuildAndRunTimeConfig buildTimeConfig, TestRunTimeConfig runTimeConfig, - FooRuntimeConfig fooRuntimeConfig, PrefixConfig prefixConfig, PrefixNamedConfig prefixNamedConfig, - AnotherPrefixConfig anotherPrefixConfig) { - this.buildTimeConfig = buildTimeConfig; - this.runTimeConfig = runTimeConfig; - this.fooRuntimeConfig = fooRuntimeConfig; - this.prefixConfig = prefixConfig; - this.prefixNamedConfig = prefixNamedConfig; - this.anotherPrefixConfig = anotherPrefixConfig; - } +@ApplicationScoped +public class ConfiguredBean { + @Inject + TestRunTimeConfig runTimeConfig; + @Inject + TestBuildAndRunTimeConfig buildTimeConfig; + @Inject + FooRuntimeConfig fooRuntimeConfig; + @Inject + PrefixConfig prefixConfig; + @Inject + PrefixNamedConfig prefixNamedConfig; + @Inject + AnotherPrefixConfig anotherPrefixConfig; public TestRunTimeConfig getRunTimeConfig() { return runTimeConfig; diff --git a/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java b/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java index 0977b03a3a2..47831946a1b 100644 --- a/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java +++ b/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java @@ -24,7 +24,6 @@ import javax.inject.Inject; -import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.config.spi.ConfigSource; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; @@ -44,6 +43,7 @@ import io.quarkus.extest.runtime.config.named.PrefixNamedConfig; import io.quarkus.test.QuarkusUnitTest; import io.restassured.RestAssured; +import io.smallrye.config.ConfigValue; import io.smallrye.config.SmallRyeConfig; /** @@ -316,11 +316,15 @@ public void testRtMapOfMap() { @Test public void buildTimeDefaults() { - // Source is only initialized once in runtime. - Assertions.assertEquals(1, OverrideBuildTimeConfigSource.counter.get()); - // Test that build configRoot are not overridden by properties in runtime. + // Source is only initialized twice (one for static init and another one for runtime) + Assertions.assertEquals(2, OverrideBuildTimeConfigSource.counter.get()); + // Test that build configRoot are not overridden by properties set in static or runtime init Assertions.assertEquals(1234567891L, buildAndRunTimeConfig.allValues.longPrimitive); - Assertions.assertEquals(0, ConfigProvider.getConfig().getValue("quarkus.btrt.all-values.long-primitive", Long.class)); + + ConfigValue value = config.getConfigValue("quarkus.btrt.all-values.long-primitive"); + Assertions.assertEquals("1234567891", value.getValue()); + Assertions.assertEquals("PropertiesConfigSource[source=Build time config]", value.getConfigSourceName()); + Assertions.assertEquals(Integer.MAX_VALUE, value.getConfigSourceOrdinal()); } @Test @@ -335,11 +339,15 @@ public void testConfigDefaultValuesSourceOrdinal() { Optional<ConfigSource> source = config.getConfigSource("PropertiesConfigSource[source=Specified default values]"); assertTrue(source.isPresent()); ConfigSource defaultValues = source.get(); - assertEquals(Integer.MIN_VALUE + 100, defaultValues.getOrdinal()); - // Should be the first - ConfigSource applicationProperties = config.getConfigSources().iterator().next(); + ConfigSource applicationProperties = null; + for (ConfigSource configSource : config.getConfigSources()) { + if (configSource.getName().contains("application.properties")) { + applicationProperties = configSource; + break; + } + } assertNotNull(applicationProperties); assertEquals(1000, applicationProperties.getOrdinal()); diff --git a/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestAnnotation.java b/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestAnnotation.java deleted file mode 100644 index 314e3ebc8aa..00000000000 --- a/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestAnnotation.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.quarkus.extest.runtime; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Documented; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Marker annotation for test configuration target beans - */ -@Target({ TYPE }) -@Retention(RUNTIME) -@Documented -@Inherited -public @interface TestAnnotation { -} diff --git a/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/OverrideBuildTimeConfigSource.java b/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/OverrideBuildTimeConfigSource.java index f450442e253..bdc269e926f 100644 --- a/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/OverrideBuildTimeConfigSource.java +++ b/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/OverrideBuildTimeConfigSource.java @@ -6,11 +6,13 @@ import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.config.spi.ConfigSource; +import io.quarkus.runtime.annotations.StaticInitSafe; import io.smallrye.config.common.MapBackedConfigSource; /** * Override a build time property in runtime. */ +@StaticInitSafe public class OverrideBuildTimeConfigSource extends MapBackedConfigSource { public static AtomicInteger counter = new AtomicInteger(0);
['core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java', 'core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java', 'core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBean.java', 'core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java', 'core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestAnnotation.java', 'core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/OverrideBuildTimeConfigSource.java']
{'.java': 6}
6
6
0
0
6
18,947,007
3,685,847
485,927
5,001
353
68
4
1
1,011
104
238
13
2
0
2021-10-21T10:24:47
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,616
quarkusio/quarkus/20787/20778
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20778
https://github.com/quarkusio/quarkus/pull/20787
https://github.com/quarkusio/quarkus/pull/20787
1
fixes
"Mutiny droped exception" when testing secured endpoint without authorization
### Describe the bug When accessing a basic-auth secured endpoint with RestAssured without authorization the following Error is logged: `ERROR [io.qua.mut.run.MutinyInfrastructure] (vert.x-eventloop-thread-11) Mutiny had to drop the following exception: java.lang.IllegalStateException: Response has already been written`. For example the following Test will succeed, but `testHelloEndpointWithoutAuthorization` logs the error. ```java @QuarkusTest public class GreetingResourceTest { @Test public void testHelloEndpointWithoutAuthorization() { given() .when().get("/hello") .then() .statusCode(401); } @Test @TestSecurity(user = "admin", roles = "admin") public void testHelloEndpointWithAuthorization() { given() .when().get("/hello") .then() .statusCode(200) .body(is("Hello RESTEasy")); } } ``` ### Expected behavior Unitests shouldn't log errors. ### Actual behavior ``` 2021-10-14 19:11:47,949 INFO [io.quarkus] (main) Quarkus 2.3.0.Final on JVM started in 1.582s. Listening on: http://localhost:8081 2021-10-14 19:11:47,953 INFO [io.quarkus] (main) Profile test activated. 2021-10-14 19:11:47,953 INFO [io.quarkus] (main) Installed features: [cdi, resteasy, security, security-properties-file, smallrye-context-propagation, vertx] 2021-10-14 19:11:48,975 ERROR [io.qua.mut.run.MutinyInfrastructure] (vert.x-eventloop-thread-11) Mutiny had to drop the following exception: java.lang.IllegalStateException: Response has already been written at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:394) at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:382) at io.vertx.core.http.impl.Http1xServerResponse.end(Http1xServerResponse.java:451) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$4$1.onItem(HttpAuthorizer.java:164) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$4$1.onItem(HttpAuthorizer.java:156) at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81) at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57) at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:43) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.operators.uni.UniOnItemTransform.subscribe(UniOnItemTransform.java:22) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni.subscribe(UniOnItemTransformToUni.java:25) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.groups.UniSubscribe.withSubscriber(UniSubscribe.java:50) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$4.onItem(HttpAuthorizer.java:156) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$4.onItem(HttpAuthorizer.java:146) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.groups.UniSubscribe.withSubscriber(UniSubscribe.java:50) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer.doDeny(HttpAuthorizer.java:146) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$2.accept(HttpAuthorizer.java:126) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$2.accept(HttpAuthorizer.java:122) at io.smallrye.context.impl.wrappers.SlowContextualConsumer.accept(SlowContextualConsumer.java:21) at io.smallrye.mutiny.helpers.UniCallbackSubscriber.onItem(UniCallbackSubscriber.java:69) at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81) at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57) at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:43) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.operators.uni.UniOnItemTransform.subscribe(UniOnItemTransform.java:22) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni.subscribe(UniOnItemTransformToUni.java:25) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.groups.UniSubscribe.withSubscriber(UniSubscribe.java:50) at io.smallrye.mutiny.groups.UniSubscribe.with(UniSubscribe.java:90) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer.doPermissionCheck(HttpAuthorizer.java:122) at io.quarkus.vertx.http.runtime.security.HttpAuthorizer.checkPermission(HttpAuthorizer.java:99) at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$3.handle(HttpSecurityRecorder.java:218) at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$3.handle(HttpSecurityRecorder.java:210) at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127) at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151) at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133) at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2$2$1.onItem(HttpSecurityRecorder.java:128) at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2$2$1.onItem(HttpSecurityRecorder.java:118) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.groups.UniSubscribe.withSubscriber(UniSubscribe.java:50) at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2$2.onItem(HttpSecurityRecorder.java:118) at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2$2.onItem(HttpSecurityRecorder.java:104) at io.smallrye.mutiny.operators.uni.UniMemoizeOp.drain(UniMemoizeOp.java:152) at io.smallrye.mutiny.operators.uni.UniMemoizeOp.onItem(UniMemoizeOp.java:172) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.forward(UniCreateFromKnownItem.java:38) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem$KnownItemSubscription.access$100(UniCreateFromKnownItem.java:26) at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownItem.subscribe(UniCreateFromKnownItem.java:23) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.operators.uni.UniMemoizeOp.subscribe(UniMemoizeOp.java:76) at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36) at io.smallrye.mutiny.groups.UniSubscribe.withSubscriber(UniSubscribe.java:50) at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:104) at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:51) at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127) at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151) at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133) at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:55) at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:37) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$10.handle(VertxHttpRecorder.java:443) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$10.handle(VertxHttpRecorder.java:440) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$1.handle(VertxHttpRecorder.java:151) at io.quarkus.vertx.http.runtime.VertxHttpRecorder$1.handle(VertxHttpRecorder.java:133) at io.vertx.core.http.impl.Http1xServerRequestHandler.handle(Http1xServerRequestHandler.java:67) at io.vertx.core.http.impl.Http1xServerRequestHandler.handle(Http1xServerRequestHandler.java:30) at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:50) at io.vertx.core.impl.DuplicatedContext.emit(DuplicatedContext.java:168) at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:143) at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:155) at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:154) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93) at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:99) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.vertx.core.http.impl.Http1xUpgradeToH2CHandler.channelRead(Http1xUpgradeToH2CHandler.java:116) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.vertx.core.http.impl.Http1xOrH2CHandler.end(Http1xOrH2CHandler.java:61) at io.vertx.core.http.impl.Http1xOrH2CHandler.channelRead(Http1xOrH2CHandler.java:38) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834) 2021-10-14 19:11:49,066 INFO [io.quarkus] (main) Quarkus stopped in 0.023s ``` ### How to Reproduce? 1. Setup ```bash git clone [email protected]:hendrikstill/mutiny-drop-exception-test-security-bug.git cd mutiny-drop-exception-test-security-bug ``` 2. run tests ```bash ./mvnw clean test ``` ### Output of `uname -a` or `ver` Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 ### Output of `java -version` openjdk version "11.0.10" 2021-01-19 ### GraalVM version (if different from Java) OpenJDK 64-Bit Server VM GraalVM CE 20.3.1 (build 11.0.10+8-jvmci-20.3-b09, mixed mode, sharing ### Quarkus version or git rev 2.3.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) ### Additional information _No response_
a2c81efd6607d270dc7eaa9b7c38acb849c85030
63d905909845c036eb327a24c5e8ba7dd89a2e37
https://github.com/quarkusio/quarkus/compare/a2c81efd6607d270dc7eaa9b7c38acb849c85030...63d905909845c036eb327a24c5e8ba7dd89a2e37
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthorizer.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthorizer.java index 0b7ce8da9be..56813aed5d3 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthorizer.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthorizer.java @@ -1,5 +1,6 @@ package io.quarkus.vertx.http.runtime.security; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.function.BiFunction; @@ -170,12 +171,20 @@ public void onSubscribe(UniSubscription subscription) { @Override public void onItem(Boolean item) { - routingContext.response().end(); + if (!routingContext.response().ended()) { + routingContext.response().end(); + } } @Override public void onFailure(Throwable failure) { - routingContext.fail(failure); + if (!routingContext.response().ended()) { + routingContext.fail(failure); + } else if (!(failure instanceof IOException)) { + log.error("Failed to send challenge", failure); + } else { + log.debug("Failed to send challenge", failure); + } } }); } else {
['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthorizer.java']
{'.java': 1}
1
1
0
0
1
18,843,180
3,665,687
483,343
4,971
759
93
13
1
16,368
528
3,969
227
1
4
2021-10-15T02:44:09
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,617
quarkusio/quarkus/20770/20755
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20755
https://github.com/quarkusio/quarkus/pull/20770
https://github.com/quarkusio/quarkus/pull/20770
1
fixes
2.4.0.CR1 Generated Bean Injection not working as before
### Describe the bug I am working on a multi-module gradle project which uses MapStruct for @Entity to DTO conversion. Mapper beans are injected into microservice modules from shared data library modules. After upgrading from quarkus 2.3.0.Final to 2.4.0.CR1 injecting mapper beans does not work anymore. Using Jandex does not solve the problem either. ### Expected behavior Injecting MapStruct mapper beans from one module into another should work for 2.4.0.RC1. ### Actual behavior Injecting MapStruct mapper beans from one module into another does not work for 2.4.0.RC1. The application crashes before starting the server in devMode: ``` 2021-10-14 01:28:17,706 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] - java member: de.lj.MapperTest#<init>() - declared on CLASS bean [types=[de.lj.MapperTest, java.lang.Object], qualifiers=[@Default, @Any], target=de.lj.MapperTest] at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1190) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:268) at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129) at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:821) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:834) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] - java member: de.lj.MapperTest#<init>() - declared on CLASS bean [types=[de.lj.MapperTest, java.lang.Object], qualifiers=[@Default, @Any], target=de.lj.MapperTest] at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:567) at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:256) ... 13 more at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:418) at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:276) Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:67) at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:92) at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:441) at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:65) at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:149) at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:105) at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145) at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63) Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] - java member: de.lj.MapperTest#<init>() - declared on CLASS bean [types=[de.lj.MapperTest, java.lang.Object], qualifiers=[@Default, @Any], target=de.lj.MapperTest] at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1190) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:268) at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129) at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:821) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:834) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] - java member: de.lj.MapperTest#<init>() - declared on CLASS bean [types=[de.lj.MapperTest, java.lang.Object], qualifiers=[@Default, @Any], target=de.lj.MapperTest] at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:567) at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:256) ... 13 more at io.quarkus.builder.Execution.run(Execution.java:116) at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79) at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:161) at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:416) ... 9 more Caused by: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] - java member: de.lj.MapperTest#<init>() - declared on CLASS bean [types=[de.lj.MapperTest, java.lang.Object], qualifiers=[@Default, @Any], target=de.lj.MapperTest] at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1190) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:268) at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129) at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:821) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:834) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] - java member: de.lj.MapperTest#<init>() - declared on CLASS bean [types=[de.lj.MapperTest, java.lang.Object], qualifiers=[@Default, @Any], target=de.lj.MapperTest] at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:567) at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:256) Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors ... 13 more 2021-10-14 01:28:17,706 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] Caused by: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type de.lj.v240.mapper.PersonMapper and qualifiers [@Default] 2021-10-14 01:28:17,838 INFO [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final > Task :microservice-2.4.0:quarkusDev FAILED Execution failed for task ':microservice-2.4.0:quarkusDev'. > Build cancelled while executing task ':microservice-2.4.0:quarkusDev' * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ``` ### How to Reproduce? I added code which allows for reproduction of the error to [my github repo](https://github.com/lorenzjosten/mapper-injection). Run quarkusDev for gradle module microservice-2.4.0 in order to reproduce the error. Run quarkusDev for gradle module microservice-2.3.0 in order to get the expected behaviour. ### Output of `uname -a` or `ver` Darwin 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06) OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.4.0.CR1 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle 7.2 ### Additional information Canonical bean injection, i.e. creating an @ApplicationScoped bean in the data-libraries, still works.
a2c81efd6607d270dc7eaa9b7c38acb849c85030
c0599fd95b2543c49a3f6cb55d9ec98037a4994e
https://github.com/quarkusio/quarkus/compare/a2c81efd6607d270dc7eaa9b7c38acb849c85030...c0599fd95b2543c49a3f6cb55d9ec98037a4994e
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/builder/GradleApplicationModelBuilder.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/builder/GradleApplicationModelBuilder.java index 1d2b9ac2253..ca779244d87 100644 --- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/builder/GradleApplicationModelBuilder.java +++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/builder/GradleApplicationModelBuilder.java @@ -24,6 +24,8 @@ import org.gradle.api.artifacts.ResolvedArtifact; import org.gradle.api.artifacts.ResolvedConfiguration; import org.gradle.api.artifacts.component.ProjectComponentIdentifier; +import org.gradle.api.file.FileCollection; +import org.gradle.api.file.FileTree; import org.gradle.api.initialization.IncludedBuild; import org.gradle.api.internal.artifacts.dependencies.DefaultDependencyArtifact; import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency; @@ -321,7 +323,7 @@ private void collectDependencies(ResolvedConfiguration configuration, if (artifactFiles != null) { // detect FS paths that aren't provided by the resolved artifacts for (File f : configuration.getFiles()) { - if (artifactFiles.contains(f)) { + if (artifactFiles.contains(f) || !f.exists()) { continue; } // here we are trying to represent a direct FS path dependency @@ -469,7 +471,7 @@ private void processQuarkusDependency(ResolvedDependencyBuilder artifactBuilder, if (Files.isDirectory(artifactPath)) { processQuarkusDir(artifactBuilder, artifactPath.resolve(BootstrapConstants.META_INF), modelBuilder); } else { - try (FileSystem artifactFs = FileSystems.newFileSystem(artifactPath, null)) { + try (FileSystem artifactFs = FileSystems.newFileSystem(artifactPath, (ClassLoader) null)) { processQuarkusDir(artifactBuilder, artifactFs.getPath(BootstrapConstants.META_INF), modelBuilder); } catch (IOException e) { throw new RuntimeException("Failed to process " + artifactPath, e); @@ -481,103 +483,79 @@ private void processQuarkusDependency(ResolvedDependencyBuilder artifactBuilder, private static void initProjectModule(Project project, DefaultWorkspaceModule module, SourceSet sourceSet, boolean test) { module.setBuildFiles(PathList.of(project.getBuildFile().toPath())); - final List<Path> allJavaDirs = new ArrayList<>(2); - sourceSet.getAllJava().getSourceDirectories().forEach(f -> { - if (f.exists()) { - allJavaDirs.add(f.toPath()); - } - }); - - if (!allJavaDirs.isEmpty()) { - final TaskCollection<AbstractCompile> compileTasks = project.getTasks().withType(AbstractCompile.class); - compileTasks.forEach(t -> { - String compiler = t.getName(); - if (compiler.startsWith("compile")) { - compiler = compiler.substring("compile".length()).toLowerCase(); - } - final File destDir = t.getDestinationDirectory().getAsFile().get(); - - final List<Path> srcDirs = new ArrayList<>(1); - for (File f : t.getSource().getFiles()) { - if (!f.exists()) { - return; - } - final Path p = f.toPath(); - int i = 0; - while (i < srcDirs.size()) { - if (p.startsWith(srcDirs.get(i))) { - break; - } - ++i; - } - if (i < srcDirs.size()) { - continue; - } - for (Path srcDir : allJavaDirs) { - if (p.startsWith(srcDir)) { - srcDirs.add(srcDir); - DefaultProcessedSources sources = new DefaultProcessedSources(srcDir.toFile(), destDir, - Collections.singletonMap("compiler", compiler)); - if (test) { - module.addTestSources(sources); - } else { - module.addMainSources(sources); - } - break; + final FileCollection allClassesDirs = sourceSet.getOutput().getClassesDirs(); + // some plugins do not add source directories to source sets and they may be missing from sourceSet.getAllJava() + // see https://github.com/quarkusio/quarkus/issues/20755 + final TaskCollection<AbstractCompile> compileTasks = project.getTasks().withType(AbstractCompile.class); + compileTasks.forEach(t -> { + if (!t.getEnabled()) { + return; + } + final FileTree source = t.getSource(); + if (source.isEmpty()) { + return; + } + final File destDir = t.getDestinationDirectory().getAsFile().get(); + if (!allClassesDirs.contains(destDir)) { + return; + } + final List<File> srcDirs = new ArrayList<>(1); + source.visit(a -> { + // we are looking for the root dirs containing sources + if (a.getRelativePath().getSegments().length == 1) { + final File srcDir = a.getFile().getParentFile(); + if (srcDirs.add(srcDir)) { + DefaultProcessedSources sources = new DefaultProcessedSources(srcDir, destDir, + Collections.singletonMap("compiler", t.getName())); + if (test) { + module.addTestSources(sources); + } else { + module.addMainSources(sources); } } } }); - } - - final List<Path> allResourcesDirs = new ArrayList<>(1); - final List<Path> addedSrcDirs = new ArrayList<>(1); - final File outputDir = sourceSet.getOutput().getResourcesDir(); - for (File resourcesDir : sourceSet.getResources().getSourceDirectories()) { - allResourcesDirs.add(resourcesDir.toPath()); - addResources(module, resourcesDir, outputDir, test, addedSrcDirs); - } + }); - if (!allResourcesDirs.isEmpty()) { - final TaskCollection<ProcessResources> resources = project.getTasks().withType(ProcessResources.class); - resources.forEach(t -> { - final File destDir = t.getDestinationDir(); - for (File f : t.getSource().getFiles()) { - if (!f.exists()) { - return; - } - final Path p = f.toPath(); - int i = 0; - while (i < addedSrcDirs.size()) { - if (p.startsWith(addedSrcDirs.get(i))) { - break; - } - ++i; - } - if (i < addedSrcDirs.size()) { - continue; - } - for (Path srcDir : allResourcesDirs) { - if (p.startsWith(srcDir)) { - addResources(module, srcDir.toFile(), destDir, test, addedSrcDirs); - break; - } + final File resourcesOutputDir = sourceSet.getOutput().getResourcesDir(); + final TaskCollection<ProcessResources> resources = project.getTasks().withType(ProcessResources.class); + resources.forEach(t -> { + if (!t.getEnabled()) { + return; + } + final FileCollection source = t.getSource(); + if (source.isEmpty()) { + return; + } + final File destDir = t.getDestinationDir(); + if (!destDir.equals(resourcesOutputDir)) { + return; + } + final List<File> srcDirs = new ArrayList<>(1); + source.getAsFileTree().visit(a -> { + // we are looking for the root dirs containing sources + if (a.getRelativePath().getSegments().length == 1) { + final File srcDir = a.getFile().getParentFile(); + if (srcDirs.add(srcDir)) { + addResources(module, srcDir, destDir, test); } } }); + }); + // there could be a task generating resources + if (resourcesOutputDir.exists() && (test ? module.getTestResources().isEmpty() : module.getMainResources().isEmpty())) { + sourceSet.getResources().getSrcDirs().forEach(srcDir -> addResources(module, srcDir, resourcesOutputDir, test)); } } - private static void addResources(DefaultWorkspaceModule module, File srcDir, final File destDir, boolean test, - Collection<Path> addedSrcDirs) { + private static void addResources(DefaultWorkspaceModule module, File srcDir, final File destDir, boolean test) { final DefaultProcessedSources resrc = new DefaultProcessedSources(srcDir, destDir); if (test) { module.addTestResources(resrc); } else { module.addMainResources(resrc); } - addedSrcDirs.add(srcDir.toPath()); } private void addSubstitutedProject(PathList.Builder paths, File projectFile) {
['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/builder/GradleApplicationModelBuilder.java']
{'.java': 1}
1
1
0
0
1
18,843,180
3,665,687
483,343
4,971
7,193
1,266
140
1
11,140
705
2,778
158
1
1
2021-10-14T13:30:34
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,618
quarkusio/quarkus/20742/20128
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20128
https://github.com/quarkusio/quarkus/pull/20742
https://github.com/quarkusio/quarkus/pull/20742
1
resolves
IsDockerWorking does not use property quarkus.docker.executable-name
### Describe the bug When using property `quarkus.docker.executable-name` to set a custom Docker executable, the strategy `DockerBinaryStrategy` of BooleanSupplier `io.quarkus.deployment.IsDockerWorking` does not use the property `quarkus.docker.executable-name` to override the executable name. ### Expected behavior If `quarkus.docker.executable-name` is set also `io.quarkus.deployment.IsDockerWorking.DockerBinaryStrategy` should honor this custom setting. ### Actual behavior Class `io.quarkus.deployment.IsDockerWorking.DockerBinaryStrategy` is always using Docker binary `docker` ### How to Reproduce? 1. Download example of https://code.quarkus.io/?e=container-image-docker 2. Create a shell/batch file that runs Docker/Podman (in my case Docker runs inside WSL2; to replace Docker Desktop) and passes all arguments 3. Set `quarkus.docker.executable-name` to that shell/batch file executable 4. Try to build ### Output of `uname -a` or `ver` Microsoft Windows [Version 10.0.18363.1734] ### Output of `java -version` OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2.2.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Gradle v7.2 ### Additional information _No response_
36d36decc0f5b47b1dd94c2c571eb49d8589bc6a
c87a10046be57e2d4972813a18c6675eb04683b9
https://github.com/quarkusio/quarkus/compare/36d36decc0f5b47b1dd94c2c571eb49d8589bc6a...c87a10046be57e2d4972813a18c6675eb04683b9
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java b/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java index 617a47426d1..2f241e9b8f5 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java @@ -16,6 +16,7 @@ import java.util.function.Function; import java.util.function.Supplier; +import org.eclipse.microprofile.config.ConfigProvider; import org.jboss.logging.Logger; import io.quarkus.deployment.console.StartupLogCompressor; @@ -125,20 +126,23 @@ public Result get() { private static class DockerBinaryStrategy implements Strategy { private final boolean silent; + private final String binary; private DockerBinaryStrategy(boolean silent) { this.silent = silent; + this.binary = ConfigProvider.getConfig().getOptionalValue("quarkus.docker.executable-name", String.class) + .orElse("docker"); } @Override public Result get() { try { - if (!ExecUtil.execSilent("docker", "-v")) { - LOGGER.warn("'docker -v' returned an error code. Make sure your Docker binary is correct"); + if (!ExecUtil.execSilent(binary, "-v")) { + LOGGER.warnf("'%s -v' returned an error code. Make sure your Docker binary is correct", binary); return Result.UNKNOWN; } } catch (Exception e) { - LOGGER.warnf("No Docker binary found or general error: %s", e); + LOGGER.warnf("No %s binary found or general error: %s", binary, e); return Result.UNKNOWN; }
['core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java']
{'.java': 1}
1
1
0
0
1
18,811,326
3,660,077
482,644
4,964
769
158
10
1
1,387
159
363
42
1
0
2021-10-13T14:51:24
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,620
quarkusio/quarkus/20673/20661
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20661
https://github.com/quarkusio/quarkus/pull/20673
https://github.com/quarkusio/quarkus/pull/20673
1
fixes
The quarkus-maven-plugin:dependency-tree not resolving the dependencies versions correctly
### Describe the bug Building the dependency-tree using the Quarkus Maven plugin and following the instructions from here: https://quarkus.io/guides/maven-tooling#logging-quarkus-application-build-classpath-tree Command: ``` mvn com.redhat.quarkus.platform:quarkus-maven-plugin:2.2.3.Final-redhat-00013:dependency-tree -Dquarkus.platform.group-id=com.redhat.quarkus.platform -Dquarkus.platform.artifact-id=quarkus-bom -Dquarkus.platform.version=2.2.3.Final-redhat-00013 ``` Even when using the right Quarkus Maven plugin version, the resolved dependencies are not replacing the versions correctly (it's using the version declared in the pom.xml file): ``` [INFO] --- quarkus-maven-plugin:2.2.3.Final-redhat-00013:dependency-tree (default-cli) @ kafka-panache-reactive-quickstart --- [INFO] Quarkus application DEV mode build dependency tree: [INFO] org.acme:kafka-panache-reactive-quickstart:pom:1.0.0-SNAPSHOT [INFO] ├─ io.quarkus:quarkus-smallrye-reactive-messaging-kafka-deployment:jar:2.2.2.Final (compile) -- SEE HERE [INFO] │ ├─ io.quarkus:quarkus-core-deployment:jar:2.2.2.Final (compile) [INFO] │ │ ├─ org.aesh:readline:jar:2.1 (compile) ``` Using the dependency:tree command from Maven directly, this is working as expected: ``` mvn dependency:tree -Dquarkus.platform.group-id=com.redhat.quarkus.platform -Dquarkus.platform.artifact-id=quarkus-bom -Dquarkus.platform.version=2.2.3.Final-redhat-00013 ``` With output: ``` [INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ kafka-panache-reactive-quickstart --- [INFO] org.acme:kafka-panache-reactive-quickstart:jar:1.0.0-SNAPSHOT [INFO] +- io.quarkus:quarkus-smallrye-reactive-messaging-kafka:jar:2.2.3.Final-redhat-00013:compile [INFO] | +- io.quarkus:quarkus-kafka-client:jar:2.2.3.Final-redhat-00013:compile [INFO] | | \\- io.quarkus:quarkus-caffeine:jar:2.2.3.Final-redhat-00013:compile [INFO] | | \\- com.github.ben-manes.caffeine:caffeine:jar:2.9.2.redhat-00001:compile ``` ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2 and Main ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
0ae0c6c13e4a44e17194ccaf77c3edf00551b9a4
4c90baabe3f1d29df9ce1015a2e093397c5bb206
https://github.com/quarkusio/quarkus/compare/0ae0c6c13e4a44e17194ccaf77c3edf00551b9a4...4c90baabe3f1d29df9ce1015a2e093397c5bb206
diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java index 49f330da427..d07aa67cf4f 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java @@ -74,10 +74,14 @@ public void execute() throws MojoExecutionException, MojoFailureException { protected MavenArtifactResolver resolver() throws BootstrapMavenException { return resolver == null ? resolver = MavenArtifactResolver.builder() - .setRepositorySystem(bootstrapProvider.repositorySystem()) .setRemoteRepositoryManager(bootstrapProvider.remoteRepositoryManager()) - //.setRepositorySystemSession(repoSession) the session should be initialized with the loaded workspace + // The system needs to be initialized with the bootstrap model builder to properly interpolate system properties set on the command line + // e.g. -Dquarkus.platform.version=xxx + //.setRepositorySystem(bootstrapProvider.repositorySystem()) + // The session should be initialized with the loaded workspace + //.setRepositorySystemSession(repoSession) .setRemoteRepositories(repos) + // To support multimodule projects that haven't been installed .setPreferPomsFromWorkspace(true) .build() : resolver;
['devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java']
{'.java': 1}
1
1
0
0
1
18,756,060
3,650,348
481,273
4,952
767
114
8
1
2,441
208
754
72
1
4
2021-10-11T19:54:50
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,622
quarkusio/quarkus/20632/20618
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20618
https://github.com/quarkusio/quarkus/pull/20632
https://github.com/quarkusio/quarkus/pull/20632
1
fixes
Config value evaluation failing when the placeholder value is missing
### Describe the bug In an application using kubernetes-config, I have a prod profile with the following configuration: ``` %prod.quarkus.kubernetes-config.secrets=postgresql %prod.quarkus.kubernetes-config.secrets.enabled=true %prod.quarkus.datasource.db-kind=postgresql %prod.quarkus.datasource.username=${database-user} %prod.quarkus.datasource.password=${database-password} %prod.quarkus.datasource.jdbc.url=jdbc:postgresql://postgresql:5432/person ``` The database-user and database-password are provided by a Kubernetes secret at runtime. However, a simple `mvn package` throws: ``` java.util.NoSuchElementException: SRCFG00011: Could not expand value database-user in property quarkus.datasource.username at io.smallrye.config.ExpressionConfigSourceInterceptor.lambda$getValue$0(ExpressionConfigSourceInterceptor.java:63) at io.smallrye.common.expression.ExpressionNode.emit(ExpressionNode.java:22) at io.smallrye.common.expression.Expression.evaluateException(Expression.java:56) at io.smallrye.common.expression.Expression.evaluate(Expression.java:70) at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:56) at io.smallrye.config.ExpressionConfigSourceInterceptor.getValue(ExpressionConfigSourceInterceptor.java:36) at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20) at io.smallrye.config.PropertyNamesConfigSourceInterceptor.getValue(PropertyNamesConfigSourceInterceptor.java:61) at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20) at io.smallrye.config.SmallRyeConfig.getConfigValue(SmallRyeConfig.java:307) at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:225) at io.smallrye.config.SmallRyeConfig.getOptionalValue(SmallRyeConfig.java:324) at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.devServicesAutoGenerateByDefault(HibernateOrmProcessor.java:199) ``` ### Expected behavior It should not fail. ### Actual behavior It fails since 2.3.0. ### How to Reproduce? Clone https://github.com/cescoffier/devnation-quarkus-movies and update the quarkus version to 999-SNAPSHOT (it fails since 2.3.0.Final), and run `mvn package -DskipTests`. You can revert to the original version to see the build succeeds. ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev _No response_ ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
2c499b15c7acdcfd536a6530c7747c15a9bc4c3a
10088661a0aa01b1c2f47f34845ca2d7e5ddf727
https://github.com/quarkusio/quarkus/compare/2c499b15c7acdcfd536a6530c7747c15a9bc4c3a...10088661a0aa01b1c2f47f34845ca2d7e5ddf727
diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java index 5a9f8b5863b..7590089a743 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java @@ -41,7 +41,6 @@ import javax.persistence.spi.PersistenceUnitTransactionType; import javax.transaction.TransactionManager; -import org.eclipse.microprofile.config.ConfigProvider; import org.hibernate.MultiTenancyStrategy; import org.hibernate.boot.archive.scan.spi.ClassDescriptor; import org.hibernate.boot.archive.scan.spi.PackageDescriptor; @@ -130,6 +129,7 @@ import io.quarkus.panache.common.deployment.HibernateEnhancersRegisteredBuildItem; import io.quarkus.panache.common.deployment.HibernateModelClassCandidatesForFieldAccessBuildItem; import io.quarkus.runtime.LaunchMode; +import io.quarkus.runtime.configuration.ConfigUtils; import io.quarkus.runtime.configuration.ConfigurationException; import net.bytebuddy.description.type.TypeDescription; import net.bytebuddy.dynamic.DynamicType; @@ -196,10 +196,9 @@ void devServicesAutoGenerateByDefault(DevServicesLauncherConfigResultBuildItem d dsName = "quarkus.datasource." + config.defaultPersistenceUnit.datasource.get() + ".username"; } - if (ConfigProvider.getConfig().getOptionalValue(dsName, String.class).isEmpty()) { + if (!ConfigUtils.isPropertyPresent(dsName)) { if (devServicesResult.getConfig().containsKey(dsName)) { - if (ConfigProvider.getConfig().getOptionalValue("quarkus.hibernate-orm.database.generation", String.class) - .isEmpty()) { + if (!ConfigUtils.isPropertyPresent("quarkus.hibernate-orm.database.generation")) { LOG.info( "Setting quarkus.hibernate-orm.database.generation=drop-and-create to initialize Dev Services managed database"); runTimeConfigurationDefaultBuildItemBuildProducer.produce(new RunTimeConfigurationDefaultBuildItem( @@ -215,10 +214,10 @@ void devServicesAutoGenerateByDefault(DevServicesLauncherConfigResultBuildItem d } else { dsName = "quarkus.datasource." + entry.getValue().datasource.get() + ".username"; } - if (ConfigProvider.getConfig().getOptionalValue(dsName, String.class).isEmpty()) { + if (!ConfigUtils.isPropertyPresent(dsName)) { if (devServicesResult.getConfig().containsKey(dsName)) { String propertyName = "quarkus.hibernate-orm." + entry.getKey() + ".database.generation"; - if (ConfigProvider.getConfig().getOptionalValue(propertyName, String.class).isEmpty()) { + if (!ConfigUtils.isPropertyPresent(propertyName)) { LOG.info("Setting " + propertyName + "=drop-and-create to initialize Dev Services managed database"); runTimeConfigurationDefaultBuildItemBuildProducer .produce(new RunTimeConfigurationDefaultBuildItem(propertyName, "drop-and-create")); @@ -1506,4 +1505,4 @@ static final class CachedProxy { this.interfaces = interfaces; } } -} \\ No newline at end of file +}
['extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java']
{'.java': 1}
1
1
0
0
1
18,759,175
3,651,280
481,465
4,957
862
161
13
1
2,715
181
611
69
1
2
2021-10-08T15:56:44
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,623
quarkusio/quarkus/20597/20606
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20606
https://github.com/quarkusio/quarkus/pull/20597
https://github.com/quarkusio/quarkus/pull/20597
1
fixes
NullPointerException when no file is pass to to rest client reactive
### Describe the bug When using rest client reactive with multipart formdata, if I don't pass any file then a NPE will occur ``` java.lang.NullPointerException: Cannot invoke "java.io.File.toPath()" because "<parameter1>.files" is null ``` the request object model look like this ```java public class AppointmentFormData { @RestForm @PartType(MediaType.TEXT_PLAIN) public String documents; @RestForm("files") @PartType(MediaType.APPLICATION_OCTET_STREAM) public File files; } ``` end the rest client ```java @Path("/appointments") @RegisterRestClient(configKey = "appointment-service") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public interface V1AppointmentServiceRestClient { @GET @Path("/{id}") Uni<V1Appointment> getAppointmentById(@PathParam("id") Long id); @POST @Consumes(MediaType.MULTIPART_FORM_DATA) Uni<V1Appointment> createAppointment(@MultipartForm AppointmentFormData data); } ``` ### Expected behavior if there is no file, it should still send data successfully ### Actual behavior throw NPE ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "16.0.1" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.3.0.final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) ### Additional information _No response_
b131a1249c5b0a4f5607119bb1fecc4d446e5df0
b5a8405d6c5d52c5bcf83b5b7df7e3476cce387a
https://github.com/quarkusio/quarkus/compare/b131a1249c5b0a4f5607119bb1fecc4d446e5df0...b5a8405d6c5d52c5bcf83b5b7df7e3476cce387a
diff --git a/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java b/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java index ee0b30d5d97..0e3eb72f9a8 100644 --- a/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java +++ b/extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java @@ -1083,9 +1083,10 @@ private ResultHandle createMultipartForm(MethodCreator methodCreator, ResultHand "No @PartType annotation found on multipart form field of type File: " + formClass.name() + "." + field.name()); } - ResultHandle filePath = methodCreator.invokeVirtualMethod( + BytecodeCreator ifFileNotNull = methodCreator.ifNotNull(fieldValue).trueBranch(); + ResultHandle filePath = ifFileNotNull.invokeVirtualMethod( MethodDescriptor.ofMethod(File.class, "toPath", Path.class), fieldValue); - addFile(methodCreator, multipartForm, formParamName, partType, filePath); + addFile(ifFileNotNull, multipartForm, formParamName, partType, filePath); } else if (is(PATH, fieldClass, index)) { // and so is path if (partType == null) { @@ -1093,10 +1094,12 @@ private ResultHandle createMultipartForm(MethodCreator methodCreator, ResultHand "No @PartType annotation found on multipart form field of type Path: " + formClass.name() + "." + field.name()); } - addFile(methodCreator, multipartForm, formParamName, partType, fieldValue); + BytecodeCreator ifPathNotNull = methodCreator.ifNotNull(fieldValue).trueBranch(); + addFile(ifPathNotNull, multipartForm, formParamName, partType, fieldValue); } else if (is(BUFFER, fieldClass, index)) { // and buffer - addBuffer(methodCreator, multipartForm, formParamName, partType, fieldValue, field); + BytecodeCreator ifBufferNotNull = methodCreator.ifNotNull(fieldValue).trueBranch(); + addBuffer(ifBufferNotNull, multipartForm, formParamName, partType, fieldValue, field); } else { // assume POJO: addPojo(methodCreator, multipartForm, formParamName, partType, fieldValue, field); } @@ -1109,10 +1112,11 @@ private ResultHandle createMultipartForm(MethodCreator methodCreator, ResultHand throw new IllegalArgumentException("Array of unsupported type: " + componentType.name() + " on " + formClassType.name() + "." + field.name()); } - ResultHandle buffer = methodCreator.invokeStaticInterfaceMethod( + BytecodeCreator ifArrayNotNull = methodCreator.ifNotNull(fieldValue).trueBranch(); + ResultHandle buffer = ifArrayNotNull.invokeStaticInterfaceMethod( MethodDescriptor.ofMethod(Buffer.class, "buffer", Buffer.class, byte[].class), fieldValue); - addBuffer(methodCreator, multipartForm, formParamName, partType, buffer, field); + addBuffer(ifArrayNotNull, multipartForm, formParamName, partType, buffer, field); break; case PRIMITIVE: // primitives are converted to text and sent as attribute @@ -1145,7 +1149,7 @@ private void addPojo(MethodCreator methodCreator, AssignableResultHandle multipa * add file upload, see {@link QuarkusMultipartForm#binaryFileUpload(String, String, String, String)} and * {@link QuarkusMultipartForm#textFileUpload(String, String, String, String)} */ - private void addFile(MethodCreator methodCreator, AssignableResultHandle multipartForm, String formParamName, + private void addFile(BytecodeCreator methodCreator, AssignableResultHandle multipartForm, String formParamName, String partType, ResultHandle filePath) { ResultHandle fileNamePath = methodCreator.invokeInterfaceMethod(PATH_GET_FILENAME, filePath); ResultHandle fileName = methodCreator.invokeVirtualMethod(OBJECT_TO_STRING, fileNamePath); @@ -1209,7 +1213,7 @@ private void addString(MethodCreator methodCreator, AssignableResultHandle multi multipartForm, methodCreator.load(formParamName), fieldValue)); } - private void addBuffer(MethodCreator methodCreator, AssignableResultHandle multipartForm, String formParamName, + private void addBuffer(BytecodeCreator methodCreator, AssignableResultHandle multipartForm, String formParamName, String partType, ResultHandle buffer, FieldInfo field) { if (partType == null) { throw new IllegalArgumentException( diff --git a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java index b3fb164f974..a43318d1920 100644 --- a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java +++ b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java @@ -300,7 +300,6 @@ private void configureBaseUrl(RestClientBuilder builder) { clientConfigByConfigKey().uri); if (propertyOptional.isEmpty()) { - // mstodo is the url there string? propertyOptional = oneOf(clientConfigByClassName().url, clientConfigByConfigKey().url); } diff --git a/integration-tests/rest-client-reactive-multipart/src/main/java/io/quarkus/it/rest/client/multipart/MultipartResource.java b/integration-tests/rest-client-reactive-multipart/src/main/java/io/quarkus/it/rest/client/multipart/MultipartResource.java index 4a040d7b963..7f9a5fc2923 100644 --- a/integration-tests/rest-client-reactive-multipart/src/main/java/io/quarkus/it/rest/client/multipart/MultipartResource.java +++ b/integration-tests/rest-client-reactive-multipart/src/main/java/io/quarkus/it/rest/client/multipart/MultipartResource.java @@ -14,6 +14,7 @@ import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; @@ -75,9 +76,11 @@ public String sendByteArrayWithPojo(@RestQuery @DefaultValue("true") Boolean wit @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @Blocking - public String sendByteArray() { + public String sendByteArray(@QueryParam("nullFile") @DefaultValue("false") boolean nullFile) { WithByteArrayAsBinaryFile data = new WithByteArrayAsBinaryFile(); - data.file = HELLO_WORLD.getBytes(UTF_8); + if (!nullFile) { + data.file = HELLO_WORLD.getBytes(UTF_8); + } data.fileName = GREETING_TXT; return client.sendByteArrayAsBinaryFile(data); } @@ -87,9 +90,11 @@ public String sendByteArray() { @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @Blocking - public String sendBuffer() { + public String sendBuffer(@QueryParam("nullFile") @DefaultValue("false") boolean nullFile) { WithBufferAsBinaryFile data = new WithBufferAsBinaryFile(); - data.file = Buffer.buffer(HELLO_WORLD); + if (!nullFile) { + data.file = Buffer.buffer(HELLO_WORLD); + } data.fileName = GREETING_TXT; return client.sendBufferAsBinaryFile(data); } @@ -99,16 +104,19 @@ public String sendBuffer() { @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @Blocking - public String sendFileAsBinary() throws IOException { - File tempFile = File.createTempFile("quarkus-test", ".bin"); - tempFile.deleteOnExit(); + public String sendFileAsBinary(@QueryParam("nullFile") @DefaultValue("false") boolean nullFile) throws IOException { + WithFileAsBinaryFile data = new WithFileAsBinaryFile(); - try (FileOutputStream fileOutputStream = new FileOutputStream(tempFile)) { - fileOutputStream.write(HELLO_WORLD.getBytes()); - } + if (!nullFile) { + File tempFile = File.createTempFile("quarkus-test", ".bin"); + tempFile.deleteOnExit(); - WithFileAsBinaryFile data = new WithFileAsBinaryFile(); - data.file = tempFile; + try (FileOutputStream fileOutputStream = new FileOutputStream(tempFile)) { + fileOutputStream.write(HELLO_WORLD.getBytes()); + } + + data.file = tempFile; + } data.fileName = GREETING_TXT; return client.sendFileAsBinaryFile(data); } @@ -118,16 +126,19 @@ public String sendFileAsBinary() throws IOException { @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) @Blocking - public String sendPathAsBinary() throws IOException { - File tempFile = File.createTempFile("quarkus-test", ".bin"); - tempFile.deleteOnExit(); + public String sendPathAsBinary(@QueryParam("nullFile") @DefaultValue("false") boolean nullFile) throws IOException { + WithPathAsBinaryFile data = new WithPathAsBinaryFile(); - try (FileOutputStream fileOutputStream = new FileOutputStream(tempFile)) { - fileOutputStream.write(HELLO_WORLD.getBytes()); - } + if (!nullFile) { + File tempFile = File.createTempFile("quarkus-test", ".bin"); + tempFile.deleteOnExit(); - WithPathAsBinaryFile data = new WithPathAsBinaryFile(); - data.file = tempFile.toPath(); + try (FileOutputStream fileOutputStream = new FileOutputStream(tempFile)) { + fileOutputStream.write(HELLO_WORLD.getBytes()); + } + + data.file = tempFile.toPath(); + } data.fileName = GREETING_TXT; return client.sendPathAsBinaryFile(data); } @@ -198,7 +209,8 @@ public String sendPathAsText() throws IOException { @Path("/echo/binary") @Consumes(MediaType.MULTIPART_FORM_DATA) public String consumeMultipart(@MultipartForm MultipartBodyWithBinaryFile body) { - return String.format("fileOk:%s,nameOk:%s", containsHelloWorld(body.file), GREETING_TXT.equals(body.fileName)); + return String.format("fileOk:%s,nameOk:%s", body.file == null ? "null" : containsHelloWorld(body.file), + GREETING_TXT.equals(body.fileName)); } @POST diff --git a/integration-tests/rest-client-reactive-multipart/src/test/java/io/quarkus/it/rest/client/multipart/MultipartResourceTest.java b/integration-tests/rest-client-reactive-multipart/src/test/java/io/quarkus/it/rest/client/multipart/MultipartResourceTest.java index 129166a254b..40dc80cd531 100644 --- a/integration-tests/rest-client-reactive-multipart/src/test/java/io/quarkus/it/rest/client/multipart/MultipartResourceTest.java +++ b/integration-tests/rest-client-reactive-multipart/src/test/java/io/quarkus/it/rest/client/multipart/MultipartResourceTest.java @@ -22,6 +22,19 @@ public void shouldSendByteArrayAsBinaryFile() { // @formatter:on } + @Test + public void shouldSendNullByteArrayAsBinaryFile() { + // @formatter:off + given() + .queryParam("nullFile", "true") + .header("Content-Type", "text/plain") + .when().get("/client/byte-array-as-binary-file") + .then() + .statusCode(200) + .body(equalTo("fileOk:null,nameOk:true")); + // @formatter:on + } + @Test public void shouldSendBufferAsBinaryFile() { // @formatter:off @@ -34,6 +47,19 @@ public void shouldSendBufferAsBinaryFile() { // @formatter:on } + @Test + public void shouldSendNullBufferAsBinaryFile() { + // @formatter:off + given() + .queryParam("nullFile", "true") + .header("Content-Type", "text/plain") + .when().get("/client/buffer-as-binary-file") + .then() + .statusCode(200) + .body(equalTo("fileOk:null,nameOk:true")); + // @formatter:on + } + @Test public void shouldSendFileAsBinaryFile() { // @formatter:off @@ -46,6 +72,19 @@ public void shouldSendFileAsBinaryFile() { // @formatter:on } + @Test + public void shouldSendNullFileAsBinaryFile() { + // @formatter:off + given() + .queryParam("nullFile", "true") + .header("Content-Type", "text/plain") + .when().get("/client/file-as-binary-file") + .then() + .statusCode(200) + .body(equalTo("fileOk:null,nameOk:true")); + // @formatter:on + } + @Test public void shouldSendPathAsBinaryFile() { // @formatter:off @@ -58,6 +97,19 @@ public void shouldSendPathAsBinaryFile() { // @formatter:on } + @Test + public void shouldSendNullPathAsBinaryFile() { + // @formatter:off + given() + .queryParam("nullFile", "true") + .header("Content-Type", "text/plain") + .when().get("/client/path-as-binary-file") + .then() + .statusCode(200) + .body(equalTo("fileOk:null,nameOk:true")); + // @formatter:on + } + @Test public void shouldSendByteArrayAsTextFile() { // @formatter:off
['integration-tests/rest-client-reactive-multipart/src/main/java/io/quarkus/it/rest/client/multipart/MultipartResource.java', 'extensions/resteasy-reactive/jaxrs-client-reactive/deployment/src/main/java/io/quarkus/jaxrs/client/reactive/deployment/JaxrsClientReactiveProcessor.java', 'extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java', 'integration-tests/rest-client-reactive-multipart/src/test/java/io/quarkus/it/rest/client/multipart/MultipartResourceTest.java']
{'.java': 4}
4
4
0
0
4
18,751,810
3,649,810
481,296
4,954
2,109
377
21
2
1,839
193
513
77
0
3
2021-10-07T18:49:42
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,624
quarkusio/quarkus/20588/20581
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20581
https://github.com/quarkusio/quarkus/pull/20588
https://github.com/quarkusio/quarkus/pull/20588
1
fixes
Wrong logging format being used in PersistenceUnitUtil
### Describe the bug In class `io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil` , line 69 we have: ``` LOG.warnf("A bean of type %1$s is being retrieved even though it doesn't have a @%2$s qualifier." + " This is deprecated usage and will not work in future versions of Quarkus." + " Annotate this bean with @%2$s(\\"%4$s\\") instead of @%3$s(\\"%4$s\\") to make it future-proof.", beanType.getName(), PersistenceUnitExtension.class.getSimpleName(), PersistenceUnit.class.getSimpleName()); ``` This actually throws a `java.util.MissingFormatArgumentException: Format specifier '%4$s'` @yrodiere I'll assign to you as it's trivial but I'm not 100% sure of what you meant :) Spotted reading build logs, should be triggered by test `io.quarkus.it.hibernate.multitenancy.inventory.HibernateNamedPersistenceUnitTest`.. would be interesting to know also why no tests fail.
3271bbd70f260299c1805378aed27f0ae25af646
041289067d06d5beeaf9906c761e092bebcc5cf1
https://github.com/quarkusio/quarkus/compare/3271bbd70f260299c1805378aed27f0ae25af646...041289067d06d5beeaf9906c761e092bebcc5cf1
diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/PersistenceUnitUtil.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/PersistenceUnitUtil.java index fe48a85363c..8c0d3306e47 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/PersistenceUnitUtil.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/PersistenceUnitUtil.java @@ -70,7 +70,7 @@ public static <T> InjectableInstance<T> legacySingleExtensionInstanceForPersiste + " This is deprecated usage and will not work in future versions of Quarkus." + " Annotate this bean with @%2$s(\\"%4$s\\") instead of @%3$s(\\"%4$s\\") to make it future-proof.", beanType.getName(), PersistenceUnitExtension.class.getSimpleName(), - PersistenceUnit.class.getSimpleName()); + PersistenceUnit.class.getSimpleName(), persistenceUnitName); } } }
['extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/PersistenceUnitUtil.java']
{'.java': 1}
1
1
0
0
1
18,733,793
3,646,464
480,796
4,949
158
16
2
1
1,003
108
215
18
0
1
2021-10-07T12:50:55
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,625
quarkusio/quarkus/20587/20567
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20567
https://github.com/quarkusio/quarkus/pull/20587
https://github.com/quarkusio/quarkus/pull/20587
1
resolves
Qute does not tell me which file has an error
### Describe the bug I'm porting some templates from a Play 1 app to Quarkus/Qute and I get the following exception: ``` 2021-10-06 16:10:49,740 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (vert.x-worker-thread-0) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.qute.deployment.QuteProcessor#analyzeTemplates threw an exception: java.lang.IllegalArgumentException: Not a virtual method: )(/ at io.quarkus.qute.Expressions.parseVirtualMethodParams(Expressions.java:39) at io.quarkus.qute.Parser.createPart(Parser.java:761) at io.quarkus.qute.Parser.parseExpression(Parser.java:743) at io.quarkus.qute.Parser.createPart(Parser.java:764) at io.quarkus.qute.Parser.parseExpression(Parser.java:743) at io.quarkus.qute.Parser.apply(Parser.java:817) at io.quarkus.qute.Parser.flushTag(Parser.java:486) at io.quarkus.qute.Parser.tag(Parser.java:293) at io.quarkus.qute.Parser.processCharacter(Parser.java:200) at io.quarkus.qute.Parser.parse(Parser.java:132) at io.quarkus.qute.EngineImpl.load(EngineImpl.java:138) ``` And it doesn't tell me which file it is, and I have dozens of them, so no idea where the error is :( Can we make sure we always display the error location? ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.3.0.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
3271bbd70f260299c1805378aed27f0ae25af646
fa096d1f3978e44b32f3a63c87007e6948ab2979
https://github.com/quarkusio/quarkus/compare/3271bbd70f260299c1805378aed27f0ae25af646...fa096d1f3978e44b32f3a63c87007e6948ab2979
diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/Expressions.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/Expressions.java index 8b4b17f7da7..c4b30c66064 100644 --- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/Expressions.java +++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/Expressions.java @@ -1,5 +1,6 @@ package io.quarkus.qute; +import io.quarkus.qute.TemplateNode.Origin; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -30,20 +31,20 @@ public static String parseVirtualMethodName(String value) { return value.substring(0, start); } - public static List<String> parseVirtualMethodParams(String value) { + public static List<String> parseVirtualMethodParams(String value, Origin origin, String exprValue) { int start = value.indexOf(LEFT_BRACKET); if (start != -1 && value.endsWith(RIGHT_BRACKET)) { String params = value.substring(start + 1, value.length() - 1); return splitParts(params, PARAMS_SPLIT_CONFIG); } - throw new IllegalArgumentException("Not a virtual method: " + value); + throw Parser.parserError("invalid virtual method in {" + exprValue + "}", origin); } - public static String parseBracketContent(String value) { + public static String parseBracketContent(String value, Origin origin, String exprValue) { if (value.endsWith(SQUARE_RIGHT_BRACKET)) { return value.substring(1, value.length() - 1); } - throw new IllegalArgumentException("Not a bracket notation expression: " + value); + throw Parser.parserError("invalid bracket notation expression in {" + exprValue + "}", origin); } public static String buildVirtualMethodSignature(String name, List<String> params) { diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java index 085a5b73e94..b03a0c8aac8 100644 --- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java +++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java @@ -492,7 +492,7 @@ private TemplateException parserError(String message) { return parserError(message, origin(0)); } - private static TemplateException parserError(String message, Origin origin) { + static TemplateException parserError(String message, Origin origin) { StringBuilder builder = new StringBuilder("Parser error"); if (!origin.getTemplateId().equals(origin.getTemplateGeneratedId())) { builder.append(" in template [").append(origin.getTemplateId()).append("]"); @@ -740,7 +740,7 @@ static ExpressionImpl parseExpression(Supplier<Integer> idGenerator, String valu Part first = null; Iterator<String> strPartsIterator = strParts.iterator(); while (strPartsIterator.hasNext()) { - Part part = createPart(idGenerator, namespace, first, strPartsIterator, scope, origin); + Part part = createPart(idGenerator, namespace, first, strPartsIterator, scope, origin, value); if (!isValidIdentifier(part.getName())) { throw parserError("invalid identifier found {" + value + "}", origin); } @@ -753,12 +753,11 @@ static ExpressionImpl parseExpression(Supplier<Integer> idGenerator, String valu } private static Part createPart(Supplier<Integer> idGenerator, String namespace, Part first, - Iterator<String> strPartsIterator, Scope scope, - Origin origin) { + Iterator<String> strPartsIterator, Scope scope, Origin origin, String exprValue) { String value = strPartsIterator.next(); if (Expressions.isVirtualMethod(value)) { String name = Expressions.parseVirtualMethodName(value); - List<String> strParams = new ArrayList<>(Expressions.parseVirtualMethodParams(value)); + List<String> strParams = new ArrayList<>(Expressions.parseVirtualMethodParams(value, origin, exprValue)); List<Expression> params = new ArrayList<>(strParams.size()); for (String strParam : strParams) { params.add(parseExpression(idGenerator, strParam.trim(), scope, origin)); @@ -769,7 +768,7 @@ private static Part createPart(Supplier<Integer> idGenerator, String namespace, } // Try to parse the literal for bracket notation if (Expressions.isBracketNotation(value)) { - value = Expressions.parseBracketContent(value); + value = Expressions.parseBracketContent(value, origin, exprValue); Object literal = LiteralSupport.getLiteralValue(value); if (literal != null && !Results.isNotFound(literal)) { value = literal.toString(); diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java index 4e2361c6963..6a978dca6ac 100644 --- a/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java +++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java @@ -355,6 +355,18 @@ public void testInvalidNamespaceExpression() { "Parser error on line 1: empty expression found {data:}", 1); } + @Test + public void testInvalidVirtualMethod() { + assertParserError("{foo.baz()(}", + "Parser error on line 1: invalid virtual method in {foo.baz()(}", 1); + } + + @Test + public void testInvalidBracket() { + assertParserError("{foo.baz[}", + "Parser error on line 1: invalid bracket notation expression in {foo.baz[}", 1); + } + public static class Foo { public List<Item> getItems() {
['independent-projects/qute/core/src/main/java/io/quarkus/qute/Expressions.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java', 'independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java']
{'.java': 3}
3
3
0
0
3
18,733,793
3,646,464
480,796
4,949
1,661
314
20
2
1,758
175
452
59
0
1
2021-10-07T12:42:22
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,626
quarkusio/quarkus/20582/20566
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20566
https://github.com/quarkusio/quarkus/pull/20582
https://github.com/quarkusio/quarkus/pull/20582
1
resolves
Generic Syntetic Bean cause ambigious type resolution when none exists
### Describe the bug When a Synthetic bean for a generic type is created like this: ``` SyntheticBeanBuildItem addMyGenericInterface() { DotName interfaceName = DotName.createSimple(MyGenericInterface.class.getName()); DotName numberTypeName = DotName.createSimple(AtomicInteger.class.getName()); DotName stringTypeName = DotName.createSimple(String.class.getName()); return SyntheticBeanBuildItem.configure(interfaceName) .creator(methodCreator -> { FunctionCreator functionCreator = methodCreator.createFunction(MyGenericInterface.class); BytecodeCreator functionBytecode = functionCreator.getBytecode(); functionBytecode.returnValue(functionBytecode.loadNull()); methodCreator.returnValue(functionCreator.getInstance()); }) .types(ParameterizedType.create(interfaceName, new Type[]{ Type.create(numberTypeName, Type.Kind.CLASS), Type.create(stringTypeName, Type.Kind.CLASS) }, null)) .done(); } ``` an "ambigious type resolution" occurs within ArC, with the same synthetic bean showing up twice. Thus, it is impossible to inject generic Syntetic beans, since with the types argument, it cause ambiguity, and without it, it cannot find an instance. ### Expected behavior ``` @Inject MyGenericInterface<AtomicInteger, String> myGenericInterface; ``` causes `myGenericInterface` to be injected with the synthetic bean ### Actual behavior ``` java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type org.acme.my.ext.MyGenericInterface<java.util.concurrent.atomic.AtomicInteger, java.lang.String> and qualifiers [@Default] - java member: org.acme.my.ext.test.MyExtTest#myGenericInterface - declared on CLASS bean [types=[org.acme.my.ext.test.MyExtTest, java.lang.Object], qualifiers=[@Default, @Any], target=org.acme.my.ext.test.MyExtTest] - available beans: - SYNTHETIC bean [types=[org.acme.my.ext.MyGenericInterface, org.acme.my.ext.MyGenericInterface<java.util.concurrent.atomic.AtomicInteger, java.lang.String>], qualifiers=[@Default, @Any], target=n/a] - SYNTHETIC bean [types=[org.acme.my.ext.MyGenericInterface, org.acme.my.ext.MyGenericInterface<java.util.concurrent.atomic.AtomicInteger, java.lang.String>], qualifiers=[@Default, @Any], target=n/a] at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1190) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:268) at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:129) at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:418) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:829) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Caused by: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type org.acme.my.ext.MyGenericInterface<java.util.concurrent.atomic.AtomicInteger, java.lang.String> and qualifiers [@Default] - java member: org.acme.my.ext.test.MyExtTest#myGenericInterface - declared on CLASS bean [types=[org.acme.my.ext.test.MyExtTest, java.lang.Object], qualifiers=[@Default, @Any], target=org.acme.my.ext.test.MyExtTest] - available beans: - SYNTHETIC bean [types=[org.acme.my.ext.MyGenericInterface, org.acme.my.ext.MyGenericInterface<java.util.concurrent.atomic.AtomicInteger, java.lang.String>], qualifiers=[@Default, @Any], target=n/a] - SYNTHETIC bean [types=[org.acme.my.ext.MyGenericInterface, org.acme.my.ext.MyGenericInterface<java.util.concurrent.atomic.AtomicInteger, java.lang.String>], qualifiers=[@Default, @Any], target=n/a] at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:576) at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:470) at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:256) ... 13 more ``` ### How to Reproduce? Reproducer: https://github.com/Christopher-Chianelli/issue-reproducer/tree/quarkus-extension-syntetic-bean Steps to reproduce: 1. cd `my-ext` 2. `mvn clean install` 3. Notice `MyExtTest` writeYourOwnUnitTest fails because myGenericInterface cannot be injected because ambiguous resolution (despite `addMyGenericInterface` only returing 1 instance of it) ### Output of `uname -a` or `ver` Linux 5.14.9-200.fc34.x86_64 ### Output of `java -version` openjdk 11.0.12 2021-07-20 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev fffe31b91b05774bbaa4456f0a57d40132b2fd2a ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) ### Additional information _No response_
3271bbd70f260299c1805378aed27f0ae25af646
3ef4e5d9a9e5d57f85964e2cebd20e5faa9860fe
https://github.com/quarkusio/quarkus/compare/3271bbd70f260299c1805378aed27f0ae25af646...3ef4e5d9a9e5d57f85964e2cebd20e5faa9860fe
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java index 1deca533a82..4f9ccde761d 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java @@ -291,28 +291,28 @@ void init(Consumer<BytecodeTransformer> bytecodeTransformerConsumer, private void initBeanByTypeMap() { Map<DotName, List<BeanInfo>> map = new HashMap<>(); for (BeanInfo bean : beans) { - for (Type beanType : bean.types) { - if (DotNames.OBJECT.equals(beanType.name())) { + bean.types.stream().map(Type::name).distinct().forEach(rawTypeName -> { + if (DotNames.OBJECT.equals(rawTypeName)) { // Every bean has java.lang.Object - no need to cache results here - continue; + return; } - List<BeanInfo> beans = map.get(beanType.name()); + List<BeanInfo> beans = map.get(rawTypeName); if (beans == null) { // Very often, there will be exactly one bean for a given type - map.put(beanType.name(), List.of(bean)); + map.put(rawTypeName, List.of(bean)); } else { if (beans.size() == 1) { - map.put(beanType.name(), List.of(beans.get(0), bean)); + map.put(rawTypeName, List.of(beans.get(0), bean)); } else { BeanInfo[] array = new BeanInfo[beans.size() + 1]; for (int i = 0; i < beans.size(); i++) { array[i] = beans.get(i); } array[beans.size()] = bean; - map.put(beanType.name(), List.of(array)); + map.put(rawTypeName, List.of(array)); } } - } + }); } this.beansByType = map; } diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/buildextension/beans/BeanRegistrarTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/buildextension/beans/BeanRegistrarTest.java index dec25178504..06a86fe616e 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/buildextension/beans/BeanRegistrarTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/buildextension/beans/BeanRegistrarTest.java @@ -20,15 +20,19 @@ import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.Target; +import java.util.List; import java.util.Map; import java.util.Optional; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.spi.CreationalContext; import javax.enterprise.util.AnnotationLiteral; +import javax.inject.Inject; import javax.inject.Qualifier; import javax.inject.Singleton; import org.jboss.jandex.DotName; +import org.jboss.jandex.ParameterizedType; import org.jboss.jandex.Type; +import org.jboss.jandex.Type.Kind; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -40,8 +44,9 @@ public class BeanRegistrarTest { @RegisterExtension public ArcTestContainer container = ArcTestContainer.builder() - .beanClasses(UselessBean.class, MyQualifier.class, NextQualifier.class) + .beanClasses(UselessBean.class, MyQualifier.class, NextQualifier.class, ListConsumer.class) .removeUnusedBeans(true) + .addRemovalExclusion(b -> b.hasType(DotName.createSimple(ListConsumer.class.getName()))) .beanRegistrars(new TestRegistrar()).build(); @AfterAll @@ -74,6 +79,18 @@ public void testSyntheticBean() { assertEquals(Integer.valueOf(152), Arc.container().instance(Integer.class).get()); assertEquals("Hello Frantisek!", Arc.container().instance(String.class).get()); assertEquals("Hello Roman!", Arc.container().instance(String.class, new NextQualifierLiteral()).get()); + @SuppressWarnings({ "resource" }) + List<String> list = Arc.container().instance(ListConsumer.class).get().list; + assertEquals(1, list.size()); + assertEquals("foo", list.get(0)); + } + + @Singleton + static class ListConsumer { + + @Inject + List<String> list; + } static class TestRegistrar implements BeanRegistrar { @@ -102,13 +119,28 @@ public void register(RegistrationContext context) { integerConfigurator.scope(Singleton.class); integerConfigurator.done(); - context.configure(String.class).unremovable().types(String.class).param("name", "Frantisek") - .creator(StringCreator.class).done(); + context.configure(String.class) + .unremovable() + .types(String.class) + .param("name", "Frantisek") + .creator(StringCreator.class) + .done(); context.configure(String.class).types(String.class).param("name", "Roman") - .creator(StringCreator.class).addQualifier().annotation(NextQualifier.class).addValue("name", "Roman") - .addValue("age", 42) - .addValue("classes", new Class[] { String.class }).done().unremovable().done(); + .creator(StringCreator.class) + .addQualifier().annotation(NextQualifier.class).addValue("name", "Roman").addValue("age", 42) + .addValue("classes", new Class[] { String.class }).done() + .unremovable() + .done(); + + context.configure(List.class) + // List, List<String> + .addType(Type.create(DotName.createSimple(List.class.getName()), Kind.CLASS)) + .addType(ParameterizedType.create(DotName.createSimple(List.class.getName()), + new Type[] { Type.create(DotName.createSimple(String.class.getName()), Kind.CLASS) }, null)) + .creator(ListCreator.class) + .unremovable() + .done(); uselessBean = context.beans() .assignableTo( @@ -129,6 +161,15 @@ public String create(CreationalContext<String> creationalContext, Map<String, Ob } + public static class ListCreator implements BeanCreator<List<String>> { + + @Override + public List<String> create(CreationalContext<List<String>> creationalContext, Map<String, Object> params) { + return List.of("foo"); + } + + } + public static class SimpleDestroyer implements BeanDestroyer<Integer> { @Override
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/buildextension/beans/BeanRegistrarTest.java']
{'.java': 2}
2
2
0
0
2
18,733,793
3,646,464
480,796
4,949
882
165
16
1
6,008
363
1,365
108
1
3
2021-10-07T09:55:39
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,628
quarkusio/quarkus/20557/20543
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20543
https://github.com/quarkusio/quarkus/pull/20557
https://github.com/quarkusio/quarkus/pull/20557
1
fixes
Problem wiring up a SSE endpoint with an internal channel with the reactive messaging HTTP connector
### Describe the bug I am using Quarkus 2.2.3 and OpenJDK 11. The SSE endpoint and incoming channel looks like: ``` @Path("/hello") public class ExampleResource { @Inject @Channel("sse-output") Multi<String> data; @GET @Produces(MediaType.SERVER_SENT_EVENTS) @RestSseElementType(MediaType.TEXT_PLAIN) public Multi<String> streamData() { return this.data; } } ``` The producer is described below: ``` @ApplicationScoped public class Producer { @Incoming("event") @Outgoing("sse-output") public String broadcast(final String time) { System.out.println("received event"); return time.toUpperCase(); } } ``` The incoming "event" channel is defined in the application.resource file as: mp.messaging.incoming.event.connector=quarkus-http mp.messaging.incoming.event.path=/event mp.messaging.incoming.event.method=POST Dependencies in pom.xml ``` <dependencies> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-arc</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-resteasy-reactive</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-junit5</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>io.rest-assured</groupId> <artifactId>rest-assured</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-reactive-messaging-http</artifactId> </dependency> </dependencies> ``` When I try to send a message using a HTTP POST, it throughs the following error: ``` 2021-10-05 12:00:37,885 ERROR [io.qua.rea.htt.run.ReactiveHttpHandlerBean] (vert.x-eventloop-thread-2) Emitting message failed: java.lang.NullPointerException at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandlerBean.handleRequest(ReactiveHttpHandlerBean.java:61) at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandlerBean_Subclass.handleRequest$$superforward1(ReactiveHttpHandlerBean_Subclass.zig:549) at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandlerBean_Subclass$$function$$9.apply(ReactiveHttpHandlerBean_Subclass$$function$$9.zig:47) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521) at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41) at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41) at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32) at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandlerBean_Subclass.handleRequest(ReactiveHttpHandlerBean_Subclass.zig:1413) at io.quarkus.reactivemessaging.http.runtime.ReactiveHandlerBeanBase.handle(ReactiveHandlerBeanBase.java:29) at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandlerBean_Subclass.handle$$superforward1(ReactiveHttpHandlerBean_Subclass.zig:530) at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandlerBean_Subclass$$function$$8.apply(ReactiveHttpHandlerBean_Subclass$$function$$8.zig:33) at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51) at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521) at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41) at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41) at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32) at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandlerBean_Subclass.handle(ReactiveHttpHandlerBean_Subclass.zig:1310) at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandler.handle(ReactiveHttpHandler.java:16) at io.quarkus.reactivemessaging.http.runtime.ReactiveHttpHandler.handle(ReactiveHttpHandler.java:6) at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127) at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151) at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133) at io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.doEnd(BodyHandlerImpl.java:313) at io.vertx.ext.web.handler.impl.BodyHandlerImpl$BHandler.end(BodyHandlerImpl.java:290) at io.vertx.ext.web.handler.impl.BodyHandlerImpl.lambda$handle$0(BodyHandlerImpl.java:86) at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100) at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:63) at io.vertx.core.http.impl.HttpEventHandler.handleEnd(HttpEventHandler.java:76) at io.vertx.core.http.impl.Http1xServerRequest.onEnd(Http1xServerRequest.java:557) at io.vertx.core.http.impl.Http1xServerRequest.lambda$pendingQueue$1(Http1xServerRequest.java:125) at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:240) at io.vertx.core.streams.impl.InboundBuffer.drain(InboundBuffer.java:227) at io.vertx.core.streams.impl.InboundBuffer.lambda$fetch$0(InboundBuffer.java:280) at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100) at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:63) at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:38) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:497) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:834) ``` The HTTP POST channel "event" works alone perfectly, however when I try to pass the event to the "see-out" channel I got the error above. thank you if you can have a look at it.
c55782fb9209ac5be952c73fd52c127ca6085ab5
e29bcdea2422cce658a138b95268ea3e5f49069f
https://github.com/quarkusio/quarkus/compare/c55782fb9209ac5be952c73fd52c127ca6085ab5...e29bcdea2422cce658a138b95268ea3e5f49069f
diff --git a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHandlerBeanBase.java b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHandlerBeanBase.java index 5a427728e8e..7b7fea04056 100644 --- a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHandlerBeanBase.java +++ b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHandlerBeanBase.java @@ -26,7 +26,7 @@ void handle(RoutingContext event) { if (bundle != null) { MultiEmitter<? super MessageType> emitter = bundle.emitter; StrictQueueSizeGuard guard = bundle.guard; - handleRequest(event, emitter, guard); + handleRequest(event, emitter, guard, bundle.path); } else { event.response().setStatusCode(404).end(); } @@ -41,6 +41,7 @@ private void addProcessor(ConfigType streamConfig) { .<MessageType> emitter(bundle::setEmitter, BackPressureStrategy.BUFFER) .onItem().invoke(guard::dequeue); bundle.setProcessor(processor); + bundle.setPath(streamConfig.path); Bundle<MessageType> previousProcessor = processors.put(key(streamConfig), bundle); if (previousProcessor != null) { @@ -49,7 +50,7 @@ private void addProcessor(ConfigType streamConfig) { } protected abstract void handleRequest(RoutingContext event, MultiEmitter<? super MessageType> emitter, - StrictQueueSizeGuard guard); + StrictQueueSizeGuard guard, String path); protected abstract String description(ConfigType streamConfig); @@ -63,6 +64,7 @@ protected abstract void handleRequest(RoutingContext event, MultiEmitter<? super private final StrictQueueSizeGuard guard; private Multi<MessageType> processor; // effectively final private MultiEmitter<? super MessageType> emitter; // effectively final + private String path; private Bundle(StrictQueueSizeGuard guard) { this.guard = guard; @@ -79,5 +81,9 @@ public void setEmitter(MultiEmitter<? super MessageType> emitter) { public Multi<MessageType> getProcessor() { return processor; } + + public void setPath(String path) { + this.path = path; + } } } diff --git a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHttpHandlerBean.java b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHttpHandlerBean.java index f6200f8b088..7641e4add5e 100644 --- a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHttpHandlerBean.java +++ b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHttpHandlerBean.java @@ -42,7 +42,7 @@ protected String key(HttpStreamConfig streamConfig) { @Override protected String key(RoutingContext context) { - return key(context.normalisedPath(), context.request().method()); + return key(context.normalizedPath(), context.request().method()); } @Override @@ -52,8 +52,11 @@ protected String description(HttpStreamConfig streamConfig) { @Override protected void handleRequest(RoutingContext event, MultiEmitter<? super HttpMessage<?>> emitter, - StrictQueueSizeGuard guard) { - if (guard.prepareToEmit()) { + StrictQueueSizeGuard guard, String path) { + if (emitter == null) { + onUnexpectedError(event, null, + "No consumer subscribed for messages sent to Reactive Messaging HTTP endpoint on path: " + path); + } else if (guard.prepareToEmit()) { try { HttpMessage<Buffer> message = new HttpMessage<>(event.getBody(), new IncomingHttpMetadata(event.request()), () -> event.response().setStatusCode(202).end(), diff --git a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveWebSocketHandlerBean.java b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveWebSocketHandlerBean.java index cb3b1983d82..86fdf27f3d8 100644 --- a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveWebSocketHandlerBean.java +++ b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveWebSocketHandlerBean.java @@ -28,7 +28,7 @@ public class ReactiveWebSocketHandlerBean extends ReactiveHandlerBeanBase<WebSoc @Override protected void handleRequest(RoutingContext event, MultiEmitter<? super WebSocketMessage<?>> emitter, - StrictQueueSizeGuard guard) { + StrictQueueSizeGuard guard, String path) { event.request().toWebSocket( webSocket -> { if (webSocket.failed()) { @@ -37,7 +37,11 @@ protected void handleRequest(RoutingContext event, MultiEmitter<? super WebSocke ServerWebSocket serverWebSocket = webSocket.result(); serverWebSocket.handler( b -> { - if (guard.prepareToEmit()) { + if (emitter == null) { + onUnexpectedError(serverWebSocket, null, + "No consumer subscribed for messages sent to " + + "Reactive Messaging WebSocket endpoint on path: " + path); + } else if (guard.prepareToEmit()) { try { emitter.emit(new WebSocketMessage<>(b, () -> serverWebSocket.write(Buffer.buffer("ACK")), @@ -67,7 +71,7 @@ protected String key(WebSocketStreamConfig config) { @Override protected String key(RoutingContext context) { - return context.normalisedPath(); + return context.normalizedPath(); } @Override @@ -78,7 +82,7 @@ protected Collection<WebSocketStreamConfig> configs() { private void onUnexpectedError(ServerWebSocket serverWebSocket, Throwable error, String message) { log.error(message, error); // TODO some error message for the client? exception mapper would be best... - serverWebSocket.close((short) 3500, message); + serverWebSocket.close((short) 3500, "Unexpected error while processing the message"); } Multi<WebSocketMessage<?>> getProcessor(String path) { diff --git a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/HttpStreamConfig.java b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/HttpStreamConfig.java index 127302d4102..b500b21a227 100644 --- a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/HttpStreamConfig.java +++ b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/HttpStreamConfig.java @@ -6,11 +6,9 @@ public class HttpStreamConfig extends StreamConfigBase { public final HttpMethod method; - public final String path; public HttpStreamConfig(String path, String method, String name, int bufferSize) { - super(bufferSize); - this.path = path; + super(bufferSize, path); this.method = toHttpMethod(method, name); } diff --git a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/StreamConfigBase.java b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/StreamConfigBase.java index caed4a514a8..0174103016a 100644 --- a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/StreamConfigBase.java +++ b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/StreamConfigBase.java @@ -2,8 +2,10 @@ public class StreamConfigBase { public final int bufferSize; + public final String path; - public StreamConfigBase(int bufferSize) { + public StreamConfigBase(int bufferSize, String path) { + this.path = path; this.bufferSize = bufferSize; } } diff --git a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/WebSocketStreamConfig.java b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/WebSocketStreamConfig.java index c2ff5316ae0..5d1eea4357b 100644 --- a/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/WebSocketStreamConfig.java +++ b/extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/WebSocketStreamConfig.java @@ -1,11 +1,8 @@ package io.quarkus.reactivemessaging.http.runtime.config; public class WebSocketStreamConfig extends StreamConfigBase { - public final String path; - public WebSocketStreamConfig(String path, int bufferSize) { - super(bufferSize); - this.path = path; + super(bufferSize, path); } public String path() { diff --git a/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java b/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java index b41ee0ec82a..9ef6e41090a 100644 --- a/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java +++ b/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java @@ -318,7 +318,7 @@ private static RestClientsConfig getConfigRoot() { InstanceHandle<RestClientsConfig> configHandle = Arc.container() .instance(RestClientsConfig.class); if (!configHandle.isAvailable()) { - throw new IllegalStateException("Unable to find the RestClientConfigRootProvider"); + throw new IllegalStateException("Unable to find the RestClientConfigs"); } return configHandle.get(); }
['extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java', 'extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHandlerBeanBase.java', 'extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/StreamConfigBase.java', 'extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveWebSocketHandlerBean.java', 'extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/ReactiveHttpHandlerBean.java', 'extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/WebSocketStreamConfig.java', 'extensions/reactive-messaging-http/runtime/src/main/java/io/quarkus/reactivemessaging/http/runtime/config/HttpStreamConfig.java']
{'.java': 7}
7
7
0
0
7
18,725,255
3,644,772
480,534
4,945
2,312
407
46
7
6,670
269
1,583
130
0
4
2021-10-06T11:06:56
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,629
quarkusio/quarkus/20547/20458
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20458
https://github.com/quarkusio/quarkus/pull/20547
https://github.com/quarkusio/quarkus/pull/20547
1
fixes
Exceptions ignored when writing repsonse with VertxBlockingOutput.java
### Describe the bug I am using StreamingOutput to send large response body to the client. If the client closes the connection while the server is writing the server will not get any exception and the data written by the server will vanish into the aether. - This happens in all versions after Quarkus 2.0.0. - This does not happen for HTTP/2. - This hapens when using the blocking call. I believe that I have tracked this down to the io.quarkus.resteasy.runtime.standalone.VertxBlockingOutput.java:82 (`request.response().write(createBuffer(data));`) The whole method is: ``` @Override public void write(ByteBuf data, boolean last) throws IOException { if (last && data == null) { request.response().end(); return; } try { //do all this in the same lock synchronized (request.connection()) { try { awaitWriteable(); if (last) { request.response().end(createBuffer(data)); } else { request.response().write(createBuffer(data)); } } catch (Exception e) { if (data != null && data.refCnt() > 0) { data.release(); } throw new IOException("Failed to write", e); } } } finally { if (last) { terminateResponse(); } } } ``` To me it looks like after the Vert.x 4 update the exception handling is missing. After the update to 4 the `request.response().write` does not throw an exception but returns a Vertx future that needs to be checked for success/failure/throwable. ### Expected behavior When the client closes the connection while the server is writing the response we should get: `new IOException("Failed to write", e)` ### Actual behavior When the client closes the connection while the server is writing the response we get no exception and the server just continues to write its output to the aether. ### How to Reproduce? I don't have a code example but: 1. Setup up server that returns large output as StreamingOutput (maybe infinite output). 2. Connect with the client using HTTP/1.1 and call the method. 3. Kill the client. 4. Notice the server method will just continue to write to the StreamingOutput without getting the expected error. ### Output of `uname -a` or `ver` Darwin RKV-MBP-Gisli.local 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64 ### Output of `java -version` openjdk version "11.0.10" 2021-01-19 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2.3.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
657ae2965955ba1bd015d2049e4830dc223c1b36
b9229a365040f7cd0009e8cfbf213de1a90abdd8
https://github.com/quarkusio/quarkus/compare/657ae2965955ba1bd015d2049e4830dc223c1b36...b9229a365040f7cd0009e8cfbf213de1a90abdd8
diff --git a/extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java b/extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java index 998817a1ccb..b8801e241e0 100644 --- a/extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java +++ b/extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java @@ -69,8 +69,15 @@ Buffer createBuffer(ByteBuf data) { public void write(ByteBuf data, boolean last) throws IOException { if (last && data == null) { request.response().end(); + //if there is a problem we still try and end, but then throw to report to the caller + if (throwable != null) { + throw new IOException(throwable); + } return; } + if (throwable != null) { + throw new IOException(throwable); + } try { //do all this in the same lock synchronized (request.connection()) {
['extensions/resteasy-classic/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java']
{'.java': 1}
1
1
0
0
1
18,716,190
3,642,909
480,339
4,944
293
60
7
1
2,995
383
662
87
0
1
2021-10-06T05:17:46
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,630
quarkusio/quarkus/20546/20538
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20538
https://github.com/quarkusio/quarkus/pull/20546
https://github.com/quarkusio/quarkus/pull/20546
1
fixes
[quarkus-quartz] `cron` expression of `@Scheduled` is not updated via ENV (overwriting application.properties)
### Describe the bug Given * `@Scheduled(identity = "aJob", cron = "{a.job.schedule.cron}")` in code * `a.job.schedule.cron=0 0 1 * * ? *` in application.properties and * `A_JOB_SCHEDULE_CRON=0 0 1 * * ? 2100` in ENV if the application has been started prior without the ENV part, restarting the application with ENV doesn't update the field `cron_expression` in the table `qrtz_cron_triggers`. if the application has not been started prior without the ENV part, starting it the first time with ENV leads to `cron_expression` being filled with the cron expression from ENV, not from application.properties (as expected). ### Expected behavior Field `cron_expression` in the table `qrtz_cron_triggers` is updated. Alternatively, this behaviour is documented on the https://quarkus.io/guides/quartz and there is a way to overwrite existing cron expressions using ENV. ### Actual behavior Field `cron_expression` in the table `qrtz_cron_triggers` is not updated. ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` Microsoft Windows [Version 10.0.18363.1766] ### Output of `java -version` 11.0.10 ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 2.2.1.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Apache Maven 3.8.1 ### Additional information _No response_
bdce87ffc26bf6d82055d813e76775c067c54646
6d67f8664cabf0a12788b9ddf44c9b617c724388
https://github.com/quarkusio/quarkus/compare/bdce87ffc26bf6d82055d813e76775c067c54646...6d67f8664cabf0a12788b9ddf44c9b617c724388
diff --git a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java index d3d49675bab..d3939ebe628 100644 --- a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java +++ b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java @@ -195,10 +195,15 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Sc } JobDetail job = jobBuilder.build(); + org.quartz.Trigger trigger = triggerBuilder.build(); if (!scheduler.checkExists(job.getKey())) { - scheduler.scheduleJob(job, triggerBuilder.build()); + scheduler.scheduleJob(job, trigger); LOGGER.debugf("Scheduled business method %s with config %s", method.getMethodDescription(), scheduled); + } else { + scheduler.rescheduleJob(trigger.getKey(), trigger); + LOGGER.debugf("Rescheduled business method %s with config %s", method.getMethodDescription(), + scheduled); } } }
['extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java']
{'.java': 1}
1
1
0
0
1
18,703,912
3,639,769
479,630
4,935
511
67
7
1
1,375
196
355
48
1
0
2021-10-05T18:49:30
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,631
quarkusio/quarkus/20525/20522
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20522
https://github.com/quarkusio/quarkus/pull/20525
https://github.com/quarkusio/quarkus/pull/20525
1
resolves
Quakrus CLI: --help command for 'create' is not working
### Describe the bug Quakrus CLI for 999-SNAPSHOT fails with: _Creating an app (default project type, see --help). [ERROR] ❗ Unable to create project: Unknown option: '--help'_ when running: java -jar $home/quarkus-main/devtools/cli/target/quarkus-cli-999-SNAPSHOT-runner.jar registry --help ### Expected behavior Help for "create" command should appear ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` _No response_ ### Output of `java -version` _No response_ ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev 999-SNAPSHOT ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
597f550208763046e13976984fccaab3befd7c39
4d706e6429fc69781dd836f8bcca1cacb0d205e9
https://github.com/quarkusio/quarkus/compare/597f550208763046e13976984fccaab3befd7c39...4d706e6429fc69781dd836f8bcca1cacb0d205e9
diff --git a/devtools/cli/src/main/java/io/quarkus/cli/Create.java b/devtools/cli/src/main/java/io/quarkus/cli/Create.java index 6b9e608ec9d..a8672a83530 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/Create.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/Create.java @@ -3,6 +3,7 @@ import java.util.List; import java.util.concurrent.Callable; +import io.quarkus.cli.common.HelpOption; import io.quarkus.cli.common.OutputOptionMixin; import picocli.CommandLine; import picocli.CommandLine.ParseResult; @@ -17,6 +18,9 @@ public class Create implements Callable<Integer> { @CommandLine.Mixin protected OutputOptionMixin output; + @CommandLine.Mixin + protected HelpOption helpOption; + @CommandLine.Spec protected CommandLine.Model.CommandSpec spec; diff --git a/devtools/cli/src/main/java/io/quarkus/cli/Registry.java b/devtools/cli/src/main/java/io/quarkus/cli/Registry.java index 9b2fb38fb3b..b0f8e2bacae 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/Registry.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/Registry.java @@ -3,6 +3,7 @@ import java.util.List; import java.util.concurrent.Callable; +import io.quarkus.cli.common.HelpOption; import io.quarkus.cli.common.OutputOptionMixin; import picocli.CommandLine; import picocli.CommandLine.ParseResult; @@ -17,6 +18,9 @@ public class Registry implements Callable<Integer> { @CommandLine.Mixin protected OutputOptionMixin output; + @CommandLine.Mixin + protected HelpOption helpOption; + @CommandLine.Spec protected CommandLine.Model.CommandSpec spec; diff --git a/devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java b/devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java index 7a398062a66..ed1510b4cb5 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java @@ -7,6 +7,7 @@ import java.util.TreeMap; import java.util.concurrent.Callable; +import io.quarkus.cli.common.HelpOption; import io.quarkus.cli.common.OutputOptionMixin; import io.quarkus.cli.common.RunModeOption; import io.quarkus.cli.common.TargetQuarkusVersionGroup; @@ -34,6 +35,9 @@ public class BaseCreateCommand implements Callable<Integer> { @Mixin ToggleRegistryClientMixin registryClient; + @CommandLine.Mixin + protected HelpOption helpOption; + @Spec protected CommandSpec spec; diff --git a/devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java b/devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java index 7078e12881a..1a740fb5da4 100644 --- a/devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java +++ b/devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java @@ -2,6 +2,7 @@ import java.util.concurrent.Callable; +import io.quarkus.cli.common.HelpOption; import io.quarkus.cli.common.OutputOptionMixin; import picocli.CommandLine; import picocli.CommandLine.Mixin; @@ -16,6 +17,9 @@ public class BaseRegistryCommand implements Callable<Integer> { @Mixin protected RegistryClientMixin registryClient; + @CommandLine.Mixin + protected HelpOption helpOption; + @Spec protected CommandSpec spec; diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java index 59552333a2f..d41e6923e20 100644 --- a/devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java +++ b/devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java @@ -24,6 +24,7 @@ public class CliHelpTest { public void testCommandHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); CliDriver.Result result2 = CliDriver.execute(workspaceRoot); Assertions.assertEquals(result.stdout, result2.stdout, "Invoking the base command should show usage help"); @@ -31,52 +32,59 @@ public void testCommandHelp() throws Exception { } @Test - @Order(20) + @Order(10) public void testCreateHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test - @Order(21) + @Order(11) public void testCreateAppHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "app", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test - @Order(22) + @Order(12) public void testCreateCliHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "cli", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test - @Order(23) + @Order(13) public void testCreateExtensionHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "extension", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test - @Order(30) + @Order(20) public void testBuildHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "build", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test - @Order(40) + @Order(30) public void testDevHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "dev", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test - @Order(50) + @Order(40) public void testExtHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); CliDriver.Result result2 = CliDriver.execute(workspaceRoot, "extension", "--help"); Assertions.assertEquals(result.stdout, result2.stdout, "Help output for command aliases should be the same."); @@ -84,10 +92,11 @@ public void testExtHelp() throws Exception { } @Test - @Order(51) + @Order(41) public void testExtCatHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "cat", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); CliDriver.Result result2 = CliDriver.execute(workspaceRoot, "ext", "cat", "--help"); Assertions.assertEquals(result.stdout, result2.stdout, "Help output for command aliases should be the same."); @@ -95,10 +104,11 @@ public void testExtCatHelp() throws Exception { } @Test - @Order(52) + @Order(42) public void testExtListHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "ls", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); CliDriver.Result result2 = CliDriver.execute(workspaceRoot, "ext", "list", "--help"); Assertions.assertEquals(result.stdout, result2.stdout, "Help output for command aliases should be the same."); @@ -106,28 +116,63 @@ public void testExtListHelp() throws Exception { } @Test - @Order(53) + @Order(43) public void testExtAddHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "add", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test - @Order(53) + @Order(44) public void testExtRemoveHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "ext", "rm", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); CliDriver.Result result2 = CliDriver.execute(workspaceRoot, "ext", "remove", "--help"); Assertions.assertEquals(result.stdout, result2.stdout, "Help output for command aliases should be the same."); CliDriver.println("-- same as above\\n\\n"); } + @Test + @Order(50) + public void testRegistryHelp() throws Exception { + CliDriver.Result result = CliDriver.execute(workspaceRoot, "registry", "--help"); + result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); + } + + @Test + @Order(51) + public void testRegistryListHelp() throws Exception { + CliDriver.Result result = CliDriver.execute(workspaceRoot, "registry", "list", "--help"); + result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); + } + + @Test + @Order(51) + public void testRegistryAddHelp() throws Exception { + CliDriver.Result result = CliDriver.execute(workspaceRoot, "registry", "add", "--help"); + result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); + } + + @Test + @Order(52) + public void testRegistryRemoveHelp() throws Exception { + CliDriver.Result result = CliDriver.execute(workspaceRoot, "registry", "rm", "--help"); + result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); + } + @Order(60) @Test public void testGenerateCompletionHelp() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "completion", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test @@ -135,6 +180,7 @@ public void testGenerateCompletionHelp() throws Exception { public void testCommandVersion() throws Exception { CliDriver.Result result = CliDriver.execute(workspaceRoot, "version", "--help"); result.echoSystemOut(); + Assertions.assertTrue(result.stdout.contains("Usage"), "Help output should show usage instructions"); } @Test
['devtools/cli/src/main/java/io/quarkus/cli/Registry.java', 'devtools/cli/src/test/java/io/quarkus/cli/CliHelpTest.java', 'devtools/cli/src/main/java/io/quarkus/cli/create/BaseCreateCommand.java', 'devtools/cli/src/main/java/io/quarkus/cli/Create.java', 'devtools/cli/src/main/java/io/quarkus/cli/registry/BaseRegistryCommand.java']
{'.java': 5}
5
5
0
0
5
18,677,812
3,635,072
479,026
4,927
420
92
16
4
776
104
197
47
0
0
2021-10-04T15:22:56
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,632
quarkusio/quarkus/20515/20512
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20512
https://github.com/quarkusio/quarkus/pull/20515
https://github.com/quarkusio/quarkus/pull/20515
1
resolves
Qute fails to find methods from parent interface when using multilevel inheritance
### Describe the bug As a follow up on https://github.com/quarkusio/quarkus/issues/19564 I was playing around with Qute and strict rendering a bit more. Just noticed that when I introduce another level of interfaces that Qute won't be able to find the methods anymore. See https://github.com/wjglerum/quarkus/commit/7fb6d7b68ab19af24827ac6dc263bf70fb8a58ca ``` java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.qute.deployment.QuteProcessor#processTemplateErrors threw an exception: io.quarkus.qute.TemplateException: Found template problems (3): [1] Incorrect expression found: {metrics.responses.value} - property/method [value] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method - at metrics.html:1 [2] Incorrect expression found: {metrics.responses.name(1)} - property/method [name(1)] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method - at metrics.html:1 [3] Incorrect expression found: {metrics.requests.value.or(null)} - property/method [value] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method - at metrics.html:1 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:196) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:829) at org.jboss.threads.JBossThread.run(JBossThread.java:501) Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {metrics.responses.value} - property/method [value] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method - at metrics.html:1 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:176) ... 11 more Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {metrics.responses.name(1)} - property/method [name(1)] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method - at metrics.html:1 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:176) ... 11 more Suppressed: io.quarkus.qute.TemplateException: Incorrect expression found: {metrics.requests.value.or(null)} - property/method [value] not found on class [io.quarkus.qute.deployment.typesafe.InterfaceValidationSuccessTest$Count] nor handled by an extension method - at metrics.html:1 at io.quarkus.qute.deployment.QuteProcessor.processTemplateErrors(QuteProcessor.java:176) ... 11 more ``` Any ideas on how Qute should handle this? ### Expected behavior _No response_ ### Actual behavior _No response_ ### How to Reproduce? _No response_ ### Output of `uname -a` or `ver` ``` Darwin Willems-MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64 x86_64 ``` ### Output of `java -version` ``` openjdk 11.0.11 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode) ``` ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev `2.2.3.Final` and `2.3.0.CR1` ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) ``` Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f) Maven home: /Users/wjglerum/.m2/wrapper/dists/apache-maven-3.8.2-bin/1um3pu5poco57pibs3g92d6vrf/apache-maven-3.8.2 Java version: 11.0.11, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home Default locale: en_NL, platform encoding: UTF-8 OS name: "mac os x", version: "11.5", arch: "x86_64", family: "mac" ``` ### Additional information _No response_
e0d19f3709ad411ed6accdf8d9016f3d7217b71a
25793afee8f4d10176bdd2c0c401137d182eb685
https://github.com/quarkusio/quarkus/compare/e0d19f3709ad411ed6accdf8d9016f3d7217b71a...25793afee8f4d10176bdd2c0c401137d182eb685
diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java index 76a7c6d1a04..f2e341003a5 100644 --- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java +++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java @@ -1708,6 +1708,7 @@ private static TemplateExtensionMethodBuildItem findTemplateExtensionMethod(Info private static AnnotationTarget findProperty(String name, ClassInfo clazz, IndexView index) { Set<DotName> interfaceNames = new HashSet<>(); while (clazz != null) { + addInterfaces(clazz, index, interfaceNames); interfaceNames.addAll(clazz.interfaceNames()); // Fields for (FieldInfo field : clazz.fields()) { @@ -1756,6 +1757,19 @@ private static AnnotationTarget findProperty(String name, ClassInfo clazz, Index return null; } + private static void addInterfaces(ClassInfo clazz, IndexView index, Set<DotName> interfaceNames) { + if (clazz == null) { + return; + } + List<DotName> names = clazz.interfaceNames(); + if (!names.isEmpty()) { + interfaceNames.addAll(names); + for (DotName name : names) { + addInterfaces(index.getClassByName(name), index, interfaceNames); + } + } + } + /** * Find a non-static non-synthetic method with the given name, matching number of params and assignable parameter types. * @@ -1771,7 +1785,7 @@ private static AnnotationTarget findMethod(VirtualMethodPart virtualMethod, Clas IndexView index, Function<String, String> templateIdToPathFun, Map<String, Match> results) { Set<DotName> interfaceNames = new HashSet<>(); while (clazz != null) { - interfaceNames.addAll(clazz.interfaceNames()); + addInterfaces(clazz, index, interfaceNames); for (MethodInfo method : clazz.methods()) { if (Modifier.isPublic(method.flags()) && !Modifier.isStatic(method.flags()) && !ValueResolverGenerator.isSynthetic(method.flags()) diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java index c98a77f1821..6806e4af0fe 100644 --- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java +++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java @@ -20,7 +20,7 @@ public class InterfaceValidationSuccessTest { @RegisterExtension static final QuarkusUnitTest config = new QuarkusUnitTest() .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) - .addClasses(Metrics.class, Count.class, Wrapper.class) + .addClasses(Metrics.class, Count.class, Wrapper.class, NumericWrapper.class) .addAsResource(new StringAsset("{@java.util.List list}" + "{list.empty}:{list.toString}"), "templates/list.html") @@ -76,7 +76,10 @@ public Count requests() { String name(int age); } - public interface Count extends Wrapper<Integer> { + public interface NumericWrapper extends Wrapper<Integer> { + } + + public interface Count extends NumericWrapper { } public interface Metrics {
['extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/typesafe/InterfaceValidationSuccessTest.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java']
{'.java': 2}
2
2
0
0
2
18,677,313
3,634,970
479,012
4,927
632
118
16
1
4,816
383
1,318
96
2
4
2021-10-04T07:13:16
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,633
quarkusio/quarkus/20479/20475
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/20475
https://github.com/quarkusio/quarkus/pull/20479
https://github.com/quarkusio/quarkus/pull/20479
1
fixes
NoSuchFileException when uploading file after a while
### Describe the bug Dear Quarkus community, When using Multipart File Upload feature of RestEasy Reactive, it uses by default ${java.io.tmpdir}/uploads to temporary store the uploaded files. It seems in my system at least there are some cleaning tasks and from time to time this subdirectory named "uploads" gets deleted. In that scenario, files cannot be uploaded anymore, with the following exception: `2021-09-30 09:21:16,634 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-2) Request failed: java.lang.RuntimeException: java.nio.file.NoSuchFileException: /tmp/uploads/resteasy-reactive1643737138058622276upload at org.jboss.resteasy.reactive.server.core.multipart.MultiPartParserDefinition$MultiPartUploadHandler.beginPart(MultiPartParserDefinition.java:247) at org.jboss.resteasy.reactive.server.core.multipart.MultipartParser$ParseState.headerName(MultipartParser.java:184) at org.jboss.resteasy.reactive.server.core.multipart.MultipartParser$ParseState.parse(MultipartParser.java:99) at org.jboss.resteasy.reactive.server.core.multipart.MultiPartParserDefinition$MultiPartUploadHandler.parseBlocking(MultiPartParserDefinition.java:218) at org.jboss.resteasy.reactive.server.handlers.FormBodyHandler.handle(FormBodyHandler.java:88) at org.jboss.resteasy.reactive.server.handlers.FormBodyHandler.handle(FormBodyHandler.java:25) at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141) at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:543) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:831) Caused by: java.nio.file.NoSuchFileException: /tmp/uploads/resteasy-reactive1643737138058622276upload at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219) at java.base/java.nio.file.Files.newByteChannel(Files.java:375) at java.base/java.nio.file.Files.createFile(Files.java:652) at java.base/java.nio.file.TempFileHelper.create(TempFileHelper.java:135) at java.base/java.nio.file.TempFileHelper.createTempFile(TempFileHelper.java:158) at java.base/java.nio.file.Files.createTempFile(Files.java:872) at org.jboss.resteasy.reactive.server.core.multipart.MultiPartParserDefinition$MultiPartUploadHandler.beginPart(MultiPartParserDefinition.java:240) ... 13 more` If I manually recreate the /tmp/uploads directory, then everything works again, even without restarting the java service. Regards, ### Expected behavior As by default the file upload feature requires a subdirectory of the temp directory, it should be checked if the subdirectory still exists ### Actual behavior At startup the subdirectory /tmp/uploads is created, but Quarkus fails to receive document if this directory gets deleted. ### How to Reproduce? 1. Run the File upload example service 2. Delete /tmp/uploads directory that it creates 3. Try to upload a new document 4. See the exception 5. Re-create the /tmp/uploads directory 6. Upload a document 7. Sees it's working again. ### Output of `uname -a` or `ver` Linux test.dont-code.net 5.6.6-300.fc32.x86_64 #1 SMP Tue Apr 21 13:44:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux ### Output of `java -version` openjdk version "16.0.1" 2021-04-20 OpenJDK Runtime Environment 21.3 (build 16.0.1+9) OpenJDK 64-Bit Server VM 21.3 (build 16.0.1+9, mixed mode, sharing) ### GraalVM version (if different from Java) _No response_ ### Quarkus version or git rev Quarkus 2.2.1.Final ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) _No response_ ### Additional information _No response_
f787bcff2231145c14a5988546363d6d81f30394
7f8fa29c97e88b4c47c8e7fbfc8cfd95d9c17b61
https://github.com/quarkusio/quarkus/compare/f787bcff2231145c14a5988546363d6d81f30394...7f8fa29c97e88b4c47c8e7fbfc8cfd95d9c17b61
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultiPartParserDefinition.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultiPartParserDefinition.java index 907013bf7d5..f03cdf0598a 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultiPartParserDefinition.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultiPartParserDefinition.java @@ -237,6 +237,7 @@ public void beginPart(final CaseInsensitiveMap<String> headers) { if (fileName != null && fileSizeThreshold == 0) { try { if (tempFileLocation != null) { + Files.createDirectories(tempFileLocation); file = Files.createTempFile(tempFileLocation, "resteasy-reactive", "upload"); } else { file = Files.createTempFile("resteasy-reactive", "upload"); @@ -266,6 +267,7 @@ public void data(final ByteBuffer buffer) throws IOException { if (file == null && fileName != null && fileSizeThreshold < this.currentFileSize) { try { if (tempFileLocation != null) { + Files.createDirectories(tempFileLocation); file = Files.createTempFile(tempFileLocation, "resteasy-reactive", "upload"); } else { file = Files.createTempFile("resteasy-reactive", "upload");
['independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultiPartParserDefinition.java']
{'.java': 1}
1
1
0
0
1
18,644,212
3,628,520
478,171
4,921
143
16
2
1
4,396
317
1,068
83
0
0
2021-09-30T13:44:08
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,753
quarkusio/quarkus/17378/17324
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/17324
https://github.com/quarkusio/quarkus/pull/17378
https://github.com/quarkusio/quarkus/pull/17378
1
fixes
AeshConsole exception happening randomly when killing continuous testing
## Describe the bug Exception happening randomly when killing continuous testing (using main): ``` Exception in thread "Aesh InputStream Reader" java.lang.RuntimeException: Unable to read io/quarkus/deployment/dev/console/AeshConsole$4.class at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1$1.apply(JarClassPathElement.java:131) at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1$1.apply(JarClassPathElement.java:118) at io.quarkus.bootstrap.classloading.JarClassPathElement.withJarFile(JarClassPathElement.java:161) at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1.getData(JarClassPathElement.java:118) at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:435) at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:397) at io.quarkus.deployment.dev.console.AeshConsole.lambda$setup$0(AeshConsole.java:160) at org.aesh.terminal.EventDecoder.accept(EventDecoder.java:105) at org.aesh.terminal.EventDecoder.accept(EventDecoder.java:31) at org.aesh.terminal.io.Decoder.write(Decoder.java:133) at org.aesh.readline.tty.terminal.TerminalConnection.openBlocking(TerminalConnection.java:216) at org.aesh.readline.tty.terminal.TerminalConnection.openBlocking(TerminalConnection.java:203) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.util.zip.ZipException: ZipFile invalid LOC header (bad signature) at java.base/java.util.zip.ZipFile$ZipFileInputStream.initDataOffset(ZipFile.java:1008) at java.base/java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:1018) at java.base/java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:468) at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:159) at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107) at io.quarkus.bootstrap.classloading.JarClassPathElement.readStreamContents(JarClassPathElement.java:250) at io.quarkus.bootstrap.classloading.JarClassPathElement$1$1$1.apply(JarClassPathElement.java:123) ... 14 more ``` project: https://github.com/ia3andy/rock-rock-rock
6c63c63237bcb7188c86adafe61a831cbc4cae8c
1f17e198abea2ef963458a4c5bc30f93f43d1231
https://github.com/quarkusio/quarkus/compare/6c63c63237bcb7188c86adafe61a831cbc4cae8c...1f17e198abea2ef963458a4c5bc30f93f43d1231
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java index 70c880b4130..07f7c8cabb8 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java @@ -115,23 +115,44 @@ public URL getUrl() { @Override public byte[] getData() { - return withJarFile(new Function<JarFile, byte[]>() { - @Override - public byte[] apply(JarFile jarFile) { - try { + try { + return withJarFile(new Function<JarFile, byte[]>() { + @Override + public byte[] apply(JarFile jarFile) { try { - return readStreamContents(jarFile.getInputStream(res)); - } catch (InterruptedIOException e) { - //if we are interrupted reading data we finish the op, then just re-interrupt the thread state - byte[] bytes = readStreamContents(jarFile.getInputStream(res)); - Thread.currentThread().interrupt(); - return bytes; + try { + return readStreamContents(jarFile.getInputStream(res)); + } catch (InterruptedIOException e) { + //if we are interrupted reading data we finish the op, then just re-interrupt the thread state + byte[] bytes = readStreamContents(jarFile.getInputStream(res)); + Thread.currentThread().interrupt(); + return bytes; + } + } catch (IOException e) { + if (!closed) { + throw new ZipFileMayHaveChangedException(e); + } + throw new RuntimeException("Unable to read " + name, e); } - } catch (IOException e) { - throw new RuntimeException("Unable to read " + name, e); } + }); + } catch (ZipFileMayHaveChangedException e) { + //this is a weird corner case, that should not really affect end users, but is super annoying + //if you are actually working on Quarkus. If you rebuild quarkus while you have an application + //running reading from the rebuilt zip file will fail, but some of these classes are needed + //for a clean shutdown, so the Java process hangs and needs to be forcibly killed + //this effectively attempts to reopen the file, allowing shutdown to work. + //we need to do this here as close needs a write lock while withJarFile takes a readLock + try { + log.error("Failed to read " + name + + " attempting to re-open the zip file. It is likely a jar file changed on disk, you should shutdown your application", + e); + close(); + return getData(); + } catch (IOException ignore) { + throw new RuntimeException("Unable to read " + name, e.getCause()); } - }); + } } @Override @@ -260,4 +281,10 @@ public static byte[] readStreamContents(InputStream inputStream) throws IOExcept public String toString() { return file.getName() + ": " + jarPath; } + + static class ZipFileMayHaveChangedException extends RuntimeException { + public ZipFileMayHaveChangedException(Throwable cause) { + super(cause); + } + } }
['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java']
{'.java': 1}
1
1
0
0
1
16,510,648
3,210,265
425,334
4,483
3,956
520
53
1
2,341
84
562
34
1
1
2021-05-19T23:03:23
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,755
quarkusio/quarkus/17369/16453
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/16453
https://github.com/quarkusio/quarkus/pull/17369
https://github.com/quarkusio/quarkus/pull/17369
1
fixes
Upgrading from 1.11.x to 1.13.x breaks kubernetes authentication for quarkus-vault extension
## Describe the bug I use quarkus-vault extension to access secrets dynamically. I use client-token authentication for local development and kubernetes authentication for production (see below for configuration). I upgraded from version 1.11.x to 1.13.x and everything works fine for local development. But when I tried to deploy into kubernetes, I get the following exception during kubernetes authentication : ``` ERROR: Failed to start application (with profile prod) io.smallrye.mutiny.TimeoutException at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:58) at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:61) at io.quarkus.vault.runtime.client.VertxVaultClient.exec(VertxVaultClient.java:161) at io.quarkus.vault.runtime.client.VertxVaultClient.exec(VertxVaultClient.java:154) at io.quarkus.vault.runtime.client.VertxVaultClient.post(VertxVaultClient.java:107) at io.quarkus.vault.runtime.client.VertxVaultClient.post(VertxVaultClient.java:101) at io.quarkus.vault.runtime.client.authmethod.VaultInternalKubernetesAuthMethod.login(VaultInternalKubernetesAuthMethod.java:28) at io.quarkus.vault.runtime.VaultAuthManager.loginKubernetes(VaultAuthManager.java:256) at io.quarkus.vault.runtime.VaultAuthManager.login(VaultAuthManager.java:155) at io.quarkus.vault.runtime.VaultAuthManager.vaultLogin(VaultAuthManager.java:145) at io.quarkus.vault.runtime.VaultAuthManager.login(VaultAuthManager.java:116) at io.quarkus.vault.runtime.VaultAuthManager.login(VaultAuthManager.java:95) at io.quarkus.vault.runtime.VaultAuthManager.getClientToken(VaultAuthManager.java:79) at io.quarkus.vault.runtime.VaultKvManager.readSecret(VaultKvManager.java:36) at io.quarkus.vault.runtime.VaultKvManager_ClientProxy.readSecret(VaultKvManager_ClientProxy.zig:222) at io.quarkus.vault.runtime.config.VaultConfigSource.fetchSecrets(VaultConfigSource.java:92) at io.quarkus.vault.runtime.config.VaultConfigSource.lambda$fetchSecrets$2(VaultConfigSource.java:88) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at io.quarkus.vault.runtime.config.VaultConfigSource.fetchSecrets(VaultConfigSource.java:88) at io.quarkus.vault.runtime.config.VaultConfigSource.lambda$getSecretConfig$0(VaultConfigSource.java:72) at java.base/java.util.Optional.ifPresent(Optional.java:176) at io.quarkus.vault.runtime.config.VaultConfigSource.getSecretConfig(VaultConfigSource.java:72) at io.quarkus.vault.runtime.config.VaultConfigSource.getValue(VaultConfigSource.java:53) at io.smallrye.config.ConfigValueConfigSourceWrapper.getConfigValue(ConfigValueConfigSourceWrapper.java:20) at io.smallrye.config.SmallRyeConfigSourceInterceptor.getValue(SmallRyeConfigSourceInterceptor.java:26) at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20) at io.smallrye.config.SmallRyeConfigSourceInterceptor.getValue(SmallRyeConfigSourceInterceptor.java:27) at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20) at io.smallrye.config.SmallRyeConfigSourceInterceptor.getValue(SmallRyeConfigSourceInterceptor.java:27) at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20) at io.smallrye.config.SecretKeysConfigSourceInterceptor.getValue(SecretKeysConfigSourceInterceptor.java:22) at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20) at io.smallrye.config.RelocateConfigSourceInterceptor.getValue(RelocateConfigSourceInterceptor.java:26) at io.smallrye.config.SmallRyeConfigSourceInterceptorContext.proceed(SmallRyeConfigSourceInterceptorContext.java:20) at io.smallrye.config.ProfileConfigSourceInterceptor.convertProfile(ProfileConfigSourceInterceptor.java:125) at io.smallrye.config.ProfileConfigSourceInterceptor.<init>(ProfileConfigSourceInterceptor.java:49) at io.smallrye.config.SmallRyeConfigBuilder$1.getInterceptor(SmallRyeConfigBuilder.java:165) at io.smallrye.config.SmallRyeConfigBuilder$InterceptorWithPriority.getInterceptor(SmallRyeConfigBuilder.java:413) at io.smallrye.config.SmallRyeConfig$ConfigSourceInterceptorWithPriority.getInterceptor(SmallRyeConfig.java:608) at io.smallrye.config.SmallRyeConfig$ConfigSources.<init>(SmallRyeConfig.java:424) at io.smallrye.config.SmallRyeConfig.<init>(SmallRyeConfig.java:66) at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:358) at io.quarkus.runtime.generated.Config.readConfig(Config.zig:2071) at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(RuntimeConfigSetup.zig:60) at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:552) at io.quarkus.runtime.Application.start(Application.java:90) at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:100) at io.quarkus.runtime.Quarkus.run(Quarkus.java:66) at io.quarkus.runtime.Quarkus.run(Quarkus.java:42) at io.quarkus.runtime.Quarkus.run(Quarkus.java:119) at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29) ``` ### Configuration ```properties # vault "%dev": quarkus: vault: url: ${VAULT_URL} authentication: client-token: 00000000-0000-0000-0000-000000000000 secret-config-kv-path: ${VAULT_PATH} "%prod": quarkus: vault: url: ${VAULT_URL} authentication: kubernetes: role: ${VAULT_K8S_ROLE} auth-mount-path: ${K8S_AUTH_MOUNT_PATH} secret-config-kv-path: ${VAULT_PATH} ``` ## Environment (please complete the following information): ### Docker image openjdk:14 ### Output of `java -version` Java 14 ### Build tool (ie. output of `mvnw --version` or `gradlew --version`) Maven 3.6 ## Additional context I tried one month ago to upgrade from 1.11.x to 1.12.x and had the same error. I didn't change anything else except the following property after upgrade : ```properties quarkus: ... package: type: legacy-jar ```
950286bd0f8c4951f54935a6637b695a0cf09198
37604ad3350262414ec81312c8eecd9d0ce53118
https://github.com/quarkusio/quarkus/compare/950286bd0f8c4951f54935a6637b695a0cf09198...37604ad3350262414ec81312c8eecd9d0ce53118
diff --git a/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/MutinyVertxClientFactory.java b/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/MutinyVertxClientFactory.java index b4ebe50c3fa..35ad4f4ba25 100644 --- a/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/MutinyVertxClientFactory.java +++ b/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/MutinyVertxClientFactory.java @@ -22,6 +22,10 @@ public static WebClient createHttpClient(Vertx vertx, VaultBootstrapConfig vault .setConnectTimeout((int) vaultBootstrapConfig.connectTimeout.toMillis()) .setIdleTimeout((int) vaultBootstrapConfig.readTimeout.getSeconds()); + if (vaultBootstrapConfig.nonProxyHosts.isPresent()) { + options.setNonProxyHosts(vaultBootstrapConfig.nonProxyHosts.get()); + } + boolean trustAll = vaultBootstrapConfig.tls.skipVerify.orElseGet(() -> tlsConfig.trustAll); if (trustAll) { skipVerify(options); diff --git a/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/config/VaultBootstrapConfig.java b/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/config/VaultBootstrapConfig.java index 5f82842529c..561d38880d9 100644 --- a/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/config/VaultBootstrapConfig.java +++ b/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/config/VaultBootstrapConfig.java @@ -210,6 +210,17 @@ public class VaultBootstrapConfig { @ConfigItem(defaultValue = DEFAULT_READ_TIMEOUT) public Duration readTimeout; + /** + * List of remote hosts that are not proxied when the client is configured to use a proxy. This + * list serves the same purpose as the JVM {@code nonProxyHosts} configuration. + * + * <p> + * Entries can use the <i>*</i> wildcard character for pattern matching, e.g <i>*.example.com</i> matches + * <i>www.example.com</i>. + */ + @ConfigItem + public Optional<List<String>> nonProxyHosts; + /** * List of named credentials providers, such as: `quarkus.vault.credentials-provider.foo.kv-path=mypath` * <p> diff --git a/extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultAuthManagerTest.java b/extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultAuthManagerTest.java index 24e9dd84173..fd9302df836 100644 --- a/extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultAuthManagerTest.java +++ b/extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultAuthManagerTest.java @@ -125,6 +125,7 @@ private VaultBootstrapConfig createConfig() { config.authentication.userpass.passwordWrappingToken = Optional.empty(); config.connectTimeout = Duration.ofSeconds(1); config.readTimeout = Duration.ofSeconds(1); + config.nonProxyHosts = Optional.empty(); config.tls.skipVerify = Optional.of(true); config.logConfidentialityLevel = LogConfidentialityLevel.LOW; config.renewGracePeriod = Duration.ofSeconds(3); diff --git a/extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultDbManagerTest.java b/extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultDbManagerTest.java index 3437587327e..76fde7c66d1 100644 --- a/extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultDbManagerTest.java +++ b/extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultDbManagerTest.java @@ -135,6 +135,7 @@ private VaultBootstrapConfig createConfig() { config.authentication.userpass.passwordWrappingToken = Optional.empty(); config.connectTimeout = Duration.ofSeconds(1); config.readTimeout = Duration.ofSeconds(1); + config.nonProxyHosts = Optional.empty(); config.tls.skipVerify = Optional.of(true); config.logConfidentialityLevel = LogConfidentialityLevel.LOW; config.renewGracePeriod = Duration.ofSeconds(3); diff --git a/test-framework/vault/src/main/java/io/quarkus/vault/test/VaultTestExtension.java b/test-framework/vault/src/main/java/io/quarkus/vault/test/VaultTestExtension.java index 33b33f608ef..3d496359b76 100644 --- a/test-framework/vault/src/main/java/io/quarkus/vault/test/VaultTestExtension.java +++ b/test-framework/vault/src/main/java/io/quarkus/vault/test/VaultTestExtension.java @@ -178,6 +178,7 @@ private TestVaultClient createVaultClient() { vaultBootstrapConfig.tls.caCert = Optional.empty(); vaultBootstrapConfig.connectTimeout = Duration.ofSeconds(5); vaultBootstrapConfig.readTimeout = Duration.ofSeconds(1); + vaultBootstrapConfig.nonProxyHosts = Optional.empty(); vaultBootstrapConfig.authentication = new VaultAuthenticationConfig(); vaultBootstrapConfig.authentication.kubernetes = new VaultKubernetesAuthenticationConfig(); return new TestVaultClient(new VaultConfigHolder().setVaultBootstrapConfig(vaultBootstrapConfig));
['test-framework/vault/src/main/java/io/quarkus/vault/test/VaultTestExtension.java', 'extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultDbManagerTest.java', 'extensions/vault/runtime/src/test/java/io/quarkus/vault/runtime/VaultAuthManagerTest.java', 'extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/config/VaultBootstrapConfig.java', 'extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/MutinyVertxClientFactory.java']
{'.java': 5}
5
5
0
0
5
16,582,217
3,222,607
426,560
4,491
591
143
15
2
6,136
270
1,501
110
0
3
2021-05-19T17:07:46
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
2,875
quarkusio/quarkus/13934/13926
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/13926
https://github.com/quarkusio/quarkus/pull/13934
https://github.com/quarkusio/quarkus/pull/13934
1
fixes
RESTEasy Reactive: writers can add headers too
Originally I had to write https://github.com/quarkusio/quarkus/pull/13802/commits/77105396c3208a76e13283f9d2dc3e7b956e757a in order to fix an exception such as "response already written" where we tried to set the headers and status code after a writer had started writing on the response (wonder why this doesn't happen every time), but it makes the TCK fail: ``` 2020-12-14T17:11:53.1704407Z [ERROR] JAXRSProvidersClient0098.writeHeaderEntityUsingWriterTest:332->JAXRSCommonClient.invoke:342 [WebValidatorBase] Unable to find the following header in the server's response: READABLEWRITEABLE: <READABLEWRITEABLE>JAXRS</READABLEWRITEABLE> 2020-12-14T17:11:53.1706491Z [WebValidatorBase] Response headers recieved from server: 2020-12-14T17:11:53.1707380Z ResponseHeader -> Content-Type: text/xml;charset=UTF-8 2020-12-14T17:11:53.1708157Z ResponseHeader -> content-length: 0 ``` Because writers can add headers. So we need to find a way to delay writing headers until we detect someone trying to write on the response. RESTEasy does this by wrapping the `OutputStream` passed to clients and only write headers once/if they start using it. Not sure how that affects the optimised writers path.
9cdae32140a0b6f583b055a19de6cc60cc22a77e
76cd5697a2d43a502959cf2a1723d9c4e7ea0ebd
https://github.com/quarkusio/quarkus/compare/9cdae32140a0b6f583b055a19de6cc60cc22a77e...76cd5697a2d43a502959cf2a1723d9c4e7ea0ebd
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java index 992c3d293b4..babee7adfb7 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java @@ -40,13 +40,15 @@ import io.quarkus.resteasy.reactive.server.runtime.ResteasyReactiveSecurityContext; import io.quarkus.security.identity.SecurityIdentity; import io.quarkus.vertx.http.runtime.security.QuarkusHttpUser; +import io.undertow.server.HttpServerExchange; +import io.undertow.server.ResponseCommitListener; import io.vertx.core.http.HttpServerRequest; import io.vertx.core.http.HttpServerResponse; import io.vertx.core.net.impl.ConnectionBase; import io.vertx.ext.web.RoutingContext; public class ServletRequestContext extends ResteasyReactiveRequestContext - implements ServerHttpRequest, ServerHttpResponse { + implements ServerHttpRequest, ServerHttpResponse, ResponseCommitListener { private static final LazyValue<Event<SecurityIdentity>> SECURITY_IDENTITY_EVENT = new LazyValue<>( ServletRequestContext::createEvent); @@ -57,15 +59,17 @@ public class ServletRequestContext extends ResteasyReactiveRequestContext ServletWriteListener writeListener; byte[] asyncWriteData; Consumer<Throwable> asyncWriteHandler; + protected Consumer<ResteasyReactiveRequestContext> preCommitTask; public ServletRequestContext(Deployment deployment, ProvidersImpl providers, HttpServletRequest request, HttpServletResponse response, ThreadSetupAction requestContext, ServerRestHandler[] handlerChain, ServerRestHandler[] abortHandlerChain, - RoutingContext context) { + RoutingContext context, HttpServerExchange exchange) { super(deployment, providers, requestContext, handlerChain, abortHandlerChain); this.request = request; this.response = response; this.context = context; + exchange.addResponseCommitListener(this); } protected boolean isRequestScopeManagementRequired() { @@ -453,6 +457,18 @@ public OutputStream createResponseOutputStream() { } } + @Override + public void setPreCommitListener(Consumer<ResteasyReactiveRequestContext> task) { + preCommitTask = task; + } + + @Override + public void beforeCommit(HttpServerExchange exchange) { + if (preCommitTask != null) { + preCommitTask.accept(this); + } + } + class ServletWriteListener implements WriteListener { private final ServletOutputStream outputStream; diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContextFactory.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContextFactory.java index 7b1656ad3c9..2cc20536b9e 100644 --- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContextFactory.java +++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContextFactory.java @@ -24,6 +24,6 @@ public ResteasyReactiveRequestContext createContext(Deployment deployment, Provi io.undertow.servlet.handlers.ServletRequestContext src = (io.undertow.servlet.handlers.ServletRequestContext) context; return new ServletRequestContext(deployment, providers, (HttpServletRequest) src.getServletRequest(), (HttpServletResponse) src.getServletResponse(), requestContext, handlerChain, abortHandlerChain, - (RoutingContext) ((VertxHttpExchange) src.getExchange().getDelegate()).getContext()); + (RoutingContext) ((VertxHttpExchange) src.getExchange().getDelegate()).getContext(), src.getExchange()); } } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ServerSerialisers.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ServerSerialisers.java index eb25baabcb4..e816c4a7fd6 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ServerSerialisers.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ServerSerialisers.java @@ -17,6 +17,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import java.util.function.Consumer; import java.util.function.Function; import javax.ws.rs.RuntimeType; import javax.ws.rs.WebApplicationException; @@ -57,6 +58,13 @@ public class ServerSerialisers extends Serialisers { + private static final Consumer<ResteasyReactiveRequestContext> HEADER_FUNCTION = new Consumer<ResteasyReactiveRequestContext>() { + @Override + public void accept(ResteasyReactiveRequestContext context) { + ServerSerialisers.encodeResponseHeaders(context); + } + }; + public static BuiltinReader[] BUILTIN_READERS = new BuiltinReader[] { new BuiltinReader(String.class, ServerStringMessageBodyHandler.class, MediaType.WILDCARD), @@ -164,49 +172,62 @@ public static boolean invokeWriter(ResteasyReactiveRequestContext context, Objec WriterInterceptor[] writerInterceptors = context.getWriterInterceptors(); boolean outputStreamSet = context.getOutputStream() != null; - if (writer instanceof ServerMessageBodyWriter && writerInterceptors == null && !outputStreamSet) { - ServerMessageBodyWriter<Object> quarkusRestWriter = (ServerMessageBodyWriter<Object>) writer; - RuntimeResource target = context.getTarget(); - ServerSerialisers.encodeResponseHeaders(context); - Type genericType; - if (context.hasGenericReturnType()) { // make sure that when a Response with a GenericEntity was returned, we use it - genericType = context.getGenericReturnType(); - } else { - genericType = target == null ? null : target.getReturnType(); - } - Class<?> entityClass = entity.getClass(); - if (quarkusRestWriter.isWriteable( - entityClass, - genericType, - target == null ? null : target.getLazyMethod(), - context.getResponseMediaType())) { - if (mediaType != null) { - context.setResponseContentType(mediaType); + context.serverResponse().setPreCommitListener(HEADER_FUNCTION); + try { + if (writer instanceof ServerMessageBodyWriter && writerInterceptors == null && !outputStreamSet) { + ServerMessageBodyWriter<Object> quarkusRestWriter = (ServerMessageBodyWriter<Object>) writer; + RuntimeResource target = context.getTarget(); + Type genericType; + if (context.hasGenericReturnType()) { // make sure that when a Response with a GenericEntity was returned, we use it + genericType = context.getGenericReturnType(); + } else { + genericType = target == null ? null : target.getReturnType(); } - quarkusRestWriter.writeResponse(entity, genericType, context); - return true; - } else { - return false; - } - } else { - if (writer.isWriteable(entity.getClass(), context.getGenericReturnType(), context.getAllAnnotations(), - context.getResponseMediaType())) { - Response response = context.getResponse().get(); - if (mediaType != null) { - context.setResponseContentType(mediaType); + Class<?> entityClass = entity.getClass(); + if (quarkusRestWriter.isWriteable( + entityClass, + genericType, + target == null ? null : target.getLazyMethod(), + context.getResponseMediaType())) { + if (mediaType != null) { + context.setResponseContentType(mediaType); + } + quarkusRestWriter.writeResponse(entity, genericType, context); + return true; + } else { + return false; } - if (writerInterceptors == null) { - writer.writeTo(entity, entity.getClass(), context.getGenericReturnType(), - context.getAllAnnotations(), response.getMediaType(), response.getHeaders(), - context.getOrCreateOutputStream()); - ServerSerialisers.encodeResponseHeaders(context); - context.getOrCreateOutputStream().close(); + } else { + if (writer.isWriteable(entity.getClass(), context.getGenericReturnType(), context.getAllAnnotations(), + context.getResponseMediaType())) { + Response response = context.getResponse().get(); + if (mediaType != null) { + context.setResponseContentType(mediaType); + } + if (writerInterceptors == null) { + writer.writeTo(entity, entity.getClass(), context.getGenericReturnType(), + context.getAllAnnotations(), response.getMediaType(), response.getHeaders(), + context.getOrCreateOutputStream()); + context.getOrCreateOutputStream().close(); + } else { + runWriterInterceptors(context, entity, writer, response, writerInterceptors, serialisers); + } + return true; } else { - runWriterInterceptors(context, entity, writer, response, writerInterceptors, serialisers); + return false; } - return true; + } + } catch (Throwable e) { + //clear the pre-commit listener, as if this error is unrecoverable + //the error handling will want to write out its own response + //and the pre commit listener will interfere with that + context.serverResponse().setPreCommitListener(null); + if (e instanceof RuntimeException) { + throw (RuntimeException) e; + } else if (e instanceof IOException) { + throw (IOException) e; } else { - return false; + throw new RuntimeException(e); } } } diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/spi/ServerHttpResponse.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/spi/ServerHttpResponse.java index fa9d12e8d98..39761308baf 100644 --- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/spi/ServerHttpResponse.java +++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/spi/ServerHttpResponse.java @@ -4,6 +4,7 @@ import java.util.Map; import java.util.concurrent.CompletionStage; import java.util.function.Consumer; +import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext; public interface ServerHttpResponse { @@ -34,4 +35,6 @@ public interface ServerHttpResponse { CompletionStage<Void> write(byte[] data); OutputStream createResponseOutputStream(); + + void setPreCommitListener(Consumer<ResteasyReactiveRequestContext> task); } diff --git a/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java b/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java index 869f75cc009..e8af88c0d04 100644 --- a/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java +++ b/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java @@ -29,11 +29,12 @@ import org.jboss.resteasy.reactive.spi.ThreadSetupAction; public class VertxResteasyReactiveRequestContext extends ResteasyReactiveRequestContext - implements ServerHttpRequest, ServerHttpResponse { + implements ServerHttpRequest, ServerHttpResponse, Handler<Void> { protected final RoutingContext context; protected final HttpServerRequest request; protected final HttpServerResponse response; + protected Consumer<ResteasyReactiveRequestContext> preCommitTask; public VertxResteasyReactiveRequestContext(Deployment deployment, ProvidersImpl providers, RoutingContext context, @@ -42,6 +43,7 @@ public VertxResteasyReactiveRequestContext(Deployment deployment, ProvidersImpl this.context = context; this.request = context.request(); this.response = context.response(); + context.addHeadersEndHandler(this); } public RoutingContext getContext() { @@ -313,4 +315,16 @@ public void handle(AsyncResult<Void> event) { public OutputStream createResponseOutputStream() { return new ResteasyReactiveOutputStream(this); } + + @Override + public void setPreCommitListener(Consumer<ResteasyReactiveRequestContext> task) { + preCommitTask = task; + } + + @Override + public void handle(Void event) { + if (preCommitTask != null) { + preCommitTask.accept(this); + } + } }
['independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/spi/ServerHttpResponse.java', 'independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ServerSerialisers.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContext.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive-servlet/runtime/src/main/java/io/quarkus/resteasy/reactive/server/servlet/runtime/ServletRequestContextFactory.java']
{'.java': 5}
5
5
0
0
5
13,864,959
2,704,656
360,916
3,817
7,276
1,227
138
5
1,213
138
334
15
1
1
2020-12-17T01:17:03
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0