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] | repo_stars
int64 10
44.3k
| repo_language
stringclasses 8
values | repo_languages
stringclasses 296
values | repo_license
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,091 | quarkusio/quarkus/8318/8301 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8301 | https://github.com/quarkusio/quarkus/pull/8318 | https://github.com/quarkusio/quarkus/pull/8318 | 1 | fixes | Qute collection access requires restart of quarkus:dev | **Describe the bug**
When coding Qute templates in `quarkus:dev`, the first time we access a `list.get(index)` fails with a `java.lang.ClassNotFoundException: io.quarkus.qute.runtime.extensions.CollectionTemplateExtensions_Extension_ValueResolver_get_646e8480881185b6bc78b6698eeafb5d7b01c85c$$function$$2`
Once we restart `quarkus:dev` and then the resolver is "known" once, it works as expected (even we remove the access and add it again).
**Reproducer**
1. Start `quarkus:dev` with an empty template
2. Add a template that accesses a list, similar to this:
```
{#if ! entries.isEmpty}
First title: {entries.get(0).title}
{/}
```
3. It fails with:
```
java.lang.NoClassDefFoundError: io.quarkus.qute.runtime.extensions.CollectionTemplateExtensions_Extension_ValueResolver_get_646e8480881185b6bc78b6698eeafb5d7b01c85c$$function$$2
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1190)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2299)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:143)
at io.quarkus.qute.EvaluatorImpl.resolveReference(EvaluatorImpl.java:76)
at io.quarkus.qute.EvaluatorImpl.evaluate(EvaluatorImpl.java:48)
at io.quarkus.qute.ResolutionContextImpl.evaluate(ResolutionContextImpl.java:31)
at io.quarkus.qute.ExpressionNode.resolve(ExpressionNode.java:25)
at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:126)
at io.quarkus.qute.IfSectionHelper.lambda$resolveCondition$0(IfSectionHelper.java:55)
at io.quarkus.qute.IfSectionHelper$$Lambda$844/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1183)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2299)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:143)
at io.quarkus.qute.IfSectionHelper.resolveCondition(IfSectionHelper.java:53)
at io.quarkus.qute.IfSectionHelper.resolve(IfSectionHelper.java:43)
at io.quarkus.qute.SectionNode.resolve(SectionNode.java:34)
at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:126)
at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:33)
at io.quarkus.qute.Parser$1$1.resolve(Parser.java:80)
at io.quarkus.qute.SectionNode.resolve(SectionNode.java:34)
at io.quarkus.qute.TemplateImpl.renderData(TemplateImpl.java:99)
at io.quarkus.qute.TemplateImpl.access$200(TemplateImpl.java:14)
at io.quarkus.qute.TemplateImpl$TemplateInstanceImpl.renderAsync(TemplateImpl.java:80)
at io.quarkus.resteasy.qute.runtime.TemplateResponseFilter.filter(TemplateResponseFilter.java:58)
at org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:360)
at org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:251)
at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:101)
at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:74)
at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:590)
... 58 more
Caused by: java.lang.NoClassDefFoundError: io.quarkus.qute.runtime.extensions.CollectionTemplateExtensions_Extension_ValueResolver_get_646e8480881185b6bc78b6698eeafb5d7b01c85c$$function$$2
at io.quarkus.qute.runtime.extensions.CollectionTemplateExtensions_Extension_ValueResolver_get_646e8480881185b6bc78b6698eeafb5d7b01c85c.resolve(CollectionTemplateExtensions_Extension_ValueResolver_get_646e8480881185b6bc78b6698eeafb5d7b01c85c.zig:70)
at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:100)
at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:109)
at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:109)
at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:109)
at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:109)
at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:109)
at io.quarkus.qute.EvaluatorImpl.resolve(EvaluatorImpl.java:109)
at io.quarkus.qute.EvaluatorImpl.resolveReference(EvaluatorImpl.java:75)
at io.quarkus.qute.EvaluatorImpl.lambda$resolveReference$1(EvaluatorImpl.java:78)
at io.quarkus.qute.EvaluatorImpl$$Lambda$904/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1183)
... 86 more
Caused by: java.lang.ClassNotFoundException: io.quarkus.qute.runtime.extensions.CollectionTemplateExtensions_Extension_ValueResolver_get_646e8480881185b6bc78b6698eeafb5d7b01c85c$$function$$2
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:788)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:1081)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:318)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:274)
... 98 more
```
4. If we stop and restart `quarkus:dev`, it works.
Btw, in the same case (empty template when starting then adding the code only once `quarkus:dev` is running) `list[index]` doesn't fail with an error but silently returns no element:
```
{#if ! entries.isEmpty}
Entries has {entries.size} elements
First title: {entries[0].title}
{/}
```
```
<!-- output -->
Entries has 3 elements
First title: NOT_FOUND
```
Tested with Quarkus version `1.3.1.Final`.
| b923fde090eb469a6cdad82a660225b7068833e8 | c1416efff529a20c98a3f7dca5fd9042998ca5b3 | https://github.com/quarkusio/quarkus/compare/b923fde090eb469a6cdad82a660225b7068833e8...c1416efff529a20c98a3f7dca5fd9042998ca5b3 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
index 84a9856e7f4..b6769276f91 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
@@ -10,6 +10,7 @@
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
+import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -22,7 +23,21 @@ public MemoryClassPathElement(Map<String, byte[]> resources) {
}
public void reset(Map<String, byte[]> resources) {
- this.resources = resources;
+ Map<String, byte[]> newResources = new HashMap<>(resources);
+ //we can't delete .class files from the loader
+ //gizmo may not generate the same function names on restart
+ //so if we delete them already loaded classes may have problems, as functions they reference
+ //may have been removed
+ //see https://github.com/quarkusio/quarkus/issues/8301
+ for (Map.Entry<String, byte[]> e : this.resources.entrySet()) {
+ if (newResources.containsKey(e.getKey())) {
+ continue;
+ }
+ if (e.getKey().endsWith(".class")) {
+ newResources.put(e.getKey(), e.getValue());
+ }
+ }
+ this.resources = newResources;
}
@Override | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,228,090 | 1,600,252 | 213,499 | 2,230 | 806 | 161 | 17 | 1 | 5,926 | 262 | 1,553 | 89 | 0 | 4 | 1970-01-01T00:26: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 |
3,092 | quarkusio/quarkus/8304/8299 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8299 | https://github.com/quarkusio/quarkus/pull/8304 | https://github.com/quarkusio/quarkus/pull/8304 | 1 | resolves | Error when putting Qute include inside if/when/for | **Describe the bug**
When putting an `{include}` inside a `{for}`, `{if}`, or `{with}` (maybe others), the inclusion fails with an error.
**To Reproduce**
The following works as expected:
```
<!-- some HTML file -->
{#include includes/teaser}
{#title}My Title{/title}
{#content}My content{/content}
{/include}
```
```
<!-- includes/teaser.html -->
<h2>{#insert title/}</h2>
<p>{#insert content/}</p>
```
```
<!-- output -->
<h2>My Title</h2>
<p>My content</p>
```
The following...
```
<!-- some HTML file -->
{#if hello == 'world'}
{#include includes/teaser}
{#title}My Title{/title}
{#content}My content{/content}
{/include}
{/if}
```
fails with:
```
org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:381)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:216)
at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:610)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:520)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:259)
at org.jboss.resteasy.core.SynchronousDispatcher$$Lambda$717/0000000000000000.run(Unknown Source)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:160)
at org.jboss.resteasy.core.SynchronousDispatcher$$Lambda$718/0000000000000000.get(Unknown Source)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:163)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:245)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:249)
at io.quarkus.resteasy.runtime.ResteasyFilter$ResteasyResponseWrapper.sendError(ResteasyFilter.java:65)
at io.undertow.servlet.handlers.DefaultServlet.doGet(DefaultServlet.java:172)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:503)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at io.quarkus.resteasy.runtime.ResteasyFilter.doFilter(ResteasyFilter.java:28)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:270)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:59)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:116)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:113)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1$1.call(UndertowDeploymentRecorder.java:496)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:250)
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:175)
at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:102)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:290)
at io.undertow.server.DefaultExchangeHandler.handle(DefaultExchangeHandler.java:18)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$6$1.run(UndertowDeploymentRecorder.java:379)
at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2027)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1551)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1442)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at java.base/java.lang.Thread.run(Thread.java:835)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.NullPointerException
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1693)
at io.quarkus.qute.EngineImpl.getTemplate(EngineImpl.java:109)
at io.quarkus.qute.IncludeSectionHelper$Factory$1.get(IncludeSectionHelper.java:54)
at io.quarkus.qute.IncludeSectionHelper$Factory$1.get(IncludeSectionHelper.java:49)
at io.quarkus.qute.IncludeSectionHelper.resolve(IncludeSectionHelper.java:23)
at io.quarkus.qute.SectionNode.resolve(SectionNode.java:34)
at io.quarkus.qute.SectionNode$SectionResolutionContextImpl.execute(SectionNode.java:119)
at io.quarkus.qute.SectionHelper$SectionResolutionContext.execute(SectionHelper.java:33)
at io.quarkus.qute.Parser$1$1.resolve(Parser.java:80)
at io.quarkus.qute.SectionNode.resolve(SectionNode.java:34)
at io.quarkus.qute.TemplateImpl.renderData(TemplateImpl.java:99)
at io.quarkus.qute.TemplateImpl.access$200(TemplateImpl.java:14)
at io.quarkus.qute.TemplateImpl$TemplateInstanceImpl.renderAsync(TemplateImpl.java:80)
at io.quarkus.resteasy.qute.runtime.TemplateResponseFilter.filter(TemplateResponseFilter.java:58)
at org.jboss.resteasy.core.interception.jaxrs.ContainerResponseContextImpl.filter(ContainerResponseContextImpl.java:360)
at org.jboss.resteasy.core.ServerResponseWriter.executeFilters(ServerResponseWriter.java:251)
at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:101)
at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:74)
at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:590)
... 58 more
```
And putting `{include}` inside a `{for}` (for example) fails with:
```
java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:248)
at io.quarkus.runtime.Application.start(Application.java:90)
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:564)
at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:99)
at io.quarkus.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:103)
at io.quarkus.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:138)
at io.quarkus.vertx.http.runtime.devmode.VertxHotReplacementSetup$1.handle(VertxHotReplacementSetup.java:50)
at io.quarkus.vertx.http.runtime.devmode.VertxHotReplacementSetup$1.handle(VertxHotReplacementSetup.java:42)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:316)
at io.vertx.core.impl.ContextImpl$$Lambda$713/0000000000000000.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:835)
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:373)
at java.base/java.util.ArrayList.get(ArrayList.java:426)
at io.quarkus.qute.SectionInitContextImpl.getParameters(SectionInitContextImpl.java:28)
at io.quarkus.qute.SectionInitContextImpl.getParameter(SectionInitContextImpl.java:36)
at io.quarkus.qute.LoopSectionHelper$Factory.initialize(LoopSectionHelper.java:125)
at io.quarkus.qute.LoopSectionHelper$Factory.initialize(LoopSectionHelper.java:102)
at io.quarkus.qute.SectionNode$Builder.build(SectionNode.java:88)
at io.quarkus.qute.Parser.flushTag(Parser.java:358)
at io.quarkus.qute.Parser.tag(Parser.java:197)
at io.quarkus.qute.Parser.processCharacter(Parser.java:148)
at io.quarkus.qute.Parser.parse(Parser.java:105)
at io.quarkus.qute.EngineImpl.load(EngineImpl.java:135)
at io.quarkus.qute.EngineImpl$$Lambda$475/0000000000000000.apply(Unknown Source)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
at io.quarkus.qute.EngineImpl.getTemplate(EngineImpl.java:109)
at io.quarkus.qute.runtime.EngineProducer.<init>(EngineProducer.java:126)
at io.quarkus.qute.runtime.EngineProducer_Bean.create(EngineProducer_Bean.zig:382)
at io.quarkus.qute.runtime.EngineProducer_Bean.create(EngineProducer_Bean.zig:299)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:80)
at io.quarkus.arc.impl.AbstractSharedContext$$Lambda$59/0000000000000000.apply(Unknown Source)
at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
at io.quarkus.arc.impl.ComputingCache$CacheFunction$$Lambda$468/0000000000000000.get(Unknown Source)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
at io.quarkus.qute.runtime.EngineProducer_Bean.get(EngineProducer_Bean.zig:283)
at io.quarkus.qute.runtime.EngineProducer_Bean.get(EngineProducer_Bean.zig:251)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:376)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:389)
at io.quarkus.arc.impl.ArcContainerImpl.instance(ArcContainerImpl.java:249)
at io.quarkus.qute.runtime.EngineProducer_Observer_Synthetic_5ca7449e3ab1631e7e8ed910338051c00d29a79b.notify(EngineProducer_Observer_Synthetic_5ca7449e3ab1631e7e8ed910338051c00d29a79b.zig:71)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:282)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:267)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:69)
at io.quarkus.arc.runtime.LifecycleEventRunner.fireStartupEvent(LifecycleEventRunner.java:23)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:113)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent276.deploy_0(LifecycleEventsBuildStep$startupEvent276.zig:77)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent276.deploy(LifecycleEventsBuildStep$startupEvent276.zig:36)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:210)
... 16 more
```
However, if the `{include}` is empty, like in the following, there is no error (but also no way to use the include as expected):
```
{#for entry in entries}
{#include includes/teaser}
{/include}
{/}
```
```
<!-- output -->
<h2></h2>
<p></p>
```
Tested with Quarkus version `1.3.0.Final` and `1.3.1.Final`.
| 3e9a7106483ed675cb6e89b991766f79356e7996 | bb2bf209f9a937b75927b1c7c4917ce75ffc7201 | https://github.com/quarkusio/quarkus/compare/3e9a7106483ed675cb6e89b991766f79356e7996...bb2bf209f9a937b75927b1c7c4917ce75ffc7201 | diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/LoopSectionHelper.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/LoopSectionHelper.java
index 23e146ef787..36e8526dac4 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/LoopSectionHelper.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/LoopSectionHelper.java
@@ -28,7 +28,7 @@ public class LoopSectionHelper implements SectionHelper {
private final Expression iterable;
LoopSectionHelper(String alias, Expression iterable) {
- this.alias = alias.equals(Parameter.EMPTY) ? DEFAULT_ALIAS : alias;
+ this.alias = Parameter.EMPTY.equals(alias) ? DEFAULT_ALIAS : alias;
this.iterable = Objects.requireNonNull(iterable);
}
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 6eef6d20bf3..7b7324a3d18 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
@@ -289,6 +289,7 @@ private void flushTag() {
typeInfoStack.addFirst(typeInfos);
}
+ // A new block - stop ignoring the block content
ignoreContent = false;
} else {
@@ -345,6 +346,7 @@ private void flushTag() {
"section block end tag [" + name + "] does not match the start tag [" + block.getLabel() + "]");
}
section.addBlock(sectionBlockStack.pop().build());
+ // Ignore the block content until a next block starts or the current section ends
ignoreContent = true;
} else {
// Section end
@@ -354,7 +356,11 @@ private void flushTag() {
}
section = sectionStack.pop();
if (!ignoreContent) {
+ // Add the current block to the current section
section.addBlock(sectionBlockStack.pop().build());
+ } else {
+ // The current section ends - stop ignoring the block content
+ ignoreContent = false;
}
sectionBlockStack.peek().addNode(section.build());
}
diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/SectionInitContextImpl.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/SectionInitContextImpl.java
index 39b512fb967..6388cf957a0 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/SectionInitContextImpl.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/SectionInitContextImpl.java
@@ -1,6 +1,7 @@
package io.quarkus.qute;
import io.quarkus.qute.SectionHelperFactory.SectionInitContext;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@@ -25,7 +26,7 @@ public SectionInitContextImpl(EngineImpl engine, List<SectionBlock> blocks, Func
* @return the params of the main block
*/
public Map<String, String> getParameters() {
- return blocks.get(0).parameters;
+ return blocks.isEmpty() ? Collections.emptyMap() : blocks.get(0).parameters;
}
public boolean hasParameter(String name) {
@@ -38,7 +39,7 @@ public String getParameter(String name) {
@Override
public Expression getExpression(String parameterName) {
- return blocks.get(0).expressions.get(parameterName);
+ return blocks.isEmpty() ? null : blocks.get(0).expressions.get(parameterName);
}
@Override
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 147cb0de2a8..88ed9c6de02 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
@@ -58,4 +58,22 @@ public void testOptionalBlockEndTags() {
engine.parse("{#include super}{#header}super header{#footer}super footer{/include}").render());
}
+ @Test
+ public void testIncludeInLoop() {
+ Engine engine = Engine.builder().addDefaults().build();
+ engine.putTemplate("foo", engine.parse("{#insert snippet}empty{/insert}"));
+ assertEquals("1.2.3.4.5.",
+ engine.parse("{#for i in 5}{#include foo}{#snippet}{count}.{/snippet} this should be ingored {/include}{/for}")
+ .render());
+ }
+
+ @Test
+ public void testIncludeInIf() {
+ Engine engine = Engine.builder().addDefaults().build();
+ engine.putTemplate("foo", engine.parse("{#insert snippet}empty{/insert}"));
+ assertEquals("1",
+ engine.parse("{#if true}{#include foo} {#snippet}1{/snippet} {/include}{/if}")
+ .render());
+ }
+
} | ['independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/LoopSectionHelper.java', 'independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/SectionInitContextImpl.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 8,221,947 | 1,599,252 | 213,385 | 2,229 | 847 | 157 | 13 | 3 | 14,032 | 457 | 3,350 | 208 | 0 | 8 | 1970-01-01T00:26: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 |
3,093 | quarkusio/quarkus/8302/8294 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8294 | https://github.com/quarkusio/quarkus/pull/8302 | https://github.com/quarkusio/quarkus/pull/8302 | 1 | fixes | Using @ConfigProperty with Optional<List<String>> throw an exception | **Describe the bug**
Using:
```
@ConfigProperty(name = "items3")
Optional<List<String>> getItems3();
```
**Expected behavior**
Return an empty list when unset
**Actual behavior**
Throws an exception:
```
java.lang.IllegalArgumentException: No Converter registered for interface java.util.List
at io.smallrye.config.SmallRyeConfig.lambda$getConverter$1(SmallRyeConfig.java:202)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1705)
at io.smallrye.config.SmallRyeConfig.getConverter(SmallRyeConfig.java:199)
```
**To Reproduce**
Reproducer:
https://github.com/ia3andy/check-list-config-empty
**Environment (please complete the following information):**
- Quarkus version or git rev: 1.3.1.Final
| 41db86a2e2d881f50431fdcfb0d3ef7647a17a7c | fef18580a87b621aa352138ca19e7b14776f6f7b | https://github.com/quarkusio/quarkus/compare/41db86a2e2d881f50431fdcfb0d3ef7647a17a7c...fef18580a87b621aa352138ca19e7b14776f6f7b | diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java
index 5262640498e..9d8643ea1f5 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java
@@ -268,11 +268,27 @@ private static ResultHandle populateConfigObject(ClassLoader classLoader, ClassI
field.declaringClass().name());
// config.getOptionalValue
- ResultHandle setterValue = methodCreator.invokeInterfaceMethod(
- MethodDescriptor.ofMethod(Config.class, "getOptionalValue", Optional.class, String.class,
- Class.class),
- config, methodCreator.load(fullConfigName), methodCreator.loadClass(genericType.name().toString()));
- createWriteValue(methodCreator, configObject, field, setter, useFieldAccess, setterValue);
+ if (genericType.kind() != Type.Kind.PARAMETERIZED_TYPE) {
+ ResultHandle setterValue = methodCreator.invokeInterfaceMethod(
+ MethodDescriptor.ofMethod(Config.class, "getOptionalValue", Optional.class, String.class,
+ Class.class),
+ config, methodCreator.load(fullConfigName),
+ methodCreator.loadClass(genericType.name().toString()));
+ createWriteValue(methodCreator, configObject, field, setter, useFieldAccess, setterValue);
+ } else {
+ // convert the String value and populate an Optional with it
+ ReadOptionalResponse readOptionalResponse = createReadOptionalValueAndConvertIfNeeded(fullConfigName,
+ genericType, field.declaringClass().name(), methodCreator, config);
+ createWriteValue(readOptionalResponse.getIsPresentTrue(), configObject, field, setter, useFieldAccess,
+ readOptionalResponse.getIsPresentTrue().invokeStaticMethod(
+ MethodDescriptor.ofMethod(Optional.class, "of", Optional.class, Object.class),
+ readOptionalResponse.getValue()));
+
+ // set Optional.empty if the value isn't set
+ createWriteValue(readOptionalResponse.getIsPresentFalse(), configObject, field, setter, useFieldAccess,
+ readOptionalResponse.getIsPresentFalse().invokeStaticMethod(
+ MethodDescriptor.ofMethod(Optional.class, "empty", Optional.class)));
+ }
} else {
/*
* We want to support cases where the Config class defines a default value for fields
diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ConfigPropertiesUtil.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ConfigPropertiesUtil.java
index a17e0b939d9..76982cd50e5 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ConfigPropertiesUtil.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ConfigPropertiesUtil.java
@@ -94,7 +94,7 @@ static ReadOptionalResponse createReadOptionalValueAndConvertIfNeeded(String pro
return new ReadOptionalResponse(value, isPresentTrue, isPresentBranch.falseBranch(), effectiveTypeResponse);
}
- private static EffectiveTypeResponse getEffectiveResultType(Type resultType, DotName declaringClass) {
+ static EffectiveTypeResponse getEffectiveResultType(Type resultType, DotName declaringClass) {
if (DotNames.LIST.equals(resultType.name()) || DotNames.COLLECTION.equals(resultType.name())
|| DotNames.SET.equals(resultType.name())) {
/*
diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/InterfaceConfigPropertiesUtil.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/InterfaceConfigPropertiesUtil.java
index bd02a980f34..9d2fa1b4204 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/InterfaceConfigPropertiesUtil.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/InterfaceConfigPropertiesUtil.java
@@ -1,6 +1,7 @@
package io.quarkus.arc.deployment.configproperties;
import static io.quarkus.arc.deployment.configproperties.ConfigPropertiesUtil.createReadMandatoryValueAndConvertIfNeeded;
+import static io.quarkus.arc.deployment.configproperties.ConfigPropertiesUtil.createReadOptionalValueAndConvertIfNeeded;
import static io.quarkus.arc.deployment.configproperties.ConfigPropertiesUtil.determineSingleGenericType;
import java.lang.reflect.Modifier;
@@ -134,12 +135,32 @@ static String generateImplementationForInterfaceConfigProperties(ClassInfo origi
Type genericType = determineSingleGenericType(returnType,
method.declaringClass().name());
- ResultHandle result = methodCreator.invokeInterfaceMethod(
- MethodDescriptor.ofMethod(Config.class, "getOptionalValue", Optional.class, String.class,
- Class.class),
- config, methodCreator.load(fullConfigName),
- methodCreator.loadClass(genericType.name().toString()));
- methodCreator.returnValue(result);
+
+ if (genericType.kind() != Type.Kind.PARAMETERIZED_TYPE) {
+ ResultHandle result = methodCreator.invokeInterfaceMethod(
+ MethodDescriptor.ofMethod(Config.class, "getOptionalValue", Optional.class,
+ String.class,
+ Class.class),
+ config, methodCreator.load(fullConfigName),
+ methodCreator.loadClass(genericType.name().toString()));
+ methodCreator.returnValue(result);
+ } else {
+ // convert the String value and populate an Optional with it
+ ConfigPropertiesUtil.ReadOptionalResponse readOptionalResponse = createReadOptionalValueAndConvertIfNeeded(
+ fullConfigName,
+ genericType, method.declaringClass().name(), methodCreator, config);
+
+ // return Optional.empty() if no config value was read
+ readOptionalResponse.getIsPresentFalse()
+ .returnValue(readOptionalResponse.getIsPresentFalse().invokeStaticMethod(
+ MethodDescriptor.ofMethod(Optional.class, "empty", Optional.class)));
+
+ // return Optional.of() using the converted value
+ readOptionalResponse.getIsPresentTrue()
+ .returnValue(readOptionalResponse.getIsPresentTrue().invokeStaticMethod(
+ MethodDescriptor.ofMethod(Optional.class, "of", Optional.class, Object.class),
+ readOptionalResponse.getValue()));
+ }
} else {
if (defaultValueStr != null) {
/*
diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java
index 65d79dff90e..9a81c7c7998 100644
--- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java
+++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java
@@ -27,7 +27,7 @@ public class ClassWithAllPublicFieldsConfigPropertiesTest {
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(DummyBean.class, DummyProperties.class)
.addAsResource(new StringAsset(
- "dummy.name=quarkus\\ndummy.numbers=1,2,3,4\\ndummy.bool-with-default=true\\ndummy.optional-int=100"),
+ "dummy.name=quarkus\\ndummy.numbers=1,2,3,4\\ndummy.bool-with-default=true\\ndummy.optional-int=100\\ndummy.optional-int-list=1,2"),
"application.properties"));
@Inject
@@ -42,6 +42,9 @@ public void testConfiguredValues() {
assertTrue(dummyBean.getOptionalInt().isPresent());
assertEquals(100, dummyBean.getOptionalInt().get());
assertFalse(dummyBean.getOptionalString().isPresent());
+ assertFalse(dummyBean.getOptionalStringList().isPresent());
+ assertTrue(dummyBean.getOptionalIntList().isPresent());
+ assertEquals(Arrays.asList(1, 2), dummyBean.getOptionalIntList().get());
}
@Singleton
@@ -72,6 +75,14 @@ Optional<Integer> getOptionalInt() {
Optional<String> getOptionalString() {
return dummyProperties.optionalString;
}
+
+ Optional<List<String>> getOptionalStringList() {
+ return dummyProperties.optionalStringList;
+ }
+
+ Optional<List<Integer>> getOptionalIntList() {
+ return dummyProperties.optionalIntList;
+ }
}
@ConfigProperties(prefix = "dummy")
@@ -83,5 +94,7 @@ public static class DummyProperties {
public List<Integer> numbers;
public Optional<Integer> optionalInt;
public Optional<String> optionalString;
+ public Optional<List<String>> optionalStringList;
+ public Optional<List<Integer>> optionalIntList;
}
}
diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/TypicalInterfaceConfigPropertiesTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/TypicalInterfaceConfigPropertiesTest.java
index ba31954273c..c91f9e09a4f 100644
--- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/TypicalInterfaceConfigPropertiesTest.java
+++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/TypicalInterfaceConfigPropertiesTest.java
@@ -6,6 +6,7 @@
import java.util.Arrays;
import java.util.Collection;
+import java.util.List;
import java.util.Optional;
import javax.inject.Inject;
@@ -28,7 +29,7 @@ public class TypicalInterfaceConfigPropertiesTest {
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(DummyBean.class, DummyProperties.class)
.addAsResource(new StringAsset(
- "dummy.name=quarkus\\ndummy.numbers=1,2,3,4\\ndummy.boolWD=true\\ndummy.optional-int=100"),
+ "dummy.name=quarkus\\ndummy.numbers=1,2,3,4\\ndummy.boolWD=true\\ndummy.optional-int=100\\ndummy.optionalStringList=a,b"),
"application.properties"));
@Inject
@@ -44,6 +45,9 @@ public void testConfiguredValues() {
assertTrue(dummyBean.getOptionalInt().isPresent());
assertEquals(100, dummyBean.getOptionalInt().get());
assertFalse(dummyBean.getOptionalString().isPresent());
+ assertFalse(dummyBean.getIntListOptional().isPresent());
+ assertTrue(dummyBean.getStringListOptional().isPresent());
+ assertEquals(Arrays.asList("a", "b"), dummyBean.getStringListOptional().get());
}
@Singleton
@@ -76,6 +80,14 @@ Optional<String> getOptionalString() {
return dummyProperties.stringOptional();
}
+ Optional<List<String>> getStringListOptional() {
+ return dummyProperties.stringListOptional();
+ }
+
+ Optional<List<Integer>> getIntListOptional() {
+ return dummyProperties.intListOptional();
+ }
+
String nameWithSuffix() {
return dummyProperties.nameWithSuffix();
}
@@ -100,6 +112,12 @@ public interface DummyProperties {
@ConfigProperty(name = "optionalString")
Optional<String> stringOptional();
+ @ConfigProperty(name = "optionalStringList")
+ Optional<List<String>> stringListOptional();
+
+ @ConfigProperty(name = "optionalIntList")
+ Optional<List<Integer>> intListOptional();
+
default String nameWithSuffix() {
return getFirstName() + "!";
} | ['extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/ClassWithAllPublicFieldsConfigPropertiesTest.java', 'extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ConfigPropertiesUtil.java', 'extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/ClassConfigPropertiesUtil.java', 'extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/configproperties/InterfaceConfigPropertiesUtil.java', 'extensions/arc/deployment/src/test/java/io/quarkus/arc/test/configproperties/TypicalInterfaceConfigPropertiesTest.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 8,224,204 | 1,599,665 | 213,428 | 2,230 | 5,184 | 720 | 61 | 3 | 779 | 56 | 181 | 27 | 1 | 2 | 1970-01-01T00:26: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 |
3,094 | quarkusio/quarkus/8283/8260 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8260 | https://github.com/quarkusio/quarkus/pull/8283 | https://github.com/quarkusio/quarkus/pull/8283 | 1 | fixes | Prohibited package name: java.util.concurrent | **Describe the bug**
I tried to upgrade quarkus version (platform + plugin) to 1.3.0.Final and 1.3.1.Final, but maven build failed due to error in instantiation of test:
```
...fileDownload Time elapsed: 0.021 s <<< ERROR!
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.SecurityException: Prohibited package name: java.util.concurrent
```
I guess, it is somehow project related, because I couldn't reproduce the issue in basic demo application. The test was executed fine with quarkus 1.2.0.Final
I tried to search in all project depedencies if I spot a class within the that java package but no luck.
Is there a way, how to get more info from quarkus, what was wrong? I tried to enable TRACE log level in application.properties (in test/resources) but again, just those
**Expected behavior**
The tests annotated by @QuarkusTest annotation should be executed fine or it should get back more explanatory error message, which class was in prohibited package.
**Actual behavior**
Test fails due to following issue : Caused by: java.lang.SecurityException: Prohibited package name: java.util.concurrent
**To Reproduce**
Steps to reproduce the behavior:
Not able to reproduce it.
**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`:
Linux name-VirtualBox 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`:
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b06)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 25.242-b06-jvmci-20.0-b02, mixed mode)
- GraalVM version (if different from Java):
- Quarkus version or git rev: 1.3.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/<>/Tools/maven
Java version: 1.8.0_242, vendor: Oracle Corporation, runtime: /home/<>/Tools/graalvm/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-91-generic", arch: "amd64", family: "unix"
**Additional context**
(Add any other context about the problem here.)
| dded561efe07ed5de7d4971f9fc16ad6c45b5dea | b3fe1e9882a26adff63202633a08c1be3488553d | https://github.com/quarkusio/quarkus/compare/dded561efe07ed5de7d4971f9fc16ad6c45b5dea...b3fe1e9882a26adff63202633a08c1be3488553d | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
index feb0e97ae9d..5bfd53defe2 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
@@ -35,6 +35,7 @@ public class QuarkusClassLoader extends ClassLoader implements Closeable {
private static final Logger log = Logger.getLogger(QuarkusClassLoader.class);
protected static final String META_INF_SERVICES = "META-INF/services/";
+ protected static final String JAVA = "java.";
static {
registerAsParallelCapable();
@@ -276,6 +277,9 @@ public Class<?> loadClass(String name) throws ClassNotFoundException {
@Override
protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ if (name.startsWith(JAVA)) {
+ return parent.loadClass(name);
+ }
//even if the thread is interrupted we still want to be able to load classes
//if the interrupt bit is set then we clear it and restore it at the end
boolean interrupted = Thread.interrupted(); | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,199,641 | 1,594,438 | 212,869 | 2,225 | 143 | 28 | 4 | 1 | 2,575 | 320 | 687 | 54 | 0 | 2 | 1970-01-01T00:26: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 |
3,095 | quarkusio/quarkus/8247/8246 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8246 | https://github.com/quarkusio/quarkus/pull/8247 | https://github.com/quarkusio/quarkus/pull/8247 | 1 | fixes | quarkus.container-image.registry is not reflected, docker.io is always used | Trying to push the image to quay.io, docker.io is always used
It seems quarkus.container-image.registry is not reflected in the push command
I will look into it and try to fix is.
| a1768757089ea347693e4bdca1517fe0cba01d58 | b5023c8fc43c5b7abf991a1aa717d7e2e33d2b19 | https://github.com/quarkusio/quarkus/compare/a1768757089ea347693e4bdca1517fe0cba01d58...b5023c8fc43c5b7abf991a1aa717d7e2e33d2b19 | diff --git a/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerProcessor.java b/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerProcessor.java
index e25f53c01ee..eb186d74536 100644
--- a/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerProcessor.java
+++ b/extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerProcessor.java
@@ -118,12 +118,15 @@ private void createContainerImage(ContainerImageConfig containerImageConfig, Doc
log.infof("Pushed container image %s (%s)\\n", image, reader.getImageId());
if (pushRequested || containerImageConfig.push) {
+ String registry = "docker.io";
if (!containerImageConfig.registry.isPresent()) {
log.info("No container image registry was set, so 'docker.io' will be used");
+ } else {
+ registry = containerImageConfig.registry.get();
}
// Check if we need to login first
if (containerImageConfig.username.isPresent() && containerImageConfig.password.isPresent()) {
- boolean loginSuccessful = ExecUtil.exec("docker", "login", "-u", containerImageConfig.username.get(),
+ boolean loginSuccessful = ExecUtil.exec("docker", "login", registry, "-u", containerImageConfig.username.get(),
"-p" + containerImageConfig.password.get());
if (!loginSuccessful) {
throw dockerException(new String[] { "-u", containerImageConfig.username.get(), "-p", "********" }); | ['extensions/container-image/container-image-docker/deployment/src/main/java/io/quarkus/container/image/docker/deployment/DockerProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,196,373 | 1,593,988 | 212,772 | 2,225 | 378 | 69 | 5 | 1 | 187 | 31 | 43 | 6 | 0 | 0 | 1970-01-01T00:26: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 |
3,096 | quarkusio/quarkus/8219/8217 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8217 | https://github.com/quarkusio/quarkus/pull/8219 | https://github.com/quarkusio/quarkus/pull/8219 | 1 | resolves | Qute - computed section helpers used during validation don't play well with {#include} | As a result section blocks in an `{#include}` section must also define an end tag which is normally optional. | e1492fb9a5273f8ae4b2d12a89ac561ea6e0f4f4 | d3c2976bcd211d5127c6de0f5e0909600e1b5099 | https://github.com/quarkusio/quarkus/compare/e1492fb9a5273f8ae4b2d12a89ac561ea6e0f4f4...d3c2976bcd211d5127c6de0f5e0909600e1b5099 | diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/include/IncludeTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/include/IncludeTest.java
index ce75ef68f87..b0c80dd229f 100644
--- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/include/IncludeTest.java
+++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/include/IncludeTest.java
@@ -18,15 +18,16 @@ public class IncludeTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
- .addAsResource(new StringAsset("{#insert item}NOK{/}"), "templates/base.html")
- .addAsResource(new StringAsset("{#include base}{#item}OK{/}{/}"), "templates/detail.html"));
+ .addAsResource(new StringAsset("{#insert item}NOK{/}:{#insert foo}default foo{/}"), "templates/base.html")
+ .addAsResource(new StringAsset("{#include base}{#item}OK{/}{#foo}my foo{/include}"),
+ "templates/detail.html"));
@Inject
Template detail;
@Test
public void testIncludeSection() {
- assertEquals("OK", detail.render());
+ assertEquals("OK:my foo", detail.render());
}
}
diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/EngineImpl.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/EngineImpl.java
index 385c0b097df..0dfdf59ccca 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/EngineImpl.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/EngineImpl.java
@@ -44,7 +44,7 @@ class EngineImpl implements Engine {
EngineImpl(Map<String, SectionHelperFactory<?>> sectionHelperFactories, List<ValueResolver> valueResolvers,
List<NamespaceResolver> namespaceResolvers, List<TemplateLocator> locators,
List<ResultMapper> resultMappers, Function<String, SectionHelperFactory<?>> sectionHelperFunc) {
- this.sectionHelperFactories = new HashMap<>(sectionHelperFactories);
+ this.sectionHelperFactories = Collections.unmodifiableMap(new HashMap<>(sectionHelperFactories));
this.valueResolvers = sort(valueResolvers);
this.namespaceResolvers = ImmutableList.copyOf(namespaceResolvers);
this.evaluator = new EvaluatorImpl(this.valueResolvers);
@@ -82,7 +82,7 @@ public SectionHelperFactory<?> getSectionHelperFactory(String name) {
}
public Map<String, SectionHelperFactory<?>> getSectionHelperFactories() {
- return Collections.unmodifiableMap(sectionHelperFactories);
+ return sectionHelperFactories;
}
public List<ValueResolver> getValueResolvers() {
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 c91eb18173c..6eef6d20bf3 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
@@ -263,7 +263,7 @@ private void flushTag() {
// Add a section block if the section name matches a section block label or does not map to any section helper and the last section treats unknown subsections as blocks
if (lastSection != null && lastSection.factory.getBlockLabels().contains(sectionName)
|| (lastSection.factory.treatUnknownSectionsAsBlocks()
- && engine.getSectionHelperFactory(sectionName) == null)) {
+ && !engine.getSectionHelperFactories().containsKey(sectionName))) {
// Section block
if (!ignoreContent) {
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 cf87f46fdf5..147cb0de2a8 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
@@ -50,4 +50,12 @@ public void testIncludeSimpleData() {
engine.parse("{#include detail/}").render(data));
}
+ @Test
+ public void testOptionalBlockEndTags() {
+ Engine engine = Engine.builder().addDefaults().build();
+ engine.putTemplate("super", engine.parse("{#insert header}header{/}:{#insert footer /}"));
+ assertEquals("super header:super footer",
+ engine.parse("{#include super}{#header}super header{#footer}super footer{/include}").render());
+ }
+
} | ['independent-projects/qute/core/src/main/java/io/quarkus/qute/EngineImpl.java', 'extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/include/IncludeTest.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java', 'independent-projects/qute/core/src/test/java/io/quarkus/qute/IncludeTest.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 8,195,969 | 1,593,908 | 212,766 | 2,225 | 477 | 82 | 6 | 2 | 110 | 19 | 24 | 1 | 0 | 0 | 1970-01-01T00:26: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 |
3,097 | quarkusio/quarkus/8176/8156 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8156 | https://github.com/quarkusio/quarkus/pull/8176 | https://github.com/quarkusio/quarkus/pull/8176 | 1 | fixes | Quarkus hello.world image build fails when using openjdk-8u252-jvmci-20.0-b03 | **Describe the bug**
Building a Quarkus hello.world image fails when using a GraalVM built from https://github.com/graalvm/graal-jvmci-8/releases/download/jvmci-20.0-b03/openjdk-8u252-jvmci-20.0-b03-linux-amd64.tar.gz
```
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hello.world ---
[INFO] Building jar: /home/pwoegere/OLabs/issues/GR-21959/hello.world/target/hello.world-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- quarkus-maven-plugin:1.2.0.Final:build (default) @ hello.world ---
[INFO] [org.jboss.threads] JBoss Threads version 3.0.0.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building thin jar: /home/pwoegere/OLabs/issues/GR-21959/hello.world/target/hello.world-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 1055ms
[INFO]
[INFO] --- quarkus-maven-plugin:1.2.0.Final:native-image (default) @ hello.world ---
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /home/pwoegere/OLabs/issues/GR-21959/hello.world/target/hello.world-1.0-SNAPSHOT-native-image-source-jar/hello.world-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /home/pwoegere/OLabs/issues/GR-21959/hello.world/target/hello.world-1.0-SNAPSHOT-native-image-source-jar/hello.world-1.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.1.0-dev LIBGRAAL (Java Version 1.8.0_252)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /home/pwoegere/OLabs/issues/GR-21959/graal/vm/latest_graalvm_home/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar hello.world-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace hello.world-1.0-SNAPSHOT-runner
[hello.world-1.0-SNAPSHOT-runner:47922] classlist: 4,574.43 ms, 1.36 GB
[hello.world-1.0-SNAPSHOT-runner:47922] (cap): 653.05 ms, 1.36 GB
[hello.world-1.0-SNAPSHOT-runner:47922] setup: 2,072.65 ms, 1.36 GB
15:10:54,309 INFO [org.jbo.threads] JBoss Threads version 3.0.0.Final
[hello.world-1.0-SNAPSHOT-runner:47922] (clinit): 582.35 ms, 1.95 GB
[hello.world-1.0-SNAPSHOT-runner:47922] (typeflow): 11,011.49 ms, 1.95 GB
[hello.world-1.0-SNAPSHOT-runner:47922] (objects): 8,593.85 ms, 1.95 GB
[hello.world-1.0-SNAPSHOT-runner:47922] (features): 388.07 ms, 1.95 GB
[hello.world-1.0-SNAPSHOT-runner:47922] analysis: 21,522.86 ms, 1.95 GB
Error: Unsupported features in 4 methods
Detailed message:
Error: Class initialization of io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine failed. Use the option --initialize-at-run-time=io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine to explicitly request delayed initialization of this class.
Original exception that caused the problem: java.lang.NoClassDefFoundError: org/eclipse/jetty/alpn/ALPN$Provider
at sun.misc.Unsafe.ensureClassInitialized(Native Method)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.ensureClassInitialized(ConfigurableClassInitialization.java:167)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:560)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.computeInitKindAndMaybeInitializeClass(ConfigurableClassInitialization.java:130)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.maybeInitializeHosted(ConfigurableClassInitialization.java:158)
at com.oracle.svm.hosted.SVMHost.registerType(SVMHost.java:200)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.createType(AnalysisUniverse.java:264)
at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:205)
at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupType(WrappedConstantPool.java:155)
at org.graalvm.compiler.java.BytecodeParser.lookupType(BytecodeParser.java:4248)
at org.graalvm.compiler.java.BytecodeParser.genNewInstance(BytecodeParser.java:4505)
at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5303)
at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3397)
at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3204)
at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1085)
at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:979)
at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
at org.graalvm.compiler.phases.Phase.run(Phase.java:49)
at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:209)
at org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
at org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:221)
at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:340)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:310)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:300)
at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:107)
at com.oracle.graal.pointsto.flow.StaticInvokeTypeFlow.update(InvokeTypeFlow.java:346)
at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:523)
at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:175)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.alpn.ALPN$Provider
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
... 34 more
```
**Expected behavior**
Doing the same as above but based on the previous https://github.com/graalvm/openjdk8-jvmci-builder/releases/tag/jvmci-20.0-b02 release results in a successful build. The same should work when using a GraalVM release based on jvmci-20.0-b03.
**Actual behavior**
Building the Quarkus hello.world image when using a GraalVM release based on jvmci-20.0-b03 fails with the error message shown above.
**To Reproduce**
Steps to reproduce the behavior:
1. Get and extract https://github.com/graalvm/graal-jvmci-8/releases/download/jvmci-20.0-b03/openjdk-8u252-jvmci-20.0-b03-linux-amd64.tar.gz
2. Set `JAVA_HOME` to the openjdk-8u252-jvmci-20.0-b03 release
3. Clone https://github.com/oracle/graal/
4. Change to `graal/vm` & build a GraalVM with `mx --dy /substratevm --disable-installables=true --force-bash-launchers=gu,native-image-configure,polyglot --skip-libraries=native-image-agent,polyglot`
5. Clone https://github.com/olpaw/quarkus-hello-world and change to `quarkus-hello-world`
6. Build with `GRAALVM_HOME=<path-to>/graal/vm/latest_graalvm_home mvn package -Pnative` to see the error message decribed above.
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Linux olpaw.lan 5.5.10-200.fc31.x86_64 #1 SMP Wed Mar 18 14:21:38 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`:
```
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b05)
OpenJDK 64-Bit Server VM (build 25.252-b05-jvmci-20.0-b03, mixed mode)
```
- GraalVM version (if different from Java): see Steps to reproduce pt 4.
- Quarkus version or git rev: 1.2.0.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.5.4 (Red Hat 3.5.4-5) | 4c02d4f992c1761c1c7823465c09e20473d26dcc | db174d3f3480e871e0c49dc7cd7bc7fc3fb68d57 | https://github.com/quarkusio/quarkus/compare/4c02d4f992c1761c1c7823465c09e20473d26dcc...db174d3f3480e871e0c49dc7cd7bc7fc3fb68d57 | diff --git a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
index b3c4f28ad88..37ae94beb6f 100644
--- a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
+++ b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
@@ -122,18 +122,18 @@ public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc,
@TargetClass(className = "io.netty.handler.ssl.JettyAlpnSslEngine", onlyWith = JDK8OrEarlier.class)
final class Target_io_netty_handler_ssl_JettyAlpnSslEngine {
- @Alias
+ @Substitute
static boolean isAvailable() {
return false;
}
- @Alias
+ @Substitute
static Target_io_netty_handler_ssl_JettyAlpnSslEngine newClientEngine(SSLEngine engine,
JdkApplicationProtocolNegotiator applicationNegotiator) {
return null;
}
- @Alias
+ @Substitute
static Target_io_netty_handler_ssl_JettyAlpnSslEngine newServerEngine(SSLEngine engine,
JdkApplicationProtocolNegotiator applicationNegotiator) {
return null; | ['extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,157,677 | 1,585,957 | 211,649 | 2,213 | 86 | 27 | 6 | 1 | 8,644 | 486 | 2,471 | 99 | 5 | 2 | 1970-01-01T00:26: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 |
3,100 | quarkusio/quarkus/8108/8009 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8009 | https://github.com/quarkusio/quarkus/pull/8108 | https://github.com/quarkusio/quarkus/pull/8108 | 1 | fixes | Quarkus Kotlin extension not added in Bootstrap Kotlin+Gradle Project | **Describe the bug**
Quarkus Kotlin extension is not added in dependencies Bootstrap Kotlin+Gradle Project
**Expected behavior**
It should be added to to `dependencies` block
**Actual behavior**
It is not added to to `dependencies` block
**To Reproduce**
Steps to reproduce the behavior:
- Bootstrap kotlin+gradle project
```
mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create \\
-DprojectGroupId=org.acme \\
-DprojectArtifactId=kotlin-test-gradle \\
-DclassName="org.acme.fruitStore.FruitResource" \\
-Dpath="/fruits" \\
-DplatformArtifactId=quarkus-bom \\
-Dextensions="kotlin,resteasy-jsonb" \\
-DbuildTool=gradle
```
**Environment (please complete the following information):**
- Build tool : Gradle 6.1.1
| 9f9788c78bc82f7ce6e1f79038f030e5458fde94 | 1490af52c89ef235663920aaa030a4401f7aa477 | https://github.com/quarkusio/quarkus/compare/9f9788c78bc82f7ce6e1f79038f030e5458fde94...1490af52c89ef235663920aaa030a4401f7aa477 | diff --git a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java
index caf1fab6a3b..df61b6767de 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java
@@ -214,7 +214,8 @@ public void execute() throws MojoExecutionException {
File createdDependenciesBuildFile = new File(projectRoot, buildToolEnum.getDependenciesFile());
File buildFile = new File(createdDependenciesBuildFile.getAbsolutePath());
if (success) {
- success = new AddExtensions(projectWriter, platform).extensions(extensions).execute().isSuccess();
+ success = new AddExtensions(projectWriter, buildToolEnum, platform).extensions(extensions).execute()
+ .isSuccess();
}
if (BuildTool.MAVEN.equals(buildToolEnum)) {
createMavenWrapper(createdDependenciesBuildFile, ToolsUtils.readQuarkusProperties(platform));
diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java
index 2fefe7f6247..5cb2bc5ac6a 100644
--- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java
+++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java
@@ -207,6 +207,32 @@ public void testProjectGenerationFromScratchWithExtensions() throws Exception {
&& d.getVersion() == null)).isTrue();
}
+ @Test
+ public void testGradleProjectGenerationFromScratchWithExtensions() throws Exception {
+ testDir = initEmptyProject("projects/gradle-project-generation-with-extensions");
+ assertThat(testDir).isDirectory();
+ invoker = initInvoker(testDir);
+
+ Properties properties = new Properties();
+ properties.put("projectGroupId", "org.acme");
+ properties.put("projectArtifactId", "acme");
+ properties.put("className", "org.acme.MyResource");
+ properties.put("extensions", "kotlin,jackson");
+ properties.put("buildTool", "gradle");
+ setup(properties);
+
+ // As the directory is not empty (log) navigate to the artifactID directory
+ testDir = new File(testDir, "acme");
+
+ assertThat(new File(testDir, "build.gradle")).isFile();
+ assertThat(new File(testDir, "src/main/kotlin")).isDirectory();
+
+ check(new File(testDir, "src/main/kotlin/org/acme/MyResource.kt"), "package org.acme");
+
+ assertThat(FileUtils.readFileToString(new File(testDir, "build.gradle"), "UTF-8"))
+ .contains("quarkus-kotlin", "quarkus-jackson").doesNotContain("missing");
+ }
+
@Test
public void testProjectGenerationFromScratchWithCustomDependencies() throws Exception {
testDir = initEmptyProject("projects/project-generation-with-resource-and-custom-deps"); | ['devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java', 'integration-tests/maven/src/test/java/io/quarkus/maven/it/CreateProjectMojoIT.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 8,148,809 | 1,584,163 | 211,430 | 2,212 | 272 | 46 | 3 | 1 | 751 | 75 | 195 | 29 | 0 | 1 | 1970-01-01T00:26: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 |
3,101 | quarkusio/quarkus/8099/7996 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7996 | https://github.com/quarkusio/quarkus/pull/8099 | https://github.com/quarkusio/quarkus/pull/8099 | 1 | fixes | Quarkus 1.3.0.Final gradle does not start with Undertow Servlet | **Describe the bug**
When I include Undertow Servlet in a Gradle project, quarkus application does not start.
**Expected behavior**
Quarkus app should start without throwing an error
**Actual behavior**
(Describe the actual behavior clearly and concisely.)
**To Reproduce**
Steps to reproduce the behavior:
1. Go to https://code.quarkus.io/
2. Change Build Tool to: Gradle
3. Add Undertow Servlet as a dependency.
4. Generate project
5. Try running with quarkusDev build task.
Project throws java.lang.ExceptionInInitializerError
The same configuration when used with maven starts fine.
**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.)
| e1fa8201567b2c894ebad125c0ae535dd9631bf9 | f6dc75afae158026fbcabf0791e650d3fac69f7e | https://github.com/quarkusio/quarkus/compare/e1fa8201567b2c894ebad125c0ae535dd9631bf9...f6dc75afae158026fbcabf0791e650d3fac69f7e | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
index ddfaf1b3481..8f489ad1672 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
@@ -34,6 +34,7 @@
public class QuarkusClassLoader extends ClassLoader implements Closeable {
private static final Logger log = Logger.getLogger(QuarkusClassLoader.class);
+ protected static final String META_INF_SERVICES = "META-INF/services/";
static {
registerAsParallelCapable();
@@ -132,6 +133,27 @@ public Enumeration<URL> getResources(String nm) throws IOException {
// resources.add(element.getResource(nm).getUrl());
// }
//}
+
+ //this is a big of a hack, but is nessesary to prevent service leakage
+ //in some situations (looking at you gradle) the parent can contain the same
+ //classes as the application. The parent aggregation stops this being a problem
+ //in most cases, however if there are no actual implementations of the service
+ //in the application then this can still cause problems
+ //this approach makes sure that we don't load services that would result
+ //in a ServiceConfigurationError
+ //see https://github.com/quarkusio/quarkus/issues/7996
+ if (name.startsWith(META_INF_SERVICES)) {
+ try {
+ Class<?> c = loadClass(name.substring(META_INF_SERVICES.length()));
+ if (c.getClassLoader() == this) {
+ //if the service class is defined by this class loader then any resources that could be loaded
+ //by the parent would have a different copy of the service class
+ banned = true;
+ }
+ } catch (ClassNotFoundException ignored) {
+ //ignore
+ }
+ }
for (ClassPathElement i : elements) {
ClassPathResource res = i.getResource(nm);
if (res != null) { | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,135,000 | 1,581,667 | 211,131 | 2,208 | 1,245 | 243 | 22 | 1 | 980 | 134 | 233 | 33 | 1 | 0 | 1970-01-01T00:26: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 |
3,104 | quarkusio/quarkus/8010/7990 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7990 | https://github.com/quarkusio/quarkus/pull/8010 | https://github.com/quarkusio/quarkus/pull/8010 | 1 | fixes | Native container-build on Windows10 fails (.exe) | **Describe the bug**
Building a native image inside docker causes an error.
It seems the build is looking for a **.exe** file. But with containerized build inside docker no **.exe** file is generated - and that is okay :-)
**Expected behavior**
Linux executable generated.
**Actual behavior**
```
[INFO] --- quarkus-maven-plugin:1.3.0.Final:build (default) @ example ---
[INFO] [org.jboss.threads] JBoss Threads version 3.0.1.Final
[INFO] [org.hibernate.Version] HHH000412: Hibernate ORM core version 5.4.12.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: C:\\git\\CA.micro\\example-quarkus\\example\\target\\example-1.0.0-SNAPSHOT-native-image-source-jar\\example-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from C:\\git\\CA.micro\\example-quarkus\\example\\target\\example-1.0.0-SNAPSHOT-native-image-source-jar\\example-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Pulling image quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11
20.0.0-java11: Pulling from quarkus/ubi-quarkus-native-image
57de4da701b5: Pull complete
cf0f3ebe9f53: Pull complete
bc826280acdc: Pull complete
Digest: sha256:7716147f3621829b8039dec6c2c56ec9eaea705e5d1b83899c600cc575c3a1a2
Status: Downloaded newer image for quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11
quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.0.0 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v //c/git/CA.micro/example-quarkus/example/target/example-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --rm quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -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=1 -J-Duser.language=de -J-Dfile.encoding=Cp1252 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar example-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -J-Xmx8g -H:-AddAllCharsets -H:-IncludeAllTimeZones -H:EnableURLProtocols=http,https --enable-all-security-services -H:-UseServiceLoaderFeature -H:+StackTrace example-1.0.0-SNAPSHOT-runner
Build on Server(pid: 28, port: 43973)*
[example-1.0.0-SNAPSHOT-runner:28] classlist: 33.900,33 ms, 1,00 GB
[example-1.0.0-SNAPSHOT-runner:28] (cap): 946,80 ms, 1,00 GB
[example-1.0.0-SNAPSHOT-runner:28] setup: 3.569,52 ms, 1,00 GB
15:50:57,711 INFO [org.hib.Version] HHH000412: Hibernate ORM core version 5.4.12.Final
15:50:57,742 INFO [org.hib.ann.com.Version] HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
15:50:57,846 INFO [org.hib.dia.Dialect] HHH000400: Using dialect: io.quarkus.hibernate.orm.runtime.dialect.QuarkusPostgreSQL10Dialect
15:51:00,713 INFO [org.jbo.threads] JBoss Threads version 3.0.1.Final
[example-1.0.0-SNAPSHOT-runner:28] (typeflow): 141.095,72 ms, 3,10 GB
[example-1.0.0-SNAPSHOT-runner:28] (objects): 66.946,90 ms, 3,10 GB
[example-1.0.0-SNAPSHOT-runner:28] (features): 3.858,65 ms, 3,10 GB
[example-1.0.0-SNAPSHOT-runner:28] analysis: 219.111,09 ms, 3,10 GB
[example-1.0.0-SNAPSHOT-runner:28] (clinit): 2.007,05 ms, 3,10 GB
[example-1.0.0-SNAPSHOT-runner:28] universe: 8.045,85 ms, 3,10 GB
[example-1.0.0-SNAPSHOT-runner:28] (parse): 14.765,83 ms, 2,36 GB
[example-1.0.0-SNAPSHOT-runner:28] (inline): 13.104,63 ms, 2,73 GB
[example-1.0.0-SNAPSHOT-runner:28] (compile): 105.498,51 ms, 2,80 GB
[example-1.0.0-SNAPSHOT-runner:28] compile: 140.530,07 ms, 2,80 GB
[example-1.0.0-SNAPSHOT-runner:28] image: 9.756,83 ms, 2,80 GB
[example-1.0.0-SNAPSHOT-runner:28] write: 4.205,53 ms, 2,80 GB
[example-1.0.0-SNAPSHOT-runner:28] [total]: 420.428,43 ms, 2,80 GB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17:00 min
[INFO] Finished at: 2020-03-19T16:57:19+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.3.0.Final:build (default) on project example: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Failed to build native image
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:352)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:938)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:273)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2027)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1551)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1442)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.nio.file.NoSuchFileException: C:\\git\\CA.micro\\example-quarkus\\example\\target\\example-1.0.0-SNAPSHOT-native-image-source-jar\\example-1.0.0-SNAPSHOT-runner.exe
[ERROR] at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
[ERROR] at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
[ERROR] at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
[ERROR] at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
[ERROR] at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
[ERROR] at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:198)
[ERROR] at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
[ERROR] at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
[ERROR] at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
[ERROR] at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
[ERROR] at java.base/java.nio.file.Files.walkFileTree(Files.java:2716)
[ERROR] at io.quarkus.bootstrap.util.IoUtils.copy(IoUtils.java:98)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:346)
[ERROR] ... 12 more
[ERROR] -> [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
```
**To Reproduce**
Steps to reproduce the behavior:
1. Start the build ``mvn clean package -Pnative``
**Configuration**
```
quarkus.native.container-build=true
quarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:20.0.0-java11
```
**Environment**
- Output of `uname -a` or `ver`: ``Microsoft Windows [Version 10.0.17134.1304]``
- Output of `java -version`:
```
openjdk version "11.0.6" 2020-01-14 LTS
OpenJDK Runtime Environment Zulu11.37+17-CA (build 11.0.6+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.37+17-CA (build 11.0.6+10-LTS, mixed mode)
```
- GraalVM version (if different from Java): ``20.0.0-java11``
- Quarkus version or git rev: ``1.3.0.Final``
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: C:\\devtools\\apache-maven-3.6.3\\bin\\..
Java version: 11.0.6, vendor: Azul Systems, Inc., runtime: C:\\Program Files\\Zulu\\zulu-11
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
```
| f75581c3ae7cd14165e3f63345d80ce0fb01392e | 0582165ead93227cb7e7f3a69af7860052eb2fe4 | https://github.com/quarkusio/quarkus/compare/f75581c3ae7cd14165e3f63345d80ce0fb01392e...0582165ead93227cb7e7f3a69af7860052eb2fe4 | 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 719874032cf..83a02c48afb 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
@@ -338,7 +338,8 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
if (exitCode != 0) {
throw imageGenerationFailed(exitCode, command);
}
- if (IS_WINDOWS) { //once image is generated it gets added .exe on windows
+ if (IS_WINDOWS && !(nativeConfig.containerRuntime.isPresent() || nativeConfig.containerBuild)) {
+ //once image is generated it gets added .exe on Windows
executableName = executableName + ".exe";
}
Path generatedImage = outputDir.resolve(executableName); | ['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,115,462 | 1,577,613 | 210,601 | 2,205 | 269 | 54 | 3 | 1 | 9,387 | 605 | 2,849 | 121 | 1 | 4 | 1970-01-01T00:26: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 |
3,107 | quarkusio/quarkus/7947/2923 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2923 | https://github.com/quarkusio/quarkus/pull/7947 | https://github.com/quarkusio/quarkus/pull/7947 | 1 | fixes | Class generation build items are screwy | We have a `GeneratedClassBuildItem` which accepts a class name, byte array, and a flag to indicate what "kind" of class it is.
At the same time, we have a pattern for generating classes, particularly with Gizmo: consume the `ClassOutputBuildItem` and then feed it to Gizmo and have it write the class directly to the `ClassOutput`.
On top of all this, we have two different kinds of `ClassOutput`.
The build item is not ideal because to use it with Gizmo, you have to create your own `ClassOutput` (the Gizmo one) and have it produce the generated classes (i.e. you can't just return a `GeneratedClassBuildItem` unless you stash the object somewhere).
The common Gizmo pattern of consuming the `ClassOutputBuildItem` is not ideal because nothing is produced - so the build step won't run unless you artificially produce something.
We should make the `ClassOutputBuildItem` work nicely with Gizmo and non-Gizmo usages. Maybe Gizmo should emit classes to an array by default, or maybe `ClassOutputBuildItem` should accept a supplier for class bytes that the Gizmo class factory can produce (if we're worried about heap usage). Maybe Gizmo's `ClassOutput` API should be replaced by a pull API like `ClassCreator.write(OutputStream)` or `ClassCreator.getBytes()` (or both).
| a0fd85a6f10f453100335e174d5f684210ccc925 | 955547ea092c5214928a56c149e70595fed51ae0 | https://github.com/quarkusio/quarkus/compare/a0fd85a6f10f453100335e174d5f684210ccc925...955547ea092c5214928a56c149e70595fed51ae0 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/ClassOutput.java b/core/deployment/src/main/java/io/quarkus/deployment/ClassOutput.java
deleted file mode 100644
index daf3f819b06..00000000000
--- a/core/deployment/src/main/java/io/quarkus/deployment/ClassOutput.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package io.quarkus.deployment;
-
-import java.io.IOException;
-import java.io.Writer;
-
-import io.quarkus.gizmo.NullWriter;
-
-/**
- * Interface that represents a target for generated bytecode
- */
-public interface ClassOutput {
-
- /**
- * Writes some generate bytecode to an output target
- *
- * @param className The class name
- * @param data The bytecode bytes
- * @throws IOException If the class cannot be written
- */
- void writeClass(boolean applicationClass, String className, byte[] data) throws IOException;
-
- void writeResource(String name, byte[] data) throws IOException;
-
- default Writer writeSource(String className) {
- return NullWriter.INSTANCE;
- }
-
-} | ['core/deployment/src/main/java/io/quarkus/deployment/ClassOutput.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,087,060 | 1,571,302 | 209,710 | 2,189 | 727 | 144 | 28 | 1 | 1,288 | 198 | 295 | 12 | 0 | 0 | 1970-01-01T00:26: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 |
3,040 | quarkusio/quarkus/9936/9847 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9847 | https://github.com/quarkusio/quarkus/pull/9936 | https://github.com/quarkusio/quarkus/pull/9936 | 1 | fixes | http access log attributes do not work | certain http access log attributes do not work, namely %t, %D
always getting "-" for those attributes in the log.
for the following pattern:
%t "%r" %s %b %D "%{i,Referer}" "%{i,User-Agent}"
getting the following line in the log file:
- "GET /_health HTTP_1_1" 200 2 - "-" "curl/7.58.0"
**Expected behavior**
%t - Date and time, in Common Log Format format
%D - Time taken to process the request, in millis
**Actual behavior**
always getting dashes ("-") for those attributes
**To Reproduce**
see the Configuration section.
**Configuration**
```properties
quarkus.http.access-log.enabled = true
quarkus.http.access-log.pattern = %t "%r" %s %b %D "%{i,Referer}" "%{i,User-Agent}"
quarkus.http.access-log.log-to-file = true
quarkus.http.access-log.base-file-name = http-access
quarkus.http.access-log.log-directory = /var/log/quarkus/http
```
**Environment (please complete the following information):**
x86_64 GNU/Linux
OpenJDK Runtime Environment Corretto-11.0.7.10.1 (build 11.0.7+10-LTS)
Quarkus 1.5.0
Apache Maven 3.6.3
| 1d456915dfc1a975ad797de9cef9ebd4843f9dcb | 465ca693bd6d7b53a01ade11fcaef7737ecc3671 | https://github.com/quarkusio/quarkus/compare/1d456915dfc1a975ad797de9cef9ebd4843f9dcb...465ca693bd6d7b53a01ade11fcaef7737ecc3671 | diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java
index e8660cbdec8..ade164d92f8 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java
@@ -1,7 +1,7 @@
package io.quarkus.vertx.http.runtime.attribute;
-import java.time.LocalDateTime;
import java.time.ZoneId;
+import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Locale;
@@ -41,7 +41,7 @@ public DateTimeAttribute(final String dateFormat, final String timezone) {
@Override
public String readAttribute(final RoutingContext exchange) {
- return formatter.format(LocalDateTime.now());
+ return formatter.format(ZonedDateTime.now());
}
@Override
diff --git a/extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttributeTest.java b/extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttributeTest.java
index 1b2dd007b2d..1c2359b768d 100644
--- a/extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttributeTest.java
+++ b/extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttributeTest.java
@@ -5,6 +5,7 @@
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class DateTimeAttributeTest {
@@ -15,4 +16,13 @@ void shouldReadAttribute() {
DateTimeAttribute dta = new DateTimeAttribute("dd/MM/yyyy");
assertThat(dta.readAttribute(null)).isEqualTo(sdf.format(new Date()));
}
+
+ @Test
+ void testDefaultDateFormat() {
+ final ExchangeAttribute attribute = new DateTimeAttribute.Builder().build(DateTimeAttribute.DATE_TIME_SHORT);
+ final String value = attribute.readAttribute(null);
+ Assertions.assertNotNull(value, DateTimeAttribute.DATE_TIME_SHORT + " attribute returned null");
+ Assertions.assertFalse(value.trim().isEmpty(), DateTimeAttribute.DATE_TIME_SHORT + " attribute returned empty value");
+ }
+
} | ['extensions/vertx-http/runtime/src/test/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttributeTest.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/DateTimeAttribute.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 9,424,383 | 1,831,629 | 244,360 | 2,623 | 175 | 27 | 4 | 1 | 1,072 | 128 | 310 | 37 | 0 | 1 | 1970-01-01T00:26: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 |
3,038 | quarkusio/quarkus/10016/10015 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10015 | https://github.com/quarkusio/quarkus/pull/10016 | https://github.com/quarkusio/quarkus/pull/10016 | 1 | fixes | Hibernate Reactive: sessions are not closed, connections leak | ATM, we have the following method to produce `Stage.Session` and `Mutiny.Session` tied to the request scope:
```java
package io.quarkus.hibernate.reactive.runtime;
import java.util.concurrent.CompletionStage;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import org.hibernate.reactive.mutiny.Mutiny;
import org.hibernate.reactive.stage.Stage;
import io.quarkus.arc.DefaultBean;
import io.smallrye.mutiny.Uni;
@ApplicationScoped
public class ReactiveSessionProducer {
@Inject
private Stage.SessionFactory reactiveSessionFactory;
@Inject
private Mutiny.SessionFactory mutinySessionFactory;
@Produces
@RequestScoped
@DefaultBean
public CompletionStage<Stage.Session> stageSession() {
return reactiveSessionFactory.openSession();
}
@Produces
@RequestScoped
@DefaultBean
public Uni<Mutiny.Session> mutinySession() {
return mutinySessionFactory.openSession();
}
public void disposeStageSession(@Disposes CompletionStage<Stage.Session> reactiveSession) {
reactiveSession.whenComplete((s, t) -> {
if (s != null)
s.close();
});
}
public void disposeMutinySession(@Disposes Uni<Mutiny.Session> reactiveSession) {
// TODO: @AGG this is not working, need to check w/ Clement to figure out the proper way
reactiveSession.on().termination((session, ex, cancelled) -> {
if (session != null)
session.close();
});
}
}
```
Now, the problem is that we're tying a `CompletionStage<Stage.Session>` (and respectively same for Mutiny) to the request, which is a promise of a session.
The `disposeStageSession` cannot work, because `CompletionStage` are immutable, and the value returned by `reactiveSession.whenComplete()` is never used, so this `s.close()` will never be called.
A similar issue exists for `disposeMutinySession` except it's possible that the `Uni<Mutiny.Session>` opens a new session for each call to `subscribe` (unless `cache()` is called on it, I don't know if it is) whereas for `CompletionStage` it's eager and will have a single session by design.
We can't do `whenComplete`/`on().termination` in `stageSession`/`mutinySession` either because that would close the session before we return it to the user.
To be frank, ATM I don't know how to register a way to auto-close what is lazily obtained by a CS/Uni and tied to the request scope. | 1efbafe938626577a3cde99c430e09d2f58ab78c | 67a3593102f81092315ed5b137ffbeba1f0d9828 | https://github.com/quarkusio/quarkus/compare/1efbafe938626577a3cde99c430e09d2f58ab78c...67a3593102f81092315ed5b137ffbeba1f0d9828 | 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 181d97d9d3b..6814c3e5d2a 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
@@ -34,7 +34,7 @@ public CompletionStage<Stage.Session> stageSession() {
@RequestScoped
@DefaultBean
public Uni<Mutiny.Session> mutinySession() {
- return mutinySessionFactory.openSession();
+ return mutinySessionFactory.openSession().cache();
}
public void disposeStageSession(@Disposes CompletionStage<Stage.Session> reactiveSession) {
@@ -45,11 +45,7 @@ public void disposeStageSession(@Disposes CompletionStage<Stage.Session> reactiv
}
public void disposeMutinySession(@Disposes Uni<Mutiny.Session> reactiveSession) {
- // TODO: @AGG this is not working, need to check w/ Clement to figure out the proper way
- reactiveSession.on().termination((session, ex, cancelled) -> {
- if (session != null)
- session.close();
- });
+ reactiveSession.subscribe().with(Mutiny.Session::close);
}
}
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 b71bfb7ae88..ec058f66f25 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
@@ -132,9 +132,8 @@ public Uni<String> reactiveUpdate() {
}
private Uni<RowSet<Row>> populateDB() {
- return db2Pool.getConnection()
- .flatMap(c -> c.preparedQuery("DELETE FROM Pig").execute().map(junk -> c))
- .flatMap(c -> c.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
+ return db2Pool.query("DELETE FROM Pig").execute()
+ .flatMap(junk -> db2Pool.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
}
private Uni<String> selectNameFromId(Integer id) {
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 4e1695a16e0..54b589b62c4 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
@@ -132,9 +132,8 @@ public Uni<String> reactiveUpdate() {
}
private Uni<RowSet<Row>> populateDB() {
- return mysqlPool.getConnection()
- .flatMap(c -> c.preparedQuery("DELETE FROM Pig").execute().map(junk -> c))
- .flatMap(c -> c.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
+ return mysqlPool.query("DELETE FROM Pig").execute()
+ .flatMap(junk -> mysqlPool.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
}
private Uni<String> selectNameFromId(Integer id) {
diff --git a/integration-tests/hibernate-reactive/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java b/integration-tests/hibernate-reactive/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java
index 147cc835cd3..a39039a542f 100644
--- a/integration-tests/hibernate-reactive/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java
+++ b/integration-tests/hibernate-reactive/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java
@@ -132,9 +132,8 @@ public Uni<String> reactiveUpdate() {
}
private Uni<RowSet<Row>> populateDB() {
- return pgPool.getConnection()
- .flatMap(c -> c.preparedQuery("DELETE FROM Pig").execute().map(junk -> c))
- .flatMap(c -> c.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
+ return pgPool.query("DELETE FROM Pig").execute()
+ .flatMap(junk -> pgPool.preparedQuery("INSERT INTO Pig (id, name) VALUES (5, 'Aloi')").execute());
}
private Uni<String> selectNameFromId(Integer id) { | ['integration-tests/hibernate-reactive-db2/src/main/java/io/quarkus/it/hibernate/reactive/db2/HibernateReactiveDB2TestEndpoint.java', 'integration-tests/hibernate-reactive-mysql/src/main/java/io/quarkus/it/hibernate/reactive/mysql/HibernateReactiveMySQLTestEndpoint.java', 'integration-tests/hibernate-reactive/src/main/java/io/quarkus/it/hibernate/reactive/postgresql/HibernateReactiveTestEndpoint.java', 'extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/ReactiveSessionProducer.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 9,482,521 | 1,842,726 | 245,655 | 2,643 | 428 | 84 | 8 | 1 | 2,670 | 268 | 578 | 69 | 0 | 1 | 1970-01-01T00:26: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,979 | quarkusio/quarkus/11513/11470 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11470 | https://github.com/quarkusio/quarkus/pull/11513 | https://github.com/quarkusio/quarkus/pull/11513 | 1 | fixes | Custom settings.xml is not honored by Quarkus (1.3, 1.7) when the path is relative | Custom settings.xml is not honored by Quarkus when the path is relative. Workaround is to set absolute path to settings.xml.
Spotted that when was trying to run Quarkus QS again released productized bit on https://maven.repository.redhat.com/ga
Bits got downloaded but test execution printed "Downloading from central: https://repo.maven.apache.org/maven2/com/redhat/quarkus/quarkus-universe-bom/1.3.4.Final-redhat-00004/quarkus-universe-bom-1.3.4.Final-redhat-00004.pom"
Quarkus implements own handling related to maven artifacts, there is probably issue in Quarkus bootstrap resolver.
I can't say if the problem is related to just 1.3 series or this is in 1.7 as upstream bits are always in central.
@aloubyansky this is probably for you.
**Reproducer**
```
git clone --branch 1.3.4.Final https://github.com/quarkusio/quarkus-quickstarts.git
code settings.xml ## see bellow
mvn -s settings.xml -f quarkus-quickstarts/pom.xml -pl getting-started clean test \\
-Dquarkus.platform.group-id=com.redhat.quarkus -Dquarkus.platform.artifact-id=quarkus-universe-bom \\
-Dquarkus.platform.version=1.3.4.Final-redhat-00004 -Dquarkus-plugin.version=1.3.4.Final-redhat-00004 \\
-Dmaven.repo.local=$PWD/local-repo
```
**Error:**
```
[INFO] Running org.acme.getting.started.GreetingResourceTest
Downloading from central: https://repo.maven.apache.org/maven2/com/redhat/quarkus/quarkus-universe-bom/1.3.4.Final-redhat-00004/quarkus-universe-bom-1.3.4.Final-redhat-00004.pom
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 1, Time elapsed: 0.875 s <<< FAILURE! - in org.acme.getting.started.GreetingResourceTest
[ERROR] testHelloEndpoint Time elapsed: 0.013 s <<< ERROR!
java.lang.RuntimeException: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for org.acme:getting-started::jar:1.0-SNAPSHOT
Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the application model for org.acme:getting-started::jar:1.0-SNAPSHOT
Caused by: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to read descriptor of org.acme:getting-started:jar:1.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.acme:getting-started:jar:1.0-SNAPSHOT
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not find artifact com.redhat.quarkus:quarkus-universe-bom:pom:1.3.4.Final-redhat-00004 in central (https://repo.maven.apache.org/maven2)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact com.redhat.quarkus:quarkus-universe-bom:pom:1.3.4.Final-redhat-00004 in central (https://repo.maven.apache.org/maven2)
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.redhat.quarkus:quarkus-universe-bom:pom:1.3.4.Final-redhat-00004 in central (https://repo.maven.apache.org/maven2)
```
**settings.xml**
```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<profiles>
<profile>
<id>rh</id>
<repositories>
<repository>
<id>red-hat-enterprise-maven-repository</id>
<url>https://maven.repository.redhat.com/ga/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>red-hat-enterprise-maven-repository</id>
<url>https://maven.repository.redhat.com/ga/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>rh</activeProfile>
</activeProfiles>
</settings>
```
**Workaround**
`mvn -s settings.xml` => `mvn -s $PWD/settings.xml` | eb015864ba85f90a4d2ca320257236dd4bc8a398 | 00352c14ad03d34bd60258f418166245114de2ce | https://github.com/quarkusio/quarkus/compare/eb015864ba85f90a4d2ca320257236dd4bc8a398...00352c14ad03d34bd60258f418166245114de2ce | diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
index e055581cbd6..dcea225818d 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
@@ -147,20 +147,7 @@ public BootstrapMavenContext(BootstrapMavenContextConfig<?> config)
currentProject = resolveCurrentProject();
this.workspace = currentProject == null ? null : currentProject.getWorkspace();
}
- userSettings = config.userSettings == null
- ? resolveSettingsFile(getCliOptions().getOptionValue(BootstrapMavenOptions.ALTERNATE_USER_SETTINGS),
- () -> {
- final String quarkusMavenSettings = PropertyUtils.getProperty(MAVEN_SETTINGS);
- return quarkusMavenSettings == null ? new File(userMavenConfigurationHome, SETTINGS_XML)
- : new File(quarkusMavenSettings);
- })
- : config.userSettings;
- globalSettings = resolveSettingsFile(getCliOptions().getOptionValue(BootstrapMavenOptions.ALTERNATE_GLOBAL_SETTINGS),
- () -> {
- final String envM2Home = System.getenv(MAVEN_HOME);
- return new File(PropertyUtils.getProperty(MAVEN_DOT_HOME, envM2Home != null ? envM2Home : ""),
- "conf/settings.xml");
- });
+ userSettings = config.userSettings;
}
public AppArtifact getCurrentProjectArtifact(String extension) throws BootstrapMavenException {
@@ -188,11 +175,27 @@ public BootstrapMavenOptions getCliOptions() {
}
public File getUserSettings() {
- return userSettings;
+ return userSettings == null
+ ? userSettings = resolveSettingsFile(
+ getCliOptions().getOptionValue(BootstrapMavenOptions.ALTERNATE_USER_SETTINGS),
+ () -> {
+ final String quarkusMavenSettings = PropertyUtils.getProperty(MAVEN_SETTINGS);
+ return quarkusMavenSettings == null ? new File(userMavenConfigurationHome, SETTINGS_XML)
+ : new File(quarkusMavenSettings);
+ })
+ : userSettings;
}
public File getGlobalSettings() {
- return globalSettings;
+ return globalSettings == null
+ ? globalSettings = resolveSettingsFile(
+ getCliOptions().getOptionValue(BootstrapMavenOptions.ALTERNATE_GLOBAL_SETTINGS),
+ () -> {
+ final String envM2Home = System.getenv(MAVEN_HOME);
+ return new File(PropertyUtils.getProperty(MAVEN_DOT_HOME, envM2Home != null ? envM2Home : ""),
+ "conf/settings.xml");
+ })
+ : globalSettings;
}
public boolean isOffline() throws BootstrapMavenException {
@@ -270,27 +273,43 @@ public static String resolveLocalRepo(Settings settings) {
return localRepo == null ? new File(userMavenConfigurationHome, "repository").getAbsolutePath() : localRepo;
}
- private static File resolveSettingsFile(String settingsArg, Supplier<File> supplier) {
+ private File resolveSettingsFile(String settingsArg, Supplier<File> supplier) {
File userSettings;
if (settingsArg != null) {
userSettings = new File(settingsArg);
if (userSettings.exists()) {
return userSettings;
}
- String base = System.getenv("MAVEN_PROJECTBASEDIR"); // Root project base dir
- if (base != null) {
- userSettings = new File(base, settingsArg);
- if (userSettings.exists()) {
- return userSettings;
- }
+ if (userSettings.isAbsolute()) {
+ return null;
}
- base = PropertyUtils.getProperty(BASEDIR); // current module project base dir
- if (base != null) {
- userSettings = new File(base, settingsArg);
- if (userSettings.exists()) {
- return userSettings;
+
+ // in case the settings path is a relative one we check whether the pom path is also a relative one
+ // in which case we can resolve the settings path relative to the project directory
+ // otherwise, we don't have a clue what the settings path is relative to
+ String alternatePomDir = getCliOptions().getOptionValue(BootstrapMavenOptions.ALTERNATE_POM_FILE);
+ if (alternatePomDir != null) {
+ File tmp = new File(alternatePomDir);
+ if (tmp.isAbsolute()) {
+ alternatePomDir = null;
+ } else {
+ if (!tmp.isDirectory()) {
+ tmp = tmp.getParentFile();
+ }
+ alternatePomDir = tmp.toString();
}
}
+
+ // Root project base dir
+ userSettings = resolveSettingsFile(settingsArg, alternatePomDir, System.getenv("MAVEN_PROJECTBASEDIR"));
+ if (userSettings != null) {
+ return userSettings;
+ }
+ // current module project base dir
+ userSettings = resolveSettingsFile(settingsArg, alternatePomDir, PropertyUtils.getProperty(BASEDIR));
+ if (userSettings != null) {
+ return userSettings;
+ }
userSettings = new File(PropertyUtils.getUserHome(), settingsArg);
if (userSettings.exists()) {
return userSettings;
@@ -300,6 +319,25 @@ private static File resolveSettingsFile(String settingsArg, Supplier<File> suppl
return userSettings.exists() ? userSettings : null;
}
+ private File resolveSettingsFile(String settingsArg, String alternatePomDir, String projectBaseDir) {
+ if (projectBaseDir == null) {
+ return null;
+ }
+ File userSettings;
+ if (alternatePomDir != null && projectBaseDir.endsWith(alternatePomDir)) {
+ userSettings = new File(projectBaseDir.substring(0, projectBaseDir.length() - alternatePomDir.length()),
+ settingsArg);
+ if (userSettings.exists()) {
+ return userSettings;
+ }
+ }
+ userSettings = new File(projectBaseDir, settingsArg);
+ if (userSettings.exists()) {
+ return userSettings;
+ }
+ return null;
+ }
+
private DefaultRepositorySystemSession newRepositorySystemSession() throws BootstrapMavenException {
final DefaultRepositorySystemSession session = MavenRepositorySystemUtils.newSession();
final Settings settings = getEffectiveSettings(); | ['independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,623,743 | 2,069,544 | 276,659 | 2,975 | 5,092 | 917 | 94 | 1 | 4,479 | 286 | 1,185 | 80 | 13 | 3 | 1970-01-01T00:26: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,970 | quarkusio/quarkus/11743/11736 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11736 | https://github.com/quarkusio/quarkus/pull/11743 | https://github.com/quarkusio/quarkus/pull/11743 | 1 | fixes | Active connection to MongoDB required for fresh project based on Quarkus master, wasn't needed for 1.7.0.Final and prior | Active connection to MongoDB required for fresh project based on master, wasn't needed for 1.7.0.Final and prior.
Getting NPE from SmallRyeMetricsRecorder.registerMetrics(SmallRyeMetricsRecorder.java:217)
Reproducer:
- build Quarkus master
- clone https://github.com/quarkus-qe/beefy-scenarios
- run `mvn clean verify -pl 002-quarkus-all-extensions/`
`mvn clean verify -pl 002-quarkus-all-extensions/ -Dquarkus.platform.version=1.7.0.Final -Dquarkus-plugin.version=1.7.0.Final` passes
Stacktrace (commented out io.quarkus:quarkus-logging-json tependency in 002-quarkus-all-extensions/pom.xml):
```
2020-08-31 10:15:01,619 INFO [org.mon.dri.cluster] (cluster-ClusterId{value='5f4cb1859520ed1f46c9241c', description='null'}-127.0.0.1:27017) Exception in monitor thread while connecting to server 127.0.0.1:27017: com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70)
at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:143)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:188)
at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
at java.base/java.net.Socket.connect(Socket.java:609)
at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:78)
at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79)
at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65)
... 4 more
2020-08-31 10:15:01,629 INFO [org.mon.dri.cluster] (cluster-ClusterId{value='5f4cb1859520ed1f46c9241d', description='null'}-127.0.0.1:27017) Exception in monitor thread while connecting to server 127.0.0.1:27017: com.mongodb.MongoSocketOpenException: Exception opening socket
at com.mongodb.internal.connection.AsynchronousSocketChannelStream$OpenCompletionHandler.failed(AsynchronousSocketChannelStream.java:124)
at java.base/sun.nio.ch.Invoker.invokeUnchecked(Invoker.java:129)
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:283)
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finish(UnixAsynchronousSocketChannelImpl.java:198)
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.onEvent(UnixAsynchronousSocketChannelImpl.java:213)
at java.base/sun.nio.ch.KQueuePort$EventHandlerTask.run(KQueuePort.java:312)
at java.base/sun.nio.ch.AsynchronousChannelGroupImpl$1.run(AsynchronousChannelGroupImpl.java:112)
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.net.ConnectException: Connection refused
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.checkConnect(Native Method)
at java.base/sun.nio.ch.UnixAsynchronousSocketChannelImpl.finishConnect(UnixAsynchronousSocketChannelImpl.java:252)
... 7 more
2020-08-31 10:15:01,677 ERROR [io.qua.application] (main) Failed to start application (with profile test): java.lang.NullPointerException
at io.quarkus.smallrye.metrics.runtime.SmallRyeMetricsRecorder.registerMetrics(SmallRyeMetricsRecorder.java:217)
at io.quarkus.deployment.steps.SmallRyeMetricsProcessor$registerRuntimeExtensionMetrics-632673255.deploy_0(SmallRyeMetricsProcessor$registerRuntimeExtensionMetrics-632673255.zig:74)
at io.quarkus.deployment.steps.SmallRyeMetricsProcessor$registerRuntimeExtensionMetrics-632673255.deploy(SmallRyeMetricsProcessor$registerRuntimeExtensionMetrics-632673255.zig:40)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:1035)
at io.quarkus.runtime.Application.start(Application.java:90)
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.run(StartupActionImpl.java:212)
```
| 4e0ed2e2fbfe4a5c83c889090d4d50c2ef5004a2 | 8775942525c833aa8975e914921a73f1443b0759 | https://github.com/quarkusio/quarkus/compare/4e0ed2e2fbfe4a5c83c889090d4d50c2ef5004a2...8775942525c833aa8975e914921a73f1443b0759 | diff --git a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java
index ccd68171859..ea9e3929f26 100644
--- a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java
+++ b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java
@@ -61,9 +61,10 @@ void metrics(Neo4jConfiguration configuration,
Neo4jDriverRecorder recorder,
BuildProducer<MetricsFactoryConsumerBuildItem> metrics) {
Consumer<MetricsFactory> metricsFactoryConsumer = recorder.registerMetrics(configuration);
- if (metricsFactoryConsumer != null) {
- metrics.produce(new MetricsFactoryConsumerBuildItem(metricsFactoryConsumer));
- }
+ // If metrics for neo4j are disabled, the returned consumer will be null,
+ // but in a processor we can't know that (it's controlled by a runtime config property)
+ // so the BuildItem might contain null and in that case will be ignored by the metrics recorder
+ metrics.produce(new MetricsFactoryConsumerBuildItem(metricsFactoryConsumer));
}
}
diff --git a/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java b/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
index e9a16c7a8b1..3f546c26035 100644
--- a/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
+++ b/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
@@ -214,7 +214,9 @@ public void registerMetric(MetricRegistry.Type scope,
}
public void registerMetrics(Consumer<MetricsFactory> consumer) {
- consumer.accept(factory);
+ if (consumer != null) {
+ consumer.accept(factory);
+ }
}
public void createRegistries(BeanContainer container) { | ['extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDriverProcessor.java', 'extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,742,070 | 2,092,224 | 279,315 | 2,996 | 637 | 120 | 11 | 2 | 4,943 | 197 | 1,183 | 59 | 1 | 1 | 1970-01-01T00:26:38 | 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,972 | quarkusio/quarkus/11716/11707 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11707 | https://github.com/quarkusio/quarkus/pull/11716 | https://github.com/quarkusio/quarkus/pull/11716 | 1 | fixes | QuarkusClassLoader.getResourceAsStream does not work with directories in quarkus:dev | **Describe the bug**
When your try to read a directory from the resources-folder using Thread.currentThread().getContextClassLoader().getResourceAsStream("test"), an IOException occurs. The directory can not be read as an InputStream, because the class Loaders uses Files.readAllBytes, which does not work with directories.
**Expected behavior**
According to the Java Spec, getResourceAsStream("test") should the same as getResource("test").openStream().
**Actual behavior**
When I use getResource("test").openStream() the InputStream is returned properly, but getResourceAsStream("test"). The follwing Exeception occurs
```
2020-08-28 11:55:57,017 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /load/1 failed, error id: 4ca207b6-2f6f-4ad6-89c8-efe7959e90d3-3: org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Unable to read /Users/christianradow/IntelliJ/classloader-test/target/classes/test
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:216)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:515)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:259)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:160)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:163)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:245)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:132)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.access$000(VertxRequestHandler.java:37)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:94)
at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.RuntimeException: Unable to read /Users/christianradow/IntelliJ/classloader-test/target/classes/test
at io.quarkus.bootstrap.classloading.DirectoryClassPathElement$1.getData(DirectoryClassPathElement.java:108)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.getResourceAsStream(QuarkusClassLoader.java:337)
at org.acme.quarkus.sample.ClassLoaderTestResource.testDirectory1(ClassLoaderTestResource.java:19)
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 org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:638)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:504)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:454)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:456)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:417)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:391)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:68)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:488)
... 20 more
Caused by: java.io.IOException: Is a directory
at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at java.base/sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:245)
at java.base/sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:223)
at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
at java.base/java.nio.file.Files.read(Files.java:3158)
at java.base/java.nio.file.Files.readAllBytes(Files.java:3212)
at io.quarkus.bootstrap.classloading.DirectoryClassPathElement$1.getData(DirectoryClassPathElement.java:100)
... 37 more
```
**To Reproduce**
Steps to reproduce the behavior:
1. Create a directory named test in the resources folder
2. Use the following Resource:
```java
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.io.InputStream;
@Path("/load")
public class ClassLoaderTestResource {
// Does not work using quarkus:dev
@GET
@Path("/1")
@Produces(MediaType.TEXT_PLAIN)
public String testDirectory1() {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream testResource = loader.getResourceAsStream("test");
return testResource.toString();
}
// Works using quarkus:dev
@GET
@Path("/2")
@Produces(MediaType.TEXT_PLAIN)
public String testDirectory2() throws IOException {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream testResource = loader.getResource("test").openStream();
return testResource.toString();
}
}
```
3. Start the project using quarkus:dev
4. Test the /load/1 endpoint to reproduce the bug.
**Configuration**
```properties
# No additional config
```
**Environment (please complete the following information):**
- tested on both Windows 10 and MacOS
- Output of `java -version`: openjdk version "11.0.2" 2019-01-15
- Quarkus version or git rev: tested on multiple Versions from 1.3.1.Final to 1.7.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3
**Additional context**
The problem occurs because the directory is read using Files.readAllBytes(), which produces an IOException.
| f585d9d8c00f235059942aa9f81b7ccea06297af | 96de5bff1b568c1840d0bcb319db7072cb6bba4d | https://github.com/quarkusio/quarkus/compare/f585d9d8c00f235059942aa9f81b7ccea06297af...96de5bff1b568c1840d0bcb319db7072cb6bba4d | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
index 439e4ab8bbf..61dae72b5b6 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
@@ -323,6 +323,17 @@ public InputStream getResourceAsStream(String unsanitisedName) {
for (ClassPathElement i : elements) {
ClassPathResource res = i.getResource(name);
if (res != null) {
+ if (res.isDirectory()) {
+ try {
+ return res.getUrl().openStream();
+ } catch (IOException e) {
+ log.debug("Ignoring exception that occurred while opening a stream for resource " + unsanitisedName,
+ e);
+ // behave like how java.lang.ClassLoader#getResourceAsStream() behaves
+ // and don't propagate the exception
+ continue;
+ }
+ }
return new ByteArrayInputStream(res.getData());
}
}
diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/classloader/ClassLoadingResourceUrlTestCase.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/classloader/ClassLoadingResourceUrlTestCase.java
index d9d91d65aee..611d70bc06d 100644
--- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/classloader/ClassLoadingResourceUrlTestCase.java
+++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/classloader/ClassLoadingResourceUrlTestCase.java
@@ -4,6 +4,7 @@
import io.quarkus.bootstrap.classloading.JarClassPathElement;
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.bootstrap.util.IoUtils;
+import java.io.InputStream;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -51,6 +52,36 @@ public void testUrlReturnedFromClassLoaderDirectory() throws Exception {
}
}
+ /**
+ * Test that {@link QuarkusClassLoader#getResourceAsStream(String)} returns a stream for directory
+ * resources
+ *
+ * @throws Exception
+ * @see <a href="https://github.com/quarkusio/quarkus/issues/11707"/>
+ */
+ @Test
+ public void testResourceAsStreamForDirectory() throws Exception {
+ final JavaArchive jar = ShrinkWrap.create(JavaArchive.class)
+ .add(new StringAsset("a"), "a.txt")
+ .add(new StringAsset("b"), "b/b.txt");
+ final Path tmpDir = Files.createTempDirectory("test");
+ try {
+ jar.as(ExplodedExporter.class).exportExploded(tmpDir.toFile(), "tmpcltest");
+ final ClassLoader cl = QuarkusClassLoader.builder("test", getClass().getClassLoader(), false)
+ .addElement(new DirectoryClassPathElement(tmpDir.resolve("tmpcltest")))
+ .build();
+
+ try (final InputStream is = cl.getResourceAsStream("b/")) {
+ Assertions.assertNotNull(is, "InputStream is null for a directory resource");
+ }
+ try (final InputStream is = cl.getResourceAsStream("b")) {
+ Assertions.assertNotNull(is, "InputStream is null for a directory resource");
+ }
+ } finally {
+ IoUtils.recursiveDelete(tmpDir);
+ }
+ }
+
/**
* URLClassLoader will return URL's that end with a / if the call to getResource ends with a /
*/ | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java', 'independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/classloader/ClassLoadingResourceUrlTestCase.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,720,377 | 2,088,205 | 278,870 | 2,992 | 616 | 82 | 11 | 1 | 8,069 | 396 | 1,791 | 123 | 0 | 3 | 1970-01-01T00:26:38 | 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,974 | quarkusio/quarkus/11639/11617 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11617 | https://github.com/quarkusio/quarkus/pull/11639 | https://github.com/quarkusio/quarkus/pull/11639 | 1 | fix | Kafka Streams Bootstrap Servers Problem | **Describe the bug**
Admin client can't establish the connection to bootstrap server. I'm sure that the host name is correct, when I use it in Kafka Messaging like mp.messaging.connector.smallrye-kafka.bootstrap.servers=my.host.name:9093 there are no problems.
**Expected behavior**
Admin client establishes the connection.
**Actual behavior**
Admin client can't establish the connection.
Kafka Consumer Config logs:
...
bootstrap.servers = [my.host.name/< unresolved >:9093] (Why < unresolved > ??? When I use the same server to mp.messaging, I don't have the < unresolved >)
...
In Console can I see:
...
Connection to node -1 (localhost/127.0.0.1:9093) could not be established. Broker may not be available.
...
ERROR [io.qua.kaf.str.run.KafkaStreamsProducer] (pool-6-thread-1) Failed to get topic names from broker: java.util.concurrent.TimeoutException
**Configuration**
```properties
quarkus.kafka-streams.bootstrap-servers=my.host.name:9093
quarkus.kafka-streams.application-id=...
quarkus.kafka-streams.topics=...
kafka-streams.security.inter.broker.protocol=SSL
kafka-streams.security.protocol=SSL
kafka-streams.ssl.truststore.location=...
kafka-streams.ssl.truststore.password=...
kafka-streams.ssl.keystore.location=...
kafka-streams.ssl.keystore.password=...
kafka-streams.ssl.key.password=...
kafka-streams.cache.max.bytes.buffering=10240
kafka-streams.commit.interval.ms=1000
kafka-streams.metadata.max.age.ms=500
kafka-streams.auto.offset.reset=earliest
kafka-streams.metrics.recording.level=DEBUG
```
**Environment (please complete the following information):**
- Output of `java -version`: openjdk version "14" 2020-03-17
OpenJDK Runtime Environment (build 14+36-1461)
OpenJDK 64-Bit Server VM (build 14+36-1461, mixed mode, sharing)
- Quarkus version or git rev: 1.7.0.Final
| 239a860252fccc3c38a05a07c300e7be0fc1bf4f | 4a4f0bda4ef6e1eb1dfddb82f43773b25acac0a1 | https://github.com/quarkusio/quarkus/compare/239a860252fccc3c38a05a07c300e7be0fc1bf4f...4a4f0bda4ef6e1eb1dfddb82f43773b25acac0a1 | diff --git a/extensions/consul-config/runtime/src/main/java/io/quarkus/consul/config/runtime/DefaultConsulConfigGateway.java b/extensions/consul-config/runtime/src/main/java/io/quarkus/consul/config/runtime/DefaultConsulConfigGateway.java
index b2482d48ad8..bf60e6da0aa 100644
--- a/extensions/consul-config/runtime/src/main/java/io/quarkus/consul/config/runtime/DefaultConsulConfigGateway.java
+++ b/extensions/consul-config/runtime/src/main/java/io/quarkus/consul/config/runtime/DefaultConsulConfigGateway.java
@@ -117,7 +117,7 @@ public Optional<Response> getValue(String key) throws IOException {
}
try (CloseableHttpClient client = httpClientBuilder.build()) {
String finalUri = (consulConfig.agent.useHttps ? "https" : "http") + "://"
- + consulConfig.agent.hostPort.getHostName() + ":" + consulConfig.agent.hostPort.getPort()
+ + consulConfig.agent.hostPort.getHostString() + ":" + consulConfig.agent.hostPort.getPort()
+ "/v1/kv/"
+ key;
HttpGet request = new HttpGet(finalUri);
diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java
index 6bb6abb43a1..9be5af77ecc 100644
--- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java
+++ b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java
@@ -60,7 +60,7 @@ private void initTracerConfig(JaegerConfig jaeger) {
initTracerProperty("JAEGER_AUTH_TOKEN", jaeger.authToken, token -> token);
initTracerProperty("JAEGER_USER", jaeger.user, user -> user);
initTracerProperty("JAEGER_PASSWORD", jaeger.password, pw -> pw);
- initTracerProperty("JAEGER_AGENT_HOST", jaeger.agentHostPort, address -> address.getHostName());
+ initTracerProperty("JAEGER_AGENT_HOST", jaeger.agentHostPort, address -> address.getHostString());
initTracerProperty("JAEGER_AGENT_PORT", jaeger.agentHostPort, address -> String.valueOf(address.getPort()));
initTracerProperty("JAEGER_REPORTER_LOG_SPANS", jaeger.reporterLogSpans, log -> log.toString());
initTracerProperty("JAEGER_REPORTER_MAX_QUEUE_SIZE", jaeger.reporterMaxQueueSize, size -> size.toString());
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 42cb3cd499b..1037b6dc61f 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
@@ -254,10 +254,14 @@ private static <T> void setProperty(Optional<T> property, Properties properties,
private static String asString(List<InetSocketAddress> addresses) {
return addresses.stream()
- .map(InetSocketAddress::toString)
+ .map(KafkaStreamsProducer::toHostPort)
.collect(Collectors.joining(","));
}
+ private static String toHostPort(InetSocketAddress inetSocketAddress) {
+ return inetSocketAddress.getHostString() + ":" + inetSocketAddress.getPort();
+ }
+
private static void waitForTopicsToBeCreated(Admin adminClient, Collection<String> topicsToAwait)
throws InterruptedException {
Set<String> lastMissingTopics = null; | ['extensions/consul-config/runtime/src/main/java/io/quarkus/consul/config/runtime/DefaultConsulConfigGateway.java', 'extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java', 'extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 10,670,281 | 2,078,441 | 277,788 | 2,982 | 715 | 137 | 10 | 3 | 1,851 | 165 | 462 | 48 | 0 | 1 | 1970-01-01T00:26:38 | 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,975 | quarkusio/quarkus/11625/11612 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11612 | https://github.com/quarkusio/quarkus/pull/11625 | https://github.com/quarkusio/quarkus/pull/11625 | 1 | fixes | devmode: Quarkus 1.7.0.Final + grpc + smallrye health gRPC Server is DOWN | **Describe the bug**
After generating a project from code.quarkus.io with grpc and smallrye health extensions, then following the quarkus gRPC quickstart guide, the healthcheck endpoint always reports gRPC server as DOWN despite the endpoint successfully responding to calls.
**Expected behavior**
Healthcheck should report UP if the service is available.
```
$ grpcurl -plaintext -proto=src/main/proto/helloworld.proto localhost:9000 helloworld.Greeter.SayHello
{
"message": "Hello "
}
```
**Actual behavior**
Healthcheck reports DOWN
```
{
"status": "DOWN",
"checks": [
{
"name": "gRPC Server",
"status": "DOWN"
}
]
}
```
**To Reproduce**
Reproduction repo: https://github.com/jeffhubLR/quarkus-1.7-grpc-smallrye-health
Steps to reproduce the behavior:
1. Generate project from code.quarkus.io, selecting grpc and smallrye health
2. Follow quarkus grpc quickstart, creating proto and .java file
3. Start up service
4. Find that calls to the grpc service succeed, while the health endpoint still reports DOWN
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Darwin USMACEA094JHUBB 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/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):
- Quarkus version or git rev: 1.7.0.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 11.0.8, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.8.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "mac"
| 8bf700dbb0144429ff227c544ea947fb2de3fe45 | 88668a1277966874deec098b9578b5c45f239fd1 | https://github.com/quarkusio/quarkus/compare/8bf700dbb0144429ff227c544ea947fb2de3fe45...88668a1277966874deec098b9578b5c45f239fd1 | diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java
index 5ca99a60e32..77b64699480 100644
--- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java
+++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java
@@ -95,24 +95,7 @@ private void prodStart(GrpcContainer grpcContainer, Vertx vertx, GrpcServerConfi
if (result.failed()) {
startResult.completeExceptionally(result.cause());
} else {
- grpcContainer.getHealthStorage().stream().forEach(new Consumer<GrpcHealthStorage>() { //NOSONAR
- @Override
- public void accept(GrpcHealthStorage storage) {
- storage.setStatus(GrpcHealthStorage.DEFAULT_SERVICE_NAME,
- HealthOuterClass.HealthCheckResponse.ServingStatus.SERVING);
- grpcContainer.getServices().forEach(
- new Consumer<BindableService>() { // NOSONAR
- @Override
- public void accept(BindableService service) {
- ServerServiceDefinition definition = service.bindService();
- storage.setStatus(definition.getServiceDescriptor().getName(),
- HealthOuterClass.HealthCheckResponse.ServingStatus.SERVING);
- }
- });
- }
- });
- LOGGER.infof("gRPC Server started on %s:%d [SSL enabled: %s]",
- configuration.host, configuration.port, !configuration.plainText);
+ postStartup(grpcContainer, configuration);
startResult.complete(null);
}
@@ -130,6 +113,27 @@ public void accept(BindableService service) {
}
}
+ private void postStartup(GrpcContainer grpcContainer, GrpcServerConfiguration configuration) {
+ grpcContainer.getHealthStorage().stream().forEach(new Consumer<GrpcHealthStorage>() { //NOSONAR
+ @Override
+ public void accept(GrpcHealthStorage storage) {
+ storage.setStatus(GrpcHealthStorage.DEFAULT_SERVICE_NAME,
+ HealthOuterClass.HealthCheckResponse.ServingStatus.SERVING);
+ grpcContainer.getServices().forEach(
+ new Consumer<BindableService>() { // NOSONAR
+ @Override
+ public void accept(BindableService service) {
+ ServerServiceDefinition definition = service.bindService();
+ storage.setStatus(definition.getServiceDescriptor().getName(),
+ HealthOuterClass.HealthCheckResponse.ServingStatus.SERVING);
+ }
+ });
+ }
+ });
+ LOGGER.infof("gRPC Server started on %s:%d [SSL enabled: %s]",
+ configuration.host, configuration.port, !configuration.plainText);
+ }
+
private void devModeStart(GrpcContainer grpcContainer, Vertx vertx, GrpcServerConfiguration configuration,
ShutdownContext shutdown) {
CompletableFuture<Boolean> future = new CompletableFuture<>();
@@ -142,6 +146,7 @@ public void handle(AsyncResult<Void> ar) {
LOGGER.error("Unable to start the gRPC server", ar.cause());
future.completeExceptionally(ar.cause());
} else {
+ postStartup(grpcContainer, configuration);
future.complete(true);
grpcVerticleCount.incrementAndGet();
} | ['extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcServerRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,669,691 | 2,078,261 | 277,771 | 2,982 | 2,782 | 397 | 41 | 1 | 2,064 | 241 | 613 | 52 | 1 | 2 | 1970-01-01T00:26:38 | 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,976 | quarkusio/quarkus/11605/11600 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11600 | https://github.com/quarkusio/quarkus/pull/11605 | https://github.com/quarkusio/quarkus/pull/11605 | 1 | fixes | Server shutdown warning when building native with Mandrel | Using Mandrel 20.1 with cleanup server option shows:
```
Status: Downloaded newer image for quay.io/quarkus/ubi-quarkus-mandrel:20.1.0.1.Alpha2-java11
quay.io/quarkus/ubi-quarkus-mandrel:20.1.0.1.Alpha2-java11
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.1.0.1.Alpha2 56d4ee1b28 (Mandrel Distribution) (Java Version 11.0.8)
Warning: Ignoring server-mode native-image argument --server-shutdown.
Error: Please specify class containing the main entry point method. (see --help)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /root/quarkus/integration-tests/main/target/quarkus-integration-test-main-1.7.0.Final-native-image-source-jar:/project:z --env LANG=C --user 0:0 --rm quay.io/quarkus/ubi-quarkus-mandrel:20.1.0.1.Alpha2-java11 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -J-Drx.unsafe-disable=true -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=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 -H:IncludeResources=test-resources/.*\\.txt --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar quarkus-integration-test-main-1.7.0.Final-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http -H:-UseServiceLoaderFeature -H:+StackTrace quarkus-integration-test-main-1.7.0.Final-runner
[quarkus-integration-test-main-1.7.0.Final-runner:56] classlist: 17,708.30 ms, 1.19 GB
```
Native image is built fine, but the warning above is related to server shutdown. Mandrel does not support server (`--no-server` already excludes the use of Mandrel), so we just need to extend server shutdown to non-Mandrel versions.
Related to https://github.com/graalvm/mandrel/issues/107. | e7169364e5bbb1148d893e61bcd5d7e22ca4cc42 | bac08b1dcbca41a76cd66a0a35e6380cee0e154e | https://github.com/quarkusio/quarkus/compare/e7169364e5bbb1148d893e61bcd5d7e22ca4cc42...bac08b1dcbca41a76cd66a0a35e6380cee0e154e | 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 15c59625dc5..7e9e8fcf908 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
@@ -204,7 +204,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
try {
List<String> command = new ArrayList<>(nativeImage);
- if (nativeConfig.cleanupServer) {
+ if (nativeConfig.cleanupServer && !graalVMVersion.isMandrel()) {
List<String> cleanup = new ArrayList<>(nativeImage);
cleanup.add("--server-shutdown");
final ProcessBuilder pb = new ProcessBuilder(cleanup.toArray(new String[0])); | ['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,669,540 | 2,078,226 | 277,766 | 2,982 | 124 | 28 | 2 | 1 | 2,169 | 133 | 630 | 15 | 1 | 1 | 1970-01-01T00:26:38 | 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,977 | quarkusio/quarkus/11561/11550 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11550 | https://github.com/quarkusio/quarkus/pull/11561 | https://github.com/quarkusio/quarkus/pull/11561 | 1 | fix | quarkus-grpc-protoc-plugin windows script fails with java.exe in Program Files | **Describe the bug**
protoc compilation fails with "'С:\\Program' is not recognized as an internal or external command, operable program or batch file."
**Expected behavior**
protoc compilation successfully runs
**Actual behavior**
protoc compilation fails with "'С:\\Program' is not recognized as an internal or external command, operable program or batch file."
**To Reproduce**
Steps to reproduce the behavior:
1. Have java in C:\\Program Files\\Java
2. Use quarkus gradle plugin with quarkus-grpc dependency to compile some protoc files
3. It will fail with exception from https://github.com/quarkusio/quarkus/blob/1.7/extensions/grpc/codegen/src/main/java/io/quarkus/grpc/deployment/GrpcCodeGen.java line 86 saying "Failed to generate Java classes from proto files:" which doesn't explain anything.
4. If you try to run generated command yourself you will get a real reason saying C:\\Program is not a command.
5. Further investigation will show that GrpcCodeGen.java generates a cmd sript on line 207 which contains a java command -
`C:\\Program Files\\AdoptOpenJDK\\jdk-11.0.7.10-hotspot\\bin\\java.EXE -cp "C:\\Users\\blablabla"`
6. Adding double quotes around java command fixes the issue
**Environment (please complete the following information):**
- Quarkus version or git rev: 1.7.0.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
Gradle 6.6
Build time: 2020-08-10 22:06:19 UTC
Revision: d119144684a0c301aea027b79857815659e431b9
Kotlin: 1.3.72
Groovy: 2.5.12
Ant: Apache Ant(TM) version 1.10.8 compiled on May 10 2020
JVM: 11.0.7 (AdoptOpenJDK 11.0.7+10)
OS: Windows 10 10.0 amd64
Issue seems to be specific to quarkus 1.7.0.Final. At least changing version to 1.6.1.Final doesn't throw this exception, but it seems like it also doesn't try to compile proto files at all. | 56cc4aa222e986254d3a5f9569baeaf69374fe47 | 196fcefd960f2f404c7782341d297c52eedcef07 | https://github.com/quarkusio/quarkus/compare/56cc4aa222e986254d3a5f9569baeaf69374fe47...196fcefd960f2f404c7782341d297c52eedcef07 | diff --git a/extensions/grpc/codegen/src/main/java/io/quarkus/grpc/deployment/GrpcCodeGen.java b/extensions/grpc/codegen/src/main/java/io/quarkus/grpc/deployment/GrpcCodeGen.java
index dcdc158210b..049bcfe7a03 100644
--- a/extensions/grpc/codegen/src/main/java/io/quarkus/grpc/deployment/GrpcCodeGen.java
+++ b/extensions/grpc/codegen/src/main/java/io/quarkus/grpc/deployment/GrpcCodeGen.java
@@ -204,7 +204,7 @@ private static Path writeScript(Path buildDir, Path pluginPath, String shebang,
}
private static void writePluginExeCmd(Path pluginPath, BufferedWriter writer) throws IOException {
- writer.write(JavaBinFinder.findBin() + " -cp \\"" +
+ writer.write("\\"" + JavaBinFinder.findBin() + "\\" -cp \\"" +
pluginPath.toAbsolutePath().toString() + "\\" " + quarkusProtocPluginMain);
writer.newLine();
} | ['extensions/grpc/codegen/src/main/java/io/quarkus/grpc/deployment/GrpcCodeGen.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,513,077 | 2,046,345 | 273,490 | 2,926 | 128 | 34 | 2 | 1 | 1,892 | 241 | 527 | 36 | 1 | 0 | 1970-01-01T00:26:38 | 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,968 | quarkusio/quarkus/11797/11792 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11792 | https://github.com/quarkusio/quarkus/pull/11797 | https://github.com/quarkusio/quarkus/pull/11797 | 1 | fixes | Command line app ignores SIGINT (Ctrl+C) | **Describe the bug**
Quarkus command line apps do not respond to SIGINT
**Expected behavior**
A Quarkus command line app should initiate shutdown when passed SIGINT (Ctrl+C on a terminal)
**Actual behavior**
The signal is ignored, nothing happens
**To Reproduce**
Steps to reproduce the behavior:
1. Clone https://github.com/ivangreene/my-quarkus-cli
2. Run `mvn clean package`
3. Run `java -jar target/my-quarkus-cli-1.0-SNAPSHOT-runner.jar`
4. Press Ctrl+C
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Darwin ivan.local 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64 i386 MacBookPro16,1 Darwin`
- Output of `java -version`:
```
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
```
- GraalVM version (if different from Java):
- Quarkus version or git rev: `1.7.1.Final`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 11.0.7, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.6", arch: "x86_64", family: "mac"
``` | 7f04249f1717b4c9772641b2a8122e4ab47a75fc | 66e46d44be320c1d480013228d0802f62a07e9bb | https://github.com/quarkusio/quarkus/compare/7f04249f1717b4c9772641b2a8122e4ab47a75fc...66e46d44be320c1d480013228d0802f62a07e9bb | diff --git a/core/runtime/src/main/java/io/quarkus/runtime/Application.java b/core/runtime/src/main/java/io/quarkus/runtime/Application.java
index 709b391261e..ac632628c96 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/Application.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/Application.java
@@ -228,16 +228,15 @@ public void awaitShutdown() {
stateLock.lock();
try {
for (;;) {
- switch (state) {
- case ST_STOPPED:
- return; // all good
- default:
- try {
- stateCond.await();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw interruptedOnAwaitStop();
- }
+ if (state == ST_STOPPED) {
+ return; // all good
+ } else {
+ try {
+ stateCond.await();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw interruptedOnAwaitStop();
+ }
}
}
} finally {
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java
index 911e549850e..f12a92b8c07 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java
@@ -1,5 +1,6 @@
package io.quarkus.runtime;
+import java.util.Locale;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.locks.Condition;
@@ -16,8 +17,6 @@
import org.jboss.logging.Logger;
import org.wildfly.common.lock.Locks;
-import com.oracle.svm.core.OS;
-
import io.quarkus.runtime.graal.DiagnosticPrinter;
import sun.misc.Signal;
import sun.misc.SignalHandler;
@@ -74,7 +73,7 @@ public static void run(Application application, Class<? extends QuarkusApplicati
//in this case we don't shut it down at the end
boolean alreadyStarted = application.isStarted();
if (!hooksRegistered) {
- registerHooks();
+ registerHooks(exitCodeHandler == null ? defaultExitCodeHandler : exitCodeHandler);
hooksRegistered = true;
}
if (currentApplication != null && !shutdownRequested) {
@@ -104,7 +103,7 @@ public static void run(Application application, Class<? extends QuarkusApplicati
}
QuarkusApplication instance;
if (bean == null) {
- instance = quarkusApplication.newInstance();
+ instance = quarkusApplication.getDeclaredConstructor().newInstance();
} else {
CreationalContext<?> ctx = beanManager.createCreationalContext(bean);
instance = (QuarkusApplication) beanManager.getReference(bean, quarkusApplication, ctx);
@@ -159,36 +158,36 @@ public static void run(Application application, Class<? extends QuarkusApplicati
(exitCodeHandler == null ? defaultExitCodeHandler : exitCodeHandler).accept(getExitCode()); //this may not be called if shutdown was initiated by a signal
}
- private static void registerHooks() {
+ private static void registerHooks(final Consumer<Integer> exitCodeHandler) {
if (ImageInfo.inImageRuntimeCode() && System.getenv(DISABLE_SIGNAL_HANDLERS) == null) {
- registerSignalHandlers();
+ registerSignalHandlers(exitCodeHandler);
}
final ShutdownHookThread shutdownHookThread = new ShutdownHookThread();
Runtime.getRuntime().addShutdownHook(shutdownHookThread);
}
- private static void registerSignalHandlers() {
- final SignalHandler handler = new SignalHandler() {
+ private static void registerSignalHandlers(final Consumer<Integer> exitCodeHandler) {
+ final SignalHandler exitHandler = new SignalHandler() {
@Override
public void handle(Signal signal) {
- System.exit(signal.getNumber() + 0x80);
+ exitCodeHandler.accept(signal.getNumber() + 0x80);
}
};
- final SignalHandler quitHandler = new SignalHandler() {
+ final SignalHandler diagnosticsHandler = new SignalHandler() {
@Override
public void handle(Signal signal) {
DiagnosticPrinter.printDiagnostics(System.out);
}
};
- handleSignal("INT", handler);
- handleSignal("TERM", handler);
+ handleSignal("INT", exitHandler);
+ handleSignal("TERM", exitHandler);
// the HUP and QUIT signals are not defined for the Windows OpenJDK implementation:
// https://hg.openjdk.java.net/jdk8u/jdk8u-dev/hotspot/file/7d5c800dae75/src/os/windows/vm/jvm_windows.cpp
- if (OS.getCurrent() == OS.WINDOWS) {
- handleSignal("BREAK", quitHandler);
+ if (System.getProperty("os.name", "unknown").toLowerCase(Locale.ENGLISH).contains("windows")) {
+ handleSignal("BREAK", diagnosticsHandler);
} else {
- handleSignal("HUP", handler);
- handleSignal("QUIT", quitHandler);
+ handleSignal("HUP", exitHandler);
+ handleSignal("QUIT", diagnosticsHandler);
}
}
@@ -294,6 +293,12 @@ public void run() {
} finally {
stateLock.unlock();
}
+ if (currentApplication.isStarted()) {
+ // On CLI apps, SIGINT won't call io.quarkus.runtime.Application#stop(),
+ // making the awaitShutdown() below block the application termination process
+ // It should be a noop if called twice anyway
+ currentApplication.stop();
+ }
currentApplication.awaitShutdown();
System.out.flush();
System.err.flush();
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
index 31c8ad6175b..5e19392330d 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
@@ -46,7 +46,7 @@
@Recorder
public class LoggingSetupRecorder {
- private static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("win");
+ private static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows");
/**
* <a href="https://conemu.github.io">ConEmu</a> ANSI X3.64 support enabled, | ['core/runtime/src/main/java/io/quarkus/runtime/Application.java', 'core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java', 'core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 10,971,459 | 2,137,752 | 285,568 | 3,072 | 3,128 | 527 | 58 | 3 | 1,473 | 175 | 484 | 34 | 1 | 2 | 1970-01-01T00:26:38 | 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,981 | quarkusio/quarkus/11504/11472 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11472 | https://github.com/quarkusio/quarkus/pull/11504 | https://github.com/quarkusio/quarkus/pull/11504 | 1 | close | Quarkus Unit tests fail when running from IntelliJ for Gradle project | **Describe the bug**
In #8737 support for IntelliJ builder/runner was added. But it seems that it does not work.
Reproducible: https://github.com/asodja/quarkus-gradle-idea-multi-module
Error:
```
java.lang.RuntimeException: java.io.UncheckedIOException: Error while reading file as JAR: /Users/anzes/prototype-dev/quarkus-gradle-idea-multi-module/module-1/build/libs/module-1-my-version.jar
at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:513)
at io.quarkus.test.junit.QuarkusTestExtension.beforeEach(QuarkusTestExtension.java:363)
Caused by: java.io.UncheckedIOException: Error while reading file as JAR: /Users/anzes/prototype-dev/quarkus-gradle-idea-multi-module/module-1/build/libs/module-1-my-version.jar
at io.quarkus.bootstrap.classloading.JarClassPathElement.<init>(JarClassPathElement.java:46)
at io.quarkus.bootstrap.classloading.ClassPathElement.fromPath(ClassPathElement.java:51)
at io.quarkus.bootstrap.app.CuratedApplication.processCpElement(CuratedApplication.java:156)
at io.quarkus.bootstrap.app.CuratedApplication.getBaseRuntimeClassLoader(CuratedApplication.java:235)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:198)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:491)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:524)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
... 29 more
Caused by: java.io.FileNotFoundException: /Users/anzes/prototype-dev/quarkus-gradle-idea-multi-module/module-1/build/libs/module-1-my-version.jar (No such file or directory)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:225)
at java.util.zip.ZipFile.<init>(ZipFile.java:155)
at java.util.jar.JarFile.<init>(JarFile.java:166)
at java.util.jar.JarFile.<init>(JarFile.java:130)
at io.smallrye.common.io.jar.JarFiles.create(JarFiles.java:34)
at io.quarkus.bootstrap.classloading.JarClassPathElement.<init>(JarClassPathElement.java:44)
... 41 more
```
The problems are two:
1. IntelliJ compiles files to `out/` and Gradle Model expects things in `build/` directory
2. Gradle Model expects Jars for test sources (IntelliJ does not create jars)
This can be workaround with: https://github.com/quarkusio/quarkus/pull/11339
If you run `./gradlew build` test will pass since jars are in `build/` folder.
**Expected behavior**
Unit test passes, no exception is thrown.
**Actual behavior**
Unit test fails, exception is thrown.
**To Reproduce**
Steps to reproduce the behavior:
1. git clone https://github.com/asodja/quarkus-gradle-idea-multi-module
2. In IntelliJ set Preferences -> Gradle -> Build and run using IntelliJ and Run tests using IntelliJ
3. Run `MyTest` (Note: you should not have `build/` folder)
**Environment (please complete the following information):**
- Mac OS Catalina
- OpenJDK 1.8.0_242
- Quarkus version: 1.7.0.Final
- Build tool: Gradle 6.5.1
| 669677000f1f898376c8250f41fa87017ad20b26 | 7da33438576d4aaa38c859d4cb8d82d24bbf8370 | https://github.com/quarkusio/quarkus/compare/669677000f1f898376c8250f41fa87017ad20b26...7da33438576d4aaa38c859d4cb8d82d24bbf8370 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/utils/BuildToolHelper.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/utils/BuildToolHelper.java
index babc69bd053..90d9c68dbfa 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/utils/BuildToolHelper.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/utils/BuildToolHelper.java
@@ -59,13 +59,13 @@ public static Path getBuildFile(Path project, BuildTool tool) {
return null;
}
- public static QuarkusModel enableGradleAppModel(Path projectRoot, String mode)
+ public static QuarkusModel enableGradleAppModel(Path projectRoot, String mode, String... tasks)
throws IOException, AppModelResolverException {
if (isMavenProject(projectRoot)) {
return null;
}
final QuarkusModel model = QuarkusGradleModelFactory.create(getBuildFile(projectRoot, BuildTool.GRADLE).toFile(),
- mode);
+ mode, tasks);
QuarkusModelHelper.exportModel(model);
return model;
}
diff --git a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/QuarkusGradleModelFactory.java b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/QuarkusGradleModelFactory.java
index 8f025f98f15..69ef1e314ef 100644
--- a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/QuarkusGradleModelFactory.java
+++ b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/QuarkusGradleModelFactory.java
@@ -8,10 +8,11 @@
public class QuarkusGradleModelFactory {
- public static QuarkusModel create(File projectDir, String mode) {
+ public static QuarkusModel create(File projectDir, String mode, String... tasks) {
try (ProjectConnection connection = GradleConnector.newConnector()
.forProjectDirectory(projectDir)
.connect()) {
+ connection.newBuild().forTasks(tasks).run();
return connection.action(new QuarkusModelBuildAction(mode)).run();
}
}
diff --git a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java
index c90a7d07ef4..dd295b6797f 100644
--- a/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java
+++ b/independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java
@@ -36,6 +36,7 @@ private QuarkusModelHelper() {
}
public final static String[] DEVMODE_REQUIRED_TASKS = new String[] { "classes" };
+ public final static String[] TEST_REQUIRED_TASKS = new String[] { "classes", "testClasses" };
public static void exportModel(QuarkusModel model) throws AppModelResolverException, IOException {
Path serializedModel = QuarkusModelHelper
diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
index aec84b21510..4cf1e341e5f 100644
--- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
+++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
@@ -57,6 +57,7 @@
import io.quarkus.bootstrap.app.StartupAction;
import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.bootstrap.runner.Timing;
+import io.quarkus.bootstrap.util.QuarkusModelHelper;
import io.quarkus.bootstrap.utils.BuildToolHelper;
import io.quarkus.builder.BuildChainBuilder;
import io.quarkus.builder.BuildContext;
@@ -181,7 +182,7 @@ private ExtensionState doJavaStart(ExtensionContext context, Class<? extends Qua
Path root = Paths.get("").normalize().toAbsolutePath();
// If gradle project running directly with IDE
if (System.getProperty(BootstrapConstants.SERIALIZED_APP_MODEL) == null) {
- BuildToolHelper.enableGradleAppModel(root, "TEST");
+ BuildToolHelper.enableGradleAppModel(root, "TEST", QuarkusModelHelper.TEST_REQUIRED_TASKS);
}
runnerBuilder.setApplicationRoot(rootBuilder.build()); | ['independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/resolver/QuarkusGradleModelFactory.java', 'independent-projects/bootstrap/gradle-resolver/src/main/java/io/quarkus/bootstrap/util/QuarkusModelHelper.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/utils/BuildToolHelper.java', 'test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 10,621,179 | 2,069,050 | 276,607 | 2,975 | 553 | 120 | 8 | 3 | 3,139 | 222 | 816 | 56 | 3 | 1 | 1970-01-01T00:26: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,982 | quarkusio/quarkus/11500/11461 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11461 | https://github.com/quarkusio/quarkus/pull/11500 | https://github.com/quarkusio/quarkus/pull/11500 | 1 | fixes | Unable to read a literal value from a secret containing keys ending in "yaml,yml or properties" | **Describe the bug**
(Describe the problem clearly and concisely.)
When reading a secret any secret key with that ends with ".yml" or ".yaml" or ".properties" is assumed to contain a ConfigSource. It's not possible to read a literal value from a secret with containing keys ending in "yaml,yml or properties"
**Expected behavior**
Should be able to read literal values from secrets containing keys ending in "yaml,yml or properties"
**Actual behavior**
2020-08-19 09:42:27,386 DEBUG [io.qua.kub.cli.run.KubernetesConfigSourceProvider] (main) Attempting to read Secret tournamentcache-generated-secret
2020-08-19 09:42:48,593 DEBUG [io.qua.kub.cli.run.AbstractKubernetesConfigSourceUtil] (main) Attempting to convert data in Secret 'tournamentcache-generated-secret' to a list of ConfigSource objects
2020-08-19 09:45:23,074 DEBUG [io.qua.kub.cli.run.AbstractKubernetesConfigSourceUtil] (main) Secret 'tournamentcache-generated-secret' converted into 0ConfigSource objects
2020-08-19 09:46:09,200 DEBUG [io.qua.kub.cli.run.KubernetesConfigSourceProvider] (main) Done reading Secret tournamentcache-generated-secret
**To Reproduce**
Steps to reproduce the behavior:
1.
2.
3.
**Configuration**
```properties
# Add your application.properties here, if applicable.
quarkus.kubernetes-config.enabled=true
quarkus.kubernetes-config.secrets.enabled=true
quarkus.kubernetes-config.fail-on-missing-config=true
quarkus.kubernetes-config.secrets=tournamentcache-generated-secret
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**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**
```yaml
oc get secret -o yaml tournamentcache-generated-secret
apiVersion: v1
data:
identities.yaml: Y3JlZGVudGlhbHM6Ci0gdXNlcm5hbWU6IGRldmVsb3BlcgogIHBhc3N3b3JkOiBUZDNaamZaYUJSOEQxQWZrCi0gdXNlcm5hbWU6IG9wZXJhdG9yCiAgcGFzc3dvcmQ6IGMyRm1KdTY3UlQ3R2JVQWsK
kind: Secret
metadata:
creationTimestamp: "2020-08-09T08:29:49Z"
labels:
app: infinispan-secret-identities
clusterName: tournamentcache
infinispan_cr: tournamentcache
```
| 3e01efc70af78a296f1b66bc823181dfdae2b640 | 2a5cd97f23302e987de357e5a53a4a215af4d223 | https://github.com/quarkusio/quarkus/compare/3e01efc70af78a296f1b66bc823181dfdae2b640...2a5cd97f23302e987de357e5a53a4a215af4d223 | diff --git a/extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java b/extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java
index 6d58dc71b79..2672f56a018 100644
--- a/extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java
+++ b/extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java
@@ -50,7 +50,7 @@ List<ConfigSource> toConfigSources(String kubernetesConfigSourceName, Map<String
log.debug(
"Adding a ConfigSource for the literal data of " + getType() + " '" + kubernetesConfigSourceName + "'");
}
- result.add(createLiteralDataConfigSource(kubernetesConfigSourceName + "-literalData",
+ result.add(createLiteralDataConfigSource(kubernetesConfigSourceName,
categorizedConfigSourceData.literalData,
ORDINAL));
}
@@ -69,9 +69,6 @@ List<ConfigSource> toConfigSources(String kubernetesConfigSourceName, Map<String
+ " '" + kubernetesConfigSourceName + "'");
}
result.add(createYamlConfigSource(kubernetesConfigSourceName, fileName, rawFileData, ORDINAL));
- } else {
- // TODO all keys named `*.{properties,yml,yaml}` are categorized as file sources,
- // but here, we only look for `application.{properties,yml,yaml}`
}
}
@@ -91,7 +88,8 @@ private static CategorizedConfigSourceData categorize(Map<String, String> data)
List<Map.Entry<String, String>> fileData = new ArrayList<>();
for (Map.Entry<String, String> entry : data.entrySet()) {
String key = entry.getKey();
- if (key.endsWith(".yml") || key.endsWith(".yaml") || key.endsWith(".properties")) {
+ if ((key.startsWith("application")) &&
+ ((key.endsWith(".yml") || key.endsWith(".yaml") || key.endsWith(".properties")))) {
fileData.add(entry);
} else {
literalData.put(key, entry.getValue());
diff --git a/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java b/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java
index e34730b5ea3..6d458abc8d7 100644
--- a/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java
+++ b/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java
@@ -59,7 +59,7 @@ void testOnlySingleNonMatchingPropertiesData() {
List<ConfigSource> configSources = sut.toConfigSources(configMap.getMetadata().getName(), configMap.getData());
- assertThat(configSources).isEmpty();
+ assertThat(configSources).isNotEmpty();
}
@Test
@@ -83,7 +83,7 @@ void testOnlySingleNonMatchingYamlData() {
List<ConfigSource> configSources = sut.toConfigSources(configMap.getMetadata().getName(), configMap.getData());
- assertThat(configSources).isEmpty();
+ assertThat(configSources).isNotEmpty();
}
@Test
@@ -101,10 +101,18 @@ void testWithAllKindsOfData() {
List<ConfigSource> configSources = sut.toConfigSources(configMap.getMetadata().getName(), configMap.getData());
assertThat(configSources).hasSize(4);
- assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("literal"))
- .singleElement().satisfies(c -> {
- assertThat(c.getProperties()).containsOnly(entry("some.key", "someValue"));
+
+ assertThat(configSources.get(0).getClass().getName().contains("ConfigMapLiteralDataPropertiesConfigSource")).isTrue();
+
+ assertThat(configSources).filteredOn(c -> !c.getName().toLowerCase().contains("application"))
+ .hasOnlyOneElementSatisfying(c -> {
+ assertThat(c.getProperties()).containsOnly(
+ entry("some.key", "someValue"),
+ entry("app.properties", "ignored1=ignoredValue1"),
+ entry("app.yaml", "ignored2: ignoredValue2"),
+ entry("app.yml", "ignored3: ignoredValue3"));
});
+
assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("application.properties"))
.singleElement().satisfies(c -> {
assertThat(c.getProperties()).containsOnly(entry("key1", "value1"), entry("app.key", "val"));
diff --git a/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java b/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java
index 1a18e573e73..13f9fbf9f86 100644
--- a/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java
+++ b/extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java
@@ -60,7 +60,7 @@ void testOnlySingleNonMatchingPropertiesData() {
List<ConfigSource> configSources = sut.toConfigSources(secret.getMetadata().getName(), secret.getData());
- assertThat(configSources).isEmpty();
+ assertThat(configSources).isNotEmpty();
}
@Test
@@ -84,7 +84,7 @@ void testOnlySingleNonMatchingYamlData() {
List<ConfigSource> configSources = sut.toConfigSources(secret.getMetadata().getName(), secret.getData());
- assertThat(configSources).isEmpty();
+ assertThat(configSources).isNotEmpty();
}
@Test
@@ -102,14 +102,22 @@ void testWithAllKindsOfData() {
List<ConfigSource> configSources = sut.toConfigSources(secret.getMetadata().getName(), secret.getData());
assertThat(configSources).hasSize(4);
- assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("literal"))
- .singleElement().satisfies(c -> {
- assertThat(c.getProperties()).containsOnly(entry("some.key", "someValue"));
+ assertThat(configSources.get(0).getClass().getName().contains("SecretLiteralDataPropertiesConfigSource")).isTrue();
+
+ assertThat(configSources).filteredOn(c -> !c.getName().toLowerCase().contains("application"))
+ .hasOnlyOneElementSatisfying(c -> {
+ assertThat(c.getProperties()).containsOnly(
+ entry("some.key", "someValue"),
+ entry("app.properties", "ignored1=ignoredValue1"),
+ entry("app.yaml", "ignored2: ignoredValue2"),
+ entry("app.yml", "ignored3: ignoredValue3"));
});
+
assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("application.properties"))
.singleElement().satisfies(c -> {
assertThat(c.getProperties()).containsOnly(entry("key1", "value1"), entry("app.key", "val"));
});
+
assertThat(configSources).filteredOn(c -> c.getName().toLowerCase().contains("application.yaml"))
.singleElement().satisfies(c -> {
assertThat(c.getProperties()).containsOnly(entry("key2", "value2"), | ['extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/ConfigMapConfigSourceUtilTest.java', 'extensions/kubernetes-config/runtime/src/main/java/io/quarkus/kubernetes/client/runtime/AbstractKubernetesConfigSourceUtil.java', 'extensions/kubernetes-config/runtime/src/test/java/io/quarkus/kubernetes/client/runtime/SecretConfigSourceUtilTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 10,740,652 | 2,091,919 | 279,290 | 2,996 | 639 | 131 | 8 | 1 | 2,363 | 221 | 662 | 56 | 0 | 2 | 1970-01-01T00:26: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,983 | quarkusio/quarkus/11499/11430 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11430 | https://github.com/quarkusio/quarkus/pull/11499 | https://github.com/quarkusio/quarkus/pull/11499 | 1 | fixes | java.lang.IllegalArgumentException: Unable to resolve locale: c.u-US | When I try to build the jar on a server I got the next error
```
[INFO] --- quarkus-maven-plugin:1.7.0.Final:build (default) @ quarkus-cloud ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.095 s
[INFO] Finished at: 2020-08-17T22:05:49Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.7.0.Final:build (default) on project quarkus-cloud: Failed to build quarkus application: java.lang.IllegalArgumentException: Unable to resolve locale: c.u-US -> [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
```
**Additional context**
IBM cloud toolchain
On my computer works just fine: macos 10.15.6 (19G2021)
| a9e63cc32e428929c43a6430e7f434d5a3e285cb | 4afde7622d20cce580124060239b7617be965d12 | https://github.com/quarkusio/quarkus/compare/a9e63cc32e428929c43a6430e7f434d5a3e285cb...4afde7622d20cce580124060239b7617be965d12 | diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/LocaleConverter.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/LocaleConverter.java
index 304668aa737..cab0ff13948 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/LocaleConverter.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/LocaleConverter.java
@@ -30,7 +30,7 @@ public Locale convert(final String value) {
}
Locale locale = Locale.forLanguageTag(NORMALIZE_LOCALE_PATTERN.matcher(localeValue).replaceAll("-"));
- if (locale.getLanguage() == null || locale.getLanguage().isEmpty()) {
+ if (locale != Locale.ROOT && (locale.getLanguage() == null || locale.getLanguage().isEmpty())) {
throw new IllegalArgumentException("Unable to resolve locale: " + value);
}
diff --git a/core/runtime/src/test/java/io/quarkus/runtime/configuration/LocaleConverterTest.java b/core/runtime/src/test/java/io/quarkus/runtime/configuration/LocaleConverterTest.java
index 0c924c9d781..87d61ffe46c 100644
--- a/core/runtime/src/test/java/io/quarkus/runtime/configuration/LocaleConverterTest.java
+++ b/core/runtime/src/test/java/io/quarkus/runtime/configuration/LocaleConverterTest.java
@@ -1,6 +1,8 @@
package io.quarkus.runtime.configuration;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertSame;
import java.util.Locale;
@@ -19,8 +21,23 @@ public void testStandardLocale() {
@Test
public void testUnderscoreLocale() {
LocaleConverter localeConverter = new LocaleConverter();
- Locale locale = localeConverter.convert("fr-FR");
+ Locale locale = localeConverter.convert("fr_FR");
assertEquals("fr", locale.getLanguage());
assertEquals("FR", locale.getCountry());
}
+
+ @Test
+ public void testCLocale() {
+ LocaleConverter localeConverter = new LocaleConverter();
+ Locale locale = localeConverter.convert("c.u-US");
+ assertSame(Locale.ROOT, locale);
+ }
+
+ @Test
+ public void testEmptyLocale() {
+ LocaleConverter localeConverter = new LocaleConverter();
+ Locale locale = localeConverter.convert("");
+ assertNull(locale);
+ }
+
} | ['core/runtime/src/main/java/io/quarkus/runtime/configuration/LocaleConverter.java', 'core/runtime/src/test/java/io/quarkus/runtime/configuration/LocaleConverterTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,570,019 | 2,057,625 | 274,926 | 2,953 | 184 | 41 | 2 | 1 | 1,209 | 129 | 296 | 24 | 1 | 1 | 1970-01-01T00:26: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,985 | quarkusio/quarkus/11352/11351 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11351 | https://github.com/quarkusio/quarkus/pull/11352 | https://github.com/quarkusio/quarkus/pull/11352 | 1 | fixes | Redis client throw null exception on get | **Describe the bug**
(Describe the problem clearly and concisely.)
Getting null pointer exception when key not exists with following code:
```
@Path("/testing")
class TestController {
@Inject
lateinit var redisClient: RedisClient
@GET
@Path("/test1")
fun test1(): String {
redisClient.get("testing") // this is throwing null pointer exception
return "Testing"
}
}
```
```
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:216)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:515)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:259)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:160)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:163)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:245)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:132)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.access$000(VertxRequestHandler.java:37)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:94)
at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at io.quarkus.redis.client.runtime.RedisClientImpl.await(RedisClientImpl.java:1026)
at io.quarkus.redis.client.runtime.RedisClientImpl.get(RedisClientImpl.java:237)
```
**Expected behavior**
(Describe the expected behavior clearly and concisely.)
**Actual behavior**
(Describe the actual behavior clearly and concisely.)
**To Reproduce**
Steps to reproduce the behavior:
1. above code provided
**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`:
`Darwin sabeehs-mbp.home 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64`
- Output of `java -version`:
```
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
```
- GraalVM version (if different from Java):
- Quarkus version or git rev:
`1.7.0.Final`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
Gradle 6.3
------------------------------------------------------------
Build time: 2020-03-24 19:52:07 UTC
Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60
Kotlin: 1.3.70
Groovy: 2.5.10
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 11.0.2 (Oracle Corporation 11.0.2+9)
OS: Mac OS X 10.15.6 x86_64
```
**Additional context**
(Add any other context about the problem here.)
| d8b2257d6a589f10cbe3942fe7d892088e3bf3fa | d7e13b7273bf41179f410436485947f45ba59155 | https://github.com/quarkusio/quarkus/compare/d8b2257d6a589f10cbe3942fe7d892088e3bf3fa...d7e13b7273bf41179f410436485947f45ba59155 | diff --git a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisClientImpl.java b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisClientImpl.java
index bb1f119610f..e0ef01b0bae 100644
--- a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisClientImpl.java
+++ b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisClientImpl.java
@@ -1023,6 +1023,10 @@ public Response zunionstore(List<String> args) {
}
private Response await(Uni<io.vertx.mutiny.redis.client.Response> mutinyResponse) {
- return mutinyResponse.await().atMost(Duration.ofSeconds(timeout)).getDelegate();
+ io.vertx.mutiny.redis.client.Response response = mutinyResponse.await().atMost(Duration.ofSeconds(timeout));
+ if (response == null) {
+ return null;
+ }
+ return response.getDelegate();
}
}
diff --git a/integration-tests/redis-client/src/main/java/io/quarkus/redis/it/RedisResource.java b/integration-tests/redis-client/src/main/java/io/quarkus/redis/it/RedisResource.java
index e59101e6ae2..0a4e0221110 100644
--- a/integration-tests/redis-client/src/main/java/io/quarkus/redis/it/RedisResource.java
+++ b/integration-tests/redis-client/src/main/java/io/quarkus/redis/it/RedisResource.java
@@ -12,6 +12,7 @@
import io.quarkus.redis.client.RedisClient;
import io.quarkus.redis.client.reactive.ReactiveRedisClient;
import io.smallrye.mutiny.Uni;
+import io.vertx.redis.client.Response;
@Path("/quarkus-redis")
@ApplicationScoped
@@ -26,7 +27,8 @@ public class RedisResource {
@GET
@Path("/sync/{key}")
public String getSync(@PathParam("key") String key) {
- return redisClient.get(key).toString();
+ Response response = redisClient.get(key);
+ return response == null ? null : response.toString();
}
@POST
@@ -41,7 +43,7 @@ public void setSync(@PathParam("key") String key, String value) {
public Uni<String> getReactive(@PathParam("key") String key) {
return reactiveRedisClient
.get(key)
- .map(response -> response.toString());
+ .map(response -> response == null ? null : response.toString());
}
@POST
diff --git a/integration-tests/redis-client/src/test/java/io/quarkus/redis/it/QuarkusRedisTest.java b/integration-tests/redis-client/src/test/java/io/quarkus/redis/it/QuarkusRedisTest.java
index 2c407bab66b..c04cec305f0 100644
--- a/integration-tests/redis-client/src/test/java/io/quarkus/redis/it/QuarkusRedisTest.java
+++ b/integration-tests/redis-client/src/test/java/io/quarkus/redis/it/QuarkusRedisTest.java
@@ -16,6 +16,12 @@ class QuarkusRedisTest {
@Test
public void sync() {
+ RestAssured.given()
+ .when()
+ .get("/quarkus-redis/sync/" + SYNC_KEY)
+ .then()
+ .statusCode(204); // the key is not set yet
+
RestAssured.given()
.body(SYNC_VALUE)
.when()
@@ -33,6 +39,12 @@ public void sync() {
@Test
public void reactive() {
+ RestAssured.given()
+ .when()
+ .get("/quarkus-redis/reactive/" + REACTIVE_KEY)
+ .then()
+ .statusCode(204); // the reactive key is not set yet
+
RestAssured.given()
.body(REACTIVE_VALUE)
.when() | ['integration-tests/redis-client/src/main/java/io/quarkus/redis/it/RedisResource.java', 'integration-tests/redis-client/src/test/java/io/quarkus/redis/it/QuarkusRedisTest.java', 'extensions/redis-client/runtime/src/main/java/io/quarkus/redis/client/runtime/RedisClientImpl.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 10,523,529 | 2,048,427 | 273,725 | 2,929 | 317 | 60 | 6 | 1 | 4,394 | 284 | 1,116 | 104 | 0 | 5 | 1970-01-01T00:26: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,986 | quarkusio/quarkus/11335/11332 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11332 | https://github.com/quarkusio/quarkus/pull/11335 | https://github.com/quarkusio/quarkus/pull/11335 | 1 | fixes | Bundle message function name generated when using params is honoured only for the message key having a parameter in it's arguments and not for the other message keys | **Describe the bug**
Bundle message function name generated when using params is honoured only for the message key having a parameter in it's arguments and not for the other message keys
e.g let's say i have this message bundle
```java
@MessageBundle(defaultKey = Message.UNDERSCORED_ELEMENT_NAME, value = "i18n")
public interface AppDefaultMsg {
@Message("hi {name} from Quarkus")
String helloWithParam(String name);
@Message("hi from Quarkus")
String helloWithoutParam();
}
```
In my template
hello.html
```html
{i18n:hello_with_param('james')}
{i18n:hello_without_param}
```
this will generates an error for the second key saying this
```log
io.quarkus.qute.TemplateException: Found template problems (70):
[1] Incorrect expression: i18n:hello_without_param
- Message bundle [name=i18n, interface=xxx.AppDefaultMsg] does not define a method for key: hello_without_param
- found in template [hello.html]
```
if you change the html to this
```html
{i18n:hello_with_param('james')}
{i18n:helloWithoutParam}
```
It will work hence confirming that the function name generated when using at least one message bundle key with argument doesn't respect the naming strategy used.
**Expected behavior**
I expect that my naming strategy to be applied to all my bundle keys like the normal case without params.
**Actual behavior**
The naming strategy is only honored for the message key having an argument
**To Reproduce**
Steps to reproduce the behavior:
1. Create a message bundle with two keys/values one having an argument and the other without argument
2. Set the naming strategy to something different than the default strategy (underscor or hyphen)
3. Create a qute template and try to display both values
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
`Darwin ***-MacBook-Pro.local 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64`
- Output of `java -version`:
java version "11.0.7" 2020-04-14 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.7+8-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.7+8-LTS, mixed mode
- Quarkus version or git rev: 1.7.0.CR2
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Gradle 6.5.1 | 92c37dc291e102f231730d19c860ea3b2c20e199 | ed73e4bf6171afab3873324a8b0fee62438d1ed6 | https://github.com/quarkusio/quarkus/compare/92c37dc291e102f231730d19c860ea3b2c20e199...ed73e4bf6171afab3873324a8b0fee62438d1ed6 | diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleMethodBuildItem.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleMethodBuildItem.java
index 000c287eb0c..ec39f4ad5e2 100644
--- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleMethodBuildItem.java
+++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleMethodBuildItem.java
@@ -5,7 +5,7 @@
import io.quarkus.builder.item.MultiBuildItem;
/**
- * Represents a message bundle method that has a template that needs to be validated.
+ * Represents a message bundle method.
* <p>
* Note that templates that contain no expressions don't need to be validated.
*/
@@ -45,4 +45,13 @@ public String getTemplate() {
return template;
}
+ /**
+ * A bundle method that does not need to be validated has {@code null} template id.
+ *
+ * @return {@code true} if the template needs to be validated
+ */
+ public boolean isValidatable() {
+ return templateId != null;
+ }
+
}
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 88734fdf924..1aea4304f45 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
@@ -270,8 +270,10 @@ void initBundleContext(MessageBundleRecorder recorder,
bundleInterfaces.put(bundle.getName(), localeToInterface);
}
- Map<String, String> templateIdToContent = messageBundleMethods.stream().collect(
- Collectors.toMap(MessageBundleMethodBuildItem::getTemplateId, MessageBundleMethodBuildItem::getTemplate));
+ Map<String, String> templateIdToContent = messageBundleMethods.stream()
+ .filter(MessageBundleMethodBuildItem::isValidatable).collect(
+ Collectors.toMap(MessageBundleMethodBuildItem::getTemplateId,
+ MessageBundleMethodBuildItem::getTemplate));
syntheticBeans.produce(SyntheticBeanBuildItem.configure(MessageBundleRecorder.BundleContext.class)
.supplier(recorder.createContext(templateIdToContent, bundleInterfaces)).done());
@@ -283,6 +285,7 @@ void validateMessageBundleMethods(TemplatesAnalysisBuildItem templatesAnalysis,
BuildProducer<IncorrectExpressionBuildItem> incorrectExpressions) {
Map<String, MessageBundleMethodBuildItem> bundleMethods = messageBundleMethods.stream()
+ .filter(MessageBundleMethodBuildItem::isValidatable)
.collect(Collectors.toMap(MessageBundleMethodBuildItem::getTemplateId, Function.identity()));
for (TemplateAnalysis analysis : templatesAnalysis.getAnalysis()) {
@@ -588,13 +591,9 @@ private String generateImplementation(ClassInfo defaultBundleInterface, String d
if (messageTemplate == null) {
messageTemplate = messageAnnotation.value().asString();
}
- if (!messageTemplate.contains("}")) {
- // No expression/tag - no need to use qute
- bundleMethod.returnValue(bundleMethod.load(messageTemplate));
- } else {
- // Obtain the template, e.g. msg_hello_name
- String templateId;
+ String templateId = null;
+ if (messageTemplate.contains("}")) {
if (defaultBundleInterface != null) {
if (locale == null) {
AnnotationInstance localizedAnnotation = bundleInterface.classAnnotation(LOCALIZED);
@@ -604,10 +603,18 @@ private String generateImplementation(ClassInfo defaultBundleInterface, String d
} else {
templateId = bundleName + "_" + key;
}
+ }
- messageTemplateMethods
- .produce(new MessageBundleMethodBuildItem(bundleName, key, templateId, method, messageTemplate));
+ MessageBundleMethodBuildItem messageBundleMethod = new MessageBundleMethodBuildItem(bundleName, key, templateId,
+ method, messageTemplate);
+ messageTemplateMethods
+ .produce(messageBundleMethod);
+ if (!messageBundleMethod.isValidatable()) {
+ // No expression/tag - no need to use qute
+ bundleMethod.returnValue(bundleMethod.load(messageTemplate));
+ } else {
+ // Obtain the template, e.g. msg_hello_name
ResultHandle template = bundleMethod.invokeStaticMethod(BUNDLES_GET_TEMPLATE,
bundleMethod.load(templateId));
// Create a template instance
diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/AlphaMessages.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/AlphaMessages.java
index e973f3dedc4..c405d5fd7f1 100644
--- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/AlphaMessages.java
+++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/AlphaMessages.java
@@ -12,4 +12,7 @@ public interface AlphaMessages {
@Message(value = "Hello!", key = "hello_alpha")
String hello();
+ @Message("Hello {name} from alpha!")
+ String helloWithParam(String name);
+
}
diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/MessageBundleTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/MessageBundleTest.java
index 441296a36f9..cee340f1ba1 100644
--- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/MessageBundleTest.java
+++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/MessageBundleTest.java
@@ -25,7 +25,7 @@ public class MessageBundleTest {
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(AppMessages.class, OtherMessages.class, AlphaMessages.class, Item.class)
.addAsResource(new StringAsset(
- "{msg:hello} {msg:hello_name('Jachym')} {msg:hello_with_if_section(3)} {alpha:hello-alpha} {alpha:hello_alpha}"),
+ "{msg:hello} {msg:hello_name('Jachym')} {msg:hello_with_if_section(3)} {alpha:hello-alpha} {alpha:hello_alpha} {alpha:hello-with-param('foo')}"),
"templates/foo.html")
.addAsResource(new StringAsset(
"hello=Hallo Welt!\\nhello_name=Hallo {name}!"),
@@ -64,10 +64,11 @@ public void testBeans() {
@Test
public void testResolvers() {
- assertEquals("Hello world! Hello Jachym! Hello you guys! Hello alpha! Hello!", foo.instance().render());
- assertEquals("Hello world! Ahoj Jachym! Hello you guys! Hello alpha! Hello!",
+ assertEquals("Hello world! Hello Jachym! Hello you guys! Hello alpha! Hello! Hello foo from alpha!",
+ foo.instance().render());
+ assertEquals("Hello world! Ahoj Jachym! Hello you guys! Hello alpha! Hello! Hello foo from alpha!",
foo.instance().setAttribute(MessageBundles.ATTRIBUTE_LOCALE, Locale.forLanguageTag("cs")).render());
- assertEquals("Hallo Welt! Hallo Jachym! Hello you guys! Hello alpha! Hello!",
+ assertEquals("Hallo Welt! Hallo Jachym! Hello you guys! Hello alpha! Hello! Hello foo from alpha!",
foo.instance().setAttribute(MessageBundles.ATTRIBUTE_LOCALE, Locale.GERMAN).render());
assertEquals("Dot test!", engine.parse("{msg:['dot.test']}").render());
} | ['extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/AlphaMessages.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleProcessor.java', 'extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/MessageBundleTest.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/MessageBundleMethodBuildItem.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 10,522,973 | 2,048,323 | 273,709 | 2,929 | 2,116 | 385 | 38 | 2 | 2,353 | 311 | 619 | 63 | 0 | 4 | 1970-01-01T00:26: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,987 | quarkusio/quarkus/11328/11253 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11253 | https://github.com/quarkusio/quarkus/pull/11328 | https://github.com/quarkusio/quarkus/pull/11328 | 1 | fixes | Regression in 1.7: Dev mode auto-compile fails in MapStruct with "Attempt to recreate a file for type ..." | **Describe the bug**
I am getting this strange error during auto-compile while trying to start dev mode in one of our modules:
```
[INFO] --- quarkus-maven-plugin:1.7.0.CR2:dev (default-cli) @ middleware-patient-api-pro-fe ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 54 source files to C:\\Develop\\someproject\\middleware\\_develop-2\\someproject-middleware\\patient\\api\\pro-fe\\target\\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Develop/someproject/middleware/_develop-2/someproject-middleware/patient/api/pro-fe/src/main/java/com/somecompany/someproject/middleware/patient/api/pro_fe/data/mapper/CaseFileApiMapper.java:[26,8] Internal error in the mapping processor: java.lang.Rat org.codehaus.plexus.classworlds.launcat org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347) Caused by: javax.annotation.processing.FilerException: Attempt to recreate a file for type com.somecompany.someproject.middleware.patient.api.pro_fe... 49 more Casat jdk.compiler/com.sun.tools.javac.processing.JavacFiler.createSourceFile(JavacFiler.java:426) stence(at org.mapstruct.ap.internal.processor.MapperRenderingProcessor.createSourceFile(Mappe[INFO] 1 error
```
I have no clue why this is so horribly garbled. `mvn -e ...` doesn't help much but at least reveals which type was attempted to recreate.
```
Attempt to recreate a file for type com.somecompany.someproject.middleware.patient.api.pro_fe.data.mapper.CaseFileApiMapperImpl
at org.mapstruct.ap.internal.processor.MapperRen(... garbled, I suppose MapperRenderingProcessor)
```
This is _not_ flaky, btw. Only the affected "MapperImpl" can fluctuate (we have multiple mappers).
Dev mode in another module does work, but there we do not use MapStruct.
**The very same code works with 1.6.1.Final!**
**Expected behavior**
Should just compile (if needed) without errors.
**Actual behavior**
Build is aborted.
**To Reproduce**
Steps to reproduce the behavior:
1. git clone clone https://github.com/famod/quarkus-quickstarts
2. git switch issue-11253-mapstruct-vs-prepare
4. cd getting-started
5. should pass: mvn clean verify (or install)
6. should fail: mvn quarkus:dev
Note: This reproducer uses MapStruct 1.4.0.Beta3. Downgrading to 1.3.1.Final does not change anything.
**Configuration**
n/a
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `MINGW64_NT-10.0-18363 XXX 3.0.7-338.x86_64 2019-11-21 23:07 UTC x86_64 Msys`
- Output of `java -version`: `OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)`
- GraalVM version (if different from Java): n/a
- Quarkus version or git rev: 1.7.0.CR1 or 1.7.0.CR2
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3
**Additional context**
`mvn clean compile quarkus:dev` works, which is no wonder since compile is skipped in this case.
I found two commits that may have something to do with it (the first one being the "hottest" candidate):
- https://github.com/quarkusio/quarkus/commit/93e1ba6f97fa2714fe67c42d8d197f0210437100#diff-c007939524ea2a3177991ef913abf5df
- https://github.com/quarkusio/quarkus/commit/3d7e64230f97a1772fb6bb58b929a2471e5a5eb2#diff-c007939524ea2a3177991ef913abf5df
I did not yet have the time to debug this. | 85fc8c0310dc6f8d898b959a9ddc842b2462d295 | 8b8bdfebf1eda5b5e7be16bd48145d3d043f0f29 | https://github.com/quarkusio/quarkus/compare/85fc8c0310dc6f8d898b959a9ddc842b2462d295...8b8bdfebf1eda5b5e7be16bd48145d3d043f0f29 | diff --git a/devtools/maven/src/main/java/io/quarkus/maven/CodeGenMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/CodeGenMojo.java
index dc812e5b613..3f3563047a7 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/CodeGenMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/CodeGenMojo.java
@@ -106,8 +106,6 @@ void doExecute(Path sourcesDir,
? buildDir.toPath().resolve("generated-test-sources")
: buildDir.toPath().resolve("generated-sources");
- sourceRegistrar.accept(generatedSourcesDir);
-
QuarkusClassLoader deploymentClassLoader = curatedApplication.createDeploymentClassLoader();
List<CodeGenData> codeGens = CodeGenerator.init(deploymentClassLoader,
Collections.singleton(sourcesDir), | ['devtools/maven/src/main/java/io/quarkus/maven/CodeGenMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,522,826 | 2,048,277 | 273,714 | 2,929 | 59 | 9 | 2 | 1 | 3,564 | 351 | 993 | 60 | 3 | 2 | 1970-01-01T00:26: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,988 | quarkusio/quarkus/11307/11264 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11264 | https://github.com/quarkusio/quarkus/pull/11307 | https://github.com/quarkusio/quarkus/pull/11307 | 1 | fixes | Amazon client requires both transport client implementations for native compilation | **Describe the bug**
The [AmazonClientTransportRecorder](https://github.com/quarkusio/quarkus/blob/master/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientTransportRecorder.java)
has both UrlConnectionHttpClient and ApacheHttpClient Code in the Runtime Recorder which seems to require both the respective dependencies during native image compilation.
**Expected behavior**
Only one of the dependencies is required during native image build time.
**Actual behavior**
Both of the dependencies are needed, which increases build time.
| 26a7116f67938744c43acb83f19c2dc50ada26f6 | 8a4119a9edf5ba1c0c96990d613d23cdc6f4754b | https://github.com/quarkusio/quarkus/compare/26a7116f67938744c43acb83f19c2dc50ada26f6...8a4119a9edf5ba1c0c96990d613d23cdc6f4754b | diff --git a/extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java b/extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java
index 46b7ae6cf69..a678c2ecff1 100644
--- a/extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java
+++ b/extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java
@@ -88,8 +88,11 @@ public void createTransportBuilders(List<AmazonClientBuildItem> amazonClients,
RuntimeValue<SdkAsyncHttpClient.Builder> asyncTransport = null;
if (client.getSyncClassName().isPresent()) {
- syncTransport = recorder.configureSync(configName(), buildSyncConfig,
- syncConfig);
+ if (buildSyncConfig.type == SyncHttpClientBuildTimeConfig.SyncClientType.APACHE) {
+ syncTransport = recorder.configureSyncApacheHttpClient(configName(), syncConfig);
+ } else {
+ syncTransport = recorder.configureSyncUrlConnectionHttpClient(configName(), syncConfig);
+ }
}
if (client.getAsyncClassName().isPresent()) {
diff --git a/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientTransportRecorder.java b/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientTransportRecorder.java
index 91f64f34be6..60f1d7684d2 100644
--- a/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientTransportRecorder.java
+++ b/extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientTransportRecorder.java
@@ -5,7 +5,6 @@
import java.util.HashSet;
import java.util.Optional;
-import io.quarkus.amazon.common.runtime.SyncHttpClientBuildTimeConfig.SyncClientType;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;
import software.amazon.awssdk.http.SdkHttpClient;
@@ -24,55 +23,6 @@
@Recorder
public class AmazonClientTransportRecorder {
- public RuntimeValue<SdkHttpClient.Builder> configureSync(String clientName, SyncHttpClientBuildTimeConfig buildConfig,
- RuntimeValue<SyncHttpClientConfig> syncConfigRuntime) {
-
- SdkHttpClient.Builder syncBuilder;
- SyncHttpClientConfig syncConfig = syncConfigRuntime.getValue();
-
- validateTlsManagersProvider(clientName, syncConfig.tlsManagersProvider, "sync");
-
- if (buildConfig.type == SyncClientType.APACHE) {
- Builder builder = ApacheHttpClient.builder();
- validateApacheClientConfig(clientName, syncConfig);
-
- builder.connectionTimeout(syncConfig.connectionTimeout);
- builder.connectionAcquisitionTimeout(syncConfig.apache.connectionAcquisitionTimeout);
- builder.connectionMaxIdleTime(syncConfig.apache.connectionMaxIdleTime);
- syncConfig.apache.connectionTimeToLive.ifPresent(builder::connectionTimeToLive);
- builder.expectContinueEnabled(syncConfig.apache.expectContinueEnabled);
- builder.maxConnections(syncConfig.apache.maxConnections);
- builder.socketTimeout(syncConfig.socketTimeout);
- builder.useIdleConnectionReaper(syncConfig.apache.useIdleConnectionReaper);
-
- if (syncConfig.apache.proxy.enabled && syncConfig.apache.proxy.endpoint.isPresent()) {
- ProxyConfiguration.Builder proxyBuilder = ProxyConfiguration.builder()
- .endpoint(syncConfig.apache.proxy.endpoint.get());
- syncConfig.apache.proxy.username.ifPresent(proxyBuilder::username);
- syncConfig.apache.proxy.password.ifPresent(proxyBuilder::password);
- syncConfig.apache.proxy.nonProxyHosts.ifPresent(c -> c.forEach(proxyBuilder::addNonProxyHost));
- syncConfig.apache.proxy.ntlmDomain.ifPresent(proxyBuilder::ntlmDomain);
- syncConfig.apache.proxy.ntlmWorkstation.ifPresent(proxyBuilder::ntlmWorkstation);
- syncConfig.apache.proxy.preemptiveBasicAuthenticationEnabled
- .ifPresent(proxyBuilder::preemptiveBasicAuthenticationEnabled);
-
- builder.proxyConfiguration(proxyBuilder.build());
- }
- getTlsKeyManagersProvider(syncConfig.tlsManagersProvider).ifPresent(builder::tlsKeyManagersProvider);
-
- syncBuilder = builder;
- } else {
- UrlConnectionHttpClient.Builder builder = UrlConnectionHttpClient.builder();
- builder.connectionTimeout(syncConfig.connectionTimeout);
- builder.socketTimeout(syncConfig.socketTimeout);
- getTlsKeyManagersProvider(syncConfig.tlsManagersProvider).ifPresent(builder::tlsKeyManagersProvider);
-
- syncBuilder = builder;
- }
-
- return new RuntimeValue<>(syncBuilder);
- }
-
public RuntimeValue<SdkAsyncHttpClient.Builder> configureAsync(String clientName,
RuntimeValue<NettyHttpClientConfig> asyncConfigRuntime) {
NettyNioAsyncHttpClient.Builder builder = NettyNioAsyncHttpClient.builder();
@@ -126,6 +76,50 @@ public RuntimeValue<SdkAsyncHttpClient.Builder> configureAsync(String clientName
return new RuntimeValue<>(builder);
}
+ public RuntimeValue<SdkHttpClient.Builder> configureSyncUrlConnectionHttpClient(String clientName,
+ RuntimeValue<SyncHttpClientConfig> syncConfigRuntime) {
+ SyncHttpClientConfig syncConfig = syncConfigRuntime.getValue();
+ validateTlsManagersProvider(clientName, syncConfig.tlsManagersProvider, "sync");
+ UrlConnectionHttpClient.Builder builder = UrlConnectionHttpClient.builder();
+ builder.connectionTimeout(syncConfig.connectionTimeout);
+ builder.socketTimeout(syncConfig.socketTimeout);
+ getTlsKeyManagersProvider(syncConfig.tlsManagersProvider).ifPresent(builder::tlsKeyManagersProvider);
+ return new RuntimeValue<>(builder);
+ }
+
+ public RuntimeValue<SdkHttpClient.Builder> configureSyncApacheHttpClient(String clientName,
+ RuntimeValue<SyncHttpClientConfig> syncConfigRuntime) {
+ SyncHttpClientConfig syncConfig = syncConfigRuntime.getValue();
+ validateTlsManagersProvider(clientName, syncConfig.tlsManagersProvider, "sync");
+ Builder builder = ApacheHttpClient.builder();
+ validateApacheClientConfig(clientName, syncConfig);
+
+ builder.connectionTimeout(syncConfig.connectionTimeout);
+ builder.connectionAcquisitionTimeout(syncConfig.apache.connectionAcquisitionTimeout);
+ builder.connectionMaxIdleTime(syncConfig.apache.connectionMaxIdleTime);
+ syncConfig.apache.connectionTimeToLive.ifPresent(builder::connectionTimeToLive);
+ builder.expectContinueEnabled(syncConfig.apache.expectContinueEnabled);
+ builder.maxConnections(syncConfig.apache.maxConnections);
+ builder.socketTimeout(syncConfig.socketTimeout);
+ builder.useIdleConnectionReaper(syncConfig.apache.useIdleConnectionReaper);
+
+ if (syncConfig.apache.proxy.enabled && syncConfig.apache.proxy.endpoint.isPresent()) {
+ ProxyConfiguration.Builder proxyBuilder = ProxyConfiguration.builder()
+ .endpoint(syncConfig.apache.proxy.endpoint.get());
+ syncConfig.apache.proxy.username.ifPresent(proxyBuilder::username);
+ syncConfig.apache.proxy.password.ifPresent(proxyBuilder::password);
+ syncConfig.apache.proxy.nonProxyHosts.ifPresent(c -> c.forEach(proxyBuilder::addNonProxyHost));
+ syncConfig.apache.proxy.ntlmDomain.ifPresent(proxyBuilder::ntlmDomain);
+ syncConfig.apache.proxy.ntlmWorkstation.ifPresent(proxyBuilder::ntlmWorkstation);
+ syncConfig.apache.proxy.preemptiveBasicAuthenticationEnabled
+ .ifPresent(proxyBuilder::preemptiveBasicAuthenticationEnabled);
+
+ builder.proxyConfiguration(proxyBuilder.build());
+ }
+ getTlsKeyManagersProvider(syncConfig.tlsManagersProvider).ifPresent(builder::tlsKeyManagersProvider);
+ return new RuntimeValue<>(builder);
+ }
+
private Optional<TlsKeyManagersProvider> getTlsKeyManagersProvider(TlsManagersProviderConfig config) {
if (config.fileStore != null && config.fileStore.path.isPresent() && config.fileStore.type.isPresent()) {
return Optional.of(config.type.create(config)); | ['extensions/amazon-services/common/deployment/src/main/java/io/quarkus/amazon/common/deployment/AbstractAmazonServiceProcessor.java', 'extensions/amazon-services/common/runtime/src/main/java/io/quarkus/amazon/common/runtime/AmazonClientTransportRecorder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,522,376 | 2,048,178 | 273,686 | 2,929 | 6,304 | 1,082 | 101 | 2 | 594 | 53 | 108 | 10 | 1 | 0 | 1970-01-01T00:26: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,969 | quarkusio/quarkus/11781/11780 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11780 | https://github.com/quarkusio/quarkus/pull/11781 | https://github.com/quarkusio/quarkus/pull/11781 | 1 | fixes | Flyway migrations does not work anymore on JDK8 after upgrade to 1.7.1.Final | **Describe the bug**
Flyway migration does not work anymore on quarkus 1.7.1 with jdk 8 when executing from inside a jar
Reproducer:
https://github.com/rmanibus/quarkus-reproducer
```
# with open-jdk 8 (it works in jdk 14):
mvn clean install
java -jar target/code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
```
This seems to have been introduced by https://github.com/quarkusio/quarkus/pull/11300
**Expected behavior**
Flyway migrations are executed
**Actual behavior**
The application throws with:
```
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2020-09-01 15:31:30,945 INFO [org.fly.cor.int.lic.VersionPrinter] (main) Flyway Community Edition 6.5.3 by Redgate
2020-09-01 15:31:31,103 INFO [org.fly.cor.int.dat.DatabaseFactory] (main) Database: jdbc:h2:mem:secondary (H2 1.4)
2020-09-01 15:31:31,235 INFO [org.fly.cor.int.sch.JdbcTableSchemaHistory] (main) Creating Schema History table "PUBLIC"."flyway_schema_history" ...
2020-09-01 15:31:31,304 ERROR [io.qua.application] (main) Failed to start application (with profile prod): org.flywaydb.core.api.FlywayException: Unable to obtain inputstream for resource: db/migration/h2-global/../h2-global/V1.0.1__Quarkus.sql
at org.flywaydb.core.internal.resource.classpath.ClassPathResource.read(ClassPathResource.java:90)
at org.flywaydb.core.internal.resolver.ChecksumCalculator.calculateChecksumForResource(ChecksumCalculator.java:67)
at org.flywaydb.core.internal.resolver.ChecksumCalculator.calculate(ChecksumCalculator.java:46)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.getChecksumForLoadableResource(SqlMigrationResolver.java:143)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.addMigrations(SqlMigrationResolver.java:181)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:88)
at org.flywaydb.core.internal.resolver.sql.SqlMigrationResolver.resolveMigrations(SqlMigrationResolver.java:44)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.collectMigrations(CompositeMigrationResolver.java:127)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.doFindAvailableMigrations(CompositeMigrationResolver.java:109)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:95)
at org.flywaydb.core.internal.resolver.CompositeMigrationResolver.resolveMigrations(CompositeMigrationResolver.java:46)
at org.flywaydb.core.internal.info.MigrationInfoServiceImpl.refresh(MigrationInfoServiceImpl.java:130)
at org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:185)
at org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:54)
at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:162)
at org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:159)
at org.flywaydb.core.internal.jdbc.TableLockingExecutionTemplate$1.call(TableLockingExecutionTemplate.java:38)
at org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:66)
at org.flywaydb.core.internal.jdbc.TableLockingExecutionTemplate.execute(TableLockingExecutionTemplate.java:33)
at org.flywaydb.core.internal.database.base.Connection.lock(Connection.java:129)
at org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:140)
at org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:159)
at org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:137)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:206)
at org.flywaydb.core.Flyway$1.execute(Flyway.java:158)
at org.flywaydb.core.Flyway.execute(Flyway.java:527)
at org.flywaydb.core.Flyway.migrate(Flyway.java:158)
at io.quarkus.flyway.runtime.FlywayRecorder.doStartActions(FlywayRecorder.java:54)
at io.quarkus.deployment.steps.FlywayProcessor$createBeansAndStartActions-1520831253.deploy_0(FlywayProcessor$createBeansAndStartActions-1520831253.zig:91)
at io.quarkus.deployment.steps.FlywayProcessor$createBeansAndStartActions-1520831253.deploy(FlywayProcessor$createBeansAndStartActions-1520831253.zig:40)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:553)
at io.quarkus.runtime.Application.start(Application.java:90)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:92)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
``` | 0255e3672057bb610521a14e5e819f32f3563131 | fb29de4f28070099055defff30910744fba126d1 | https://github.com/quarkusio/quarkus/compare/0255e3672057bb610521a14e5e819f32f3563131...fb29de4f28070099055defff30910744fba126d1 | diff --git a/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java b/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
index 1344f7e5342..000729c1541 100644
--- a/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
+++ b/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
@@ -252,7 +252,7 @@ private Set<String> getApplicationMigrationsFromPath(final String location, fina
try (final Stream<Path> pathStream = Files.walk(rootPath)) {
return pathStream.filter(Files::isRegularFile)
- .map(it -> Paths.get(location, rootPath.relativize(it).toString()).toString())
+ .map(it -> Paths.get(location, rootPath.relativize(it).toString()).normalize().toString())
// we don't want windows paths here since the paths are going to be used as classpath paths anyway
.map(it -> it.replace('\\\\', '/'))
.peek(it -> LOGGER.debugf("Discovered path: %s", it)) | ['extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,958,773 | 2,135,578 | 285,308 | 3,070 | 211 | 44 | 2 | 1 | 4,713 | 217 | 1,249 | 71 | 2 | 2 | 1970-01-01T00:26:38 | 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 |
3,037 | quarkusio/quarkus/10019/9753 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9753 | https://github.com/quarkusio/quarkus/pull/10019 | https://github.com/quarkusio/quarkus/pull/10019 | 1 | fixes | Building GraphQL quickstart generates warnings that should be avoided | We shouldn't have these warnings when building a GraphQL application:
```
[WARNING] [io.quarkus.deployment.steps.ReflectiveHierarchyStep] Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- java.lang.Boolean
- java.lang.Double
- java.lang.Enum
- java.lang.Integer
- java.lang.Object
- java.lang.String
- java.time.LocalDate
- java.util.List
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.");.
``` | cc65ca85f9611bbb577e31392f7a295c9d69e135 | 40ea18287eaf9b62c5b55e9429e5368ba353788b | https://github.com/quarkusio/quarkus/compare/cc65ca85f9611bbb577e31392f7a295c9d69e135...40ea18287eaf9b62c5b55e9429e5368ba353788b | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
index 94f38b2cb35..481a9b9dcc9 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
@@ -76,9 +76,15 @@ public static class DefaultIgnorePredicate implements Predicate<DotName> {
static final Set<String> WHITELISTED_FROM_IGNORED_PACKAGES = new HashSet<>(
Arrays.asList("java.math.BigDecimal", "java.math.BigInteger"));
+ static final List<String> PRIMITIVE = Arrays.asList("boolean", "byte",
+ "char", "short", "int", "long", "float", "double");
+
@Override
public boolean test(DotName dotName) {
String name = dotName.toString();
+ if (PRIMITIVE.contains(name)) {
+ return true;
+ }
for (String containerPackageName : DEFAULT_IGNORED_PACKAGES) {
if (name.startsWith(containerPackageName)) {
return !WHITELISTED_FROM_IGNORED_PACKAGES.contains(name);
diff --git a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
index 71901a6a2e1..6f0295b4c26 100644
--- a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
+++ b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
@@ -13,7 +13,6 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import java.util.function.Predicate;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -62,7 +61,6 @@
import io.smallrye.graphql.cdi.config.ConfigKey;
import io.smallrye.graphql.cdi.config.GraphQLConfig;
import io.smallrye.graphql.cdi.producer.GraphQLProducer;
-import io.smallrye.graphql.execution.Classes;
import io.smallrye.graphql.schema.Annotations;
import io.smallrye.graphql.schema.SchemaBuilder;
import io.smallrye.graphql.schema.model.Argument;
@@ -151,7 +149,7 @@ void buildExecutionService(
for (String c : getClassesToRegisterForReflection(schema)) {
DotName name = DotName.createSimple(c);
org.jboss.jandex.Type type = org.jboss.jandex.Type.create(name, org.jboss.jandex.Type.Kind.CLASS);
- reflectiveHierarchyProducer.produce(new ReflectiveHierarchyBuildItem(type, index, GraphQLIgnorePredicate.INSTANCE));
+ reflectiveHierarchyProducer.produce(new ReflectiveHierarchyBuildItem(type, index));
}
// Make sure the GraphQL Java classes needed for introspection can work in native mode
@@ -486,14 +484,4 @@ public void run() {
}
}
}
-
- public static class GraphQLIgnorePredicate implements Predicate<DotName> {
-
- public static final GraphQLIgnorePredicate INSTANCE = new GraphQLIgnorePredicate();
-
- @Override
- public boolean test(DotName t) {
- return Classes.isPrimitive(t.toString()) || t.toString().startsWith("java.net.");
- }
- }
} | ['extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 9,449,917 | 1,836,397 | 244,937 | 2,628 | 904 | 169 | 20 | 2 | 617 | 75 | 140 | 14 | 0 | 1 | 1970-01-01T00:26: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,948 | quarkusio/quarkus/12224/12223 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/12223 | https://github.com/quarkusio/quarkus/pull/12224 | https://github.com/quarkusio/quarkus/pull/12224 | 1 | fixes | Kafka-streams dev mode broken | **Describe the bug**
Kafka-streams dev mode is not working anymore when an update of the application is detected.
**Expected behavior**
If a project source file is updated, the dev-mode recompiles the project and is able to relaunch the application to continue to work
**Actual behavior**
The PR #11540 introduced a [boolean flag](https://github.com/quarkusio/quarkus/pull/11540/files#diff-b1ea2a75cf0dc3e000fb088c2e58d4e8R55) to prevent kafka-streams to start if the application is stopping prematurely. Once this flag set kafka-streams won't be restarted in any situation.
**To Reproduce**
This would be reproductible with the kafka-streams quickstart
| 77b772c6dc4d44649fa6b03b1b824bac9abfea5d | 12c66131b67525c5f563a5eb1d027519aff16031 | https://github.com/quarkusio/quarkus/compare/77b772c6dc4d44649fa6b03b1b824bac9abfea5d...12c66131b67525c5f563a5eb1d027519aff16031 | 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 1037b6dc61f..b9587c916da 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
@@ -63,6 +63,7 @@ public class KafkaStreamsProducer {
public KafkaStreamsProducer(KafkaStreamsSupport kafkaStreamsSupport, KafkaStreamsRuntimeConfig runtimeConfig,
Instance<Topology> topology, Instance<KafkaClientSupplier> kafkaClientSupplier,
Instance<StateListener> stateListener, Instance<StateRestoreListener> globalStateRestoreListener) {
+ shutdown = false;
// No producer for Topology -> nothing to do
if (topology.isUnsatisfied()) {
LOGGER.debug("No Topology producer; Kafka Streams will not be started"); | ['extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 11,252,861 | 2,197,477 | 292,951 | 3,117 | 26 | 5 | 1 | 1 | 671 | 84 | 165 | 12 | 1 | 0 | 1970-01-01T00:26: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,949 | quarkusio/quarkus/12181/12116 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/12116 | https://github.com/quarkusio/quarkus/pull/12181 | https://github.com/quarkusio/quarkus/pull/12181 | 1 | fixes | No suitable driver found for Postgresql with TestContainers since Quarkus 1.8 | **Describe the bug**
I have a TestContainers test that pings a Postgres DB. This test does not actually use Quarkus but I realized that it was working in 1.7.3 and failing in 1.8.
It is not a stopper for me (as I said, I realized I should have taken the `@QuarkusTest` annotation) but it sounds that something has been introduced that it makes this test fail (this test has been working since Quarkus 1.6 at least).
**Expected behavior**
The test should pass as in 1.7.3
**Actual behavior**
The test fail with:
```
java.sql.SQLException: No suitable driver found for jdbc:postgresql://localhost:32831/vintageStoreDB?loggerLevel=OFF
at org.acme.PingPostgreSQLTest.shouldPingPostgreSQL(PingPostgreSQLTest.java:32)
```
**To Reproduce**
Generate a brand new Quarkus 1.7.3-Final app with the Postgres extension. Then, add the TestContainers dependency:
```
<properties>
...
<testcontainers.version>1.14.3</testcontainers.version>
</properties>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${testcontainers.version}</version>
<scope>test</scope>
</dependency>
```
Now create a new Test
```
@QuarkusTest
@Testcontainers
public class PingPostgreSQLTest {
@Container
public static PostgreSQLContainer pg = new PostgreSQLContainer<>("postgres:12.4")
.withDatabaseName("vintageStoreDB")
.withUsername("vintage")
.withPassword("vintage")
.withExposedPorts(5432);
@Test
public void shouldPingPostgreSQL() throws Exception {
pg.start();
try (Connection con = DriverManager.getConnection(pg.getJdbcUrl(), pg.getUsername(), pg.getPassword());
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("SELECT VERSION()")) {
if (rs.next()) {
assertTrue(rs.getString(1).contains("PostgreSQL 12"));
} else {
throw new Exception();
}
}
pg.stop();
}
}
```
This test just uses TestContainers to ping a Postgres db. It doesn't use any Quarkus. In fact, if you leave the `@QuarkusTest` annotation it also works. Then, move to Quarkus 1.8.0, it fails.
**Configuration**
The test with 1.7.3 works even without any `application.properties` file declaring a Postgres driver or JDBC URL.
Because it is now failing with 1.8 I tried to add `quarkus.datasource.db-kind=postgresql` and so on.
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Darwin iMac-Pro-de-Antonio.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Jun 18 20:49:00 PDT 2020; root:xnu-6153.141.1~1/RELEASE_X86_64 x86_64
- Output of `java -version`: java version "11.0.6" 2020-01-14 LTS
- GraalVM version (if different from Java):
- Quarkus version or git rev: 1.8.0-Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): 3.6.3_1
**Additional context**
(Add any other context about the problem here.)
| b355df2af042544603d451839d8657e431ca5287 | dbbebc0e62377e1d111c284bb7f9a3add6922e16 | https://github.com/quarkusio/quarkus/compare/b355df2af042544603d451839d8657e431ca5287...dbbebc0e62377e1d111c284bb7f9a3add6922e16 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DriverRemover.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DriverRemover.java
index 283ea4c8af9..99176b1dff7 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DriverRemover.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DriverRemover.java
@@ -10,13 +10,21 @@ public class DriverRemover implements Runnable {
private static final Logger log = Logger.getLogger(DriverRemover.class);
+ final ClassLoader goingAwayCl;
+
+ public DriverRemover(ClassLoader goingAwayCl) {
+ this.goingAwayCl = goingAwayCl;
+ }
+
@Override
public void run() {
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
try {
- DriverManager.deregisterDriver(driver);
+ if (driver.getClass().getClassLoader() == goingAwayCl) {
+ DriverManager.deregisterDriver(driver);
+ }
} catch (SQLException t) {
log.error("Failed to deregister driver", t);
}
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
index 61dae72b5b6..c7ffad2f2e9 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
@@ -8,6 +8,7 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.security.ProtectionDomain;
+import java.sql.Driver;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -84,6 +85,7 @@ public class QuarkusClassLoader extends ClassLoader implements Closeable {
}
private boolean closed;
+ private volatile boolean driverLoaded;
private QuarkusClassLoader(Builder builder) {
//we need the parent to be null
@@ -397,8 +399,12 @@ protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundE
if (classPathElementResource != null) { //can happen if the class loader was closed
byte[] data = classPathElementResource.getData();
definePackage(name, classPathElement);
- return defineClass(name, data, 0, data.length,
+ Class<?> cl = defineClass(name, data, 0, data.length,
protectionDomains.computeIfAbsent(classPathElement, (ce) -> ce.getProtectionDomain(this)));
+ if (Driver.class.isAssignableFrom(cl)) {
+ driverLoaded = true;
+ }
+ return cl;
}
}
@@ -481,14 +487,17 @@ public void close() {
}
closed = true;
}
- //DriverManager only lets you remove drivers with the same CL as the caller
- //so we need do define the cleaner in this class loader
- try (InputStream is = getClass().getResourceAsStream("DriverRemover.class")) {
- byte[] data = JarClassPathElement.readStreamContents(is);
- Runnable r = (Runnable) defineClass(DriverRemover.class.getName(), data, 0, data.length).newInstance();
- r.run();
- } catch (Exception e) {
- log.debug("Failed to clean up DB drivers");
+ if (driverLoaded) {
+ //DriverManager only lets you remove drivers with the same CL as the caller
+ //so we need do define the cleaner in this class loader
+ try (InputStream is = getClass().getResourceAsStream("DriverRemover.class")) {
+ byte[] data = JarClassPathElement.readStreamContents(is);
+ Runnable r = (Runnable) defineClass(DriverRemover.class.getName(), data, 0, data.length)
+ .getConstructor(ClassLoader.class).newInstance(this);
+ r.run();
+ } catch (Exception e) {
+ log.debug("Failed to clean up DB drivers");
+ }
}
for (ClassPathElement element : elements) {
//note that this is a 'soft' close | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DriverRemover.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 11,241,875 | 2,195,185 | 292,665 | 3,116 | 1,965 | 371 | 37 | 2 | 3,233 | 344 | 843 | 95 | 0 | 3 | 1970-01-01T00:26: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,950 | quarkusio/quarkus/12156/12136 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/12136 | https://github.com/quarkusio/quarkus/pull/12156 | https://github.com/quarkusio/quarkus/pull/12156 | 1 | fixes | ServiceConfigurationError with "not a subtype" for external library in dev mode | **Describe the bug**
I get several ServiceConfigurationError exceptions with "not a subtype" message when initializing the GeoTools library suite, but only in dev mode. I've verified that the classes in the error messages are both included in the project, but also that they are in different jars (e.g. interface "CRSFactory" in gt-opengis, and "ReferencingObjectFactory" that implements CRSFactory in gt-referencing).
**Expected behavior**
No errors even in dev mode.
**Actual behavior**
Several error messages like this when GeoTools is first used:
"java.util.ServiceConfigurationError: org.opengis.referencing.crs.CRSFactory: org.geotools.referencing.factory.ReferencingObjectFactory not a subtype"
**To Reproduce**
Steps to reproduce the behavior:
1. Start attached project
2. Access http://localhost:8080/test
3. Check console for error messages
**Configuration**
No application.properties in use
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a`: Linux 5.7.15-100.fc31.x86_64 #1 SMP Tue Aug 11 17:18:01 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`: openjdk 11.0.8 2020-07-14 / OpenJDK Runtime Environment 18.9 (build 11.0.8+10) / OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10, mixed mode, sharing)
- Quarkus version: 1.7.3.Final
- Build tool: Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
**Additional context**
I've created the smallest possible test case here, so there's no difference in behaviour between dev and prod mode, except from the error messages. In my application I get bugs in dev mode because some of the services from the libraries won't load.
I've looked at https://quarkus.io/guides/class-loading-reference without finding a solution.
I tried to use <parentFirstArtifact> with quarkus-bootstrap-maven-plugin (and include the complete dependency graph for "gt-referencing"), but that didn't have any effect.
**Stack trace**
`2020-09-16 14:11:53,917 WARNING [org.geo.uti.factory] (executor-thread-1) 8: java.util.ServiceConfigurationError: org.opengis.referencing.crs.CRSFactory: org.geotools.referencing.factory.ReferencingObjectFactory not a subtype
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1236)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
at org.geotools.util.factory.FactoryRegistry.register(FactoryRegistry.java:950)
at org.geotools.util.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:859)
at org.geotools.util.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:889)
at org.geotools.util.factory.FactoryRegistry.getUnfilteredFactories(FactoryRegistry.java:289)
at org.geotools.util.factory.FactoryRegistry.getFactoryImplementation(FactoryRegistry.java:497)
at org.geotools.util.factory.FactoryRegistry.getFactory(FactoryRegistry.java:420)
at org.geotools.util.factory.FactoryCreator.getFactory(FactoryCreator.java:138)
at org.geotools.referencing.ReferencingFactoryFinder.getFactory(ReferencingFactoryFinder.java:200)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSFactory(ReferencingFactoryFinder.java:291)
at org.geotools.referencing.factory.ReferencingFactoryContainer.getCRSFactory(ReferencingFactoryContainer.java:249)
at org.geotools.referencing.factory.ReferencingFactoryContainer.initialize(ReferencingFactoryContainer.java:175)
at org.geotools.referencing.factory.ReferencingFactoryContainer.getImplementationHints(ReferencingFactoryContainer.java:195)
at org.geotools.util.factory.FactoryRegistry.usesAcceptableHints(FactoryRegistry.java:620)
at org.geotools.util.factory.FactoryRegistry.isAcceptable(FactoryRegistry.java:575)
at org.geotools.util.factory.FactoryRegistry.lambda$getFactoryImplementation$2(FactoryRegistry.java:504)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:176)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
at org.geotools.util.factory.FactoryRegistry.getFactoryImplementation(FactoryRegistry.java:505)
at org.geotools.util.factory.FactoryRegistry.getFactory(FactoryRegistry.java:420)
at org.geotools.util.factory.FactoryCreator.getFactory(FactoryCreator.java:138)
at org.geotools.referencing.factory.ReferencingFactoryContainer.instance(ReferencingFactoryContainer.java:162)
at org.geotools.referencing.factory.epsg.FactoryUsingWKT.<init>(FactoryUsingWKT.java:142)
at org.geotools.referencing.factory.epsg.FactoryUsingWKT.<init>(FactoryUsingWKT.java:136)
at org.geotools.referencing.factory.epsg.FactoryUsingWKT.<init>(FactoryUsingWKT.java:126)
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.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:779)
at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:721)
at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1394)
at org.geotools.util.factory.FactoryRegistry.register(FactoryRegistry.java:953)
at org.geotools.util.factory.FactoryRegistry.scanForPlugins(FactoryRegistry.java:859)
at org.geotools.util.factory.FactoryRegistry.scanForPluginsIfNeeded(FactoryRegistry.java:889)
at org.geotools.util.factory.FactoryRegistry.getFactories(FactoryRegistry.java:251)
at org.geotools.referencing.ReferencingFactoryFinder.getFactories(ReferencingFactoryFinder.java:183)
at org.geotools.referencing.ReferencingFactoryFinder.getCRSAuthorityFactories(ReferencingFactoryFinder.java:453)
at org.geotools.referencing.DefaultAuthorityFactory.getSupportedCodes(DefaultAuthorityFactory.java:124)
at org.geotools.referencing.CRS.getSupportedCodes(CRS.java:379)
at org.acme.ExampleResource.test(ExampleResource.java:18)
` | 631268056f59ae55e39d7280e049512a422401b7 | 847ece98fa44615530d6a49aeffdad6e7adba337 | https://github.com/quarkusio/quarkus/compare/631268056f59ae55e39d7280e049512a422401b7...847ece98fa44615530d6a49aeffdad6e7adba337 | 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 ce34e442a0a..e2c54c2029a 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -38,6 +38,7 @@
import java.util.jar.Manifest;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
import org.apache.maven.artifact.Artifact;
@@ -75,6 +76,7 @@
import org.eclipse.aether.util.artifact.JavaScopes;
import io.quarkus.bootstrap.model.AppArtifactKey;
+import io.quarkus.bootstrap.model.AppModel;
import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;
@@ -93,6 +95,7 @@
*/
@Mojo(name = "dev", defaultPhase = LifecyclePhase.PREPARE_PACKAGE, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
public class DevMojo extends AbstractMojo {
+ private static final String EXT_PROPERTIES_PATH = "META-INF/quarkus-extension.properties";
/**
* running any one of these phases means the compile phase will have been run, if these have
@@ -717,11 +720,35 @@ void prepare(final boolean triggerCompile) throws Exception {
//in most cases these are not used, however they need to be present for some
//parent-first cases such as logging
+ //first we go through and get all the parent first artifacts
+ Set<AppArtifactKey> parentFirstArtifacts = new HashSet<>();
+ for (Artifact appDep : project.getArtifacts()) {
+ if (appDep.getArtifactHandler().getExtension().equals("jar") && appDep.getFile().isFile()) {
+ try (ZipFile file = new ZipFile(appDep.getFile())) {
+ ZipEntry entry = file.getEntry(EXT_PROPERTIES_PATH);
+ if (entry != null) {
+ Properties p = new Properties();
+ try (InputStream inputStream = file.getInputStream(entry)) {
+ p.load(inputStream);
+ String parentFirst = p.getProperty(AppModel.PARENT_FIRST_ARTIFACTS);
+ if (parentFirst != null) {
+ String[] artifacts = parentFirst.split(",");
+ for (String artifact : artifacts) {
+ parentFirstArtifacts.add(new AppArtifactKey(artifact.split(":")));
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
for (Artifact appDep : project.getArtifacts()) {
// only add the artifact if it's present in the dev mode context
// we need this to avoid having jars on the classpath multiple times
- if (!devModeContext.getLocalArtifacts().contains(new AppArtifactKey(appDep.getGroupId(), appDep.getArtifactId(),
- appDep.getClassifier(), appDep.getArtifactHandler().getExtension()))) {
+ AppArtifactKey key = new AppArtifactKey(appDep.getGroupId(), appDep.getArtifactId(),
+ appDep.getClassifier(), appDep.getArtifactHandler().getExtension());
+ if (!devModeContext.getLocalArtifacts().contains(key) && parentFirstArtifacts.contains(key)) {
addToClassPaths(classPathManifest, appDep.getFile());
}
}
diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java
index a9c1a96ef67..de336cb2d6e 100644
--- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java
+++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java
@@ -70,7 +70,7 @@ protected static String[] split(String str, String[] parts, int fromIndex) {
protected final String classifier;
protected final String type;
- protected AppArtifactKey(String[] parts) {
+ public AppArtifactKey(String[] parts) {
this.groupId = parts[0];
this.artifactId = parts[1];
if (parts.length == 2 || parts[2] == null) { | ['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java', 'independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppArtifactKey.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 11,596,417 | 2,267,024 | 301,817 | 3,218 | 2,137 | 351 | 33 | 2 | 7,193 | 378 | 1,662 | 92 | 2 | 0 | 1970-01-01T00:26: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,952 | quarkusio/quarkus/12103/12102 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/12102 | https://github.com/quarkusio/quarkus/pull/12103 | https://github.com/quarkusio/quarkus/pull/12103 | 1 | fixes | Hang in build when upgrading to 1.8.0 when library class' superclass is not present on classpath | **Describe the bug**
My application builds with 1.7.3, but with 1.8.0 the quarkus:build step hangs after printing out a warning:
[WARNING] [io.quarkus.arc.processor.BeanArchives] Failed to index org.apache.cxf.phase.AbstractPhaseInterceptor: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader
One of the libraries we depend on has an optional dependency on CXF. We do not use the XML parts of that library, so the AbstractPhaseInterceptor subclass the library defines is never loaded, and do not have CXF on the app classpath.
Stopping it in a debugger, the problem appears to be in the loop at https://github.com/quarkusio/quarkus/blob/master/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoAddScopeProcessor.java#L102
superName is "org.apache.cxf.phase.AbstractPhaseInterceptor", and superClass = index.getClassByName() return null. Since it is null, it skips the if block, and loops around again without changing superName, so the the same thing repeats. If getClassByName() it probably needs to break out of the loop, maybe returning false?
I can work around this by adding that library (and the other couple of similar ones) as optional dependencies to my app as well, so they are on the build classpath.
**Expected behavior**
Build does not hang
**Actual behavior**
Build hangs
**To Reproduce**
I haven't manage to get it down to a simple reproducer yet
**Environment (please complete the following information):**
Quarkus 1.8.0.
| 3579849ffaa67d6a8f9099557249ad2dd2d44169 | 3b04c8d8ca2fc0da7b9e4714c2dba8ea035fd54d | https://github.com/quarkusio/quarkus/compare/3579849ffaa67d6a8f9099557249ad2dd2d44169...3b04c8d8ca2fc0da7b9e4714c2dba8ea035fd54d | diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoAddScopeProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoAddScopeProcessor.java
index ad84d645737..eb6eaf51c25 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoAddScopeProcessor.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoAddScopeProcessor.java
@@ -98,12 +98,14 @@ private boolean requiresContainerServices(ClassInfo clazz, Set<DotName> containe
if (index != null) {
DotName superName = clazz.superName();
while (superName != null && !superName.equals(DotNames.OBJECT)) {
- ClassInfo superClass = index.getClassByName(superName);
+ final ClassInfo superClass = index.getClassByName(superName);
if (superClass != null) {
- if (hasContainerAnnotation(clazz, containerAnnotationNames)) {
+ if (hasContainerAnnotation(superClass, containerAnnotationNames)) {
return true;
}
superName = superClass.superName();
+ } else {
+ superName = null;
}
}
} | ['extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AutoAddScopeProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 11,026,662 | 2,148,956 | 286,969 | 3,073 | 389 | 60 | 6 | 1 | 1,526 | 200 | 348 | 28 | 1 | 0 | 1970-01-01T00:26: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,953 | quarkusio/quarkus/12095/12087 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/12087 | https://github.com/quarkusio/quarkus/pull/12095 | https://github.com/quarkusio/quarkus/pull/12095 | 1 | fixes | quarkus.http[s].test-port system properties are lost on app restart triggered by @TestProfile | **Describe the bug**
If you set e.g. `<quarkus.http.test-port>0</quarkus.http.test-port>` in `systemPropertyVariables` of `maven-surefire-plugin` and you have at least one `@QuarkusTest` *without* `@TestProfile` and one `@QuarkusTest` *with* `@TestProfile` then the port is not picked up by that second test (if run after the test without `@TestProfile`).
The reason for this lies in [VertxHttpRecorder](https://github.com/quarkusio/quarkus/blob/1.7.2.Final/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java):
It is (re-?)setting the port properties here: https://github.com/quarkusio/quarkus/blob/1.7.2.Final/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java#L898-L902
and it is *clearing* the port properties here:
https://github.com/quarkusio/quarkus/blob/1.7.2.Final/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java#L916-L930
(I saw in the debugger that the recorder is setting the actual effective port, e.g. 62138)
That clearing occurs on shutdown which is triggered by the test extension because it finds a `@TestProfile`.
The app instance that is then booted up after that cannot (obviously) see the original port properties anymore, falling back to the default (or I guess to yaml/properties in case port properties are set there).
**Expected behavior**
Port system properties must survive restarts triggered by `@TestProfile`.
**Actual behavior**
Port system properties are lost on first restart by a `@TestProfile`.
**To Reproduce**
Steps to reproduce the behavior:
1. clone https://github.com/famod/quarkus-quickstarts
2. switch to issue-12087-port-sysprop-lost
diff: https://github.com/quarkusio/quarkus-quickstarts/compare/master..famod:issue-12087-port-sysprop-lost
3. cd getting-started-testing
4. mvn clean test will show that random port is only used for the first test (second one uses profile):
```
[INFO] Running org.acme.getting.started.testing.GreetingResourceTest
2020-09-14 22:30:53,552 INFO [io.quarkus] (main) Quarkus 1.7.3.Final on JVM started in 1.743s. Listening on: http://0.0.0.0:51063
2020-09-14 22:30:53,555 INFO [io.quarkus] (main) Profile test activated.
2020-09-14 22:30:53,555 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.031 s - in org.acme.getting.started.testing.GreetingResourceTest
[INFO] Running org.acme.getting.started.testing.GreetingServiceTest
2020-09-14 22:30:54,585 INFO [io.quarkus] (main) Quarkus stopped in 0.021s
2020-09-14 22:30:56,357 INFO [io.quarkus] (main) Quarkus 1.7.3.Final on JVM started in 1.585s. Listening on: http://0.0.0.0:8081
2020-09-14 22:30:56,357 INFO [io.quarkus] (main) Profile test activated.
2020-09-14 22:30:56,357 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.017 s - in org.acme.getting.started.testing.GreetingServiceTest
[INFO] Running org.acme.getting.started.testing.StaticContentTest
2020-09-14 22:30:56,599 INFO [io.quarkus] (main) Quarkus stopped in 0.015s
2020-09-14 22:30:58,120 INFO [io.quarkus] (main) Quarkus 1.7.3.Final on JVM started in 1.389s. Listening on: http://0.0.0.0:8081
2020-09-14 22:30:58,120 INFO [io.quarkus] (main) Profile test activated.
2020-09-14 22:30:58,120 INFO [io.quarkus] (main) Installed features: [cdi, resteasy]
```
**Configuration**
n/a
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `MINGW64_NT-10.0-18363 XXX 3.0.7-338.x86_64 2019-11-21 23:07 UTC x86_64 Msys`
- Output of `java -version`: `OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)`
- GraalVM version (if different from Java): n/a
- Quarkus version or git rev: `1.7.2.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.)
| 30dea713a00333d0243302bae85528e7d2851fe5 | 338f62f7d33da049f5184a2c74be77ebf16ada4c | https://github.com/quarkusio/quarkus/compare/30dea713a00333d0243302bae85528e7d2851fe5...338f62f7d33da049f5184a2c74be77ebf16ada4c | 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 b0b95c35bb9..ccbcb37b71c 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
@@ -9,6 +9,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -784,6 +785,7 @@ private static class WebDeploymentVerticle extends AbstractVerticle {
private final LaunchMode launchMode;
private volatile boolean clearHttpProperty = false;
private volatile boolean clearHttpsProperty = false;
+ private volatile Map<String, String> portPropertiesToRestore;
private final HttpConfiguration.InsecureRequests insecureRequests;
public WebDeploymentVerticle(HttpServerOptions httpOptions, HttpServerOptions httpsOptions,
@@ -892,14 +894,21 @@ private void setupTcpHttpServer(HttpServer httpServer, HttpServerOptions options
clearHttpProperty = true;
schema = "http";
}
+ portPropertiesToRestore = new HashMap<>();
String portPropertyValue = String.valueOf(actualPort);
String portPropertyName = (launchMode == LaunchMode.TEST ? "quarkus." + schema + ".test-port"
: "quarkus." + schema + ".port");
- System.setProperty(portPropertyName, portPropertyValue);
+ String prevPortPropertyValue = System.setProperty(portPropertyName, portPropertyValue);
+ if (prevPortPropertyValue != null) {
+ portPropertiesToRestore.put(portPropertyName, prevPortPropertyValue);
+ }
if (launchMode.isDevOrTest()) {
// set the profile property as well to make sure we don't have any inconsistencies
- System.setProperty(propertyWithProfilePrefix(portPropertyName),
- portPropertyValue);
+ portPropertyName = propertyWithProfilePrefix(portPropertyName);
+ prevPortPropertyValue = System.setProperty(portPropertyName, portPropertyValue);
+ if (prevPortPropertyValue != null) {
+ portPropertiesToRestore.put(portPropertyName, prevPortPropertyValue);
+ }
}
// Set in HttpOptions to output the port in the Timing class
options.setPort(actualPort);
@@ -928,6 +937,9 @@ public void stop(Future<Void> stopFuture) {
System.clearProperty(propertyWithProfilePrefix(portPropertyName));
}
}
+ if (portPropertiesToRestore != null && !portPropertiesToRestore.isEmpty()) {
+ System.getProperties().putAll(portPropertiesToRestore);
+ }
final AtomicInteger remainingCount = new AtomicInteger(0);
if (httpServer != null) { | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 11,026,662 | 2,148,956 | 286,969 | 3,073 | 1,279 | 169 | 18 | 1 | 4,160 | 434 | 1,340 | 58 | 8 | 1 | 1970-01-01T00:26: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,954 | quarkusio/quarkus/12051/12043 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/12043 | https://github.com/quarkusio/quarkus/pull/12051 | https://github.com/quarkusio/quarkus/pull/12051 | 1 | fixes | Unsatisfied dependency for type io.vertx.db2client.DB2Pool and qualifiers with Quarkus master, works with 1.8.0.Final | I see Unsatisfied dependency for type io.vertx.db2client.DB2Pool and qualifiers with Quarkus master (6588419c63) when running daily GH CI check on https://github.com/quarkus-qe/beefy-scenarios. Works well with 1.8.0.Final.
```java
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 io.vertx.db2client.DB2Pool and qualifiers [@Default]
- java member: io.quarkus.reactive.db2.client.runtime.DB2PoolProducer#db2Pool
- declared on CLASS bean [types=[java.lang.Object, io.quarkus.reactive.db2.client.runtime.DB2PoolProducer], qualifiers=[@Default, @Any], target=io.quarkus.reactive.db2.client.runtime.DB2PoolProducer]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1018)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:238)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:122)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:393)
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:936)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
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:479)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type io.vertx.db2client.DB2Pool and qualifiers [@Default]
- java member: io.quarkus.reactive.db2.client.runtime.DB2PoolProducer#db2Pool
- declared on CLASS bean [types=[java.lang.Object, io.quarkus.reactive.db2.client.runtime.DB2PoolProducer], qualifiers=[@Default, @Any], target=io.quarkus.reactive.db2.client.runtime.DB2PoolProducer]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:504)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:363)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:230)
... 14 more
```
Reproducer (expecting Quarkus master was built beforehand):
```bash
git clone https://github.com/quarkus-qe/beefy-scenarios.git
cd beefy-scenarios
mvn clean verify -pl 002-quarkus-all-extensions
```
Running with Quarkus 1.8.0.Final works fine (`mvn clean verify -pl 002-quarkus-all-extensions/ -Dquarkus.platform.version=1.8.0.Final -Dquarkus-plugin.version=1.8.0.Final`).
| 7f61df425aeff2942daf2f20f98f1e9c20c82f3d | 9bedfd477748d2b3607bb44faf275eaf79cf4101 | https://github.com/quarkusio/quarkus/compare/7f61df425aeff2942daf2f20f98f1e9c20c82f3d...9bedfd477748d2b3607bb44faf275eaf79cf4101 | diff --git a/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java b/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java
index 5485b7909f5..c6120a44c8a 100644
--- a/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java
+++ b/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java
@@ -4,6 +4,7 @@
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
+import io.quarkus.arc.processor.DotNames;
import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.datasource.runtime.DataSourcesBuildTimeConfig;
import io.quarkus.datasource.runtime.DataSourcesRuntimeConfig;
@@ -30,9 +31,24 @@
class ReactiveDB2ClientProcessor {
+ /**
+ * The producer needs to be produced in a separate method to avoid a circular dependency (the Vert.x instance creation
+ * consumes the AdditionalBeanBuildItems).
+ */
@BuildStep
- AdditionalBeanBuildItem registerBean() {
- return AdditionalBeanBuildItem.unremovableOf(DB2PoolProducer.class);
+ void poolProducer(
+ BuildProducer<AdditionalBeanBuildItem> additionalBeans,
+ DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
+ return;
+ }
+
+ additionalBeans.produce(new AdditionalBeanBuildItem.Builder()
+ .addBeanClass(DB2PoolProducer.class)
+ .setUnremovable()
+ .setDefaultScope(DotNames.APPLICATION_SCOPED)
+ .build());
}
@BuildStep
@@ -53,12 +69,7 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
// Make sure the DB2PoolProducer is initialized before the StartupEvent is fired
ServiceStartBuildItem serviceStart = new ServiceStartBuildItem("reactive-db2-client");
- if (!dataSourcesBuildTimeConfig.defaultDataSource.dbKind.isPresent()) {
- return serviceStart;
- }
-
- if (!DatabaseKind.isDB2(dataSourcesBuildTimeConfig.defaultDataSource.dbKind.get())
- || !dataSourceReactiveBuildTimeConfig.enabled) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
return serviceStart;
}
@@ -82,8 +93,30 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
}
@BuildStep
- HealthBuildItem addHealthCheck(DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig) {
- return new HealthBuildItem("io.quarkus.reactive.db2.client.runtime.health.ReactiveDB2DataSourceHealthCheck",
- dataSourcesBuildTimeConfig.healthEnabled);
+ void addHealthCheck(
+ BuildProducer<HealthBuildItem> healthChecks,
+ DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
+ return;
+ }
+
+ healthChecks
+ .produce(new HealthBuildItem("io.quarkus.reactive.db2.client.runtime.health.ReactiveDB2DataSourceHealthCheck",
+ dataSourcesBuildTimeConfig.healthEnabled));
+ }
+
+ private static boolean createPool(DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!dataSourcesBuildTimeConfig.defaultDataSource.dbKind.isPresent()) {
+ return false;
+ }
+
+ if (!DatabaseKind.isDB2(dataSourcesBuildTimeConfig.defaultDataSource.dbKind.get())
+ || !dataSourceReactiveBuildTimeConfig.enabled) {
+ return false;
+ }
+
+ return true;
}
}
diff --git a/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java b/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java
index 7b0734a0516..581e27cfbd1 100644
--- a/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java
+++ b/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java
@@ -1,13 +1,11 @@
package io.quarkus.reactive.db2.client.runtime;
-import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Singleton;
import io.vertx.db2client.DB2Pool;
-@ApplicationScoped
public class DB2PoolProducer {
@Inject
diff --git a/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java b/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java
index 231b72fc32b..8361db90854 100644
--- a/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java
+++ b/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java
@@ -4,6 +4,7 @@
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
+import io.quarkus.arc.processor.DotNames;
import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.datasource.runtime.DataSourcesBuildTimeConfig;
import io.quarkus.datasource.runtime.DataSourcesRuntimeConfig;
@@ -28,12 +29,26 @@
import io.vertx.mysqlclient.MySQLPool;
import io.vertx.sqlclient.Pool;
-@SuppressWarnings("deprecation")
class ReactiveMySQLClientProcessor {
+ /**
+ * The producer needs to be produced in a separate method to avoid a circular dependency (the Vert.x instance creation
+ * consumes the AdditionalBeanBuildItems).
+ */
@BuildStep
- AdditionalBeanBuildItem registerBean() {
- return AdditionalBeanBuildItem.unremovableOf(MySQLPoolProducer.class);
+ void poolProducer(
+ BuildProducer<AdditionalBeanBuildItem> additionalBeans,
+ DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
+ return;
+ }
+
+ additionalBeans.produce(new AdditionalBeanBuildItem.Builder()
+ .addBeanClass(MySQLPoolProducer.class)
+ .setUnremovable()
+ .setDefaultScope(DotNames.APPLICATION_SCOPED)
+ .build());
}
@BuildStep
@@ -54,13 +69,7 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
// Make sure the MySQLPoolProducer is initialized before the StartupEvent is fired
ServiceStartBuildItem serviceStart = new ServiceStartBuildItem("reactive-mysql-client");
- if (!dataSourcesBuildTimeConfig.defaultDataSource.dbKind.isPresent()) {
- return serviceStart;
- }
-
- if ((!DatabaseKind.isMySQL(dataSourcesBuildTimeConfig.defaultDataSource.dbKind.get())
- && !DatabaseKind.isMariaDB(dataSourcesBuildTimeConfig.defaultDataSource.dbKind.get()))
- || !dataSourceReactiveBuildTimeConfig.enabled) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
return serviceStart;
}
@@ -84,8 +93,31 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
}
@BuildStep
- HealthBuildItem addHealthCheck(DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig) {
- return new HealthBuildItem("io.quarkus.reactive.mysql.client.runtime.health.ReactiveMySQLDataSourceHealthCheck",
- dataSourcesBuildTimeConfig.healthEnabled);
+ void addHealthCheck(
+ BuildProducer<HealthBuildItem> healthChecks,
+ DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
+ return;
+ }
+
+ healthChecks.produce(
+ new HealthBuildItem("io.quarkus.reactive.mysql.client.runtime.health.ReactiveMySQLDataSourceHealthCheck",
+ dataSourcesBuildTimeConfig.healthEnabled));
+ }
+
+ private static boolean createPool(DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!dataSourcesBuildTimeConfig.defaultDataSource.dbKind.isPresent()) {
+ return false;
+ }
+
+ if ((!DatabaseKind.isMySQL(dataSourcesBuildTimeConfig.defaultDataSource.dbKind.get())
+ && !DatabaseKind.isMariaDB(dataSourcesBuildTimeConfig.defaultDataSource.dbKind.get()))
+ || !dataSourceReactiveBuildTimeConfig.enabled) {
+ return false;
+ }
+
+ return true;
}
}
diff --git a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java
index a949a9e8119..5e74ebc088b 100644
--- a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java
+++ b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java
@@ -1,6 +1,5 @@
package io.quarkus.reactive.mysql.client.runtime;
-import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -9,7 +8,6 @@
import io.vertx.mysqlclient.MySQLPool;
-@ApplicationScoped
public class MySQLPoolProducer {
private static final Logger LOGGER = Logger.getLogger(MySQLPoolProducer.class);
diff --git a/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java b/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java
index 320d4308e51..e12f2d93026 100644
--- a/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java
+++ b/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java
@@ -4,6 +4,7 @@
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
+import io.quarkus.arc.processor.DotNames;
import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.datasource.runtime.DataSourcesBuildTimeConfig;
import io.quarkus.datasource.runtime.DataSourcesRuntimeConfig;
@@ -29,12 +30,26 @@
import io.vertx.pgclient.PgPool;
import io.vertx.sqlclient.Pool;
-@SuppressWarnings("deprecation")
class ReactivePgClientProcessor {
+ /**
+ * The producer needs to be produced in a separate method to avoid a circular dependency (the Vert.x instance creation
+ * consumes the AdditionalBeanBuildItems).
+ */
@BuildStep
- AdditionalBeanBuildItem registerBean() {
- return AdditionalBeanBuildItem.unremovableOf(PgPoolProducer.class);
+ void poolProducer(
+ BuildProducer<AdditionalBeanBuildItem> additionalBeans,
+ DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
+ return;
+ }
+
+ additionalBeans.produce(new AdditionalBeanBuildItem.Builder()
+ .addBeanClass(PgPoolProducer.class)
+ .setUnremovable()
+ .setDefaultScope(DotNames.APPLICATION_SCOPED)
+ .build());
}
@BuildStep
@@ -62,12 +77,7 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
// Make sure the PgPoolProducer is initialized before the StartupEvent is fired
ServiceStartBuildItem serviceStart = new ServiceStartBuildItem("reactive-pg-client");
- if (!dataSourcesBuildTimeConfig.defaultDataSource.dbKind.isPresent()) {
- return serviceStart;
- }
-
- if (!DatabaseKind.isPostgreSQL(dataSourcesBuildTimeConfig.defaultDataSource.dbKind.get())
- || !dataSourceReactiveBuildTimeConfig.enabled) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
return serviceStart;
}
@@ -91,8 +101,29 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
}
@BuildStep
- HealthBuildItem addHealthCheck(DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig) {
- return new HealthBuildItem("io.quarkus.reactive.pg.client.runtime.health.ReactivePgDataSourceHealthCheck",
- dataSourcesBuildTimeConfig.healthEnabled);
+ void addHealthCheck(
+ BuildProducer<HealthBuildItem> healthChecks,
+ DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!createPool(dataSourcesBuildTimeConfig, dataSourceReactiveBuildTimeConfig)) {
+ return;
+ }
+
+ healthChecks.produce(new HealthBuildItem("io.quarkus.reactive.pg.client.runtime.health.ReactivePgDataSourceHealthCheck",
+ dataSourcesBuildTimeConfig.healthEnabled));
+ }
+
+ private static boolean createPool(DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig,
+ DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig) {
+ if (!dataSourcesBuildTimeConfig.defaultDataSource.dbKind.isPresent()) {
+ return false;
+ }
+
+ if (!DatabaseKind.isPostgreSQL(dataSourcesBuildTimeConfig.defaultDataSource.dbKind.get())
+ || !dataSourceReactiveBuildTimeConfig.enabled) {
+ return false;
+ }
+
+ return true;
}
}
diff --git a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java
index c997c62f1c1..c79bf0e51df 100644
--- a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java
+++ b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java
@@ -1,6 +1,5 @@
package io.quarkus.reactive.pg.client.runtime;
-import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -9,7 +8,6 @@
import io.vertx.pgclient.PgPool;
-@ApplicationScoped
public class PgPoolProducer {
private static final Logger LOGGER = Logger.getLogger(PgPoolProducer.class);
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DotNames.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DotNames.java
index e91806b1ee6..7084fbc4619 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DotNames.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DotNames.java
@@ -12,6 +12,7 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Priority;
+import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Initialized;
import javax.enterprise.context.control.ActivateRequestContext;
import javax.enterprise.event.Event;
@@ -82,6 +83,7 @@ public final class DotNames {
public static final DotName ALTERNATIVE_PRIORITY = create(AlternativePriority.class);
public static final DotName DEFAULT_BEAN = create(DefaultBean.class);
public static final DotName SINGLETON = create(Singleton.class);
+ public static final DotName APPLICATION_SCOPED = create(ApplicationScoped.class);
public static final DotName STEREOTYPE = create(Stereotype.class);
public static final DotName TYPED = create(Typed.class);
public static final DotName VETOED = create(Vetoed.class);
@@ -117,7 +119,7 @@ private DotNames() {
* Note that this method does not attempt to detect a nested class because the computing cache is shared with the
* {@link #create(String)} variant and so the results would be inconsistent. Therefore, this method should only be used for
* top-level classes.
- *
+ *
* @param clazz
* @return the computed dot name
*/
@@ -129,7 +131,7 @@ static DotName create(Class<?> clazz) {
* Note that the dollar sign is a valid character for class names so we cannot detect a nested class here. Therefore, this
* method returns a dot name for which {@link DotName#local()} returns {@code Foo$Bar} for the parameter
* "com.foo.Foo$Bar".
- *
+ *
* @param name
* @return the computed dot name
*/
@@ -145,7 +147,7 @@ static DotName create(String name) {
}
/**
- *
+ *
* @param clazz
* @return the simple name for the given top-level or nested class
*/
@@ -175,7 +177,7 @@ public static String simpleName(DotName dotName) {
* method returns "Foo$Bar" for the parameter "com.foo.Foo$Bar". Use {@link #simpleName(ClassInfo)} when you need to
* distinguish
* the nested classes.
- *
+ *
* @param name
* @return the simple name
*/ | ['extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java', 'extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java', 'extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DotNames.java', 'extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java', 'extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java', 'extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java'] | {'.java': 7} | 7 | 7 | 0 | 0 | 7 | 11,001,185 | 2,143,834 | 286,349 | 3,068 | 8,894 | 1,663 | 184 | 7 | 3,269 | 166 | 809 | 42 | 2 | 2 | 1970-01-01T00:26: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,956 | quarkusio/quarkus/11955/11944 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11944 | https://github.com/quarkusio/quarkus/pull/11955 | https://github.com/quarkusio/quarkus/pull/11955 | 1 | close | Gradle: Cannot push containers to multiple repositories due to task caching | **Describe the bug**
Currently the `quarkus-container-image-jib` extension does not support multiple registry urls to push images to. Therefore I'm running the following command build & push images twice.
```
./gradlew assemble -Dquarkus.container-image.push=true -Dquarkus.container-image.registry=$REGISTRY -Dquarkus.container-image.username=$REGISTRY_USER -Dquarkus.container-image.password=$REGISTRY_PASSWORD
```
However, when you run the command the second time, with a different registry, it is not executed due to gradle task caching. I think the push task should either not be cached or it should check if the registry url has changed.
**Expected behavior**
Running the build & push of jib container building with different registries should push the image to both registries.
**Actual behavior**
After the first run, the second time, the build&push task is seen as "UP TO DATE" by gradle and therefore not run for the second registry.
| ee6296a65a5d78aacac623fff0ebb10909b63c8b | 62a2315c3699258a9909007926a712d1b8851c4a | https://github.com/quarkusio/quarkus/compare/ee6296a65a5d78aacac623fff0ebb10909b63c8b...62a2315c3699258a9909007926a712d1b8851c4a | diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java
index f2f857f5054..8b7493f00b8 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java
@@ -1,6 +1,7 @@
package io.quarkus.gradle.tasks;
import java.io.File;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -78,6 +79,29 @@ public FileCollection getClasspath() {
.plus(mainSourceSet.getResources());
}
+ @Input
+ public Map<Object, Object> getQuarkusBuildSystemProperties() {
+ Map<Object, Object> quarkusSystemProperties = new HashMap<>();
+ for (Map.Entry<Object, Object> systemProperty : System.getProperties().entrySet()) {
+ if (systemProperty.getKey().toString().startsWith("quarkus.") &&
+ systemProperty.getValue() instanceof Serializable) {
+ quarkusSystemProperties.put(systemProperty.getKey(), systemProperty.getValue());
+ }
+ }
+ return quarkusSystemProperties;
+ }
+
+ @Input
+ public Map<String, String> getQuarkusBuildEnvProperties() {
+ Map<String, String> quarkusEnvProperties = new HashMap<>();
+ for (Map.Entry<String, String> systemProperty : System.getenv().entrySet()) {
+ if (systemProperty.getKey() != null && systemProperty.getKey().startsWith("QUARKUS_")) {
+ quarkusEnvProperties.put(systemProperty.getKey(), systemProperty.getValue());
+ }
+ }
+ return quarkusEnvProperties;
+ }
+
@OutputFile
public File getRunnerJar() {
return new File(getProject().getBuildDir(), extension().finalName() + "-runner.jar");
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 d7291434b4c..ed23140ec1c 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
@@ -133,6 +133,21 @@ public void canDetectOutputChangeWhenBuilding() throws Exception {
assertThat(runnerJar).exists();
}
+ @Test
+ public void canDetectSystemPropertyChangeWhenBuilding() throws Exception {
+ createProject(SourceType.JAVA);
+
+ BuildResult firstBuild = runGradleWrapper(projectRoot, "quarkusBuild", "--stacktrace");
+
+ assertThat(firstBuild.getTasks().get(":quarkusBuild")).isEqualTo(BuildResult.SUCCESS_OUTCOME);
+ assertThat(projectRoot.toPath().resolve("build").resolve("foo-1.0.0-SNAPSHOT-runner.jar")).exists();
+
+ BuildResult secondBuild = runGradleWrapper(projectRoot, "quarkusBuild", "-Dquarkus.package.type=fast-jar");
+
+ assertThat(secondBuild.getTasks().get(":quarkusBuild")).isEqualTo(BuildResult.SUCCESS_OUTCOME);
+ assertThat(projectRoot.toPath().resolve("build").resolve("quarkus-app")).exists();
+ }
+
@Test
public void canRunTest() throws Exception {
createProject(SourceType.JAVA); | ['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java', 'integration-tests/gradle/src/test/java/io/quarkus/gradle/QuarkusPluginFunctionalTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 11,013,030 | 2,145,928 | 286,633 | 3,075 | 1,104 | 219 | 24 | 1 | 966 | 127 | 210 | 16 | 0 | 1 | 1970-01-01T00:26: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,966 | quarkusio/quarkus/11808/11807 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11807 | https://github.com/quarkusio/quarkus/pull/11808 | https://github.com/quarkusio/quarkus/pull/11808 | 1 | closes | FormAuthenticationMechanism needs to handle exceptions to avoid requests without response. | Exceptions in `io.quarkus.vertx.http.runtime.security.PersistentLoginManager.save()` are not being handled correctly by the caller. This means that if an exception happens, the request will never be fulfilled. You can see this in action in #11768.
`subscribe().with()` callback in `FormAuthenticationMechanism.runFormAuth` needs to check if any exceptions happen and fail the uni if so.
I've got a patch for this already that I'll be sending shortly. | f23f4ca4f7b34e2121e2606ce59e2291749b5028 | 7bc0033bc423551d632ee4243886de462491bb60 | https://github.com/quarkusio/quarkus/compare/f23f4ca4f7b34e2121e2606ce59e2291749b5028...7bc0033bc423551d632ee4243886de462491bb60 | diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java
index e0b2e65a238..74d6962fb87 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java
@@ -74,17 +74,22 @@ public void handle(Void event) {
.subscribe().with(new Consumer<SecurityIdentity>() {
@Override
public void accept(SecurityIdentity identity) {
- loginManager.save(identity, exchange, null);
- if (redirectAfterLogin || exchange.getCookie(locationCookie) != null) {
- handleRedirectBack(exchange);
- //we have authenticated, but we want to just redirect back to the original page
- //so we don't actually authenticate the current request
- //instead we have just set a cookie so the redirected request will be authenticated
- } else {
- exchange.response().setStatusCode(200);
- exchange.response().end();
+ try {
+ loginManager.save(identity, exchange, null);
+ if (redirectAfterLogin || exchange.getCookie(locationCookie) != null) {
+ handleRedirectBack(exchange);
+ //we have authenticated, but we want to just redirect back to the original page
+ //so we don't actually authenticate the current request
+ //instead we have just set a cookie so the redirected request will be authenticated
+ } else {
+ exchange.response().setStatusCode(200);
+ exchange.response().end();
+ }
+ uniEmitter.complete(null);
+ } catch (Throwable t) {
+ log.error("Unable to complete post authentication", t);
+ uniEmitter.fail(t);
}
- uniEmitter.complete(null);
}
}, new Consumer<Throwable>() {
@Override | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/FormAuthenticationMechanism.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,966,908 | 2,136,827 | 285,452 | 3,071 | 2,274 | 245 | 25 | 1 | 456 | 61 | 96 | 5 | 0 | 0 | 1970-01-01T00:26: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,957 | quarkusio/quarkus/11936/11892 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11892 | https://github.com/quarkusio/quarkus/pull/11936 | https://github.com/quarkusio/quarkus/pull/11936 | 1 | fixes | Adding @IfBuildProfile("prod") annotation to one grpc service throws away all other services | **Describe the bug**
I have multiple grpc services defined in my proto file and corresponding implementations in java code. If I mark one implementation with annotation `@IfBuildProfile("prod")` and run application with prod profile, all other services disappear, grpcurl shows only one single service which I marked with annotation.
**Expected behavior**
All defined services should still be available in application including annotated service and all unannotated ones.
**Actual behavior**
Application starts with just one grpc service, the one I marked with `@IfBuildProfile("prod")` annotation
**To Reproduce**
Steps to reproduce the behavior:
1. Create two services in your proto file. Implement them In application. Run and check that both services are available (by calling them or by listing with `./grpcurl -plaintext localhost:9000 list`
2. Mark one service with `@IfBuildProfile("prod")` annotation
3. Run application with prod profile and try to call unmarked service. It will fail. Or try listing with `./grpcurl -plaintext localhost:9000 list` and you will see only one service (don't forget about `quarkus.grpc.server.enable-reflection-service = true`)
**Configuration**
```properties
# Add your application.properties here, if applicable.
quarkus.grpc.server.port = 9000
quarkus.grpc.server.enable-reflection-service = true
```
**Environment (please complete the following information):**
- Quarkus version or git rev:
1.7.1.Final
**Additional context**
My digging shows that `io.quarkus.grpc.runtime.GrpcContainer` injects services as `Instance<BindableService> services;` If any of the BindableService beans have some priority set it is prioritized over other BindableServices and all other services are thrown away. IfBuildProfile annotation is counted as "alternative priority" and it survives filtering in `ArcContainerImpl.resolve(Set<Bean<? extends X>> beans)` method | 180b01fc6404e9b51bb416accb668354cfb196ab | ba1315f571c391f7356aeec8ed7c6b6405e2116e | https://github.com/quarkusio/quarkus/compare/180b01fc6404e9b51bb416accb668354cfb196ab...ba1315f571c391f7356aeec8ed7c6b6405e2116e | diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/BuildTimeEnabledProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/BuildTimeEnabledProcessor.java
index d93b1788df7..596f1437b7a 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/BuildTimeEnabledProcessor.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/BuildTimeEnabledProcessor.java
@@ -18,6 +18,7 @@
import org.jboss.logging.Logger;
import io.quarkus.arc.processor.AnnotationsTransformer;
+import io.quarkus.arc.processor.AnnotationsTransformer.TransformationContext;
import io.quarkus.arc.processor.DotNames;
import io.quarkus.arc.processor.Transformation;
import io.quarkus.arc.profile.IfBuildProfile;
@@ -146,18 +147,18 @@ public void transform(TransformationContext ctx) {
if (ctx.isClass()) {
DotName classDotName = target.asClass().name();
if (classTargets.containsKey(classDotName)) {
- transformBean(target, ctx.transform(), classTargets.get(classDotName));
+ transformBean(target, ctx, classTargets.get(classDotName));
}
} else if (ctx.isMethod()) {
MethodInfo method = target.asMethod();
if (methodTargets.containsKey(method)) {
- transformBean(target, ctx.transform(), methodTargets.get(method));
+ transformBean(target, ctx, methodTargets.get(method));
}
} else if (ctx.isField()) {
FieldInfo field = target.asField();
String uniqueFieldName = toUniqueString(field);
if (fieldTargets.containsKey(uniqueFieldName)) {
- transformBean(target, ctx.transform(), fieldTargets.get(uniqueFieldName));
+ transformBean(target, ctx, fieldTargets.get(uniqueFieldName));
}
}
}
@@ -168,32 +169,18 @@ private String toUniqueString(FieldInfo field) {
return field.declaringClass().name().toString() + "." + field.name();
}
- private void transformBean(AnnotationTarget target, Transformation transform, boolean enable) {
- if (enable) {
- enableBean(transform);
- } else {
- disableBean(target, transform);
+ private void transformBean(AnnotationTarget target, TransformationContext ctx, boolean enabled) {
+ if (!enabled) {
+ Transformation transform = ctx.transform();
+ if (target.kind() == Kind.CLASS) {
+ // Veto the class
+ transform.add(DotNames.VETOED);
+ } else {
+ // Add @Alternative to the producer
+ transform.add(DotNames.ALTERNATIVE);
+ }
+ transform.done();
}
- transform.done();
- }
-
- private void enableBean(Transformation transform) {
- transform.add(DotNames.ALTERNATIVE_PRIORITY,
- createAlternativePriority());
}
- private AnnotationValue createAlternativePriority() {
- // use Integer.MAX_VALUE - 1 to avoid having conflicts with enabling beans via config
- return AnnotationValue.createIntegerValue("value", Integer.MAX_VALUE - 1);
- }
-
- private void disableBean(AnnotationTarget target, Transformation transform) {
- if (target.kind() == Kind.CLASS) {
- // Veto the class
- transform.add(DotNames.VETOED);
- } else {
- // Add @Alternative to the producer
- transform.add(DotNames.ALTERNATIVE);
- }
- }
} | ['extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/BuildTimeEnabledProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 11,004,548 | 2,144,332 | 286,431 | 3,074 | 2,114 | 369 | 43 | 1 | 1,927 | 244 | 407 | 29 | 0 | 1 | 1970-01-01T00:26: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,958 | quarkusio/quarkus/11930/11647 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11647 | https://github.com/quarkusio/quarkus/pull/11930 | https://github.com/quarkusio/quarkus/pull/11930 | 1 | fixes | Fast-Jar + quarkus.arc.remove-unused-beans=false causes ClassNotFoundException | **Describe the bug**
The exact issue is easy to reproduce with the standard quarkus start project.
1. Add the following depnednecy to the pom.xml:
```
<dependency>
<groupId>org.apache.myfaces.core.extensions.quarkus</groupId>
<artifactId>myfaces-quarkus</artifactId>
<version>2.3-next-M3</version>
</dependency>
```
2. Add the following combination of settings to the application.properties:
```
quarkus.package.type=fast-jar
quarkus.arc.remove-unused-beans=false
```
3. mvn package && java -jar target/quarkus-app/quarkus-run.jar
**Expected behavior**
The application should start without problems
**Actual behavior**
```
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:43)
at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:24)
Caused by: java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:60)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
... 6 more
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:222)
... 15 more
Caused by: java.lang.RuntimeException: Failed to initialize Arc
at io.quarkus.arc.Arc.initialize(Arc.java:26)
at io.quarkus.arc.runtime.ArcRecorder.getContainer(ArcRecorder.java:35)
at io.quarkus.deployment.steps.ArcProcessor$generateResources1649676420.deploy_0(ArcProcessor$generateResources1649676420.zig:76)
at io.quarkus.deployment.steps.ArcProcessor$generateResources1649676420.deploy(ArcProcessor$generateResources1649676420.zig:40)
at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:180)
... 15 more
Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext_8154c10ea529795d38da9083f05136178578d788_Synthetic_Bean
at io.quarkus.arc.setup.Default_ComponentsProvider.addBeans3(Default_ComponentsProvider.zig:1352)
at io.quarkus.arc.setup.Default_ComponentsProvider.getComponents(Default_ComponentsProvider.zig:48)
at io.quarkus.arc.impl.ArcContainerImpl.<init>(ArcContainerImpl.java:109)
at io.quarkus.arc.Arc.initialize(Arc.java:20)
... 19 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext_8154c10ea529795d38da9083f05136178578d788_Synthetic_Bean
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:56)
at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:43)
... 23 more
```
I am unsure if the issue is with the myfaces quarkus extension in specific, but at least i see the problem when i use it.
The exception goes away when i either remove the myfaces dependency, or do not build a fast jar. So, building and running the regular runner-jar works without problem.
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Linux dev-vm.local 3.10.0-862.11.6.el7.x86_64 #1 SMP Tue Aug 14 21:49:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`: java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
- Quarkus version or git rev: 1.7.0.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3 | 65c5a32e6b26b0351965818fc58d5db64566cea4 | 527ec857d81c0ace17244d98319a0963c7dbfb9a | https://github.com/quarkusio/quarkus/compare/65c5a32e6b26b0351965818fc58d5db64566cea4...527ec857d81c0ace17244d98319a0963c7dbfb9a | diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java
index d6bf167acdb..43d3c2f9c4a 100644
--- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java
+++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java
@@ -53,7 +53,11 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce
}
String packageName = getPackageNameFromClassName(name);
if (parentFirstPackages.contains(packageName)) {
- return getParent().loadClass(name);
+ try {
+ return getParent().loadClass(name);
+ } catch (ClassNotFoundException e) {
+ //fall through
+ }
}
synchronized (getClassLoadingLock(name)) {
Class<?> loaded = findLoadedClass(name); | ['independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 11,000,652 | 2,143,707 | 286,345 | 3,074 | 217 | 34 | 6 | 1 | 4,432 | 298 | 1,151 | 76 | 0 | 3 | 1970-01-01T00:26: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,959 | quarkusio/quarkus/11928/11857 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11857 | https://github.com/quarkusio/quarkus/pull/11928 | https://github.com/quarkusio/quarkus/pull/11928 | 1 | fixes | quarkus.debug.transformed-classes-dir does not work anymore | This regression was introduced in:
https://github.com/quarkusio/quarkus/commit/9d3fa16a74c1b9354352843aab28ce71b3c95350#diff-db1d39a812769ff88e14c8dd8e39c0c4 | 2a6241b7bbb8dcb6e7523e58dd8cc53d1b9630e7 | 7e05c1acc4752ede4c7ec18ec6d4ec325106d300 | https://github.com/quarkusio/quarkus/compare/2a6241b7bbb8dcb6e7523e58dd8cc53d1b9630e7...7e05c1acc4752ede4c7ec18ec6d4ec325106d300 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
index b561d6ce92e..3277275a2d0 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
@@ -1,5 +1,7 @@
package io.quarkus.deployment.steps;
+import java.io.File;
+import java.io.FileOutputStream;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
@@ -22,6 +24,7 @@
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
+import io.quarkus.bootstrap.BootstrapDebug;
import io.quarkus.bootstrap.classloading.ClassPathElement;
import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.deployment.QuarkusClassWriter;
@@ -104,7 +107,22 @@ public TransformedClassesBuildItem.TransformedClass call() throws Exception {
visitor = i.apply(className, visitor);
}
cr.accept(visitor, 0);
- return new TransformedClassesBuildItem.TransformedClass(className, writer.toByteArray(),
+ byte[] data = writer.toByteArray();
+ if (BootstrapDebug.DEBUG_TRANSFORMED_CLASSES_DIR != null) {
+ File debugPath = new File(BootstrapDebug.DEBUG_TRANSFORMED_CLASSES_DIR);
+ if (!debugPath.exists()) {
+ debugPath.mkdir();
+ }
+ File classFile = new File(debugPath, className.replace(".", "/") + ".class");
+ classFile.getParentFile().mkdirs();
+ try (FileOutputStream classWriter = new FileOutputStream(classFile)) {
+ classWriter.write(data);
+ } catch (Exception e) {
+ log.errorf(e, "Failed to write transformed class %s", className);
+ }
+ log.infof("Wrote transformed class to %s", classFile.getAbsolutePath());
+ }
+ return new TransformedClassesBuildItem.TransformedClass(className, data,
classFileName, eager.contains(className));
} finally {
Thread.currentThread().setContextClassLoader(old); | ['core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,999,335 | 2,143,466 | 286,323 | 3,074 | 1,477 | 198 | 20 | 1 | 158 | 6 | 66 | 2 | 1 | 0 | 1970-01-01T00:26: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,962 | quarkusio/quarkus/11854/11853 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11853 | https://github.com/quarkusio/quarkus/pull/11854 | https://github.com/quarkusio/quarkus/pull/11854 | 1 | fixes | Quarkus cli test failing | **Describe the bug**
The `io.quarkus.cli.CliTest.testAddListRemove` is failing unrelated to the changes I was working on https://github.com/quarkusio/quarkus/pull/11852
https://github.com/quarkusio/quarkus/runs/1066539001
**Expected behavior**
The test to pass.
**Actual behavior**
```log
[ERROR] Tests run: 7, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 169.318 s <<< FAILURE! - in io.quarkus.cli.CliTest
[ERROR] io.quarkus.cli.CliTest.testAddListRemove Time elapsed: 1.703 s <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <quarkus-resteasy> but was: <>
at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
at org.junit.jupiter.api.AssertionUtils.failNotEqual(AssertionUtils.java:62)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1124)
at io.quarkus.cli.CliTest.testAddListRemove(CliTest.java:90)
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:564)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
``` | 66acdbf31ce276d2806aee67fa72ad441fda0149 | 37b1e1d72ba412723d4f2dc66c52cee0765fb3e7 | https://github.com/quarkusio/quarkus/compare/66acdbf31ce276d2806aee67fa72ad441fda0149...37b1e1d72ba412723d4f2dc66c52cee0765fb3e7 | diff --git a/devtools/platform-descriptor-json/src/main/java/io/quarkus/platform/descriptor/loader/json/impl/QuarkusJsonPlatformDescriptor.java b/devtools/platform-descriptor-json/src/main/java/io/quarkus/platform/descriptor/loader/json/impl/QuarkusJsonPlatformDescriptor.java
index 2ff1acb8385..456c26eab6b 100644
--- a/devtools/platform-descriptor-json/src/main/java/io/quarkus/platform/descriptor/loader/json/impl/QuarkusJsonPlatformDescriptor.java
+++ b/devtools/platform-descriptor-json/src/main/java/io/quarkus/platform/descriptor/loader/json/impl/QuarkusJsonPlatformDescriptor.java
@@ -73,7 +73,7 @@ void setQuarkusVersion(String quarkusVersion) {
}
private MessageWriter getLog() {
- return log == null ? log = MessageWriter.DEFAULT : log;
+ return log == null ? log = MessageWriter.info() : log;
}
@Override
diff --git a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/CodestartInputBuilder.java b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/CodestartInputBuilder.java
index 51de75f3990..545736cae36 100644
--- a/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/CodestartInputBuilder.java
+++ b/independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/CodestartInputBuilder.java
@@ -14,7 +14,7 @@ public class CodestartInputBuilder {
Collection<AppArtifactKey> dependencies = new ArrayList<>();
Collection<String> codestarts = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
- MessageWriter messageWriter = MessageWriter.DEFAULT;
+ MessageWriter messageWriter = MessageWriter.info();
CodestartInputBuilder(CodestartResourceLoader resourceLoader) {
this.resourceLoader = resourceLoader;
diff --git a/independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/CodestartProcessorTest.java b/independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/CodestartProcessorTest.java
index 2cd845e06db..08367ee191c 100644
--- a/independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/CodestartProcessorTest.java
+++ b/independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/CodestartProcessorTest.java
@@ -20,7 +20,7 @@ void checkSelectedDefaultStrategy() {
spec.put("*", "replace");
final CodestartProcessor processor = new CodestartProcessor(
- MessageWriter.DEFAULT,
+ MessageWriter.info(),
Mockito.mock(CodestartResourceLoader.class),
"a",
Paths.get("test"),
@@ -37,7 +37,7 @@ void checkDefaultStrategy() {
spec.put("test/foo.tt", "forbidden");
final CodestartProcessor processor = new CodestartProcessor(
- MessageWriter.DEFAULT,
+ MessageWriter.info(),
Mockito.mock(CodestartResourceLoader.class),
"a",
Paths.get("test"),
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/data/QuarkusCommandInvocation.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/data/QuarkusCommandInvocation.java
index f8824e4f723..4470fa21e42 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/data/QuarkusCommandInvocation.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/data/QuarkusCommandInvocation.java
@@ -18,7 +18,7 @@ public QuarkusCommandInvocation(QuarkusProject quarkusProject) {
}
public QuarkusCommandInvocation(final QuarkusProject quarkusProject, final Map<String, Object> values) {
- this(quarkusProject, values, MessageWriter.DEFAULT);
+ this(quarkusProject, values, MessageWriter.info());
}
public QuarkusCommandInvocation(final QuarkusProject quarkusProject, final Map<String, Object> values,
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/QuarkusJsonPlatformDescriptorLoaderContext.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/QuarkusJsonPlatformDescriptorLoaderContext.java
index 5d6d4c21111..56e316c529b 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/QuarkusJsonPlatformDescriptorLoaderContext.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/QuarkusJsonPlatformDescriptorLoaderContext.java
@@ -12,7 +12,7 @@ public abstract class QuarkusJsonPlatformDescriptorLoaderContext implements Quar
protected final ResourceLoader resourceLoader;
public QuarkusJsonPlatformDescriptorLoaderContext(ArtifactResolver artifactResolver) {
- this(artifactResolver, MessageWriter.DEFAULT);
+ this(artifactResolver, MessageWriter.info());
}
public QuarkusJsonPlatformDescriptorLoaderContext(ArtifactResolver artifactResolver, MessageWriter log) {
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/tools/config/QuarkusPlatformConfig.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/tools/config/QuarkusPlatformConfig.java
index 9c3ed94512f..30517d22ddc 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/tools/config/QuarkusPlatformConfig.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/tools/config/QuarkusPlatformConfig.java
@@ -31,7 +31,7 @@ public Builder setMessageWriter(MessageWriter msgWriter) {
}
private MessageWriter getMessageWriter() {
- return log == null ? log = MessageWriter.DEFAULT : log;
+ return log == null ? log = MessageWriter.info() : log;
}
public Builder setPlatformDescriptor(QuarkusPlatformDescriptor platformDescr) {
diff --git a/independent-projects/tools/message-writer/src/main/java/io/quarkus/devtools/messagewriter/MessageWriter.java b/independent-projects/tools/message-writer/src/main/java/io/quarkus/devtools/messagewriter/MessageWriter.java
index 4fb31a47375..a5e8cb8252a 100644
--- a/independent-projects/tools/message-writer/src/main/java/io/quarkus/devtools/messagewriter/MessageWriter.java
+++ b/independent-projects/tools/message-writer/src/main/java/io/quarkus/devtools/messagewriter/MessageWriter.java
@@ -4,8 +4,6 @@
public interface MessageWriter {
- MessageWriter DEFAULT = info();
-
static MessageWriter info() {
return new DefaultMessageWriter();
}
diff --git a/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java b/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java
index 26ff5338c74..1e1e753b317 100644
--- a/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java
+++ b/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java
@@ -176,7 +176,7 @@ public QuarkusPlatformDescriptor resolveBundled() {
private void ensureLoggerInitialized() {
if (log == null) {
- log = MessageWriter.DEFAULT;
+ log = MessageWriter.info();
}
}
diff --git a/independent-projects/tools/platform-descriptor-resolver-json/src/test/java/io/quarkus/platform/descriptor/resolver/json/test/QuarkusJsonPlatformDescriptorResolverTest.java b/independent-projects/tools/platform-descriptor-resolver-json/src/test/java/io/quarkus/platform/descriptor/resolver/json/test/QuarkusJsonPlatformDescriptorResolverTest.java
index 8438e602944..5c316204287 100644
--- a/independent-projects/tools/platform-descriptor-resolver-json/src/test/java/io/quarkus/platform/descriptor/resolver/json/test/QuarkusJsonPlatformDescriptorResolverTest.java
+++ b/independent-projects/tools/platform-descriptor-resolver-json/src/test/java/io/quarkus/platform/descriptor/resolver/json/test/QuarkusJsonPlatformDescriptorResolverTest.java
@@ -25,7 +25,7 @@ public class QuarkusJsonPlatformDescriptorResolverTest extends ResolverSetupClea
private static Path testDir;
- private MessageWriter log = MessageWriter.DEFAULT;
+ private MessageWriter log = MessageWriter.info();
@BeforeEach
@Override | ['independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/CodestartInputBuilder.java', 'independent-projects/tools/codestarts/src/test/java/io/quarkus/devtools/codestarts/CodestartProcessorTest.java', 'independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/data/QuarkusCommandInvocation.java', 'independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/descriptor/loader/json/QuarkusJsonPlatformDescriptorLoaderContext.java', 'independent-projects/tools/platform-descriptor-resolver-json/src/test/java/io/quarkus/platform/descriptor/resolver/json/test/QuarkusJsonPlatformDescriptorResolverTest.java', 'independent-projects/tools/devtools-common/src/main/java/io/quarkus/platform/tools/config/QuarkusPlatformConfig.java', 'devtools/platform-descriptor-json/src/main/java/io/quarkus/platform/descriptor/loader/json/impl/QuarkusJsonPlatformDescriptor.java', 'independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java', 'independent-projects/tools/message-writer/src/main/java/io/quarkus/devtools/messagewriter/MessageWriter.java'] | {'.java': 9} | 9 | 9 | 0 | 0 | 9 | 10,973,328 | 2,138,512 | 285,709 | 3,068 | 730 | 145 | 14 | 7 | 1,492 | 83 | 387 | 28 | 2 | 1 | 1970-01-01T00:26: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,964 | quarkusio/quarkus/11825/11815 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11815 | https://github.com/quarkusio/quarkus/pull/11825 | https://github.com/quarkusio/quarkus/pull/11825 | 1 | fixes | Range check makes the release fail | https://github.com/quarkusio/quarkus/pull/11259/files doesn't work when doing the release.
I will revert it for now in the 1.8 branch.
```
[ERROR] AddExtensionMojoTest.testAddMultipleDependency:65 » MojoExecution Failed to in...
[ERROR] AddExtensionMojoTest.testAddSingleDependency:51 » MojoExecution Failed to init...
[ERROR] AddExtensionsMojoTest>AddExtensionMojoTest.testAddMultipleDependency:65 » MojoExecution
[ERROR] AddExtensionsMojoTest>AddExtensionMojoTest.testAddSingleDependency:51 » MojoExecution
```
```
Caused by: java.lang.IllegalStateException: Failed to load the bundled platform artifacts
at io.quarkus.platform.descriptor.resolver.json.QuarkusJsonPlatformDescriptorResolver.resolveJsonArtifactFromBom(QuarkusJsonPlatformDescriptorResolver.java:367)
at io.quarkus.platform.descriptor.resolver.json.QuarkusJsonPlatformDescriptorResolver.resolveJsonDescriptor(QuarkusJsonPlatformDescriptorResolver.java:233)
at io.quarkus.platform.descriptor.resolver.json.QuarkusJsonPlatformDescriptorResolver.resolve(QuarkusJsonPlatformDescriptorResolver.java:158)
at io.quarkus.platform.descriptor.resolver.json.QuarkusJsonPlatformDescriptorResolver.resolveLatestFromBom(QuarkusJsonPlatformDescriptorResolver.java:128)
at io.quarkus.maven.CreateUtils.resolvePlatformDescriptor(CreateUtils.java:101)
at io.quarkus.maven.QuarkusProjectMojoBase.resolvePlatformDescriptor(QuarkusProjectMojoBase.java:112)
... 68 more
Caused by: io.quarkus.platform.descriptor.resolver.json.VersionNotAvailableException: Failed to resolve the latest version of io.quarkus:quarkus-bom::pom:[1.8-snapshot, 1.9)
at io.quarkus.platform.descriptor.resolver.json.QuarkusJsonPlatformDescriptorResolver.loadFromBomCoords(QuarkusJsonPlatformDescriptorResolver.java:387)
at io.quarkus.platform.descriptor.resolver.json.QuarkusJsonPlatformDescriptorResolver.resolveJsonArtifactFromBom(QuarkusJsonPlatformDescriptorResolver.java:364)
... 73 more
``` | cabdee4ad35c2a65f71bc5339530dcd663755773 | dbf6014c6ff36628bd5ca956a3847a193fee9fc3 | https://github.com/quarkusio/quarkus/compare/cabdee4ad35c2a65f71bc5339530dcd663755773...dbf6014c6ff36628bd5ca956a3847a193fee9fc3 | diff --git a/devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java b/devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java
index 20677c4ffcc..495267a6a7d 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java
@@ -85,9 +85,8 @@ static QuarkusPlatformDescriptor resolvePlatformDescriptor(final String bomGroup
DefaultArtifactVersion pluginVersion = new DefaultArtifactVersion(baseVersion);
int majorVer = pluginVersion.getMajorVersion();
int minorVer = pluginVersion.getMinorVersion();
- version = "[" + majorVer + "." + minorVer + "-snapshot, " + majorVer + "." + (minorVer + 1) + ")";
+ version = "[" + majorVer + "." + minorVer + "-alpha, " + majorVer + "." + (minorVer + 1) + ")";
}
-
}
final QuarkusPlatformDescriptor platform; | ['devtools/maven/src/main/java/io/quarkus/maven/CreateUtils.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,969,203 | 2,137,294 | 285,520 | 3,072 | 230 | 66 | 3 | 1 | 1,992 | 87 | 471 | 25 | 1 | 2 | 1970-01-01T00:26: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,965 | quarkusio/quarkus/11817/11806 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11806 | https://github.com/quarkusio/quarkus/pull/11817 | https://github.com/quarkusio/quarkus/pull/11817 | 1 | fixes | Serialization of RestEasy JAXB wrapped collections fails in native mode | **Describe the bug**
When using the `org.jboss.resteasy.annotations.providers.jaxb.Wrapped` annotation in JAX-RS resource to force a specific Collection wrapping XML tag, the collection it not serialized in native mode. However it works as expected in JVM mode.
I use the following code:
```java
@GET
@Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
@Wrapped(element="pastries")
public List<Pastry> getPastries() {
return PastryRepository.getPastries();
}
```
**Expected behavior**
When calling my REST endpoint, I expect something like:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<pastries>
<pastry><name>Tartelette Fraise</name><price>2.0</price><size>S</size><status>available</status></pastry>
<pastry><name>Eclair Cafe</name><price>2.5</price><size>M</size><status>available</status></pastry>
<pastry><name>Millefeuille</name><price>4.4</price><size>L</size><status>available</status></pastry>
</pastries>
```
and that's the result I have when testing in JVM mode.
**Actual behavior**
When running in native mode, I have the following result:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><pastries/>
```
When calling REST endpoint that returns single entity (ex: `/pastry/{name}`), JAXB serialization works as expected even in native mode.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a `Pastry` bean annotated with `@RegisterForReflection` and `@XmlRootElement`
2. Create a JAX-RS `PastryResource` with a method annotated with `@Wrapped(element="pastries")` and returning a List of Pastry
3. Compile your app in native mode and invoke the JAX-RS endpoint.
I have a demo project here: https://github.com/microcks/api-lifecycle/tree/master/api-pastry-demo/api-implementations/quarkus-api-pastry but it already contains the workaround I found (see below). You will have to remove it first for reproducing the failure.
**Configuration**
No properties added.
**Environment:**
- Output of `uname -a` or `ver`: `Darwin lbroudou1-mac 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64`
- Output of `java -version`: `OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)`
- GraalVM version (if different from Java): used the docker image for native compilation
- Quarkus version or git rev: `1.7.1.Final`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): `Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)`
**Workaround**
Found a workaround by adding a `reflection-config.json` file and the adhoc native compilation flag. Once added the annotation is well managed in native mode and the serialization works as expected.
```json
[
{
"name" : "org.jboss.resteasy.plugins.providers.jaxb.JaxbCollection",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredFields" : true,
"allPublicFields" : true
},
{
"name" : "javax.xml.bind.annotation.W3CDomHandler",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredFields" : true,
"allPublicFields" : true
}
]
```
I think that this setup should be managed within `resteasy-jaxb` extension as this is a common use-case in RestEasy. If that makes sense for you, I could contribute a PR.
| cabdee4ad35c2a65f71bc5339530dcd663755773 | b318c9030c8cd5ca2b93d7b1cda5596d8f4ffa89 | https://github.com/quarkusio/quarkus/compare/cabdee4ad35c2a65f71bc5339530dcd663755773...b318c9030c8cd5ca2b93d7b1cda5596d8f4ffa89 | diff --git a/extensions/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java b/extensions/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java
index efa692c91b4..f9492324c8e 100755
--- a/extensions/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java
+++ b/extensions/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java
@@ -1,14 +1,52 @@
package io.quarkus.resteasy.jaxb.deployment;
+import java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.List;
+
+import org.jboss.jandex.DotName;
+import org.jboss.jandex.IndexView;
+import org.jboss.resteasy.annotations.providers.jaxb.Wrapped;
+import org.jboss.resteasy.annotations.providers.jaxb.WrappedMap;
+
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
public class ResteasyJaxbProcessor {
+ private static final List<Class<? extends Annotation>> RESTEASY_JAXB_ANNOTATIONS = Arrays.asList(
+ Wrapped.class,
+ WrappedMap.class);
+
+ @BuildStep
+ void processAnnotations(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
+ CombinedIndexBuildItem combinedIndexBuildItem) {
+ IndexView index = combinedIndexBuildItem.getIndex();
+
+ // Handle RESTEasy annotations usage.
+ for (Class annotationClazz : RESTEASY_JAXB_ANNOTATIONS) {
+ DotName annotation = DotName.createSimple(annotationClazz.getName());
+
+ if (!index.getAnnotations(annotation).isEmpty()) {
+ addReflectiveClass(reflectiveClass, true, true, "org.jboss.resteasy.plugins.providers.jaxb.JaxbCollection");
+ addReflectiveClass(reflectiveClass, true, true, "org.jboss.resteasy.plugins.providers.jaxb.JaxbMap");
+ addReflectiveClass(reflectiveClass, true, true, "javax.xml.bind.annotation.W3CDomHandler");
+ break;
+ }
+ }
+ }
+
@BuildStep
void build(BuildProducer<FeatureBuildItem> feature) {
feature.produce(new FeatureBuildItem(Feature.RESTEASY_JAXB));
}
+
+ private void addReflectiveClass(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, boolean methods, boolean fields,
+ String... className) {
+ reflectiveClass.produce(new ReflectiveClassBuildItem(methods, fields, className));
+ }
}
diff --git a/extensions/resteasy-jaxb/deployment/src/test/java/io/quarkus/resteasy/jaxb/deployment/ProducesXMLTestCase.java b/extensions/resteasy-jaxb/deployment/src/test/java/io/quarkus/resteasy/jaxb/deployment/ProducesXMLTestCase.java
index f1e44da341e..bb04058c164 100644
--- a/extensions/resteasy-jaxb/deployment/src/test/java/io/quarkus/resteasy/jaxb/deployment/ProducesXMLTestCase.java
+++ b/extensions/resteasy-jaxb/deployment/src/test/java/io/quarkus/resteasy/jaxb/deployment/ProducesXMLTestCase.java
@@ -1,11 +1,18 @@
package io.quarkus.resteasy.jaxb.deployment;
+import static org.hamcrest.Matchers.is;
+
+import java.util.Arrays;
+import java.util.List;
+
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.core.MediaType;
+import org.jboss.resteasy.annotations.providers.jaxb.Wrapped;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Assertions;
@@ -34,6 +41,15 @@ public void testProducesXML() {
.contentType(MediaType.APPLICATION_XML)
.extract().as(Bar.class);
Assertions.assertEquals(new Bar("open", "bar"), res);
+
+ RestAssured.given()
+ .contentType(ContentType.TEXT)
+ .when().get("/foo")
+ .then()
+ .log().ifValidationFails()
+ .statusCode(200)
+ .contentType(MediaType.APPLICATION_XML)
+ .body("bars.bar.size()", is(2));
}
@Path("/foo")
@@ -46,6 +62,14 @@ public Bar post(String bar) {
final String[] s = bar.split(" ");
return new Bar(s[0], s[1]);
}
- }
+ @GET
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.APPLICATION_XML)
+ @Wrapped(element = "bars")
+ public List<Bar> list() {
+ return Arrays.asList(new Bar("name_1", "description_1"),
+ new Bar("name_2", "description_2"));
+ }
+ }
} | ['extensions/resteasy-jaxb/deployment/src/test/java/io/quarkus/resteasy/jaxb/deployment/ProducesXMLTestCase.java', 'extensions/resteasy-jaxb/deployment/src/main/java/io/quarkus/resteasy/jaxb/deployment/ResteasyJaxbProcessor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,969,203 | 2,137,294 | 285,520 | 3,072 | 1,768 | 364 | 38 | 1 | 3,554 | 384 | 959 | 86 | 1 | 4 | 1970-01-01T00:26: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,990 | quarkusio/quarkus/11255/11251 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11251 | https://github.com/quarkusio/quarkus/pull/11255 | https://github.com/quarkusio/quarkus/pull/11255 | 1 | fixes | Gradle addExtension will add BOM dependency even if platform is already in dependencies list | **Describe the bug**
Gradle plugin from master branch will add platform BOM dependency even if `enforcedPlatform` is already in dependency list.
**Expected behavior**
Platform BOM should not be added by addExtension task, if BOM is already present.
**Actual behavior**
From build.gradle, after calling `.\\gradlew.bat addExtension --extensions="quarkus-jackson"`
```
dependencies {
implementation 'io.quarkus:quarkus-jackson'
implementation 'io.quarkus:quarkus-bom:999-SNAPSHOT'
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation 'io.quarkus:quarkus-resteasy-jsonb'
implementation 'io.quarkus:quarkus-resteasy'
testImplementation 'io.quarkus:quarkus-junit5'
testImplementation 'io.rest-assured:rest-assured'
}
```
**To Reproduce**
Steps to reproduce the behavior:
1. Create quarkus gradle project and call `.\\gradlew.bat addExtension --extensions="quarkus-jackson"`
| 93b6970843ecc691ee3cb71b584430ded32663f3 | c869bc7111fdf1fb626ce6e9f684eb6a33d04fcc | https://github.com/quarkusio/quarkus/compare/93b6970843ecc691ee3cb71b584430ded32663f3...c869bc7111fdf1fb626ce6e9f684eb6a33d04fcc | diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java
index ab60cfbde3a..bde532c250b 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java
@@ -24,7 +24,7 @@ public abstract class AbstractGradleBuildFile extends BuildFile {
private final Path rootProjectPath;
- private AtomicReference<Model> modelReference = new AtomicReference<>();
+ private final AtomicReference<Model> modelReference = new AtomicReference<>();
public AbstractGradleBuildFile(final Path projectDirPath, final QuarkusPlatformDescriptor platformDescriptor) {
this(projectDirPath, platformDescriptor, null);
@@ -61,11 +61,29 @@ protected boolean addDependency(AppArtifactCoords coords, boolean managed) {
}
static boolean addDependencyInModel(Model model, AppArtifactCoords coords, boolean managed) {
- StringBuilder newDependency = new StringBuilder()
- .append(" implementation '")
- .append(coords.getGroupId())
- .append(":")
- .append(coords.getArtifactId());
+ boolean isBOM = "pom".equals(coords.getType());
+ StringBuilder newDependency;
+ if (isBOM) {
+ // Check if BOM is not included already
+ String resolvedPlatform = String
+ .format("%s:%s", getProperty(model, "quarkusPlatformGroupId"),
+ getProperty(model, "quarkusPlatformArtifactId"));
+ String thisBOM = String.format("%s:%s", coords.getGroupId(), coords.getArtifactId());
+ if (thisBOM.equals(resolvedPlatform)) {
+ // BOM matches the platform, no need to do anything
+ return false;
+ }
+ newDependency = new StringBuilder()
+ .append(" implementation enforcedPlatform(\\"")
+ .append(thisBOM).append(":").append(coords.getVersion())
+ .append("\\")'");
+ } else {
+ newDependency = new StringBuilder()
+ .append(" implementation '")
+ .append(coords.getGroupId())
+ .append(":")
+ .append(coords.getArtifactId());
+ }
if (!managed &&
(coords.getVersion() != null && !coords.getVersion().isEmpty())) {
newDependency.append(":").append(coords.getVersion());
@@ -109,11 +127,7 @@ protected void removeDependency(AppArtifactKey key) {
@Override
public String getProperty(String propertyName) {
- final String property = getModel().getPropertiesContent().getProperty(propertyName);
- if (property != null || getModel().getRootPropertiesContent() == null) {
- return property;
- }
- return getModel().getRootPropertiesContent().getProperty(propertyName);
+ return getProperty(getModel(), propertyName);
}
@Override
@@ -121,6 +135,14 @@ public BuildTool getBuildTool() {
return BuildTool.GRADLE;
}
+ static String getProperty(Model model, String propertyName) {
+ final String property = model.getPropertiesContent().getProperty(propertyName);
+ if (property != null || model.getRootPropertiesContent() == null) {
+ return property;
+ }
+ return model.getRootPropertiesContent().getProperty(propertyName);
+ }
+
private Model getModel() {
return modelReference.updateAndGet(model -> {
if (model == null) {
@@ -139,7 +161,7 @@ protected void refreshData() {
this.modelReference.set(null);
}
- private boolean hasRootProjectFile(final String fileName) throws IOException {
+ private boolean hasRootProjectFile(final String fileName) {
if (rootProjectPath == null) {
return false;
}
@@ -185,17 +207,17 @@ private Model readModel() throws IOException {
return new Model(settingsContent, buildContent, propertiesContent, rootSettingsContent, rootPropertiesContent);
}
- protected String getBuildContent() throws IOException {
+ protected String getBuildContent() {
return getModel().getBuildContent();
}
static class Model {
private String settingsContent;
private String buildContent;
- private Properties propertiesContent;
+ private final Properties propertiesContent;
- private String rootSettingsContent;
- private Properties rootPropertiesContent;
+ private final String rootSettingsContent;
+ private final Properties rootPropertiesContent;
public Model(String settingsContent, String buildContent, Properties propertiesContent, String rootSettingsContent,
Properties rootPropertiesContent) {
diff --git a/integration-tests/gradle/src/test/java/io/quarkus/gradle/AddExtensionToSingleModuleProjectTest.java b/integration-tests/gradle/src/test/java/io/quarkus/gradle/AddExtensionToSingleModuleProjectTest.java
index a5a68c6efc3..8b46297fd2e 100644
--- a/integration-tests/gradle/src/test/java/io/quarkus/gradle/AddExtensionToSingleModuleProjectTest.java
+++ b/integration-tests/gradle/src/test/java/io/quarkus/gradle/AddExtensionToSingleModuleProjectTest.java
@@ -21,7 +21,10 @@ public void testAddAndRemoveExtension() throws IOException, URISyntaxException,
final Path build = projectDir.toPath().resolve("build.gradle");
assertThat(build).exists();
- assertThat(new String(Files.readAllBytes(build))).contains("implementation 'io.quarkus:quarkus-hibernate-orm'");
+ assertThat(new String(Files.readAllBytes(build)))
+ .contains("implementation 'io.quarkus:quarkus-hibernate-orm'")
+ .doesNotContain("implementation enforcedPlatform('io.quarkus:quarkus-bom:")
+ .doesNotContain("implementation 'io.quarkus:quarkus-bom:");
runGradleWrapper(projectDir, ":removeExtension", "--extensions=hibernate-orm");
assertThat(new String(Files.readAllBytes(build))).doesNotContain("implementation 'io.quarkus:quarkus-hibernate-orm'"); | ['integration-tests/gradle/src/test/java/io/quarkus/gradle/AddExtensionToSingleModuleProjectTest.java', 'independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,491,037 | 2,042,263 | 272,937 | 2,923 | 2,814 | 473 | 54 | 1 | 1,002 | 82 | 243 | 25 | 0 | 1 | 1970-01-01T00:26:36 | 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,991 | quarkusio/quarkus/11236/11064 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11064 | https://github.com/quarkusio/quarkus/pull/11236 | https://github.com/quarkusio/quarkus/pull/11236 | 1 | fixes | Split package: io.quarkus.agroal.deployment is used in both quarkus-agroal-deployment and quarkus-agroal-spi | We need to change the package for the SPI but it's too risky to do it now, scheduled for 1.8. | 00188a26307b98f6fade8e28ba8fd3a4c4d8839d | 297e9589981a5a8039162694ac1aec34e54120f4 | https://github.com/quarkusio/quarkus/compare/00188a26307b98f6fade8e28ba8fd3a4c4d8839d...297e9589981a5a8039162694ac1aec34e54120f4 | diff --git a/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java b/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java
index e54d004023a..ec6ad446791 100644
--- a/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java
+++ b/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java
@@ -26,6 +26,8 @@
import io.quarkus.agroal.runtime.LegacyDataSourceJdbcBuildTimeConfig;
import io.quarkus.agroal.runtime.LegacyDataSourcesJdbcBuildTimeConfig;
import io.quarkus.agroal.runtime.TransactionIntegration;
+import io.quarkus.agroal.spi.JdbcDataSourceBuildItem;
+import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.arc.processor.DotNames;
diff --git a/extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDataSourceBuildItem.java b/extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDataSourceBuildItem.java
similarity index 95%
rename from extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDataSourceBuildItem.java
rename to extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDataSourceBuildItem.java
index 82806454396..f584fb0ebea 100644
--- a/extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDataSourceBuildItem.java
+++ b/extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDataSourceBuildItem.java
@@ -1,4 +1,4 @@
-package io.quarkus.agroal.deployment;
+package io.quarkus.agroal.spi;
import io.quarkus.builder.item.MultiBuildItem;
diff --git a/extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDataSourceSchemaReadyBuildItem.java b/extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDataSourceSchemaReadyBuildItem.java
similarity index 94%
rename from extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDataSourceSchemaReadyBuildItem.java
rename to extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDataSourceSchemaReadyBuildItem.java
index 280ab686ba3..687ed1ba403 100644
--- a/extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDataSourceSchemaReadyBuildItem.java
+++ b/extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDataSourceSchemaReadyBuildItem.java
@@ -1,4 +1,4 @@
-package io.quarkus.agroal.deployment;
+package io.quarkus.agroal.spi;
import java.util.Collection;
diff --git a/extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDriverBuildItem.java b/extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDriverBuildItem.java
similarity index 96%
rename from extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDriverBuildItem.java
rename to extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDriverBuildItem.java
index 00dd028786c..bd8849bb2f8 100644
--- a/extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDriverBuildItem.java
+++ b/extensions/agroal/spi/src/main/java/io/quarkus/agroal/spi/JdbcDriverBuildItem.java
@@ -1,4 +1,4 @@
-package io.quarkus.agroal.deployment;
+package io.quarkus.agroal.spi;
import java.util.Optional;
diff --git a/extensions/elytron-security-jdbc/deployment/src/main/java/io/quarkus/elytron/security/jdbc/deployment/ElytronSecurityJdbcProcessor.java b/extensions/elytron-security-jdbc/deployment/src/main/java/io/quarkus/elytron/security/jdbc/deployment/ElytronSecurityJdbcProcessor.java
index 3db87dbc27f..deb65039e9d 100644
--- a/extensions/elytron-security-jdbc/deployment/src/main/java/io/quarkus/elytron/security/jdbc/deployment/ElytronSecurityJdbcProcessor.java
+++ b/extensions/elytron-security-jdbc/deployment/src/main/java/io/quarkus/elytron/security/jdbc/deployment/ElytronSecurityJdbcProcessor.java
@@ -4,7 +4,7 @@
import org.wildfly.security.auth.server.SecurityRealm;
-import io.quarkus.agroal.deployment.JdbcDataSourceBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceBuildItem;
import io.quarkus.arc.deployment.BeanContainerBuildItem;
import io.quarkus.deployment.Capability;
import io.quarkus.deployment.Feature;
diff --git a/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java b/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
index 571b16f3b06..85576bebc80 100644
--- a/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
+++ b/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
@@ -32,8 +32,8 @@
import org.jboss.jandex.DotName;
import org.jboss.logging.Logger;
-import io.quarkus.agroal.deployment.JdbcDataSourceBuildItem;
-import io.quarkus.agroal.deployment.JdbcDataSourceSchemaReadyBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceSchemaReadyBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.arc.processor.DotNames;
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 a22d50ad965..7a498422d43 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
@@ -58,8 +58,8 @@
import org.jboss.jandex.Indexer;
import org.jboss.logmanager.Level;
-import io.quarkus.agroal.deployment.JdbcDataSourceBuildItem;
-import io.quarkus.agroal.deployment.JdbcDataSourceSchemaReadyBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceSchemaReadyBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanContainerBuildItem;
import io.quarkus.arc.deployment.BeanContainerListenerBuildItem;
diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ImpliedBlockingPersistenceUnitTypeBuildItem.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ImpliedBlockingPersistenceUnitTypeBuildItem.java
index db655c194eb..3a8b6a9ae53 100644
--- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ImpliedBlockingPersistenceUnitTypeBuildItem.java
+++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ImpliedBlockingPersistenceUnitTypeBuildItem.java
@@ -1,6 +1,6 @@
package io.quarkus.hibernate.orm.deployment;
-import io.quarkus.agroal.deployment.JdbcDataSourceBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceBuildItem;
import io.quarkus.builder.item.SimpleBuildItem;
/**
diff --git a/extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java b/extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java
index 6d75ad8c512..563eb237f8a 100644
--- a/extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java
+++ b/extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java
@@ -1,6 +1,6 @@
package io.quarkus.jdbc.db2.deployment;
-import io.quarkus.agroal.deployment.JdbcDriverBuildItem;
+import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.datasource.common.runtime.DatabaseKind;
diff --git a/extensions/jdbc/jdbc-derby/deployment/src/main/java/io/quarkus/jdbc/derby/deployment/JDBCDerbyProcessor.java b/extensions/jdbc/jdbc-derby/deployment/src/main/java/io/quarkus/jdbc/derby/deployment/JDBCDerbyProcessor.java
index ab25e8f7105..ce5c278533b 100644
--- a/extensions/jdbc/jdbc-derby/deployment/src/main/java/io/quarkus/jdbc/derby/deployment/JDBCDerbyProcessor.java
+++ b/extensions/jdbc/jdbc-derby/deployment/src/main/java/io/quarkus/jdbc/derby/deployment/JDBCDerbyProcessor.java
@@ -1,6 +1,6 @@
package io.quarkus.jdbc.derby.deployment;
-import io.quarkus.agroal.deployment.JdbcDriverBuildItem;
+import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.datasource.common.runtime.DatabaseKind;
diff --git a/extensions/jdbc/jdbc-h2/deployment/src/main/java/io/quarkus/jdbc/h2/deployment/JDBCH2Processor.java b/extensions/jdbc/jdbc-h2/deployment/src/main/java/io/quarkus/jdbc/h2/deployment/JDBCH2Processor.java
index 267e6003431..53c22c5a280 100644
--- a/extensions/jdbc/jdbc-h2/deployment/src/main/java/io/quarkus/jdbc/h2/deployment/JDBCH2Processor.java
+++ b/extensions/jdbc/jdbc-h2/deployment/src/main/java/io/quarkus/jdbc/h2/deployment/JDBCH2Processor.java
@@ -1,6 +1,6 @@
package io.quarkus.jdbc.h2.deployment;
-import io.quarkus.agroal.deployment.JdbcDriverBuildItem;
+import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.datasource.common.runtime.DatabaseKind;
diff --git a/extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/JDBCMariaDBProcessor.java b/extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/JDBCMariaDBProcessor.java
index b79f5fb0be7..b243fa3b47a 100644
--- a/extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/JDBCMariaDBProcessor.java
+++ b/extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/JDBCMariaDBProcessor.java
@@ -1,6 +1,6 @@
package io.quarkus.jdbc.mariadb.deployment;
-import io.quarkus.agroal.deployment.JdbcDriverBuildItem;
+import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.datasource.common.runtime.DatabaseKind;
diff --git a/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLProcessor.java b/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLProcessor.java
index 60d5b05f79e..98206104dfe 100644
--- a/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLProcessor.java
+++ b/extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLProcessor.java
@@ -1,6 +1,6 @@
package io.quarkus.jdbc.mssql.deployment;
-import io.quarkus.agroal.deployment.JdbcDriverBuildItem;
+import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.datasource.common.runtime.DatabaseKind;
diff --git a/extensions/jdbc/jdbc-mysql/deployment/src/main/java/io/quarkus/jdbc/mysql/deployment/JDBCMySQLProcessor.java b/extensions/jdbc/jdbc-mysql/deployment/src/main/java/io/quarkus/jdbc/mysql/deployment/JDBCMySQLProcessor.java
index 9947e8b3324..2f1c22f16c1 100644
--- a/extensions/jdbc/jdbc-mysql/deployment/src/main/java/io/quarkus/jdbc/mysql/deployment/JDBCMySQLProcessor.java
+++ b/extensions/jdbc/jdbc-mysql/deployment/src/main/java/io/quarkus/jdbc/mysql/deployment/JDBCMySQLProcessor.java
@@ -19,7 +19,7 @@
import com.mysql.cj.jdbc.result.ResultSetInternalMethods;
import com.mysql.cj.protocol.Resultset;
-import io.quarkus.agroal.deployment.JdbcDriverBuildItem;
+import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.datasource.common.runtime.DatabaseKind;
diff --git a/extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/JDBCPostgreSQLProcessor.java b/extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/JDBCPostgreSQLProcessor.java
index ae4e00e31e9..16135434153 100644
--- a/extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/JDBCPostgreSQLProcessor.java
+++ b/extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/JDBCPostgreSQLProcessor.java
@@ -1,6 +1,6 @@
package io.quarkus.jdbc.postgresql.deployment;
-import io.quarkus.agroal.deployment.JdbcDriverBuildItem;
+import io.quarkus.agroal.spi.JdbcDriverBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.processor.BuiltinScope;
import io.quarkus.datasource.common.runtime.DatabaseKind;
diff --git a/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/LiquibaseProcessor.java b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/LiquibaseProcessor.java
index 89fdffe5a86..5903b5749ef 100644
--- a/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/LiquibaseProcessor.java
+++ b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/LiquibaseProcessor.java
@@ -12,8 +12,8 @@
import org.jboss.logging.Logger;
-import io.quarkus.agroal.deployment.JdbcDataSourceBuildItem;
-import io.quarkus.agroal.deployment.JdbcDataSourceSchemaReadyBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceSchemaReadyBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.arc.processor.DotNames;
diff --git a/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java b/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java
index 4c166ecbbfa..7d5503d803c 100644
--- a/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java
+++ b/extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java
@@ -28,8 +28,8 @@
import org.quartz.simpl.SimpleThreadPool;
import org.quartz.spi.SchedulerPlugin;
-import io.quarkus.agroal.deployment.JdbcDataSourceBuildItem;
-import io.quarkus.agroal.deployment.JdbcDataSourceSchemaReadyBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceBuildItem;
+import io.quarkus.agroal.spi.JdbcDataSourceSchemaReadyBuildItem;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.datasource.common.runtime.DatabaseKind; | ['extensions/jdbc/jdbc-h2/deployment/src/main/java/io/quarkus/jdbc/h2/deployment/JDBCH2Processor.java', 'extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java', 'extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDataSourceBuildItem.java', 'extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/JDBCMariaDBProcessor.java', 'extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/LiquibaseProcessor.java', 'extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ImpliedBlockingPersistenceUnitTypeBuildItem.java', 'extensions/jdbc/jdbc-mssql/deployment/src/main/java/io/quarkus/jdbc/mssql/deployment/MsSQLProcessor.java', 'extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDriverBuildItem.java', 'extensions/elytron-security-jdbc/deployment/src/main/java/io/quarkus/elytron/security/jdbc/deployment/ElytronSecurityJdbcProcessor.java', 'extensions/jdbc/jdbc-mysql/deployment/src/main/java/io/quarkus/jdbc/mysql/deployment/JDBCMySQLProcessor.java', 'extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java', 'extensions/jdbc/jdbc-db2/deployment/src/main/java/io/quarkus/jdbc/db2/deployment/JDBCDB2Processor.java', 'extensions/jdbc/jdbc-derby/deployment/src/main/java/io/quarkus/jdbc/derby/deployment/JDBCDerbyProcessor.java', 'extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java', 'extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/JDBCPostgreSQLProcessor.java', 'extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java', 'extensions/agroal/spi/src/main/java/io/quarkus/agroal/deployment/JdbcDataSourceSchemaReadyBuildItem.java'] | {'.java': 17} | 17 | 17 | 0 | 0 | 17 | 10,488,330 | 2,041,749 | 272,894 | 2,922 | 2,113 | 573 | 36 | 17 | 93 | 20 | 26 | 1 | 0 | 0 | 1970-01-01T00:26:36 | 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 |
3,026 | quarkusio/quarkus/10310/10292 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10292 | https://github.com/quarkusio/quarkus/pull/10310 | https://github.com/quarkusio/quarkus/pull/10310 | 1 | fix | Concurrent requests for blocking reactive routes is limited by quarkus.vertx.event-loops-pool-size | **Describe the bug**
Concurrent requests for blocking reactive routes is limited by quarkus.vertx.event-loops-pool-size
**Expected behavior**
Concurrent requests for blocking reactive routes should be limited by quarkus.vertx.worker-pool-size
**Actual behavior**
When a blocking route is created with the the Route annotation.
`@Route(path = "/blocking-with-annotation", methods = HttpMethod.GET, type = Route.HandlerType.BLOCKING)`
Then the concurrent HTTP requests are limited by the number of event loops.
**To Reproduce**
See ReactiveRoutesTest.java in:
https://github.com/timoesk/quarkus-reactive-routes-issue
| a997206a64e373a1aa2cc9fe3961a1631a7ae2c1 | 3708bee4da25d4d949889f947d013fa33048b85b | https://github.com/quarkusio/quarkus/compare/a997206a64e373a1aa2cc9fe3961a1631a7ae2c1...3708bee4da25d4d949889f947d013fa33048b85b | 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 3cd415b1ba1..136ac025bf7 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
@@ -734,7 +734,7 @@ public void addRoute(RuntimeValue<Router> router, Function<Router, Route> route,
Handler<RoutingContext> requestHandler = handler;
if (blocking == HandlerType.BLOCKING) {
- vr.blockingHandler(requestHandler);
+ vr.blockingHandler(requestHandler, false);
} else if (blocking == HandlerType.FAILURE) {
vr.failureHandler(requestHandler);
} else { | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,692,831 | 1,883,079 | 250,758 | 2,687 | 104 | 18 | 2 | 1 | 648 | 67 | 139 | 23 | 1 | 0 | 1970-01-01T00:26:33 | 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 |
3,018 | quarkusio/quarkus/10598/10593 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10593 | https://github.com/quarkusio/quarkus/pull/10598 | https://github.com/quarkusio/quarkus/pull/10598 | 1 | resolves | ArC AnnotationStore - AnnotationTarget is incorrectly used as a key in a Map | `ClassInfo` and `FieldInfo` do not override `equals()`/`hashCode()`. Moreover, new `FieldInfo` objects are created for each `ClassInfo.fields()` invocation. | 160bdf3769b7891d743654606712d4b2807e4788 | 7f33d1e36f77889484b597efada770bcd23c7e01 | https://github.com/quarkusio/quarkus/compare/160bdf3769b7891d743654606712d4b2807e4788...7f33d1e36f77889484b597efada770bcd23c7e01 | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationStore.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationStore.java
index 925782fe8c5..583c5d52a03 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationStore.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationStore.java
@@ -7,12 +7,15 @@
import java.util.Collections;
import java.util.EnumMap;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
import org.jboss.jandex.AnnotationTarget.Kind;
import org.jboss.jandex.DotName;
+import org.jboss.jandex.FieldInfo;
+import org.jboss.jandex.MethodInfo;
/**
* Applies {@link AnnotationsTransformer}s and caches the results of transformations.
@@ -22,7 +25,7 @@
*/
public final class AnnotationStore {
- private final ConcurrentMap<AnnotationTarget, Collection<AnnotationInstance>> transformed;
+ private final ConcurrentMap<AnnotationTargetKey, Collection<AnnotationInstance>> transformed;
private final EnumMap<Kind, List<AnnotationsTransformer>> transformersMap;
@@ -50,7 +53,7 @@ public final class AnnotationStore {
*/
public Collection<AnnotationInstance> getAnnotations(AnnotationTarget target) {
if (transformed != null) {
- return transformed.computeIfAbsent(target, this::transform);
+ return transformed.computeIfAbsent(new AnnotationTargetKey(target), this::transform);
}
return getOriginalAnnotations(target);
}
@@ -88,7 +91,8 @@ public boolean hasAnyAnnotation(AnnotationTarget target, Iterable<DotName> names
return Annotations.containsAny(getAnnotations(target), names);
}
- private Collection<AnnotationInstance> transform(AnnotationTarget target) {
+ private Collection<AnnotationInstance> transform(AnnotationTargetKey key) {
+ AnnotationTarget target = key.target;
Collection<AnnotationInstance> annotations = getOriginalAnnotations(target);
List<AnnotationsTransformer> transformers = transformersMap.get(target.kind());
if (transformers.isEmpty()) {
@@ -144,4 +148,65 @@ public Transformation transform() {
}
+ /**
+ * We cannot use annotation target directly as a key in a Map. Only {@link MethodInfo} overrides equals/hashCode.
+ */
+ static final class AnnotationTargetKey {
+
+ final AnnotationTarget target;
+
+ public AnnotationTargetKey(AnnotationTarget target) {
+ this.target = target;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ AnnotationTargetKey other = (AnnotationTargetKey) obj;
+ if (target.kind() != other.target.kind()) {
+ return false;
+ }
+ switch (target.kind()) {
+ case METHOD:
+ return target.asMethod().equals(other.target);
+ case FIELD:
+ FieldInfo field = target.asField();
+ FieldInfo otherField = other.target.asField();
+ return Objects.equals(field.name(), otherField.name())
+ && Objects.equals(field.declaringClass().name(), otherField.declaringClass().name());
+ case CLASS:
+ return target.asClass().name().equals(other.target.asClass().name());
+ default:
+ throw unsupportedAnnotationTarget(target);
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ switch (target.kind()) {
+ case METHOD:
+ return target.asMethod().hashCode();
+ case FIELD:
+ return Objects.hash(target.asField().name(), target.asField().declaringClass().name());
+ case CLASS:
+ return target.asClass().name().hashCode();
+ default:
+ throw unsupportedAnnotationTarget(target);
+ }
+ }
+
+ }
+
+ private static IllegalArgumentException unsupportedAnnotationTarget(AnnotationTarget target) {
+ return new IllegalArgumentException("Unsupported annotation target: " + target.kind());
+ }
+
} | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationStore.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,000,734 | 1,946,758 | 259,879 | 2,729 | 2,960 | 491 | 71 | 1 | 157 | 17 | 40 | 1 | 0 | 0 | 1970-01-01T00:26: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 |
3,019 | quarkusio/quarkus/10575/10572 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10572 | https://github.com/quarkusio/quarkus/pull/10575 | https://github.com/quarkusio/quarkus/pull/10575 | 1 | resolves | Problem with Qute context using for and each blocks | **Describe the bug**
Using `for` and `each` blocks, when accessing an existing key, I think it shouldn't use the `data` context no?
Reproducer code:
```Java
@Test
void quteTest() throws IOException {
final HashMap<String, Object> dep1 = new HashMap<>();
dep1.put("version", "1.0");
final HashMap<String, Object> data = new HashMap<>();
data.put("dependencies", Arrays.asList(dep1, new HashMap<>()));
data.put("version", "hellllllo");
final String result = Engine.builder().addDefaults().build().parse("{#for dep in dependencies}\\n{#if dep.version}<version>{dep.version}</version>\\n{/if}\\n{/for}").render(data);
Assertions.assertThat(result).doesNotContain("hellllllo");
}
```
Maybe this is an expected behavior with `it` using a `each` block, but with `for` assigned to `dep` in the example it doesn't make sense at all. | 160bdf3769b7891d743654606712d4b2807e4788 | abe9923cb811d8d32bef20ebacbb216992d36df6 | https://github.com/quarkusio/quarkus/compare/160bdf3769b7891d743654606712d4b2807e4788...abe9923cb811d8d32bef20ebacbb216992d36df6 | diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/EvaluatorImpl.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/EvaluatorImpl.java
index e2152b2eb37..b0488e968ad 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/EvaluatorImpl.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/EvaluatorImpl.java
@@ -73,14 +73,9 @@ private CompletionStage<Object> resolveReference(boolean tryParent, Object ref,
// The last part - no need to compose
return resolve(evalContext, resolvers.iterator());
} else {
+ // Next part - no need to try the parent context/outer scope
return resolve(evalContext, resolvers.iterator())
- .thenCompose(r -> {
- if (parts.hasNext()) {
- return resolveReference(tryParent, r, parts, resolutionContext);
- } else {
- return CompletableFuture.completedFuture(r);
- }
- });
+ .thenCompose(r -> resolveReference(false, r, parts, resolutionContext));
}
}
diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/LoopSectionTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/LoopSectionTest.java
index 639e766b38f..e07ce14898a 100644
--- a/independent-projects/qute/core/src/test/java/io/quarkus/qute/LoopSectionTest.java
+++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/LoopSectionTest.java
@@ -1,6 +1,7 @@
package io.quarkus.qute;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
@@ -147,4 +148,26 @@ public void testNoniterable() {
}
}
+ @Test
+ void testScope() {
+ final HashMap<String, Object> dep1 = new HashMap<>();
+ dep1.put("version", "1.0");
+ final HashMap<String, Object> data = new HashMap<>();
+ data.put("dependencies", Arrays.asList(dep1, new HashMap<>()));
+ data.put("version", "hellllllo");
+ Engine engine = Engine.builder().addDefaults().build();
+ String result = engine.parse("{#for dep in dependencies}{#if dep.version}<version>{dep.version}</version>{/if}{/for}")
+ .render(data);
+ assertFalse(result.contains("hellllllo"), result);
+ result = engine.parse("{#for dep in dependencies}{#if dep.version}<version>{version}</version>{/if}{/for}")
+ .render(data);
+ assertTrue(result.contains("hellllllo"), result);
+ result = engine.parse("{#each dependencies}{#if it.version}<version>{it.version}</version>{/if}{/each}")
+ .render(data);
+ assertFalse(result.contains("hellllllo"), result);
+ result = engine.parse("{#each dependencies}{#if it.version}<version>{version}</version>{/if}{/each}")
+ .render(data);
+ assertTrue(result.contains("hellllllo"), result);
+ }
+
} | ['independent-projects/qute/core/src/main/java/io/quarkus/qute/EvaluatorImpl.java', 'independent-projects/qute/core/src/test/java/io/quarkus/qute/LoopSectionTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,000,734 | 1,946,758 | 259,879 | 2,729 | 510 | 77 | 9 | 1 | 909 | 92 | 223 | 19 | 0 | 1 | 1970-01-01T00:26: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 |
3,020 | quarkusio/quarkus/10548/8416 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8416 | https://github.com/quarkusio/quarkus/pull/10548 | https://github.com/quarkusio/quarkus/pull/10548 | 1 | fixes | if something is already running on port startup has no warning /signs of problems | **Describe the bug**
Start two quarkus:dev or something else confilciting on port 8080 and your second run will not show any warning/errors.
**Expected behavior**
Warning or even full error if ports cannot be bound.
| 6b5b582821a8d72255957b2c8c741f3c66cec8b5 | 6fe0f2a6879f0069523c564525785491f3300e37 | https://github.com/quarkusio/quarkus/compare/6b5b582821a8d72255957b2c8c741f3c66cec8b5...6fe0f2a6879f0069523c564525785491f3300e37 | 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 0ae4c4b402c..c0785231810 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
@@ -114,8 +114,12 @@ public void accept(Integer integer) {
}
runtimeUpdatesProcessor.startupFailed();
} catch (Exception e) {
- t.addSuppressed(new RuntimeException("Failed to recover after failed start", e));
- throw new RuntimeException(t);
+ close();
+ log.error("Failed to recover after failed start", e);
+ //this is the end of the road, we just exit
+ //generally we only hit this if something is already listening on the HTTP port
+ //or the system config is so broken we can't start HTTP
+ System.exit(1);
}
}
}
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 15e4b86464c..9743cee2f23 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -333,6 +333,9 @@ public void execute() throws MojoFailureException, MojoExecutionException {
if (System.currentTimeMillis() > nextCheck) {
nextCheck = System.currentTimeMillis() + 100;
if (!runner.process.isAlive()) {
+ if (runner.process.exitValue() != 0) {
+ throw new MojoExecutionException("Dev mode process did not complete successfully");
+ }
return;
}
final Set<Path> changed = new HashSet<>();
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 93a4f512647..88402c3cd9f 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
@@ -152,9 +152,15 @@ public static void startServerAfterFailedStart() {
// the server start to fail
hotReplacementHandler = prevHotReplacementHandler;
}
- VertxConfiguration vertxConfiguration = new VertxConfiguration();
- ConfigInstantiator.handleObject(vertxConfiguration);
- Vertx vertx = VertxCoreRecorder.initialize(vertxConfiguration, null);
+ Supplier<Vertx> supplier = VertxCoreRecorder.getVertx();
+ Vertx vertx;
+ if (supplier == null) {
+ VertxConfiguration vertxConfiguration = new VertxConfiguration();
+ ConfigInstantiator.handleObject(vertxConfiguration);
+ vertx = VertxCoreRecorder.initialize(vertxConfiguration, null);
+ } else {
+ vertx = supplier.get();
+ }
try {
HttpBuildTimeConfig buildConfig = new HttpBuildTimeConfig(); | ['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 9,969,670 | 1,941,343 | 259,180 | 2,727 | 1,430 | 247 | 23 | 3 | 224 | 34 | 50 | 7 | 0 | 0 | 1970-01-01T00:26: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 |
3,021 | quarkusio/quarkus/10546/6209 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6209 | https://github.com/quarkusio/quarkus/pull/10546 | https://github.com/quarkusio/quarkus/pull/10546 | 1 | fixes | IllegalArgumentException: workerPoolSize must be > 0 if quarkus:dev fails to start | While developing an extension, if any error is thrown during initialization, the following misleading exception appears in the logs when running quarkus:dev:
```
15:27:48,255 ERROR [io.qua.dev.DevModeMain] Failed to start quarkus: java.lang.IllegalArgumentException: workerPoolSize must be > 0
at io.vertx.core.VertxOptions.setWorkerPoolSize(VertxOptions.java:275)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder.convertToVertxOptions(VertxCoreRecorder.java:151)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initializeWeb(VertxCoreRecorder.java:104)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder.startServerAfterFailedStart(VertxHttpRecorder.java:115)
at io.quarkus.vertx.http.deployment.devmode.VertxHotReplacementSetup.handleFailedInitialStart(VertxHotReplacementSetup.java:30)
at io.quarkus.dev.RuntimeUpdatesProcessor.startupFailed(RuntimeUpdatesProcessor.java:451)
at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:192)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:96)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:67)
``` | ee33c045eefc2e3047faff0b11bda666874124d9 | a30ab3fb2cafba18c76cab2e6a104e4f5d95db85 | https://github.com/quarkusio/quarkus/compare/ee33c045eefc2e3047faff0b11bda666874124d9...a30ab3fb2cafba18c76cab2e6a104e4f5d95db85 | 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 0ae4c4b402c..065a221ab96 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
@@ -41,7 +41,7 @@
public class IsolatedDevModeMain implements BiConsumer<CuratedApplication, Map<String, Object>>, Closeable {
- private static final Logger log = Logger.getLogger(DevModeMain.class);
+ private static final Logger log = Logger.getLogger(IsolatedDevModeMain.class);
public static final String APP_ROOT = "app-root";
private volatile DevModeContext context;
@@ -101,7 +101,6 @@ public void accept(Integer integer) {
} else {
//we need to set this here, while we still have the correct TCCL
//this is so the config is still valid, and we can read HTTP config from application.properties
- log.error("Failed to start Quarkus", t);
log.info("Attempting to start hot replacement endpoint to recover from previous Quarkus startup failure");
if (runtimeUpdatesProcessor != null) {
Thread.currentThread().setContextClassLoader(curatedApplication.getBaseRuntimeClassLoader());
@@ -142,6 +141,8 @@ public synchronized void restartApp(Set<String> changedResources) {
} catch (Throwable t) {
deploymentProblem = t;
log.error("Failed to start quarkus", t);
+ Thread.currentThread().setContextClassLoader(curatedApplication.getAugmentClassLoader());
+ LoggingSetupRecorder.handleFailedStart();
}
} finally {
restarting = false;
diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxProducer.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxProducer.java
index fcd77bbf196..a5640bda6da 100644
--- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxProducer.java
+++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxProducer.java
@@ -10,7 +10,6 @@
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
-import javax.inject.Inject;
import javax.inject.Singleton;
import org.jboss.logging.Logger;
@@ -34,25 +33,22 @@ public class VertxProducer {
private static final Logger LOGGER = Logger.getLogger(VertxProducer.class);
- @Inject
- Vertx vertx;
-
@Singleton
@Produces
- public EventBus eventbus() {
+ public EventBus eventbus(Vertx vertx) {
return vertx.eventBus();
}
@Singleton
@Produces
- public io.vertx.mutiny.core.Vertx mutiny() {
+ public io.vertx.mutiny.core.Vertx mutiny(Vertx vertx) {
return io.vertx.mutiny.core.Vertx.newInstance(vertx);
}
@Singleton
@Produces
@Deprecated
- public io.vertx.axle.core.Vertx axle() {
+ public io.vertx.axle.core.Vertx axle(Vertx vertx) {
LOGGER.warn(
"`io.vertx.axle.core.Vertx` is deprecated and will be removed in a future version - it is "
+ "recommended to switch to `io.vertx.mutiny.core.Vertx`");
@@ -62,7 +58,7 @@ public io.vertx.axle.core.Vertx axle() {
@Singleton
@Produces
@Deprecated
- public io.vertx.reactivex.core.Vertx rx() {
+ public io.vertx.reactivex.core.Vertx rx(Vertx vertx) {
LOGGER.warn(
"`io.vertx.reactivex.core.Vertx` is deprecated and will be removed in a future version - it is "
+ "recommended to switch to `io.vertx.mutiny.core.Vertx`");
@@ -102,8 +98,7 @@ public io.vertx.mutiny.core.eventbus.EventBus mutinyEventBus(io.vertx.mutiny.cor
* @param event
* @param beanManager
*/
- void undeployVerticles(@Observes @BeforeDestroyed(ApplicationScoped.class) Object event,
- BeanManager beanManager, io.vertx.mutiny.core.Vertx mutiny) {
+ void undeployVerticles(@Observes @BeforeDestroyed(ApplicationScoped.class) Object event, BeanManager beanManager) {
// Only beans with the AbstractVerticle in the set of bean types are considered - we need a deployment id
Set<Bean<?>> beans = beanManager.getBeans(AbstractVerticle.class, Any.Literal.INSTANCE);
Context applicationContext = beanManager.getContext(ApplicationScoped.class);
@@ -115,6 +110,8 @@ void undeployVerticles(@Observes @BeforeDestroyed(ApplicationScoped.class) Objec
// Only existing instances are considered
try {
AbstractVerticle verticle = (AbstractVerticle) instance;
+ io.vertx.mutiny.core.Vertx mutiny = beanManager.createInstance()
+ .select(io.vertx.mutiny.core.Vertx.class).get();
mutiny.undeploy(verticle.deploymentID()).await().indefinitely();
LOGGER.debugf("Undeployed verticle: %s", instance.getClass());
} catch (Exception e) {
diff --git a/extensions/vertx/runtime/src/test/java/io/quarkus/vertx/runtime/VertxProducerTest.java b/extensions/vertx/runtime/src/test/java/io/quarkus/vertx/runtime/VertxProducerTest.java
index 725df6cfc9c..1868eb04ee4 100644
--- a/extensions/vertx/runtime/src/test/java/io/quarkus/vertx/runtime/VertxProducerTest.java
+++ b/extensions/vertx/runtime/src/test/java/io/quarkus/vertx/runtime/VertxProducerTest.java
@@ -8,6 +8,7 @@
import org.junit.jupiter.api.Test;
import io.quarkus.vertx.core.runtime.VertxCoreRecorder;
+import io.vertx.core.Vertx;
public class VertxProducerTest {
@@ -27,24 +28,23 @@ public void tearDown() {
@Test
public void shouldNotFailWithoutConfig() {
- producer.vertx = VertxCoreRecorder.initialize(null, null);
- verifyProducer();
+ verifyProducer(VertxCoreRecorder.initialize(null, null));
}
- private void verifyProducer() {
- assertThat(producer.eventbus()).isNotNull();
+ private void verifyProducer(Vertx v) {
+ assertThat(producer.eventbus(v)).isNotNull();
- assertThat(producer.axle()).isNotNull();
- assertFalse(producer.axle().isClustered());
- assertThat(producer.axleEventBus(producer.axle())).isNotNull();
+ assertThat(producer.axle(v)).isNotNull();
+ assertFalse(producer.axle(v).isClustered());
+ assertThat(producer.axleEventBus(producer.axle(v))).isNotNull();
- assertThat(producer.rx()).isNotNull();
- assertFalse(producer.rx().isClustered());
- assertThat(producer.rxEventBus(producer.rx())).isNotNull();
+ assertThat(producer.rx(v)).isNotNull();
+ assertFalse(producer.rx(v).isClustered());
+ assertThat(producer.rxEventBus(producer.rx(v))).isNotNull();
- assertThat(producer.mutiny()).isNotNull();
- assertFalse(producer.mutiny().isClustered());
- assertThat(producer.mutinyEventBus(producer.mutiny())).isNotNull();
+ assertThat(producer.mutiny(v)).isNotNull();
+ assertFalse(producer.mutiny(v).isClustered());
+ assertThat(producer.mutinyEventBus(producer.mutiny(v))).isNotNull();
}
} | ['extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxProducer.java', 'extensions/vertx/runtime/src/test/java/io/quarkus/vertx/runtime/VertxProducerTest.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 9,969,031 | 1,941,231 | 259,175 | 2,727 | 1,312 | 286 | 22 | 2 | 1,084 | 55 | 270 | 14 | 0 | 1 | 1970-01-01T00:26: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 |
3,022 | quarkusio/quarkus/10545/5998 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5998 | https://github.com/quarkusio/quarkus/pull/10545 | https://github.com/quarkusio/quarkus/pull/10545 | 1 | fixes | JaxRS Security wrong content-type | **Describe the bug**
When security is enabled, and you are calling a JaxRS endpoint, without any matching roles.
The "Forbidden" is return as plain text, but content-type is "application/json".
**Expected behavior**
Returned with content-type matching content.
**Actual behavior**
The "Forbidden" is return as plain text, but content-type is "application/json".
**To Reproduce**
Reproducer can be found in this repo: https://github.com/SlyngDK/quarkus-jaxrs-security-wrong-content-type
**Configuration**
```properties
See reproducer ^^^
```
**Environment (please complete the following information):**
- Output of `java -version`: openjdk version "1.8.0_232"
- Quarkus version or git rev: 1.0.1.Final
**Additional context**
This there changed some thing about default returned Content-Type???
Maybe this is also affecting other areas.
I have seen same problem with a ContainerRequestFilter calling requestContext.abortWith(), which not setting the MediaType on the response, changed with the new versions.
| 5e43ab814c0464b2a25eac96d0e713abb3ede308 | 59265e170d6ac94cfb38949de01978248b3c4099 | https://github.com/quarkusio/quarkus/compare/5e43ab814c0464b2a25eac96d0e713abb3ede308...59265e170d6ac94cfb38949de01978248b3c4099 | diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/ForbiddenExceptionMapper.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/ForbiddenExceptionMapper.java
index b9ed6e3e88a..8a4a5c4f291 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/ForbiddenExceptionMapper.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/ForbiddenExceptionMapper.java
@@ -14,8 +14,9 @@
@Provider
@Priority(Priorities.USER + 1)
public class ForbiddenExceptionMapper implements ExceptionMapper<ForbiddenException> {
+
@Override
public Response toResponse(ForbiddenException exception) {
- return Response.status(403).entity("Forbidden").build();
+ return Response.status(403).build();
}
}
diff --git a/extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/RolesAllowedUnitTest.java b/extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/RolesAllowedUnitTest.java
index f81495b569d..b9983c650c2 100644
--- a/extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/RolesAllowedUnitTest.java
+++ b/extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/RolesAllowedUnitTest.java
@@ -170,8 +170,6 @@ public void callEcho2() {
.get("/endp/echo2").andReturn();
Assertions.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, response.getStatusCode());
- String replyString = response.body().asString();
- Assertions.assertEquals("Forbidden", replyString);
}
/**
@@ -245,8 +243,6 @@ public void echoWithToken2() throws Exception {
.get("/endp/echo").andReturn();
Assertions.assertEquals(HttpURLConnection.HTTP_FORBIDDEN, response.getStatusCode());
- String replyString = response.body().asString();
- Assertions.assertEquals("Forbidden", replyString);
}
/** | ['extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/RolesAllowedUnitTest.java', 'extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/ForbiddenExceptionMapper.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 9,969,450 | 1,941,307 | 259,182 | 2,727 | 113 | 23 | 3 | 1 | 1,044 | 127 | 229 | 29 | 1 | 1 | 1970-01-01T00:26: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 |
3,023 | quarkusio/quarkus/10544/5213 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5213 | https://github.com/quarkusio/quarkus/pull/10544 | https://github.com/quarkusio/quarkus/pull/10544 | 1 | fixes | UnsupportedOperationException thrown at startup for vertx-quickstart project with Java 11 | **Describe the bug**
When starting vertx-quickstart project (from quarkus quickstart examples) via ```mvn compile quarkus:dev -Dquarkus.log.level=DEBUG``` the following stack trace is shown in the logs:
```
2019-11-05 13:00:34,557 DEBUG [io.net.uti.int.PlatformDependent0] (build-16) direct buffer constructor: unavailable: java.lang.UnsupportedOperationException: Reflective setAccessible(true) disabled
at io.netty.util.internal.ReflectionUtil.trySetAccessible(ReflectionUtil.java:31)
at io.netty.util.internal.PlatformDependent0$4.run(PlatformDependent0.java:224)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:218)
at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:272)
at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
at io.netty.buffer.UnpooledByteBufAllocator.<clinit>(UnpooledByteBufAllocator.java:37)
at io.netty.buffer.Unpooled.<clinit>(Unpooled.java:73)
at io.netty.handler.codec.http.HttpObjectEncoder.<clinit>(HttpObjectEncoder.java:53)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at io.quarkus.netty.deployment.NettyProcessor.build(NettyProcessor.java:81)
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$1.execute(ExtensionLoader.java:941)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
2019-11-05 13:00:34,558 DEBUG [io.net.uti.int.PlatformDependent0] (build-16) java.nio.Bits.unaligned: available, {}
2019-11-05 13:00:34,559 DEBUG [io.net.uti.int.PlatformDependent0] (build-16) jdk.internal.misc.Unsafe.allocateUninitializedArray(int): unavailable: java.lang.IllegalAccessException: class io.netty.util.internal.PlatformDependent0$6 cannot access class jdk.internal.misc.Unsafe (in module java.base) because module java.base does not export jdk.internal.misc to unnamed module @75b061d
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:591)
at java.base/java.lang.reflect.Method.invoke(Method.java:558)
at io.netty.util.internal.PlatformDependent0$6.run(PlatformDependent0.java:334)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at io.netty.util.internal.PlatformDependent0.<clinit>(PlatformDependent0.java:325)
at io.netty.util.internal.PlatformDependent.isAndroid(PlatformDependent.java:272)
at io.netty.util.internal.PlatformDependent.<clinit>(PlatformDependent.java:92)
at io.netty.buffer.UnpooledByteBufAllocator.<clinit>(UnpooledByteBufAllocator.java:37)
at io.netty.buffer.Unpooled.<clinit>(Unpooled.java:73)
at io.netty.handler.codec.http.HttpObjectEncoder.<clinit>(HttpObjectEncoder.java:53)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:315)
at io.quarkus.netty.deployment.NettyProcessor.build(NettyProcessor.java:81)
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$1.execute(ExtensionLoader.java:941)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
```
**Expected behavior**
No stack trace (or fail to start application)
**Actual behavior**
Application is started with possible errors.
**To Reproduce**
Steps to reproduce the behavior:
1. git clone https://github.com/quarkusio/quarkus-quickstarts.git
2. cd quarkus-quickstarts/vertx-quickstart
3. mvn compile quarkus:dev -Dquarkus.log.level=DEBUG
Just after the application is about to start, this exception occurs and the stack trace is logged. This is probably related to Java modules (which was introduces in Java 9).
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
Darwin MacBook-Pro.local 19.0.0 Darwin Kernel Version 19.0.0: Wed Sep 25 20:18:50 PDT 2019; root:xnu-6153.11.26~2/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)
- GraalVM version (if different from Java): N/A
- Quarkus version or git rev: 0.28.1
| 91015de7fa821926f51e3922a15fa8e16a96afb0 | 42637b83ad9dcaf8521f9b4ba8e83bc1781bb4a3 | https://github.com/quarkusio/quarkus/compare/91015de7fa821926f51e3922a15fa8e16a96afb0...42637b83ad9dcaf8521f9b4ba8e83bc1781bb4a3 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
index ac6f9b42923..e856ae2b974 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
@@ -1,6 +1,7 @@
package io.quarkus.deployment.logging;
import java.util.Arrays;
+import java.util.logging.Level;
import io.quarkus.builder.item.MultiBuildItem;
import io.quarkus.runtime.logging.LogCleanupFilterElement;
@@ -19,10 +20,16 @@ public LogCleanupFilterBuildItem(String loggerName, String... messageStarts) {
if (messageStarts.length == 0) {
throw new IllegalArgumentException("messageStarts cannot be null");
}
-
this.filterElement = new LogCleanupFilterElement(loggerName, Arrays.asList(messageStarts));
}
+ public LogCleanupFilterBuildItem(String loggerName, Level targetLevel, String... messageStarts) {
+ if (messageStarts.length == 0) {
+ throw new IllegalArgumentException("messageStarts cannot be null");
+ }
+ this.filterElement = new LogCleanupFilterElement(loggerName, targetLevel, Arrays.asList(messageStarts));
+ }
+
public LogCleanupFilterElement getFilterElement() {
return filterElement;
}
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 4ddf8012481..fed4d7e04b1 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
@@ -65,6 +65,13 @@ void setUpDefaultLogCleanupFilters(List<LogCleanupFilterBuildItem> logCleanupFil
"quarkus.log.filter.\\"" + logCleanupFilter.getFilterElement().getLoggerName()
+ "\\".if-starts-with",
startsWithClause));
+ if (logCleanupFilter.getFilterElement().getTargetLevel() != null) {
+ configOutput.accept(
+ new RunTimeConfigurationDefaultBuildItem(
+ "quarkus.log.filter.\\"" + logCleanupFilter.getFilterElement().getLoggerName()
+ + "\\".target-level",
+ logCleanupFilter.getFilterElement().getTargetLevel().toString()));
+ }
}
}
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java
index 3a76d8748c5..afb95ee8a40 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java
@@ -1,6 +1,7 @@
package io.quarkus.runtime.logging;
import java.util.List;
+import java.util.logging.Level;
import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;
@@ -12,4 +13,10 @@ public class CleanupFilterConfig {
*/
@ConfigItem(defaultValue = "inherit")
List<String> ifStartsWith;
+
+ /**
+ * The new log level for the filtered message, defaults to DEBUG
+ */
+ @ConfigItem(defaultValue = "DEBUG")
+ Level targetLevel;
}
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java
index 90827335146..17f69775007 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java
@@ -29,8 +29,12 @@ public boolean isLoggable(LogRecord record) {
if (filterElement != null) {
for (String messageStart : filterElement.getMessageStarts()) {
if (record.getMessage().startsWith(messageStart)) {
- record.setLevel(org.jboss.logmanager.Level.DEBUG);
- return Logger.getLogger(record.getLoggerName()).isDebugEnabled();
+ record.setLevel(filterElement.getTargetLevel());
+ if (filterElement.getTargetLevel().intValue() <= org.jboss.logmanager.Level.TRACE.intValue()) {
+ return Logger.getLogger(record.getLoggerName()).isTraceEnabled();
+ } else {
+ return Logger.getLogger(record.getLoggerName()).isDebugEnabled();
+ }
}
}
}
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java
index 92bae5f8235..603dd14b115 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java
@@ -1,13 +1,16 @@
package io.quarkus.runtime.logging;
import java.util.List;
+import java.util.logging.Level;
public class LogCleanupFilterElement {
private String loggerName;
private List<String> messageStarts;
+ private Level targetLevel;
// Required by recorder
public LogCleanupFilterElement() {
+
}
public LogCleanupFilterElement(String loggerName, List<String> messageStarts) {
@@ -15,6 +18,12 @@ public LogCleanupFilterElement(String loggerName, List<String> messageStarts) {
this.messageStarts = messageStarts;
}
+ public LogCleanupFilterElement(String loggerName, Level targetLevel, List<String> messageStarts) {
+ this.loggerName = loggerName;
+ this.messageStarts = messageStarts;
+ this.targetLevel = targetLevel;
+ }
+
public String getLoggerName() {
return loggerName;
}
@@ -27,7 +36,15 @@ public List<String> getMessageStarts() {
return messageStarts;
}
- public void setMessageStart(List<String> messageStarts) {
+ public void setMessageStarts(List<String> messageStarts) {
this.messageStarts = messageStarts;
}
-}
\\ No newline at end of file
+
+ public Level getTargetLevel() {
+ return targetLevel;
+ }
+
+ public void setTargetLevel(Level targetLevel) {
+ this.targetLevel = targetLevel;
+ }
+}
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
index d2f959e3a3c..31c8ad6175b 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java
@@ -94,7 +94,8 @@ public void initializeLogging(LogConfig config, final List<RuntimeValue<Optional
final Map<String, CleanupFilterConfig> filters = config.filters;
List<LogCleanupFilterElement> filterElements = new ArrayList<>(filters.size());
for (Entry<String, CleanupFilterConfig> entry : filters.entrySet()) {
- filterElements.add(new LogCleanupFilterElement(entry.getKey(), entry.getValue().ifStartsWith));
+ filterElements.add(
+ new LogCleanupFilterElement(entry.getKey(), entry.getValue().targetLevel, entry.getValue().ifStartsWith));
}
final ArrayList<Handler> handlers = new ArrayList<>(3 + additionalHandlers.size());
diff --git a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java
index e033a145450..91aa1cc67ef 100644
--- a/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java
+++ b/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java
@@ -10,8 +10,10 @@
import javax.inject.Singleton;
import org.jboss.logging.Logger;
+import org.jboss.logmanager.Level;
import io.netty.channel.EventLoopGroup;
+import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.logging.InternalLoggerFactory;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
@@ -26,6 +28,7 @@
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeReinitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.UnsafeAccessedFieldBuildItem;
+import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
import io.quarkus.netty.BossEventLoopGroup;
import io.quarkus.netty.MainEventLoopGroup;
import io.quarkus.netty.runtime.EmptyByteBufStub;
@@ -33,15 +36,15 @@
class NettyProcessor {
- @Inject
- BuildProducer<ReflectiveClassBuildItem> reflectiveClass;
-
private static final Logger log = Logger.getLogger(NettyProcessor.class);
static {
InternalLoggerFactory.setDefaultFactory(new JBossNettyLoggerFactory());
}
+ @Inject
+ BuildProducer<ReflectiveClassBuildItem> reflectiveClass;
+
@BuildStep
public NativeImageSystemPropertyBuildItem limitMem() {
//in native mode we limit the size of the epoll array
@@ -243,4 +246,12 @@ RuntimeInitializedClassBuildItem runtimeInitBcryptUtil() {
// this holds a direct allocated byte buffer that needs to be initialised at run time
return new RuntimeInitializedClassBuildItem(EmptyByteBufStub.class.getName());
}
+
+ //if debug logging is enabled netty logs lots of exceptions
+ //see https://github.com/quarkusio/quarkus/issues/5213
+ @BuildStep
+ LogCleanupFilterBuildItem cleanup() {
+ return new LogCleanupFilterBuildItem(PlatformDependent.class.getName() + "0", Level.TRACE, "direct buffer constructor",
+ "jdk.internal.misc.Unsafe", "sun.misc.Unsafe");
+ }
} | ['core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilterElement.java', 'core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java', 'core/runtime/src/main/java/io/quarkus/runtime/logging/LogCleanupFilter.java', 'extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java', 'core/runtime/src/main/java/io/quarkus/runtime/logging/CleanupFilterConfig.java', 'core/runtime/src/main/java/io/quarkus/runtime/logging/LoggingSetupRecorder.java', 'core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingResourceProcessor.java'] | {'.java': 7} | 7 | 7 | 0 | 0 | 7 | 9,969,670 | 1,941,343 | 259,180 | 2,727 | 3,209 | 603 | 72 | 7 | 5,937 | 316 | 1,463 | 84 | 1 | 2 | 1970-01-01T00:26: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 |
3,024 | quarkusio/quarkus/10455/10319 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10319 | https://github.com/quarkusio/quarkus/pull/10455 | https://github.com/quarkusio/quarkus/pull/10455 | 1 | fixes | Unable to perform a count operation on a named query | This is probably less of a bug and more of a gap in my Hibernate/HQL knowledge. Basically my named query works with `find` but throws when I add `count`.
```Java
@Entity
@DiscriminatorValue("RN")
@NamedQuery(name="Nurse.available",
query="select n from Nurse n, Availability av where n.id = av.teamMember and av.onShift = true")
public class Nurse extends TeamMember {
public static List<Nurse> onShift() {
return find("#Nurse.available"); //works fine
}
public static long onShiftCount() {
return find("#Nurse.available").count(); //throws exception
}
}
```
```
org.jboss.resteasy.spi.UnhandledException: io.quarkus.panache.common.exception.PanacheQueryException: Unable to perform a count operation on a named query
```
The immediate workaround to use the query directly:
```Java
public static long onShiftCount() {
return find("select n from Nurse n, Availability av where n.id = av.teamMember and av.onShift = true").count(); //this works!
}
```
Java 14
Quarkus 1.5.2 | 1351db38449a90171cf167e9231859fddae184e4 | 513df597a510cc2eb9154ebf1a989af843e574d7 | https://github.com/quarkusio/quarkus/compare/1351db38449a90171cf167e9231859fddae184e4...513df597a510cc2eb9154ebf1a989af843e574d7 | diff --git a/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java b/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java
index 4a5cd99105a..c0fa321b1d5 100644
--- a/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java
+++ b/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java
@@ -206,12 +206,14 @@ public void withHint(String hintName, Object value) {
@SuppressWarnings("unchecked")
public long count() {
- if (AbstractJpaOperations.isNamedQuery(query)) {
- throw new PanacheQueryException("Unable to perform a count operation on a named query");
- }
-
if (count == null) {
- Query countQuery = em.createQuery(countQuery());
+ String selectQuery = query;
+ if (AbstractJpaOperations.isNamedQuery(query)) {
+ org.hibernate.query.Query q = (org.hibernate.query.Query) em.createNamedQuery(query.substring(1));
+ selectQuery = q.getQueryString();
+ }
+
+ Query countQuery = em.createQuery(countQuery(selectQuery));
if (paramsArrayOrMap instanceof Map)
AbstractJpaOperations.bindParameters(countQuery, (Map<String, Object>) paramsArrayOrMap);
else
@@ -223,13 +225,13 @@ public long count() {
return count;
}
- private String countQuery() {
+ private String countQuery(String selectQuery) {
if (countQuery != null) {
return countQuery;
}
// try to generate a good count query from the existing query
- Matcher selectMatcher = SELECT_PATTERN.matcher(query);
+ Matcher selectMatcher = SELECT_PATTERN.matcher(selectQuery);
String countQuery;
if (selectMatcher.matches()) {
// this one cannot be null
@@ -239,17 +241,17 @@ private String countQuery() {
String secondSelection = selectMatcher.group(2);
// we can only count distinct single columns
if (secondSelection != null && !secondSelection.trim().isEmpty()) {
- throw new PanacheQueryException("Count query not supported for select query: " + query);
+ throw new PanacheQueryException("Count query not supported for select query: " + selectQuery);
}
countQuery = "SELECT COUNT(" + firstSelection + ") " + selectMatcher.group(3);
} else {
// it's not distinct, forget the column list
countQuery = "SELECT COUNT(*) " + selectMatcher.group(3);
}
- } else if (FROM_PATTERN.matcher(query).matches()) {
- countQuery = "SELECT COUNT(*) " + query;
+ } else if (FROM_PATTERN.matcher(selectQuery).matches()) {
+ countQuery = "SELECT COUNT(*) " + selectQuery;
} else {
- throw new PanacheQueryException("Count query not supported for select query: " + query);
+ throw new PanacheQueryException("Count query not supported for select query: " + selectQuery);
}
// remove the order by clause
diff --git a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java
index 2f5ecc52d0d..971a987404c 100644
--- a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java
+++ b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java
@@ -159,6 +159,7 @@ public String testModel() {
persons = Person.find("#Person.getByName", Parameters.with("name", "stef")).list();
Assertions.assertEquals(1, persons.size());
Assertions.assertEquals(person, persons.get(0));
+ Assertions.assertEquals(1, Person.find("#Person.getByName", Parameters.with("name", "stef")).count());
Assertions.assertThrows(PanacheQueryException.class, () -> Person.find("#Person.namedQueryNotFound").list());
NamedQueryEntity.find("#NamedQueryMappedSuperClass.getAll").list();
NamedQueryEntity.find("#NamedQueryEntity.getAll").list(); | ['extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java', 'integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 9,863,244 | 1,915,740 | 254,871 | 2,729 | 1,494 | 277 | 24 | 1 | 1,052 | 128 | 251 | 29 | 0 | 3 | 1970-01-01T00:26:33 | 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 |
3,025 | quarkusio/quarkus/10316/8297 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8297 | https://github.com/quarkusio/quarkus/pull/10316 | https://github.com/quarkusio/quarkus/pull/10316 | 1 | fixes | Unable to copy .env file in dev mode | **Describe the bug**
The `.env` file for environment variables at project root can't be used on Windows 10.
When creating this file and running `mvnw quarkus:dev` it produces a warning in the log and the environment variables are not used by quarkus.
**Expected behavior**
I can define environment variables in `.env` file and use it in `application.properties` like this:
`greeting.message = ${MESSAGE}`
**Actual behavior**
A warning and exception is printed to the console:
```
Listening for transport dt_socket at address: 5005
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2020-03-31 12:12:54,098 WARN [io.qua.dev.DevModeMain] (main) Unable to copy .env file
2020-03-31 12:12:57,080 ERROR [io.qua.application] (main) Failed to start application: java.util.NoSuchElementException: Property MESSAGE not found
at io.smallrye.config.SmallRyeConfig.propertyNotFound(SmallRyeConfig.java:209)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:96)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:80)
at io.quarkus.runtime.configuration.ConfigExpander.accept(ConfigExpander.java:55)
at io.quarkus.runtime.configuration.ConfigExpander.accept(ConfigExpander.java:15)
at org.wildfly.common.expression.ExpressionNode.emit(ExpressionNode.java:42)
at org.wildfly.common.expression.Expression.evaluateException(Expression.java:75)
at org.wildfly.common.expression.Expression.evaluate(Expression.java:89)
at io.quarkus.runtime.configuration.ExpandingConfigSource.expandValue(ExpandingConfigSource.java:101)
at io.quarkus.runtime.configuration.ExpandingConfigSource.expand(ExpandingConfigSource.java:69)
at io.quarkus.runtime.configuration.ExpandingConfigSource.getValue(ExpandingConfigSource.java:47)
at io.quarkus.runtime.configuration.DeploymentProfileConfigSource.getValue(DeploymentProfileConfigSource.java:80)
at io.smallrye.config.SmallRyeConfig.getRawValue(SmallRyeConfig.java:121)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:84)
at io.smallrye.config.SmallRyeConfig.getOptionalValue(SmallRyeConfig.java:131)
at io.quarkus.arc.runtime.ConfigRecorder.validateConfigProperties(ConfigRecorder.java:35)
at io.quarkus.deployment.steps.ConfigBuildStep$validateConfigProperties24.deploy_0(ConfigBuildStep$validateConfigProperties24.zig:120)
at io.quarkus.deployment.steps.ConfigBuildStep$validateConfigProperties24.deploy(ConfigBuildStep$validateConfigProperties24.zig:36)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:154)
at io.quarkus.runtime.Application.start(Application.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:99)
at io.quarkus.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:60)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:236)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:39)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:131)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:113)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:54)
2020-03-31 12:12:57,111 ERROR [io.qua.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:232)
at io.quarkus.runtime.Application.start(Application.java:90)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:99)
at io.quarkus.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:60)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:236)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:39)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:131)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:113)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:54)
Caused by: java.util.NoSuchElementException: Property MESSAGE not found
at io.smallrye.config.SmallRyeConfig.propertyNotFound(SmallRyeConfig.java:209)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:96)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:80)
at io.quarkus.runtime.configuration.ConfigExpander.accept(ConfigExpander.java:55)
at io.quarkus.runtime.configuration.ConfigExpander.accept(ConfigExpander.java:15)
at org.wildfly.common.expression.ExpressionNode.emit(ExpressionNode.java:42)
at org.wildfly.common.expression.Expression.evaluateException(Expression.java:75)
at org.wildfly.common.expression.Expression.evaluate(Expression.java:89)
at io.quarkus.runtime.configuration.ExpandingConfigSource.expandValue(ExpandingConfigSource.java:101)
at io.quarkus.runtime.configuration.ExpandingConfigSource.expand(ExpandingConfigSource.java:69)
at io.quarkus.runtime.configuration.ExpandingConfigSource.getValue(ExpandingConfigSource.java:47)
at io.quarkus.runtime.configuration.DeploymentProfileConfigSource.getValue(DeploymentProfileConfigSource.java:80)
at io.smallrye.config.SmallRyeConfig.getRawValue(SmallRyeConfig.java:121)
at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:84)
at io.smallrye.config.SmallRyeConfig.getOptionalValue(SmallRyeConfig.java:131)
at io.quarkus.arc.runtime.ConfigRecorder.validateConfigProperties(ConfigRecorder.java:35)
at io.quarkus.deployment.steps.ConfigBuildStep$validateConfigProperties24.deploy_0(ConfigBuildStep$validateConfigProperties24.zig:120)
at io.quarkus.deployment.steps.ConfigBuildStep$validateConfigProperties24.deploy(ConfigBuildStep$validateConfigProperties24.zig:36)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:154)
... 13 more
```
**To Reproduce**
Steps to reproduce the behavior:
1. `git clone https://github.com/quarkusio/quarkus-quickstarts.git` (tag: `1.3.1.Final`)
2. go to `config-quickstart` directory
3. add a `.env` file in the `config-quickstart` directory, see below for the content
4. modify `application.properties` like below
5. run `mvnw quarkus:dev`
**Configuration**
`application.properties`:
```properties
# Your configuration properties
greeting.message = ${MESSAGE}
greeting.name = quarkus
```
`.env`:
```
MESSAGE=hello
```
**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.720]
- Output of `java -version`:
```
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_232-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.232-b09, mixed mode)
```
- GraalVM version (if different from Java): not installed
- Quarkus version or git rev: 1.3.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
Maven home: C:\\Users\\Leon\\.m2\\wrapper\\dists\\apache-maven-3.6.2-bin\\795eh28tki48bv3l67maojf0ra\\apache-maven-3.6.2
Java version: 1.8.0_232, vendor: AdoptOpenJDK, runtime: C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.232.09-hotspot\\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
```
**Additional context**
Feature was added in #7519 | 01e615fffa9b0713de55577c805601a3bb8b92a1 | e4401a0d7484ce973fb611629359568660ae503e | https://github.com/quarkusio/quarkus/compare/01e615fffa9b0713de55577c805601a3bb8b92a1...e4401a0d7484ce973fb611629359568660ae503e | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
index 6771d0240c9..a5deda3c6e7 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
@@ -1,14 +1,17 @@
package io.quarkus.deployment.dev;
+import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
+import java.io.PrintStream;
import java.net.URI;
import java.net.URL;
+import java.nio.file.FileSystemException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -16,6 +19,7 @@
import java.util.Map;
import java.util.Properties;
+import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;
import io.quarkus.bootstrap.app.AdditionalDependency;
@@ -23,6 +27,7 @@
import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.model.AppArtifactKey;
import io.quarkus.bootstrap.model.PathsCollection;
+import io.quarkus.deployment.util.ProcessUtil;
import io.quarkus.dev.appstate.ApplicationStateNotification;
/**
@@ -123,7 +128,7 @@ public void start() throws Exception {
}
}
- copyDotEnvFile();
+ linkDotEnvFile();
Properties buildSystemProperties = new Properties();
buildSystemProperties.putAll(context.getBuildSystemProperties());
@@ -140,10 +145,10 @@ public void start() throws Exception {
}
}
- // copies the .env file to the directory where the process is running
+ // links the .env file to the directory where the process is running
// this is done because for the .env file to take effect, it needs to be
// in the same directory as the running process
- private void copyDotEnvFile() {
+ private void linkDotEnvFile() {
File projectDir = context.getProjectDir();
if (projectDir == null) { // this is the case for QuarkusDevModeTest
return;
@@ -157,13 +162,24 @@ private void copyDotEnvFile() {
Path dotEnvPath = projectDir.toPath().resolve(".env");
if (Files.exists(dotEnvPath)) {
+ Path link = currentDir.resolve(".env");
+ silentDeleteFile(link);
try {
- Path link = currentDir.resolve(".env");
- silentDeleteFile(link);
// create a symlink to ensure that user updates to the file have the expected effect in dev-mode
- Files.createSymbolicLink(link, dotEnvPath);
- } catch (IOException e) {
- log.warn("Unable to copy .env file", e);
+ try {
+ Files.createSymbolicLink(link, dotEnvPath);
+ } catch (FileSystemException e) {
+ // on Windows fall back to mklink if symlink cannot be created via Files API (due to insufficient permissions)
+ // see https://github.com/quarkusio/quarkus/issues/8297
+ if (SystemUtils.IS_OS_WINDOWS) {
+ log.debug("Falling back to mklink on Windows after FileSystemException", e);
+ makeHardLinkWindowsFallback(link, dotEnvPath);
+ } else {
+ throw e;
+ }
+ }
+ } catch (IOException | InterruptedException e) {
+ log.warn("Unable to link .env file", e);
}
}
}
@@ -176,6 +192,24 @@ private void silentDeleteFile(Path path) {
}
}
+ private void makeHardLinkWindowsFallback(Path link, Path dotEnvPath) throws IOException, InterruptedException {
+ Process process = new ProcessBuilder("cmd.exe", "/C", "mklink", "/H", link.toString(), dotEnvPath.toString())
+ .redirectOutput(new File("NUL"))
+ .redirectError(ProcessBuilder.Redirect.PIPE)
+ .start();
+ try {
+ ByteArrayOutputStream errStream = new ByteArrayOutputStream();
+ ProcessUtil.streamErrorTo(new PrintStream(errStream), process);
+ int exitValue = process.waitFor();
+ if (exitValue > 0) {
+ throw new IOException(
+ "mklink /H execution failed with exit code " + exitValue + ": " + new String(errStream.toByteArray()));
+ }
+ } finally {
+ process.destroy();
+ }
+ }
+
@Override
public void close() throws IOException {
if (realCloseable != null) {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java
index 97ec754a588..1198ea1da15 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java
@@ -11,6 +11,7 @@
import java.util.Optional;
import java.util.function.BooleanSupplier;
+import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;
import io.quarkus.bootstrap.util.IoUtils;
@@ -237,7 +238,5 @@ public boolean getAsBoolean() {
// copied from Java 9
// TODO remove when we move to Java 11
- private static final File NULL_FILE = new File(
- (System.getProperty("os.name")
- .startsWith("Windows") ? "NUL" : "/dev/null"));
+ private static final File NULL_FILE = new File(SystemUtils.IS_OS_WINDOWS ? "NUL" : "/dev/null");
}
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 9613f8fa3fb..048df634b36 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
@@ -23,7 +23,6 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
@@ -38,6 +37,7 @@
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
+import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;
import io.quarkus.bootstrap.BootstrapDependencyProcessingException;
@@ -131,8 +131,6 @@ public class JarResultBuildStep {
public static final String QUARKUS = "quarkus";
public static final String DEFAULT_FAST_JAR_DIRECTORY_NAME = "quarkus-app";
- private static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
-
@BuildStep
OutputTargetBuildItem outputTarget(BuildSystemTargetBuildItem bst, PackageConfig packageConfig) {
String name = packageConfig.outputName.isPresent() ? packageConfig.outputName.get() : bst.getBaseName();
@@ -669,7 +667,7 @@ public NativeImageSourceJarBuildItem buildNativeImageJar(CurateOutcomeBuildItem
.map((s) -> new GeneratedClassBuildItem(true, s.getName(), s.getClassData()))
.collect(Collectors.toList()));
- if (IS_WINDOWS) {
+ if (SystemUtils.IS_OS_WINDOWS) {
log.warn("Uber JAR strategy is used for native image source JAR generation on Windows. This is done " +
"for the time being to work around a current GraalVM limitation on Windows concerning the " +
"maximum command length (see https://github.com/oracle/graal/issues/2387).");
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 abecf3d1f91..c1ddfd2fd4d 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
@@ -15,13 +15,13 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import org.apache.commons.lang3.SystemUtils;
import org.jboss.logging.Logger;
import io.quarkus.bootstrap.util.IoUtils;
@@ -54,9 +54,6 @@ public class NativeImageBuildStep {
*/
private static final String JAVA_HOME_ENV = "JAVA_HOME";
- private static final boolean IS_LINUX = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("linux");
- private static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
-
/**
* The name of the environment variable containing the system path.
*/
@@ -97,13 +94,13 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
nativeImage = new ArrayList<>();
String outputPath = outputDir.toAbsolutePath().toString();
- if (IS_WINDOWS) {
+ if (SystemUtils.IS_OS_WINDOWS) {
outputPath = FileUtil.translateToVolumePath(outputPath);
}
Collections.addAll(nativeImage, containerRuntime, "run", "-v",
outputPath + ":" + CONTAINER_BUILD_VOLUME_PATH + ":z", "--env", "LANG=C");
- if (IS_LINUX) {
+ if (SystemUtils.IS_OS_LINUX) {
if ("docker".equals(containerRuntime)) {
String uid = getLinuxID("-ur");
String gid = getLinuxID("-gr");
@@ -143,7 +140,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
}
} else {
- if (IS_LINUX) {
+ if (SystemUtils.IS_OS_LINUX) {
noPIE = detectNoPIE();
}
@@ -312,7 +309,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
+ " Please consider removing this configuration key as it is ignored (JNI is always enabled) and it"
+ " will be removed in a future Quarkus version.");
}
- if (!nativeConfig.enableServer && !IS_WINDOWS) {
+ if (!nativeConfig.enableServer && !SystemUtils.IS_OS_WINDOWS) {
command.add("--no-server");
}
if (nativeConfig.enableVmInspection) {
@@ -346,7 +343,7 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
if (exitCode != 0) {
throw imageGenerationFailed(exitCode, command);
}
- if (IS_WINDOWS && !(isContainerBuild)) {
+ if (SystemUtils.IS_OS_WINDOWS && !(isContainerBuild)) {
//once image is generated it gets added .exe on Windows
executableName = executableName + ".exe";
}
@@ -398,7 +395,7 @@ private void handleAdditionalProperties(NativeConfig nativeConfig, List<String>
private RuntimeException imageGenerationFailed(int exitValue, List<String> command) {
if (exitValue == OOM_ERROR_VALUE) {
- if (command.contains("docker") && !IS_LINUX) {
+ if (command.contains("docker") && !SystemUtils.IS_OS_LINUX) {
return new RuntimeException("Image generation failed. Exit code was " + exitValue
+ " which indicates an out of memory error. The most likely cause is Docker not being given enough memory. Also consider increasing the Xmx value for native image generation by setting the \\""
+ QUARKUS_XMX_PROPERTY + "\\" property");
@@ -423,7 +420,7 @@ private void checkGraalVMVersion(String version) {
}
private static File getNativeImageExecutable(Optional<String> graalVmHome, File javaHome, Map<String, String> env) {
- String imageName = IS_WINDOWS ? "native-image.cmd" : "native-image";
+ String imageName = SystemUtils.IS_OS_WINDOWS ? "native-image.cmd" : "native-image";
if (graalVmHome.isPresent()) {
File file = Paths.get(graalVmHome.get(), "bin", imageName).toFile();
if (file.exists()) {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/util/ProcessUtil.java b/core/deployment/src/main/java/io/quarkus/deployment/util/ProcessUtil.java
index d23cf7d139e..2f18f890adc 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/util/ProcessUtil.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/util/ProcessUtil.java
@@ -105,8 +105,20 @@ public static void streamOutputToSysOut(final Process process) {
* @param process The process whose STDERR needs to be streamed.
*/
public static void streamErrorToSysErr(final Process process) {
+ streamErrorTo(System.err, process);
+ }
+
+ /**
+ * Streams the {@link Process process'} {@code STDERR} to the given
+ * {@code printStream}. This creates and starts a thread to stream the contents.
+ * The {@link Process} is expected to have been started in {@link java.lang.ProcessBuilder.Redirect#PIPE}
+ * mode
+ *
+ * @param process The process whose STDERR needs to be streamed.
+ */
+ public static void streamErrorTo(final PrintStream printStream, final Process process) {
final InputStream processStdErr = process.getErrorStream();
- final Thread t = new Thread(new Streamer(processStdErr, System.err));
+ final Thread t = new Thread(new Streamer(processStdErr, printStream));
t.setName("Process stderr streamer");
t.setDaemon(true);
t.start(); | ['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/util/ProcessUtil.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 9,691,871 | 1,882,888 | 250,732 | 2,687 | 4,888 | 974 | 94 | 5 | 8,789 | 479 | 2,234 | 131 | 1 | 5 | 1970-01-01T00:26:33 | 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 |
3,027 | quarkusio/quarkus/10286/10279 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10279 | https://github.com/quarkusio/quarkus/pull/10286 | https://github.com/quarkusio/quarkus/pull/10286 | 1 | fix | Dependency parity validator is missing dependencies with different versions | Reproducible with the camel-quarkus-amqp module of `quarkus-master` branch of Camel Quarkus https://github.com/apache/camel-quarkus/tree/quarkus-master
From my point of view, the dependencies of the amqp runtime and deployment modules a in a perfect parity:
https://github.com/apache/camel-quarkus/blob/quarkus-master/extensions/amqp/runtime/pom.xml
https://github.com/apache/camel-quarkus/blob/quarkus-master/extensions/amqp/deployment/pom.xml
The error of the extension-descriptor mojo is as follows:
```
[ERROR] Quarkus Extension Dependency Verification Error
[ERROR] Deployment artifact org.apache.camel.quarkus:camel-quarkus-amqp-deployment::jar:1.1.0-SNAPSHOT was found to be missing dependencies on Quarkus extension artifacts marked with '-' below:
[ERROR] + org.apache.camel.quarkus:camel-quarkus-amqp-deployment::jar:1.1.0-SNAPSHOT
[ERROR] + org.apache.camel.quarkus:camel-quarkus-amqp::jar:1.1.0-SNAPSHOT
[ERROR] + org.amqphub.quarkus:quarkus-qpid-jms-deployment::jar:0.15.0
[ERROR] - io.quarkus:quarkus-core-deployment::jar:999-SNAPSHOT
[ERROR] - io.quarkus:quarkus-arc-deployment::jar:999-SNAPSHOT
[ERROR] - io.quarkus:quarkus-netty-deployment::jar:999-SNAPSHOT
[ERROR] + org.apache.camel.quarkus:camel-quarkus-core-deployment::jar:1.1.0-SNAPSHOT
[ERROR] + org.apache.camel.quarkus:camel-quarkus-support-common-deployment::jar:1.1.0-SNAPSHOT
[ERROR] + org.apache.camel.quarkus:camel-quarkus-jms-deployment::jar:1.1.0-SNAPSHOT
[ERROR] + org.apache.camel.quarkus:camel-quarkus-support-spring-deployment::jar:1.1.0-SNAPSHOT
[ERROR] + org.apache.camel.quarkus:camel-quarkus-support-commons-logging-deployment::jar:1.1.0-SNAPSHOT
```
Those missing dependencies are transitive dependencies of `org.amqphub.quarkus:quarkus-qpid-jms-deployment` I am not controling.
Perhaps the mojo is too picky about the versions? org.amqphub.quarkus:quarkus-qpid-jms-deployment::jar:0.15.0 depends on quarkus 1.5.x while the mojo expects 999-SNAPSHOT (based on our BOMs)?
cc @aloubyansky | e41839730c491e62ce547aa281000172ea1acbe1 | cead3969a8ec44a2cc81d488be1960aa35b659cc | https://github.com/quarkusio/quarkus/compare/e41839730c491e62ce547aa281000172ea1acbe1...cead3969a8ec44a2cc81d488be1960aa35b659cc | diff --git a/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java
index b9f7db275ed..75d0de4c0ea 100644
--- a/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java
+++ b/independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java
@@ -69,8 +69,6 @@ public class ExtensionDescriptorMojo extends AbstractMojo {
private static final String GROUP_ID = "group-id";
private static final String ARTIFACT_ID = "artifact-id";
- private static DefaultPrettyPrinter prettyPrinter = null;
-
/**
* The entry point to Aether, i.e. the component doing all the work.
*
@@ -149,9 +147,6 @@ public void execute() throws MojoExecutionException {
validateExtensionDeps();
}
- prettyPrinter = new DefaultPrettyPrinter();
- prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);
-
final Properties props = new Properties();
props.setProperty(BootstrapConstants.PROP_DEPLOYMENT_ARTIFACT, deployment);
final Path output = outputDirectory.toPath().resolve(BootstrapConstants.META_INF);
@@ -257,6 +252,9 @@ public void execute() throws MojoExecutionException {
extObject.put("description", project.getDescription());
}
+ final DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
+ prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);
+
try (BufferedWriter bw = Files
.newBufferedWriter(output.resolve(BootstrapConstants.QUARKUS_EXTENSION_FILE_NAME))) {
bw.write(getMapper(true).writer(prettyPrinter).writeValueAsString(extObject));
@@ -270,12 +268,13 @@ private void validateExtensionDeps() throws MojoExecutionException {
final AppArtifactCoords deploymentCoords = AppArtifactCoords.fromString(deployment);
- final Node rootDeployment = new Node(null, deploymentCoords, 2);
- final Node rootRuntime = rootDeployment.newChild(toCoords(project.getArtifact()), 1);
+ final String rootDeploymentGact = gact(deploymentCoords);
+ final Node rootDeployment = new Node(null, rootDeploymentGact, 2);
+ final Node rootRuntime = rootDeployment.newChild(gact(project.getArtifact()), 1);
- final Map<AppArtifactCoords, Node> expectedExtensionDeps = new HashMap<>();
- expectedExtensionDeps.put(deploymentCoords, rootDeployment);
- expectedExtensionDeps.put(rootRuntime.coords, rootRuntime);
+ final Map<String, Node> expectedExtensionDeps = new HashMap<>();
+ expectedExtensionDeps.put(rootDeploymentGact, rootDeployment);
+ expectedExtensionDeps.put(rootRuntime.gact, rootRuntime);
// collect transitive extension deps
final DependencyResult resolvedDeps;
@@ -316,8 +315,9 @@ public boolean visitEnter(DependencyNode node) {
+ BootstrapConstants.PROP_DEPLOYMENT_ARTIFACT + " property in its "
+ BootstrapConstants.DESCRIPTOR_PATH);
}
- currentNode = currentNode.newChild(AppArtifactCoords.fromString(deploymentStr), currentNodeId);
- expectedExtensionDeps.put(currentNode.coords, currentNode);
+ currentNode = currentNode.newChild(gact(AppArtifactCoords.fromString(deploymentStr)),
+ currentNodeId);
+ expectedExtensionDeps.put(currentNode.gact, currentNode);
extDepsTotal.incrementAndGet();
}
} catch (IOException e) {
@@ -353,9 +353,7 @@ public boolean visitEnter(DependencyNode dep) {
if (artifact == null) {
return true;
}
- final AppArtifactCoords coords = new AppArtifactCoords(artifact.getGroupId(), artifact.getArtifactId(),
- artifact.getClassifier(), artifact.getExtension(), artifact.getVersion());
- final Node node = expectedExtensionDeps.get(coords);
+ final Node node = expectedExtensionDeps.get(gact(artifact));
if (node != null && !node.included) {
node.included = true;
extDepsTotal.decrementAndGet();
@@ -374,12 +372,12 @@ public boolean visitLeave(DependencyNode node) {
log.error("Quarkus Extension Dependency Verification Error");
log.error("Deployment artifact " + deploymentCoords +
" was found to be missing dependencies on Quarkus extension artifacts marked with '-' below:");
- final List<AppArtifactCoords> missing = rootDeployment.collectMissing(log);
+ final List<String> missing = rootDeployment.collectMissing(log);
final StringBuilder buf = new StringBuilder();
buf.append("Deployment artifact ");
buf.append(deploymentCoords);
buf.append(" is missing the following dependencies from its configuration: ");
- final Iterator<AppArtifactCoords> i = missing.iterator();
+ final Iterator<String> i = missing.iterator();
buf.append(i.next());
while (i.hasNext()) {
buf.append(", ").append(i.next());
@@ -417,11 +415,6 @@ private boolean isAnalyzable(final File f) {
return f != null && f.getName().endsWith(".jar") && f.exists() && !f.isDirectory();
}
- private AppArtifactCoords toCoords(Artifact a) {
- return new AppArtifactCoords(a.getGroupId(), a.getArtifactId(), a.getClassifier(),
- a.getArtifactHandler().getExtension(), a.getVersion());
- }
-
private void transformLegacyToNew(final Path output, ObjectNode extObject, ObjectMapper mapper)
throws MojoExecutionException {
ObjectNode metadata = null;
@@ -463,8 +456,6 @@ private void transformLegacyToNew(final Path output, ObjectNode extObject, Objec
extObject.set("metadata", metadata);
- // updateSourceFiles(output, extObject, mapper);
-
}
/**
@@ -493,44 +484,74 @@ private ObjectMapper getMapper(boolean yaml) {
}
}
+ static String gact(AppArtifactCoords artifact) {
+ StringBuilder buf = new StringBuilder();
+ buf.append(artifact.getGroupId()).append(':').append(artifact.getArtifactId()).append(':');
+ final String classifier = artifact.getClassifier();
+ if (classifier != null && !classifier.isEmpty()) {
+ buf.append(classifier);
+ }
+ return buf.append(':').append(artifact.getType()).append(':').toString();
+ }
+
+ static String gact(Artifact artifact) {
+ StringBuilder buf = new StringBuilder();
+ buf.append(artifact.getGroupId()).append(':').append(artifact.getArtifactId()).append(':');
+ final String classifier = artifact.getClassifier();
+ if (classifier != null && !classifier.isEmpty()) {
+ buf.append(classifier);
+ }
+ return buf.append(':').append(artifact.getType()).append(':').toString();
+ }
+
+ static String gact(org.eclipse.aether.artifact.Artifact artifact) {
+ StringBuilder buf = new StringBuilder();
+ buf.append(artifact.getGroupId()).append(':').append(artifact.getArtifactId()).append(':');
+ final String classifier = artifact.getClassifier();
+ if (classifier != null && !classifier.isEmpty()) {
+ buf.append(classifier);
+ }
+ return buf.append(':').append(artifact.getExtension()).append(':').toString();
+ }
+
private static class Node {
final Node parent;
- final AppArtifactCoords coords;
+ final String gact;
final int id;
boolean included;
List<Node> children = new ArrayList<>(0);
- Node(Node parent, AppArtifactCoords artifact, int id) {
+ Node(Node parent, String gact, int id) {
this.parent = parent;
- this.coords = artifact;
+ this.gact = gact;
this.id = id;
}
- Node newChild(AppArtifactCoords artifact, int id) {
- final Node child = new Node(this, artifact, id);
+ Node newChild(String gact, int id) {
+ final Node child = new Node(this, gact, id);
children.add(child);
return child;
}
- List<AppArtifactCoords> collectMissing(Log log) {
- final List<AppArtifactCoords> missing = new ArrayList<>();
+ List<String> collectMissing(Log log) {
+ final List<String> missing = new ArrayList<>();
collectMissing(log, 0, missing);
return missing;
}
- private void collectMissing(Log log, int depth, List<AppArtifactCoords> missing) {
+ private void collectMissing(Log log, int depth, List<String> missing) {
final StringBuilder buf = new StringBuilder();
if (included) {
buf.append('+');
} else {
buf.append('-');
- missing.add(coords);
+ missing.add(gact);
}
buf.append(' ');
for (int i = 0; i < depth; ++i) {
buf.append(" ");
}
- buf.append(coords);
+ buf.append(gact);
log.error(buf.toString());
for (Node child : children) {
child.collectMissing(log, depth + 1, missing); | ['independent-projects/bootstrap/maven-plugin/src/main/java/io/quarkus/maven/ExtensionDescriptorMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,690,016 | 1,882,577 | 250,706 | 2,688 | 5,076 | 936 | 89 | 1 | 2,082 | 138 | 623 | 29 | 3 | 1 | 1970-01-01T00:26:33 | 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,993 | quarkusio/quarkus/11210/9967 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9967 | https://github.com/quarkusio/quarkus/pull/11210 | https://github.com/quarkusio/quarkus/pull/11210 | 1 | fixes | Pool AdminClient in KafkaStreams health check | **Describe the bug**
Lots of INFO logs are generated by default due to KafkaStreams health check (500MB of logs in a few hours with 20 pods & 10s check frequency):
```
INFO <[org.apa.kaf.cli.adm.AdminClientConfig]> AdminClientConfig values:
client.dns.lookup = default
client.id =
connections.max.idle.ms = 300000
(...)
INFO <[org.apa.kaf.com.uti.AppInfoParser]> version: 2.4.1
```
The logging is kind of hardcoded into Kafka when using [Admin#create](https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/clients/admin/Admin.java#L63), but a workaround is to set:
```
quarkus.log.category."org.apache.kafka.clients.admin.AdminClientConfig".level=WARN
quarkus.log.category."org.apache.kafka.common.utils.AppInfoParser".level=WARN
```
Though creating many admin clients also raises the question of connection usage on the broker.
And we're seeing some AdminClient#close actually taking a long time (not investigated):
```
io.vertx.core.impl.BlockedThread - WARNING <[io.ver.cor.imp.BlockedThreadChecker] TID#17> [PFX: ] Thread Thread[vert.x-worker-thread-5,5,main]=Thread[vert.x-worker-thread-5,5,main] has been blocked for 69273 ms, time limit is 60000 ms: io.vertx.core.VertxException: Thread blocked
at java.base@11.0.5/java.lang.Object.wait(Native Method)
at java.base@11.0.5/java.lang.Thread.join(Thread.java:1305)
at java.base@11.0.5/java.lang.Thread.join(Thread.java:1379)
at app//org.apache.kafka.clients.admin.KafkaAdminClient.close(KafkaAdminClient.java:541)
at app//org.apache.kafka.clients.admin.Admin.close(Admin.java:96)
at app//org.apache.kafka.clients.admin.Admin.close(Admin.java:79)
at app//io.quarkus.kafka.streams.runtime.KafkaStreamsTopologyManager.getMissingTopics(KafkaStreamsTopologyManager.java:175)
at app//io.quarkus.kafka.streams.runtime.KafkaStreamsTopologyManager_ClientProxy.getMissingTopics(KafkaStreamsTopologyManager_ClientProxy.zig:339)
at app//io.quarkus.kafka.streams.runtime.health.KafkaStreamsTopicsHealthCheck.call(KafkaStreamsTopicsHealthCheck.java:50)
at app//io.quarkus.kafka.streams.runtime.health.KafkaStreamsTopicsHealthCheck_ClientProxy.call(KafkaStreamsTopicsHealthCheck_ClientProxy.zig:117)
at app//io.smallrye.health.SmallRyeHealthReporter.jsonObject(SmallRyeHealthReporter.java:185)
at app//io.smallrye.health.SmallRyeHealthReporter.fillCheck(SmallRyeHealthReporter.java:172)
at app//io.smallrye.health.SmallRyeHealthReporter.processChecks(SmallRyeHealthReporter.java:160)
at app//io.smallrye.health.SmallRyeHealthReporter.getHealth(SmallRyeHealthReporter.java:138)
at app//io.smallrye.health.SmallRyeHealthReporter.getReadiness(SmallRyeHealthReporter.java:105)
at app//io.smallrye.health.SmallRyeHealthReporter_ClientProxy.getReadiness(SmallRyeHealthReporter_ClientProxy.zig:104)
at app//io.quarkus.smallrye.health.runtime.SmallRyeReadinessHandler.handle(SmallRyeReadinessHandler.java:42)
```
**Expected behavior**
AdminClients should be pooled.
Based on a recent answer to https://stackoverflow.com/questions/57038823/is-adminclient-in-package-kafka-clients-thread-safe , it would appear AdminClient is actually thread-safe (I haven't seen it reflected on the doc yet ?), so we could share the instance.
I'm wondering if other frameworks already took that assumption.
**Actual behavior**
New AdminClient created every 10s.
**Environment (please complete the following information):**
- Output of `java -version`: 11.0.5
- Quarkus version or git rev: 1.4.1.Final
| dfefc2cb5a54ecee5f82a2c6e47eb78f45953004 | 9de04afc21f97e5cb7735023f1f3610c3994ad92 | https://github.com/quarkusio/quarkus/compare/dfefc2cb5a54ecee5f82a2c6e47eb78f45953004...9de04afc21f97e5cb7735023f1f3610c3994ad92 | 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 8b76e09f2c7..0fc17b028db 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
@@ -24,7 +24,7 @@
import javax.inject.Singleton;
import org.apache.kafka.clients.CommonClientConfigs;
-import org.apache.kafka.clients.admin.AdminClient;
+import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.AdminClientConfig;
import org.apache.kafka.clients.admin.ListTopicsResult;
import org.apache.kafka.common.config.SaslConfigs;
@@ -55,6 +55,7 @@ public class KafkaStreamsProducer {
private final ExecutorService executorService;
private final KafkaStreams kafkaStreams;
private final KafkaStreamsTopologyManager kafkaStreamsTopologyManager;
+ private final Admin kafkaAdminClient;
@Inject
public KafkaStreamsProducer(KafkaStreamsSupport kafkaStreamsSupport, KafkaStreamsRuntimeConfig runtimeConfig,
@@ -66,6 +67,7 @@ public KafkaStreamsProducer(KafkaStreamsSupport kafkaStreamsSupport, KafkaStream
this.executorService = null;
this.kafkaStreams = null;
this.kafkaStreamsTopologyManager = null;
+ this.kafkaAdminClient = null;
return;
}
@@ -73,13 +75,13 @@ public KafkaStreamsProducer(KafkaStreamsSupport kafkaStreamsSupport, KafkaStream
String bootstrapServersConfig = asString(runtimeConfig.bootstrapServers);
Properties kafkaStreamsProperties = getStreamsProperties(buildTimeProperties, bootstrapServersConfig, runtimeConfig);
- Properties adminClientConfig = getAdminClientConfig(kafkaStreamsProperties);
+ this.kafkaAdminClient = Admin.create(getAdminClientConfig(kafkaStreamsProperties));
this.executorService = Executors.newSingleThreadExecutor();
- this.kafkaStreams = initializeKafkaStreams(kafkaStreamsProperties, runtimeConfig, adminClientConfig, topology.get(),
+ this.kafkaStreams = initializeKafkaStreams(kafkaStreamsProperties, runtimeConfig, kafkaAdminClient, topology.get(),
kafkaClientSupplier, stateListener, globalStateRestoreListener, executorService);
- this.kafkaStreamsTopologyManager = new KafkaStreamsTopologyManager(adminClientConfig);
+ this.kafkaStreamsTopologyManager = new KafkaStreamsTopologyManager(kafkaAdminClient);
}
@Produces
@@ -107,11 +109,14 @@ void close() {
LOGGER.debug("Stopping Kafka Streams pipeline");
kafkaStreams.close();
}
+ if (kafkaAdminClient != null) {
+ kafkaAdminClient.close();
+ }
}
private static KafkaStreams initializeKafkaStreams(Properties kafkaStreamsProperties,
- KafkaStreamsRuntimeConfig runtimeConfig,
- Properties adminClientConfig, Topology topology, Instance<KafkaClientSupplier> kafkaClientSupplier,
+ KafkaStreamsRuntimeConfig runtimeConfig, Admin adminClient, Topology topology,
+ Instance<KafkaClientSupplier> kafkaClientSupplier,
Instance<StateListener> stateListener, Instance<StateRestoreListener> globalStateRestoreListener,
ExecutorService executorService) {
KafkaStreams kafkaStreams;
@@ -133,7 +138,7 @@ private static KafkaStreams initializeKafkaStreams(Properties kafkaStreamsProper
@Override
public void run() {
try {
- waitForTopicsToBeCreated(adminClientConfig, runtimeConfig.getTrimmedTopics());
+ waitForTopicsToBeCreated(adminClient, runtimeConfig.getTrimmedTopics());
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
return;
@@ -249,35 +254,33 @@ private static String asString(List<InetSocketAddress> addresses) {
.collect(Collectors.joining(","));
}
- private static void waitForTopicsToBeCreated(Properties adminClientConfig, Collection<String> topicsToAwait)
+ private static void waitForTopicsToBeCreated(Admin adminClient, Collection<String> topicsToAwait)
throws InterruptedException {
- try (AdminClient adminClient = AdminClient.create(adminClientConfig)) {
- Set<String> lastMissingTopics = null;
- while (true) {
- try {
- ListTopicsResult topics = adminClient.listTopics();
- Set<String> existingTopics = topics.names().get(10, TimeUnit.SECONDS);
+ Set<String> lastMissingTopics = null;
+ while (true) {
+ try {
+ ListTopicsResult topics = adminClient.listTopics();
+ Set<String> existingTopics = topics.names().get(10, TimeUnit.SECONDS);
+
+ if (existingTopics.containsAll(topicsToAwait)) {
+ LOGGER.debug("All expected topics created: " + topicsToAwait);
+ return;
+ } else {
+ Set<String> missingTopics = new HashSet<>(topicsToAwait);
+ missingTopics.removeAll(existingTopics);
- if (existingTopics.containsAll(topicsToAwait)) {
- LOGGER.debug("All expected topics created: " + topicsToAwait);
- return;
+ // Do not spam warnings - topics may take time to be created by an operator like Strimzi
+ if (missingTopics.equals(lastMissingTopics)) {
+ LOGGER.debug("Waiting for topic(s) to be created: " + missingTopics);
} else {
- Set<String> missingTopics = new HashSet<>(topicsToAwait);
- missingTopics.removeAll(existingTopics);
-
- // Do not spam warnings - topics may take time to be created by an operator like Strimzi
- if (missingTopics.equals(lastMissingTopics)) {
- LOGGER.debug("Waiting for topic(s) to be created: " + missingTopics);
- } else {
- LOGGER.warn("Waiting for topic(s) to be created: " + missingTopics);
- lastMissingTopics = missingTopics;
- }
+ LOGGER.warn("Waiting for topic(s) to be created: " + missingTopics);
+ lastMissingTopics = missingTopics;
}
-
- Thread.sleep(1_000);
- } catch (ExecutionException | TimeoutException e) {
- LOGGER.error("Failed to get topic names from broker", e);
}
+
+ Thread.sleep(1_000);
+ } catch (ExecutionException | TimeoutException e) {
+ LOGGER.error("Failed to get topic names from broker", e);
}
}
}
diff --git a/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java b/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java
index ac696df956a..c33539397ed 100644
--- a/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java
+++ b/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java
@@ -3,13 +3,12 @@
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
-import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
-import org.apache.kafka.clients.admin.AdminClient;
+import org.apache.kafka.clients.admin.Admin;
import org.apache.kafka.clients.admin.ListTopicsResult;
import org.jboss.logging.Logger;
@@ -17,16 +16,16 @@ public class KafkaStreamsTopologyManager {
private static final Logger LOGGER = Logger.getLogger(KafkaStreamsTopologyManager.class.getName());
- private final Properties adminClientConfig;
+ private final Admin adminClient;
- public KafkaStreamsTopologyManager(Properties adminClientConfig) {
- this.adminClientConfig = adminClientConfig;
+ public KafkaStreamsTopologyManager(Admin adminClient) {
+ this.adminClient = adminClient;
}
public Set<String> getMissingTopics(Collection<String> topicsToCheck) throws InterruptedException {
HashSet<String> missing = new HashSet<>(topicsToCheck);
- try (AdminClient adminClient = AdminClient.create(adminClientConfig)) {
+ try {
ListTopicsResult topics = adminClient.listTopics();
Set<String> topicNames = topics.names().get(10, TimeUnit.SECONDS);
| ['extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java', 'extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,484,527 | 2,040,928 | 272,796 | 2,921 | 4,758 | 839 | 76 | 2 | 3,539 | 229 | 884 | 58 | 2 | 3 | 1970-01-01T00:26:36 | 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 |
3,028 | quarkusio/quarkus/10283/10059 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10059 | https://github.com/quarkusio/quarkus/pull/10283 | https://github.com/quarkusio/quarkus/pull/10283 | 1 | resolves | Cannot inject reactive Pool/PgPool into gRPC Singleton | **Describe the bug**
A null reference is passed while injecting a reactive `Pool` or `PgPool` into any bean annotated with `@Singleton` if extension `quarkus-grpc` is added. Injection of my own Singleton works fine.
This mostly affects injection into a gRPC service implementation as these services only work if annotated with `@Singleton`. Injection into `@ApplicationScoped` keeps working as expected. Injection fails with `@Dependent` as well. I did not try any other.
Injection of an `@ApplicationScoped` bean into `@Singleton` still works, probably since its a Proxy. My understanding is `PgPool` is supposed to be a `Singleton` itself, so there shouldn't be a reason to not be able to inject it into a Singleton.
Injection of `PgPool` into Singleton/Dependent works fine in a regular REST project without `quarkus-grpc`.
Tried the following injection methods:
1. package-private field annotated with `@Inject`
2. constructor with `@Inject`
3. constructor without `@Inject`
**Expected behavior**
We should be able to inject reactive Pool/PgPool in gRPC Singletons.
**Actual behavior**
In a gRPC Singleton, injected Pool/PgPool is null at both construction and runtime.
**To Reproduce**
Steps to reproduce the behavior:
1. Create gRPC service with `quarkus-grpc`, `quarkus-reactive-pg-client`, `quarkus-resteasy`, , `quarkus-resteasy-jackson`, `quarkus-resteasy-mutiny`
2. Add `@Inject Pool pool` to the `@Singleton` extending a gRPC service.
4. In one of the service methods add a Null-Check on `pool` and return an error on null.
3. Launch quarkus
4. Test the method to confirm null.
**Configuration**
```properties
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=test
quarkus.datasource.password=test
quarkus.datasource.reactive.url=postgresql://localhost:5432/test
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
```
Darwin REMMACJ5Y8GTFM 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
```
- Output of `java -version`:
```
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
```
- Quarkus version or git rev: 1.5.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
------------------------------------------------------------
Gradle 6.5
------------------------------------------------------------
Build time: 2020-06-02 20:46:21 UTC
Revision: a27f41e4ae5e8a41ab9b19f8dd6d86d7b384dad4
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 11.0.2 (Oracle Corporation 11.0.2+9)
OS: Mac OS X 10.15.5 x86_64
```
**Additional context**
Installed features: [cdi, grpc-client, grpc-server, mutiny, reactive-pg-client, resteasy-jackson, resteasy-mutiny, vertx]
| 7a73160a9a4b717933cf06f782db224958aa0a93 | ca9783a67b4657d5e55ed8d4334bad03c13662d4 | https://github.com/quarkusio/quarkus/compare/7a73160a9a4b717933cf06f782db224958aa0a93...ca9783a67b4657d5e55ed8d4334bad03c13662d4 | diff --git a/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java b/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java
index 54f2731db25..ffc823a54c5 100644
--- a/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java
+++ b/extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java
@@ -1,7 +1,9 @@
package io.quarkus.reactive.db2.client.deployment;
+import javax.inject.Singleton;
+
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
-import io.quarkus.arc.deployment.BeanContainerBuildItem;
+import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.datasource.runtime.DataSourcesBuildTimeConfig;
import io.quarkus.datasource.runtime.DataSourcesRuntimeConfig;
@@ -23,6 +25,7 @@
import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem;
import io.quarkus.vertx.deployment.VertxBuildItem;
import io.vertx.db2client.DB2Pool;
+import io.vertx.sqlclient.Pool;
class ReactiveDB2ClientProcessor {
@@ -38,7 +41,7 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
BuildProducer<VertxPoolBuildItem> vertxPool,
DB2PoolRecorder recorder,
VertxBuildItem vertx,
- BeanContainerBuildItem beanContainer, ShutdownContextBuildItem shutdown,
+ BuildProducer<SyntheticBeanBuildItem> syntheticBeans, ShutdownContextBuildItem shutdown,
DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig, DataSourcesRuntimeConfig dataSourcesRuntimeConfig,
DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig,
DataSourceReactiveRuntimeConfig dataSourceReactiveRuntimeConfig,
@@ -55,11 +58,16 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
return serviceStart;
}
- RuntimeValue<DB2Pool> db2PoolValue = recorder.configureDB2Pool(vertx.getVertx(), beanContainer.getValue(),
+ RuntimeValue<DB2Pool> db2PoolValue = recorder.configureDB2Pool(vertx.getVertx(),
dataSourcesRuntimeConfig, dataSourceReactiveRuntimeConfig, dataSourceReactiveDB2Config,
shutdown);
db2Pool.produce(new DB2PoolBuildItem(db2PoolValue));
+ // Synthetic bean for DB2Pool
+ syntheticBeans.produce(SyntheticBeanBuildItem.configure(DB2Pool.class).addType(Pool.class).scope(Singleton.class)
+ .runtimeValue(db2PoolValue)
+ .setRuntimeInit().done());
+
boolean isDefault = true; // assume always the default pool for now
vertxPool.produce(new VertxPoolBuildItem(db2PoolValue, DatabaseKind.DB2, isDefault));
diff --git a/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java b/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java
index 69f33cee9dd..7b0734a0516 100644
--- a/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java
+++ b/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java
@@ -2,6 +2,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
import javax.inject.Singleton;
import io.vertx.db2client.DB2Pool;
@@ -9,31 +10,15 @@
@ApplicationScoped
public class DB2PoolProducer {
- private volatile DB2Pool db2Pool;
- private io.vertx.mutiny.db2client.DB2Pool mutinyDB2Pool;
-
- void initialize(DB2Pool db2Pool) {
- this.db2Pool = db2Pool;
- }
-
- /**
- * @return the <em>bare</em> PostGreSQL Pool instance.
- */
- @Singleton
- @Produces
- public DB2Pool db2Pool() {
- return db2Pool;
- }
+ @Inject
+ DB2Pool db2Pool;
/**
* @return the <em>mutiny</em> DB2 Pool instance. The instance is created lazily.
*/
@Singleton
@Produces
- public synchronized io.vertx.mutiny.db2client.DB2Pool mutinyDB2Pool() {
- if (mutinyDB2Pool == null) {
- mutinyDB2Pool = io.vertx.mutiny.db2client.DB2Pool.newInstance(db2Pool);
- }
- return mutinyDB2Pool;
+ public io.vertx.mutiny.db2client.DB2Pool mutinyDB2Pool() {
+ return io.vertx.mutiny.db2client.DB2Pool.newInstance(db2Pool);
}
}
diff --git a/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java b/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java
index c26b5dd0ef7..d0f97ba3818 100644
--- a/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java
+++ b/extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java
@@ -5,7 +5,6 @@
import java.util.Map;
-import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.credentials.CredentialsProvider;
import io.quarkus.credentials.runtime.CredentialsProviderFinder;
import io.quarkus.datasource.runtime.DataSourceRuntimeConfig;
@@ -22,7 +21,7 @@
@Recorder
public class DB2PoolRecorder {
- public RuntimeValue<DB2Pool> configureDB2Pool(RuntimeValue<Vertx> vertx, BeanContainer container,
+ public RuntimeValue<DB2Pool> configureDB2Pool(RuntimeValue<Vertx> vertx,
DataSourcesRuntimeConfig dataSourcesRuntimeConfig,
DataSourceReactiveRuntimeConfig dataSourceReactiveRuntimeConfig,
DataSourceReactiveDB2Config dataSourceReactiveDB2Config,
@@ -32,9 +31,6 @@ public RuntimeValue<DB2Pool> configureDB2Pool(RuntimeValue<Vertx> vertx, BeanCon
dataSourceReactiveRuntimeConfig,
dataSourceReactiveDB2Config);
- DB2PoolProducer producer = container.instance(DB2PoolProducer.class);
- producer.initialize(pool);
-
shutdown.addShutdownTask(pool::close);
return new RuntimeValue<>(pool);
}
diff --git a/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java b/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java
index 473fb56c185..ca5c654b0a5 100644
--- a/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java
+++ b/extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java
@@ -1,7 +1,9 @@
package io.quarkus.reactive.mysql.client.deployment;
+import javax.inject.Singleton;
+
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
-import io.quarkus.arc.deployment.BeanContainerBuildItem;
+import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.datasource.runtime.DataSourcesBuildTimeConfig;
import io.quarkus.datasource.runtime.DataSourcesRuntimeConfig;
@@ -26,6 +28,7 @@
import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem;
import io.quarkus.vertx.deployment.VertxBuildItem;
import io.vertx.mysqlclient.MySQLPool;
+import io.vertx.sqlclient.Pool;
@SuppressWarnings("deprecation")
class ReactiveMySQLClientProcessor {
@@ -42,7 +45,7 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
BuildProducer<VertxPoolBuildItem> vertxPool,
MySQLPoolRecorder recorder,
VertxBuildItem vertx,
- BeanContainerBuildItem beanContainer, ShutdownContextBuildItem shutdown,
+ BuildProducer<SyntheticBeanBuildItem> syntheticBeans, ShutdownContextBuildItem shutdown,
BuildProducer<ExtensionSslNativeSupportBuildItem> sslNativeSupport,
DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig, DataSourcesRuntimeConfig dataSourcesRuntimeConfig,
DataSourceReactiveBuildTimeConfig dataSourceReactiveBuildTimeConfig,
@@ -65,12 +68,17 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
boolean isLegacy = !dataSourcesBuildTimeConfig.defaultDataSource.dbKind.isPresent();
- RuntimeValue<MySQLPool> mySqlPool = recorder.configureMySQLPool(vertx.getVertx(), beanContainer.getValue(),
+ RuntimeValue<MySQLPool> mySqlPool = recorder.configureMySQLPool(vertx.getVertx(),
dataSourcesRuntimeConfig, dataSourceReactiveRuntimeConfig, dataSourceReactiveMySQLConfig,
legacyDataSourcesRuntimeConfig, legacyDataSourceReactiveMySQLConfig, isLegacy,
shutdown);
mysqlPool.produce(new MySQLPoolBuildItem(mySqlPool));
+ // Synthetic bean for MySQLPool
+ syntheticBeans.produce(SyntheticBeanBuildItem.configure(MySQLPool.class).addType(Pool.class).scope(Singleton.class)
+ .runtimeValue(mySqlPool)
+ .setRuntimeInit().done());
+
boolean isDefault = true; // assume always the default pool for now
vertxPool.produce(new VertxPoolBuildItem(mySqlPool, DatabaseKind.MYSQL, isDefault));
diff --git a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java
index f6cda665960..a949a9e8119 100644
--- a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java
+++ b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java
@@ -2,6 +2,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
import javax.inject.Singleton;
import org.jboss.logging.Logger;
@@ -13,44 +14,16 @@ public class MySQLPoolProducer {
private static final Logger LOGGER = Logger.getLogger(MySQLPoolProducer.class);
- private volatile MySQLPool mysqlPool;
- private io.vertx.mutiny.mysqlclient.MySQLPool mutinyMySQLPool;
-
- /**
- * @deprecated The Axle API is deprecated and will be removed in the future, use {@link #mutinyMySQLPool} instead.
- */
- @Deprecated
- private io.vertx.axle.mysqlclient.MySQLPool axleMySQLPool;
-
- /**
- * @deprecated The RX API is deprecated and will be removed in the future, use {@link #mutinyMySQLPool} instead.
- */
- @Deprecated
- private io.vertx.reactivex.mysqlclient.MySQLPool rxMySQLPool;
-
- void initialize(MySQLPool mysqlPool) {
- this.mysqlPool = mysqlPool;
- }
-
- /**
- * @return the <em>bare</em> MySQL Pool instance.
- */
- @Singleton
- @Produces
- public MySQLPool mysqlPool() {
- return mysqlPool;
- }
+ @Inject
+ MySQLPool mysqlPool;
/**
* @return the <em>mutiny</em> MySQL Pool instance. The instance is created lazily.
*/
@Singleton
@Produces
- public synchronized io.vertx.mutiny.mysqlclient.MySQLPool mutinyMySQLPool() {
- if (mutinyMySQLPool == null) {
- mutinyMySQLPool = io.vertx.mutiny.mysqlclient.MySQLPool.newInstance(mysqlPool);
- }
- return mutinyMySQLPool;
+ public io.vertx.mutiny.mysqlclient.MySQLPool mutinyMySQLPool() {
+ return io.vertx.mutiny.mysqlclient.MySQLPool.newInstance(mysqlPool);
}
/**
@@ -62,14 +35,11 @@ public synchronized io.vertx.mutiny.mysqlclient.MySQLPool mutinyMySQLPool() {
@Singleton
@Produces
@Deprecated
- public synchronized io.vertx.axle.mysqlclient.MySQLPool axleMySQLPool() {
- if (axleMySQLPool == null) {
- LOGGER.warn(
- "`io.vertx.axle.mysqlclient.MySQLPool` is deprecated and will be removed in a future version - it is "
- + "recommended to switch to `io.vertx.mutiny.mysqlclient.MySQLPool`");
- axleMySQLPool = io.vertx.axle.mysqlclient.MySQLPool.newInstance(mysqlPool);
- }
- return axleMySQLPool;
+ public io.vertx.axle.mysqlclient.MySQLPool axleMySQLPool() {
+ LOGGER.warn(
+ "`io.vertx.axle.mysqlclient.MySQLPool` is deprecated and will be removed in a future version - it is "
+ + "recommended to switch to `io.vertx.mutiny.mysqlclient.MySQLPool`");
+ return io.vertx.axle.mysqlclient.MySQLPool.newInstance(mysqlPool);
}
/**
@@ -81,13 +51,10 @@ public synchronized io.vertx.axle.mysqlclient.MySQLPool axleMySQLPool() {
@Singleton
@Produces
@Deprecated
- public synchronized io.vertx.reactivex.mysqlclient.MySQLPool rxMySQLPool() {
- if (rxMySQLPool == null) {
- LOGGER.warn(
- "`io.vertx.reactivex.mysqlclient.MySQLPool` is deprecated and will be removed in a future version - it is "
- + "recommended to switch to `io.vertx.mutiny.mysqlclient.MySQLPool`");
- rxMySQLPool = io.vertx.reactivex.mysqlclient.MySQLPool.newInstance(mysqlPool);
- }
- return rxMySQLPool;
+ public io.vertx.reactivex.mysqlclient.MySQLPool rxMySQLPool() {
+ LOGGER.warn(
+ "`io.vertx.reactivex.mysqlclient.MySQLPool` is deprecated and will be removed in a future version - it is "
+ + "recommended to switch to `io.vertx.mutiny.mysqlclient.MySQLPool`");
+ return io.vertx.reactivex.mysqlclient.MySQLPool.newInstance(mysqlPool);
}
}
diff --git a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
index 6a16b2c184c..4dcde4001e7 100644
--- a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
+++ b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
@@ -13,7 +13,6 @@
import org.jboss.logging.Logger;
-import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.credentials.CredentialsProvider;
import io.quarkus.credentials.runtime.CredentialsProviderFinder;
import io.quarkus.datasource.runtime.DataSourceRuntimeConfig;
@@ -35,7 +34,7 @@ public class MySQLPoolRecorder {
private static final Logger log = Logger.getLogger(MySQLPoolRecorder.class);
- public RuntimeValue<MySQLPool> configureMySQLPool(RuntimeValue<Vertx> vertx, BeanContainer container,
+ public RuntimeValue<MySQLPool> configureMySQLPool(RuntimeValue<Vertx> vertx,
DataSourcesRuntimeConfig dataSourcesRuntimeConfig,
DataSourceReactiveRuntimeConfig dataSourceReactiveRuntimeConfig,
DataSourceReactiveMySQLConfig dataSourceReactiveMySQLConfig,
@@ -54,9 +53,6 @@ public RuntimeValue<MySQLPool> configureMySQLPool(RuntimeValue<Vertx> vertx, Bea
legacyDataSourcesRuntimeConfig.defaultDataSource, legacyDataSourceReactiveMySQLConfig);
}
- MySQLPoolProducer producer = container.instance(MySQLPoolProducer.class);
- producer.initialize(mysqlPool);
-
shutdown.addShutdownTask(mysqlPool::close);
return new RuntimeValue<>(mysqlPool);
}
diff --git a/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java b/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java
index 53d48009576..87e4ef71fa5 100644
--- a/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java
+++ b/extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java
@@ -1,7 +1,9 @@
package io.quarkus.reactive.pg.client.deployment;
+import javax.inject.Singleton;
+
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
-import io.quarkus.arc.deployment.BeanContainerBuildItem;
+import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.datasource.runtime.DataSourcesBuildTimeConfig;
import io.quarkus.datasource.runtime.DataSourcesRuntimeConfig;
@@ -27,6 +29,7 @@
import io.quarkus.smallrye.health.deployment.spi.HealthBuildItem;
import io.quarkus.vertx.deployment.VertxBuildItem;
import io.vertx.pgclient.PgPool;
+import io.vertx.sqlclient.Pool;
@SuppressWarnings("deprecation")
class ReactivePgClientProcessor {
@@ -49,7 +52,7 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
BuildProducer<VertxPoolBuildItem> vertxPool,
PgPoolRecorder recorder,
VertxBuildItem vertx,
- BeanContainerBuildItem beanContainer,
+ BuildProducer<SyntheticBeanBuildItem> syntheticBeans,
ShutdownContextBuildItem shutdown,
BuildProducer<ExtensionSslNativeSupportBuildItem> sslNativeSupport,
DataSourcesBuildTimeConfig dataSourcesBuildTimeConfig, DataSourcesRuntimeConfig dataSourcesRuntimeConfig,
@@ -72,12 +75,17 @@ ServiceStartBuildItem build(BuildProducer<FeatureBuildItem> feature,
boolean isLegacy = !dataSourcesBuildTimeConfig.defaultDataSource.dbKind.isPresent();
- RuntimeValue<PgPool> pool = recorder.configurePgPool(vertx.getVertx(), beanContainer.getValue(),
+ RuntimeValue<PgPool> pool = recorder.configurePgPool(vertx.getVertx(),
dataSourcesRuntimeConfig, dataSourceReactiveRuntimeConfig, dataSourceReactivePostgreSQLConfig,
legacyDataSourcesRuntimeConfig, legacyDataSourceReactivePostgreSQLConfig, isLegacy,
shutdown);
pgPool.produce(new PgPoolBuildItem(pool));
+ // Synthetic bean for PgPool
+ syntheticBeans.produce(
+ SyntheticBeanBuildItem.configure(PgPool.class).addType(Pool.class).scope(Singleton.class).runtimeValue(pool)
+ .setRuntimeInit().done());
+
boolean isDefault = true; // assume always the default pool for now
vertxPool.produce(new VertxPoolBuildItem(pool, DatabaseKind.POSTGRESQL, isDefault));
diff --git a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java
index 35875950bac..c997c62f1c1 100644
--- a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java
+++ b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java
@@ -2,6 +2,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
import javax.inject.Singleton;
import org.jboss.logging.Logger;
@@ -13,43 +14,16 @@ public class PgPoolProducer {
private static final Logger LOGGER = Logger.getLogger(PgPoolProducer.class);
- private volatile PgPool pgPool;
- private io.vertx.mutiny.pgclient.PgPool mutinyPgPool;
-
- /**
- * @deprecated The Axle API is deprecated and will be removed in the future, use {@link #mutinyPgPool} instead.
- */
- @Deprecated
- private io.vertx.axle.pgclient.PgPool axlePgPool;
- /**
- * @deprecated The RX API is deprecated and will be removed in the future, use {@link #mutinyPgPool} instead.
- */
- @Deprecated
- private io.vertx.reactivex.pgclient.PgPool rxPgPool;
-
- void initialize(PgPool pgPool) {
- this.pgPool = pgPool;
- }
-
- /**
- * @return the <em>bare</em> PostGreSQL Pool instance.
- */
- @Singleton
- @Produces
- public PgPool pgPool() {
- return pgPool;
- }
+ @Inject
+ PgPool pgPool;
/**
* @return the <em>mutiny</em> PostGreSQL Pool instance. The instance is created lazily.
*/
@Singleton
@Produces
- public synchronized io.vertx.mutiny.pgclient.PgPool mutinyPgPool() {
- if (mutinyPgPool == null) {
- mutinyPgPool = io.vertx.mutiny.pgclient.PgPool.newInstance(pgPool);
- }
- return mutinyPgPool;
+ public io.vertx.mutiny.pgclient.PgPool mutinyPgPool() {
+ return io.vertx.mutiny.pgclient.PgPool.newInstance(pgPool);
}
/**
@@ -61,14 +35,11 @@ public synchronized io.vertx.mutiny.pgclient.PgPool mutinyPgPool() {
@Singleton
@Produces
@Deprecated
- public synchronized io.vertx.axle.pgclient.PgPool axlePgPool() {
- if (axlePgPool == null) {
- LOGGER.warn(
- "` io.vertx.axle.pgclient.PgPool` is deprecated and will be removed in a future version - it is "
- + "recommended to switch to `io.vertx.mutiny.pgclient.PgPool`");
- axlePgPool = io.vertx.axle.pgclient.PgPool.newInstance(pgPool);
- }
- return axlePgPool;
+ public io.vertx.axle.pgclient.PgPool axlePgPool() {
+ LOGGER.warn(
+ "`io.vertx.axle.pgclient.PgPool` is deprecated and will be removed in a future version - it is "
+ + "recommended to switch to `io.vertx.mutiny.pgclient.PgPool`");
+ return io.vertx.axle.pgclient.PgPool.newInstance(pgPool);
}
/**
@@ -80,13 +51,10 @@ public synchronized io.vertx.axle.pgclient.PgPool axlePgPool() {
@Singleton
@Produces
@Deprecated
- public synchronized io.vertx.reactivex.pgclient.PgPool rxPgPool() {
- if (rxPgPool == null) {
- LOGGER.warn(
- "` io.vertx.reactivex.pgclient.PgPool` is deprecated and will be removed in a future version - it is "
- + "recommended to switch to `io.vertx.mutiny.pgclient.PgPool`");
- rxPgPool = io.vertx.reactivex.pgclient.PgPool.newInstance(pgPool);
- }
- return rxPgPool;
+ public io.vertx.reactivex.pgclient.PgPool rxPgPool() {
+ LOGGER.warn(
+ "`io.vertx.reactivex.pgclient.PgPool` is deprecated and will be removed in a future version - it is "
+ + "recommended to switch to `io.vertx.mutiny.pgclient.PgPool`");
+ return io.vertx.reactivex.pgclient.PgPool.newInstance(pgPool);
}
}
diff --git a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
index 70e6b8a0f9b..7d4e7c5fd8a 100644
--- a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
+++ b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
@@ -13,7 +13,6 @@
import org.jboss.logging.Logger;
-import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.credentials.CredentialsProvider;
import io.quarkus.credentials.runtime.CredentialsProviderFinder;
import io.quarkus.datasource.runtime.DataSourceRuntimeConfig;
@@ -35,7 +34,7 @@ public class PgPoolRecorder {
private static final Logger log = Logger.getLogger(PgPoolRecorder.class);
- public RuntimeValue<PgPool> configurePgPool(RuntimeValue<Vertx> vertx, BeanContainer container,
+ public RuntimeValue<PgPool> configurePgPool(RuntimeValue<Vertx> vertx,
DataSourcesRuntimeConfig dataSourcesRuntimeConfig,
DataSourceReactiveRuntimeConfig dataSourceReactiveRuntimeConfig,
DataSourceReactivePostgreSQLConfig dataSourceReactivePostgreSQLConfig,
@@ -54,9 +53,6 @@ public RuntimeValue<PgPool> configurePgPool(RuntimeValue<Vertx> vertx, BeanConta
legacyDataSourcesRuntimeConfig.defaultDataSource, legacyDataSourceReactivePostgreSQLConfig);
}
- PgPoolProducer producer = container.instance(PgPoolProducer.class);
- producer.initialize(pgPool);
-
shutdown.addShutdownTask(pgPool::close);
return new RuntimeValue<>(pgPool);
}
diff --git a/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java b/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java
index 1f8f0a0a55f..6d602b3f0ce 100644
--- a/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java
+++ b/extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java
@@ -18,12 +18,11 @@
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.AnnotationsTransformerBuildItem;
-import io.quarkus.arc.deployment.BeanContainerBuildItem;
+import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem;
+import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem.BeanConfiguratorBuildItem;
import io.quarkus.arc.deployment.CustomScopeAnnotationsBuildItem;
import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
import io.quarkus.arc.deployment.UnremovableBeanBuildItem.BeanClassAnnotationExclusion;
-import io.quarkus.arc.deployment.ValidationPhaseBuildItem;
-import io.quarkus.arc.deployment.ValidationPhaseBuildItem.ValidationErrorBuildItem;
import io.quarkus.arc.processor.AnnotationStore;
import io.quarkus.arc.processor.AnnotationsTransformer;
import io.quarkus.arc.processor.BeanInfo;
@@ -71,7 +70,7 @@ AdditionalBeanBuildItem registerBean() {
@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
- VertxBuildItem build(CoreVertxBuildItem vertx, VertxRecorder recorder, BeanContainerBuildItem beanContainer,
+ VertxBuildItem build(CoreVertxBuildItem vertx, VertxRecorder recorder,
List<EventConsumerBusinessMethodItem> messageConsumerBusinessMethods,
BuildProducer<GeneratedClassBuildItem> generatedClass,
AnnotationProxyBuildItem annotationProxy, LaunchModeBuildItem launchMode, ShutdownContextBuildItem shutdown,
@@ -108,14 +107,13 @@ public UnremovableBeanBuildItem unremovableBeans() {
}
@BuildStep
- void validateBeanDeployment(
- ValidationPhaseBuildItem validationPhase,
+ void collectEventConsumers(
+ BeanRegistrationPhaseBuildItem beanRegistrationPhase,
BuildProducer<EventConsumerBusinessMethodItem> messageConsumerBusinessMethods,
- BuildProducer<ValidationErrorBuildItem> errors) {
-
- // We need to collect all business methods annotated with @MessageConsumer first
- AnnotationStore annotationStore = validationPhase.getContext().get(BuildExtension.Key.ANNOTATION_STORE);
- for (BeanInfo bean : validationPhase.getContext().beans().classBeans()) {
+ BuildProducer<BeanConfiguratorBuildItem> errors) {
+ // We need to collect all business methods annotated with @ConsumeEvent first
+ AnnotationStore annotationStore = beanRegistrationPhase.getContext().get(BuildExtension.Key.ANNOTATION_STORE);
+ for (BeanInfo bean : beanRegistrationPhase.getContext().beans().classBeans()) {
for (MethodInfo method : bean.getTarget().get().asClass().methods()) {
AnnotationInstance consumeEvent = annotationStore.getAnnotation(method, CONSUME_EVENT);
if (consumeEvent != null) {
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
index b62c542e96d..0b9f2097096 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
@@ -82,7 +82,7 @@ public B read(BeanConfiguratorBase<?, ?> base) {
public B types(Class<?>... types) {
for (Class<?> type : types) {
- this.types.add(Type.create(DotName.createSimple(type.getName()), Kind.CLASS));
+ addType(type);
}
return self();
}
@@ -102,6 +102,10 @@ public B addType(Type type) {
return self();
}
+ public B addType(Class<?> type) {
+ return addType(DotName.createSimple(type.getName()));
+ }
+
public B addQualifier(Class<? extends Annotation> annotationClass) {
return addQualifier(DotName.createSimple(annotationClass.getName()));
} | ['extensions/reactive-mysql-client/deployment/src/main/java/io/quarkus/reactive/mysql/client/deployment/ReactiveMySQLClientProcessor.java', 'extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolProducer.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java', 'extensions/reactive-db2-client/deployment/src/main/java/io/quarkus/reactive/db2/client/deployment/ReactiveDB2ClientProcessor.java', 'extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java', 'extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java', 'extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolProducer.java', 'extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java', 'extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolProducer.java', 'extensions/reactive-pg-client/deployment/src/main/java/io/quarkus/reactive/pg/client/deployment/ReactivePgClientProcessor.java', 'extensions/reactive-db2-client/runtime/src/main/java/io/quarkus/reactive/db2/client/runtime/DB2PoolRecorder.java'] | {'.java': 11} | 11 | 11 | 0 | 0 | 11 | 9,692,831 | 1,883,079 | 250,758 | 2,687 | 11,818 | 2,615 | 236 | 11 | 2,993 | 361 | 841 | 68 | 0 | 4 | 1970-01-01T00:26:33 | 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 |
3,030 | quarkusio/quarkus/10170/10166 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10166 | https://github.com/quarkusio/quarkus/pull/10170 | https://github.com/quarkusio/quarkus/pull/10170 | 1 | fixes | -Dquarkus.args cannot handle more than one argument in command line | **Describe the bug**
When running applications in Maven with more than one command line argument for `-Dquarkus.args`, Quarkus is not capable of handling those arguments and passing them to the application
**Expected behavior**
In the example code linked below in reproduction steps, the expected behaviour is for the program to take 2 arguments (`--name` and `--day`) which should produce a message of `Hello {name}! Today is {day}`
**Actual behavior**
The console outputs help text for either Java or Maven
**To Reproduce**
Steps to reproduce the behavior:
1. Clone example [repo](https://github.com/rt-chang/quarkus-command-line-demo)
2. Enter the command `./mvnw quarkus:dev -Dquarkus.args="--name=Bob --day=Monday"` (or any other values for the arguments)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Microsoft Windows [Version 10.0.17763.1282]`
- Output of `java -version`:
```
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)
```
- GraalVM version (if different from Java): `20.1.0`
- Quarkus version or git rev: `Quarkus 1.5.2.Final`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): `Apache Maven 3.6.3`
**Additional context**
Also tried the following:
- Attempted to escape the quotes as suggested by @geoand in the Zulip chat (ie. ` ./mvnw quarkus:dev -Dquarkus.args=\\"--name=Bob --day=Monday\\"`
- Attempted to use commas as delimiters between arguments
| 4f809fc61cdddc888dc09d72d67542aec2e6be7b | 273c2d377b1e406552e7f4eca1923c6aff0b2f0e | https://github.com/quarkusio/quarkus/compare/4f809fc61cdddc888dc09d72d67542aec2e6be7b...273c2d377b1e406552e7f4eca1923c6aff0b2f0e | 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 7aac5840e3f..867ab2ffe8e 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -310,7 +310,7 @@ public void execute() throws MojoFailureException, MojoExecutionException {
}
if (jvmArgs != null) {
- args.addAll(Arrays.asList(jvmArgs.split(" ")));
+ args.addAll(Arrays.asList(CommandLineUtils.translateCommandline(jvmArgs)));
}
// the following flags reduce startup time and are acceptable only for dev purposes | ['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,607,560 | 1,867,220 | 248,617 | 2,668 | 157 | 27 | 2 | 1 | 1,592 | 213 | 440 | 32 | 1 | 1 | 1970-01-01T00:26: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 |
3,032 | quarkusio/quarkus/10125/10119 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10119 | https://github.com/quarkusio/quarkus/pull/10125 | https://github.com/quarkusio/quarkus/pull/10125 | 1 | fixes | MongoDB Health Check fails when using Mongo template on Openshift | **Describe the bug**
When configuring an application to point to a mongoDB instance deployed using the standard Openshift templates, the health check fails as it does not have the permissions to connect to the admin database. The openshift template creates an user with ReadWrite permissions that does not have the required permissions to list databases in admin db. There is also no config property to specify the admin password.
**Expected behavior**
Expect the health check to return a good status
**Actual behavior**
Health check fails with the following error message:
```
checks": [
{
"name": "MongoDB connection health check",
"status": "DOWN",
"data": {
"reason": "Command failed with error 13 (Unauthorized): 'not authorized on admin to execute command { listDatabases: 1, nameOnly: true, $db: \\"admin\\" }' on server mongodb:27017. The full response is {\\"ok\\": 0.0, \\"errmsg\\": \\"not authorized on admin to execute command { listDatabases: 1, nameOnly: true, $db: \\\\\\"admin\\\\\\" }\\", \\"code\\": 13, \\"codeName\\": \\"Unauthorized\\"}"
}
}
```
**To Reproduce**
Steps to reproduce the behavior:
1. Deploy a mongo db instance using the standard Openshift template:
```
oc new-app --template=mongodb-ephemeral --param=MONGODB_DATABASE=catalog -n ${namespace}
```
2. Deploy a simple application that uses panache/mongodb configured to connect with the normal user account provisioned by the Openshift template
3. Enable the smallrye-health extension
4. Verify /health or /health/ready endpoint
**Configuration**
```properties
# Add your application.properties here, if applicable.
quarkus.mongodb.connection-string = mongodb://mongodb:27017
quarkus.mongodb.database = catalog
quarkus.mongodb.credentials.username = [generated username]
quarkus.mongodb.credentials.password = [ generated password]
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Openshift 4.x (ubi-minimal), pod: 4.18.0-147.5.1.el8_1.x86_64
- Output of `java -version`:
```
openjdk version "11.0.7" 2020-04-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10-LTS, mixed mode, sharing)
```
- GraalVM version (if different from Java): 20.0.0
- Quarkus version or git rev: 1.5.0-Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): 3.6.3
**Additional context**
(Add any other context about the problem here.)
| 08013dcf7b2a9d2c75b794877e8550570159c731 | 011dadad06ef7f5e15017d6b040e81da816249dd | https://github.com/quarkusio/quarkus/compare/08013dcf7b2a9d2c75b794877e8550570159c731...011dadad06ef7f5e15017d6b040e81da816249dd | diff --git a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/health/MongoHealthCheck.java b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/health/MongoHealthCheck.java
index 2222a58793f..41aa9159daa 100644
--- a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/health/MongoHealthCheck.java
+++ b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/health/MongoHealthCheck.java
@@ -8,6 +8,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.spi.Bean;
+import org.bson.Document;
import org.eclipse.microprofile.health.HealthCheck;
import org.eclipse.microprofile.health.HealthCheckResponse;
import org.eclipse.microprofile.health.HealthCheckResponseBuilder;
@@ -45,15 +46,9 @@ public HealthCheckResponse call() {
boolean isDefault = DEFAULT_CLIENT.equals(client.getKey());
MongoClient mongoClient = client.getValue();
try {
- StringBuilder databases = new StringBuilder();
- for (String db : mongoClient.listDatabaseNames()) {
- if (databases.length() != 0) {
- databases.append(", ");
- }
- databases.append(db);
- }
+ Document document = mongoClient.getDatabase("admin").runCommand(new Document("ping", 1));
String mongoClientName = isDefault ? "default" : client.getKey();
- builder.up().withData(mongoClientName, databases.toString());
+ builder.up().withData(mongoClientName, document.toJson());
} catch (Exception e) {
return builder.down().withData("reason", e.getMessage()).build();
} | ['extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/health/MongoHealthCheck.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,574,788 | 1,860,320 | 247,834 | 2,660 | 607 | 101 | 11 | 1 | 2,553 | 323 | 640 | 55 | 0 | 4 | 1970-01-01T00:26: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 |
3,034 | quarkusio/quarkus/10066/10050 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10050 | https://github.com/quarkusio/quarkus/pull/10066 | https://github.com/quarkusio/quarkus/pull/10066 | 1 | fixes | Quarkus LDAP Security - on loglevel DEBUG, the username & password are dumped | **Describe the bug**
The debug log dumps passwords. Maybe it is a good idea to censor them, or else at least give only a hash of that password? An example:
2020-06-16 10:47:09,259 DEBUG [io.qua.ver.htt.run.sec.BasicAuthenticationMechanism] (vert.x-eventloop-thread-14) Found basic auth header USERNAME:PASSWORD (decoded using charset UTF-8)
**Expected behavior**
The password should not be logged
**To Reproduce**
Steps to reproduce the behavior:
1. Create a project with security based on plain authentication
2. Change application.propêrties to set the loglevel to debug
3. Surf, log on, enter username and password
| 5cee27288ed279ddfac53ea6fa3268589d9526f9 | 8141f98b4d690afb7ff6cf5dc3bf980fdb3d9e34 | https://github.com/quarkusio/quarkus/compare/5cee27288ed279ddfac53ea6fa3268589d9526f9...8141f98b4d690afb7ff6cf5dc3bf980fdb3d9e34 | diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java
index 2ac35579f54..e641dc6bf33 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java
@@ -139,11 +139,11 @@ public Uni<SecurityIdentity> authenticate(RoutingContext context,
}
plainChallenge = new String(decode, charset);
- log.debugf("Found basic auth header %s (decoded using charset %s)", plainChallenge, charset);
int colonPos;
if ((colonPos = plainChallenge.indexOf(COLON)) > -1) {
String userName = plainChallenge.substring(0, colonPos);
char[] password = plainChallenge.substring(colonPos + 1).toCharArray();
+ log.debugf("Found basic auth header %s:***** (decoded using charset %s)", userName, charset);
UsernamePasswordAuthenticationRequest credential = new UsernamePasswordAuthenticationRequest(userName,
new PasswordCredential(password)); | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/BasicAuthenticationMechanism.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,482,707 | 1,842,762 | 245,660 | 2,643 | 233 | 47 | 2 | 1 | 640 | 86 | 155 | 15 | 0 | 0 | 1970-01-01T00:26: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 |
3,035 | quarkusio/quarkus/10032/10031 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10031 | https://github.com/quarkusio/quarkus/pull/10032 | https://github.com/quarkusio/quarkus/pull/10032 | 1 | fixes | JarRunnerIT fast jar test methods consistently failing on CI runs | I haven't been able to reproduce locally but `JarRunnerIT` test methods `testThatFastJarFormatWorks` and `testThatMutableFastJarWorks` have been failing regularly (across various Java versions) with condition timeout exception in CI runs. To help debug what's going, we recently merged this PR https://github.com/quarkusio/quarkus/pull/9960 which has now turned out to be useful, because a subsequent CI run failure[1] now has the following logs, from a failure of
```
2020-06-15T19:48:44.8880973Z [ERROR] Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 333.633 s <<< FAILURE! - in io.quarkus.maven.it.JarRunnerIT
2020-06-15T19:48:44.8882135Z [ERROR] testThatMutableFastJarWorks Time elapsed: 307.78 s <<< ERROR!
2020-06-15T19:48:44.8884800Z org.awaitility.core.ConditionTimeoutException: Condition with io.quarkus.maven.it.JarRunnerIT was not fulfilled within 1 minutes.
2020-06-15T19:48:45.0599036Z at io.quarkus.maven.it.JarRunnerIT.lambda$testThatMutableFastJarWorks$7(JarRunnerIT.java:150)
2020-06-15T19:48:45.0617135Z at
```
```
2020-06-15T19:48:27.1122162Z ####### LOG DUMP ON FAILURE (start) ######
2020-06-15T19:48:27.1124138Z Dumping logs that were generated in target/test-classes/projects/project-classic-console-output-mutable-fast-jar/target/output.log for an operation that resulted in org.awaitility.core.ConditionTimeoutException:
2020-06-15T19:48:27.1139467Z
2020-06-15T19:48:27.1140673Z /opt/hostedtoolcache/AdoptOpenJDK/1.0.0-releases-8-hotspot-normal-latest/x64/jre/bin/java
2020-06-15T19:48:27.1141211Z -jar
2020-06-15T19:48:27.1141816Z /home/runner/work/quarkus/quarkus/integration-tests/maven/target/test-classes/projects/project-classic-console-output-mutable-fast-jar/target/quarkus-app/quarkus-run.jar
2020-06-15T19:48:27.1142172Z __ ____ __ _____ ___ __ ____ ______
2020-06-15T19:48:27.1142615Z --/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
2020-06-15T19:48:27.1143056Z -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
2020-06-15T19:48:27.1143512Z --\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2020-06-15T19:48:27.1144108Z 2020-06-15 19:43:26,858 ERROR [io.qua.application] (main) Failed to start application: java.lang.RuntimeException: Unable to start HTTP server
2020-06-15T19:48:27.1144450Z at io.quarkus.vertx.http.runtime.VertxHttpRecorder.doServerStart(VertxHttpRecorder.java:432)
2020-06-15T19:48:27.1144835Z at io.quarkus.vertx.http.runtime.VertxHttpRecorder.startServer(VertxHttpRecorder.java:198)
2020-06-15T19:48:27.1145878Z at io.quarkus.deployment.steps.VertxHttpProcessor$openSocket-2064782366.deploy_0(VertxHttpProcessor$openSocket-2064782366.zig:119)
2020-06-15T19:48:27.1146937Z at io.quarkus.deployment.steps.VertxHttpProcessor$openSocket-2064782366.deploy(VertxHttpProcessor$openSocket-2064782366.zig:36)
2020-06-15T19:48:27.1147338Z at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:450)
2020-06-15T19:48:27.1147625Z at io.quarkus.runtime.Application.start(Application.java:90)
2020-06-15T19:48:27.1148044Z at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:91)
2020-06-15T19:48:27.1149633Z at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
2020-06-15T19:48:27.1187782Z at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
2020-06-15T19:48:27.1188116Z at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
2020-06-15T19:48:27.1188601Z at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
2020-06-15T19:48:27.1188756Z at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020-06-15T19:48:27.1192167Z at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2020-06-15T19:48:27.1192337Z at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2020-06-15T19:48:27.1192492Z at java.lang.reflect.Method.invoke(Method.java:498)
2020-06-15T19:48:27.1192641Z at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:31)
2020-06-15T19:48:27.1192795Z at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:18)
2020-06-15T19:48:27.1192992Z Caused by: java.util.concurrent.ExecutionException: java.lang.LinkageError: loader (instance of io/quarkus/bootstrap/runner/RunnerClassLoader): attempted duplicate class definition for name: "io/vertx/core/net/impl/VertxEventLoopGroup"
2020-06-15T19:48:27.1193182Z at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
2020-06-15T19:48:27.1193337Z at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
2020-06-15T19:48:27.1193525Z at io.quarkus.vertx.http.runtime.VertxHttpRecorder.doServerStart(VertxHttpRecorder.java:403)
2020-06-15T19:48:27.1193676Z ... 16 more
2020-06-15T19:48:27.1193855Z Caused by: java.lang.LinkageError: loader (instance of io/quarkus/bootstrap/runner/RunnerClassLoader): attempted duplicate class definition for name: "io/vertx/core/net/impl/VertxEventLoopGroup"
2020-06-15T19:48:27.1194170Z at java.lang.ClassLoader.defineClass1(Native Method)
2020-06-15T19:48:27.1194317Z at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
2020-06-15T19:48:27.1194470Z at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:79)
2020-06-15T19:48:27.1194625Z at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:44)
2020-06-15T19:48:27.1194783Z at io.vertx.core.http.impl.HttpServerImpl.<init>(HttpServerImpl.java:67)
2020-06-15T19:48:27.1194938Z at io.vertx.core.impl.VertxImpl.createHttpServer(VertxImpl.java:310)
2020-06-15T19:48:27.1195088Z at io.quarkus.vertx.http.runtime.VertxHttpRecorder$WebDeploymentVerticle.start(VertxHttpRecorder.java:759)
2020-06-15T19:48:27.1195245Z at io.vertx.core.Verticle.start(Verticle.java:66)
2020-06-15T19:48:27.1195394Z at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$9(DeploymentManager.java:556)
2020-06-15T19:48:27.1195543Z at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
2020-06-15T19:48:27.1195697Z at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
2020-06-15T19:48:27.1195857Z at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
2020-06-15T19:48:27.1196022Z at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
2020-06-15T19:48:27.1196178Z at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
2020-06-15T19:48:27.1196334Z at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
2020-06-15T19:48:27.1196490Z at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2020-06-15T19:48:27.1196631Z at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2020-06-15T19:48:27.1196777Z at java.lang.Thread.run(Thread.java:748)
2020-06-15T19:48:27.1196863Z
2020-06-15T19:48:27.1197553Z 2020-06-15 19:43:26,924 ERROR [io.qua.run.Application] (main) Error running Quarkus application: java.lang.RuntimeException: Failed to start quarkus
2020-06-15T19:48:27.1197716Z at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:519)
2020-06-15T19:48:27.1197861Z at io.quarkus.runtime.Application.start(Application.java:90)
2020-06-15T19:48:27.1197996Z at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:91)
2020-06-15T19:48:27.1198143Z at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
2020-06-15T19:48:27.1198383Z at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
2020-06-15T19:48:27.1198527Z at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
2020-06-15T19:48:27.1198669Z at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
2020-06-15T19:48:27.1198807Z at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2020-06-15T19:48:27.1198960Z at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2020-06-15T19:48:27.1199349Z at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2020-06-15T19:48:27.1199534Z at java.lang.reflect.Method.invoke(Method.java:498)
2020-06-15T19:48:27.1199797Z at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:31)
2020-06-15T19:48:27.1199983Z at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:18)
2020-06-15T19:48:27.1200892Z Caused by: java.lang.RuntimeException: Unable to start HTTP server
2020-06-15T19:48:27.1201264Z at io.quarkus.vertx.http.runtime.VertxHttpRecorder.doServerStart(VertxHttpRecorder.java:432)
2020-06-15T19:48:27.1201462Z at io.quarkus.vertx.http.runtime.VertxHttpRecorder.startServer(VertxHttpRecorder.java:198)
2020-06-15T19:48:27.1202086Z at io.quarkus.deployment.steps.VertxHttpProcessor$openSocket-2064782366.deploy_0(VertxHttpProcessor$openSocket-2064782366.zig:119)
2020-06-15T19:48:27.1207094Z at io.quarkus.deployment.steps.VertxHttpProcessor$openSocket-2064782366.deploy(VertxHttpProcessor$openSocket-2064782366.zig:36)
2020-06-15T19:48:27.1211145Z at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:450)
2020-06-15T19:48:27.1211466Z ... 12 more
2020-06-15T19:48:27.1225766Z Caused by: java.util.concurrent.ExecutionException: java.lang.LinkageError: loader (instance of io/quarkus/bootstrap/runner/RunnerClassLoader): attempted duplicate class definition for name: "io/vertx/core/net/impl/VertxEventLoopGroup"
2020-06-15T19:48:27.1226700Z at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
2020-06-15T19:48:27.1229932Z at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1908)
2020-06-15T19:48:27.1234288Z at io.quarkus.vertx.http.runtime.VertxHttpRecorder.doServerStart(VertxHttpRecorder.java:403)
2020-06-15T19:48:27.1234791Z ... 16 more
2020-06-15T19:48:27.1246042Z Caused by: java.lang.LinkageError: loader (instance of io/quarkus/bootstrap/runner/RunnerClassLoader): attempted duplicate class definition for name: "io/vertx/core/net/impl/VertxEventLoopGroup"
2020-06-15T19:48:27.1248677Z at java.lang.ClassLoader.defineClass1(Native Method)
2020-06-15T19:48:27.1252637Z at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
2020-06-15T19:48:27.1260807Z at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:79)
2020-06-15T19:48:27.1266657Z at io.quarkus.bootstrap.runner.RunnerClassLoader.loadClass(RunnerClassLoader.java:44)
2020-06-15T19:48:27.1270904Z at io.vertx.core.http.impl.HttpServerImpl.<init>(HttpServerImpl.java:67)
2020-06-15T19:48:27.1272893Z at io.vertx.core.impl.VertxImpl.createHttpServer(VertxImpl.java:310)
2020-06-15T19:48:27.1279301Z at io.quarkus.vertx.http.runtime.VertxHttpRecorder$WebDeploymentVerticle.start(VertxHttpRecorder.java:759)
2020-06-15T19:48:27.1282013Z at io.vertx.core.Verticle.start(Verticle.java:66)
2020-06-15T19:48:27.1286941Z at io.vertx.core.impl.DeploymentManager.lambda$doDeploy$9(DeploymentManager.java:556)
2020-06-15T19:48:27.1290827Z at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:366)
2020-06-15T19:48:27.1296581Z at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38)
2020-06-15T19:48:27.1300959Z at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
2020-06-15T19:48:27.1307695Z at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
2020-06-15T19:48:27.1310727Z at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
2020-06-15T19:48:27.1316178Z at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
2020-06-15T19:48:27.1326888Z at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
2020-06-15T19:48:27.1336413Z at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2020-06-15T19:48:27.1336912Z at java.lang.Thread.run(Thread.java:748)
2020-06-15T19:48:27.1337221Z
2020-06-15T19:48:27.1337468Z
2020-06-15T19:48:27.1341616Z ####### LOG DUMP ON FAILURE (end) ######
```
I haven't yet had a chance to analyze this log, so creating an issue to keep track of this.
[1] https://github.com/quarkusio/quarkus/pull/10026/checks?check_run_id=773794492
| 2c45f9a46d1743e1b3233af8ece86add9b886188 | d4456fed6bba7b5c3e6ec42d049f7724e567b580 | https://github.com/quarkusio/quarkus/compare/2c45f9a46d1743e1b3233af8ece86add9b886188...d4456fed6bba7b5c3e6ec42d049f7724e567b580 | diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java
index 921c41088b7..d6bf167acdb 100644
--- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java
+++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java
@@ -15,7 +15,6 @@
/**
* Classloader used for production application, using the multi jar strategy
- *
*/
public class RunnerClassLoader extends ClassLoader {
@@ -49,10 +48,6 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce
//note that for performance reasons this CL does not do parent first delegation
//although the intention is not for it to be a true isolated parent first CL
//'delegation misses' where the parent throws a ClassNotFoundException are very expensive
- Class<?> loaded = findLoadedClass(name);
- if (loaded != null) {
- return loaded;
- }
if (name.startsWith("java.")) {
return getParent().loadClass(name);
}
@@ -61,6 +56,10 @@ public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundExce
return getParent().loadClass(name);
}
synchronized (getClassLoadingLock(name)) {
+ Class<?> loaded = findLoadedClass(name);
+ if (loaded != null) {
+ return loaded;
+ }
ClassLoadingResource[] resources;
if (packageName == null) {
resources = resourceDirectoryMap.get(""); | ['independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/runner/RunnerClassLoader.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,449,820 | 1,836,395 | 244,933 | 2,628 | 259 | 49 | 9 | 1 | 12,368 | 567 | 4,223 | 118 | 2 | 2 | 1970-01-01T00:26: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 |
3,036 | quarkusio/quarkus/10030/10003 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10003 | https://github.com/quarkusio/quarkus/pull/10030 | https://github.com/quarkusio/quarkus/pull/10030 | 1 | fixes | quarkus-maven-plugin not working correctly for project creation. | **Describe the bug**
quarkus-maven-plugin not working correctly for project creation.
**Expected behavior**
working without problem to locate gradle wrapper. 1.4.x is working.
**Actual behavior**
```
D:\\Quarkus\\templates>mvn io.quarkus:quarkus-maven-plugin:1.5.1.Final:create -DbuildTool=gradle -DoutputDirectory=1.5.1.Final -DplatformVersion=1.5.1.Final
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:1.5.1.Final:create (default-cli) @ standalone-pom ---
Set the project groupId [org.acme.quarkus.sample]:
Set the project artifactId [my-quarkus-project]:
Set the project version [1.0-SNAPSHOT]:
Do you want to create a REST resource? (y/n) [no]:
Creating a new project in D:\\Quarkus\\templates\\1.5.1.Final\\my-quarkus-project
[ERROR] Unable to copy Gradle wrapper from platform descriptor
java.io.IOException: Failed to locate gradle-wrapper\\gradlew on the classpath
at io.quarkus.platform.descriptor.loader.json.ClassPathResourceLoader.loadResource (ClassPathResourceLoader.java:23)
at io.quarkus.platform.descriptor.loader.json.impl.QuarkusJsonPlatformDescriptor.loadResource (QuarkusJsonPlatformDescriptor.java:126)
at io.quarkus.maven.CreateProjectMojo.createGradleWrapper (CreateProjectMojo.java:245)
at io.quarkus.maven.CreateProjectMojo.execute (CreateProjectMojo.java:226)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO]
[INFO] ========================================================================================
[INFO] Your new application has been created in D:\\Quarkus\\templates\\1.5.1.Final\\my-quarkus-project
[INFO] Navigate into this directory and launch your application with mvn quarkus:dev
[INFO] Your application will be accessible on http://localhost:8080
[INFO] ========================================================================================
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.213 s
[INFO] Finished at: 2020-06-15T17:04:15+08:00
[INFO] ------------------------------------------------------------------------
```
**To Reproduce**
Steps to reproduce the behavior:
1. Type the command "mvn io.quarkus:quarkus-maven-plugin:1.5.1.Final:create -DbuildTool=gradle -DoutputDirectory=1.5.1.Final -DplatformVersion=1.5.1.Final" on windows console.
2. You will see the problem.
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Microsoft Windows [版本 10.0.18363.900]
- Output of `java -version`:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
- Quarkus version or git rev: 1.5.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
| 1626772b0f5fcc8e1cb8f90628fb79601c73e35d | 1ca5b3549221e1207477d47eb2d3c6264710df18 | https://github.com/quarkusio/quarkus/compare/1626772b0f5fcc8e1cb8f90628fb79601c73e35d...1ca5b3549221e1207477d47eb2d3c6264710df18 | diff --git a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java
index 36724667155..c8f45861476 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java
@@ -16,7 +16,6 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
@@ -220,7 +219,7 @@ private void createGradleWrapper(QuarkusPlatformDescriptor platform, Path projec
Files.createDirectories(projectDirPath.resolve("gradle/wrapper"));
for (String filename : CreateUtils.GRADLE_WRAPPER_FILES) {
- byte[] fileContent = platform.loadResource(Paths.get(CreateUtils.GRADLE_WRAPPER_PATH, filename).toString(),
+ byte[] fileContent = platform.loadResource(CreateUtils.GRADLE_WRAPPER_PATH + '/' + filename,
is -> {
byte[] buffer = new byte[is.available()];
is.read(buffer); | ['devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,450,044 | 1,836,428 | 244,939 | 2,628 | 263 | 51 | 3 | 1 | 5,120 | 333 | 1,291 | 78 | 1 | 1 | 1970-01-01T00:26: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 |
3,016 | quarkusio/quarkus/10656/10617 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10617 | https://github.com/quarkusio/quarkus/pull/10656 | https://github.com/quarkusio/quarkus/pull/10656 | 1 | fixes | Method countQuery does not create select if where are line break characters (\\n) | I have base functional for create where string, it create string with line break characters (\\n).
code:
> PanacheQuery<MyEntity> myEntityPanacheQuery = MyEntity.find(whereStr, whereParameters);
> myEntityPanacheQuery.page(Page.of(pageNumber, pageSize)).list(); // it is good work
> myEntityPanacheQuery.count(); // it is return exception
method count() is return exception:
`io.quarkus.panache.common.exception.PanacheQueryException: Count query not supported for select query: FROM com.MyEntity WHERE field like :field
and (1 = :value1 OR (field2 = :field2))
at io.quarkus.hibernate.orm.panache.common.runtime.CommonPanacheQueryImpl.countQuery(CommonPanacheQueryImpl.java:252)
at io.quarkus.hibernate.orm.panache.common.runtime.CommonPanacheQueryImpl.count(CommonPanacheQueryImpl.java:214)
at io.quarkus.hibernate.orm.panache.runtime.PanacheQueryImpl.count(PanacheQueryImpl.java:144)
at com.bivgroup.soglacie.rra.service.journal.jra.WorkAgentJournalService.lambda$loadJournalResult$1(WorkAgentJournalService.java:39)
at io.smallrye.mutiny.operators.UniMapOnResult$1.onItem(UniMapOnResult.java:31)
`
If remove line break characters from where string, when countQuery will be to work well.
I think FROM_PATTERN in CommonPanacheQueryImpl class it should be replaced `Pattern.compile("^\\\\s*FROM\\\\s+.*", Pattern.CASE_INSENSITIVE);` on `Pattern.compile("^\\s*FROM\\s+(.|\\n)*", Pattern.CASE_INSENSITIVE)`; or similar that patter processed line break characters (\\n).
Quarkus version 1.5.2 | 5c4d64b5b34faca40e66912bb21c6b41ab1d14f1 | 1309a6b688f82050183323a4b6eba22db96cddad | https://github.com/quarkusio/quarkus/compare/5c4d64b5b34faca40e66912bb21c6b41ab1d14f1...1309a6b688f82050183323a4b6eba22db96cddad | diff --git a/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java b/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java
index c0fa321b1d5..b9c82510ba8 100644
--- a/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java
+++ b/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java
@@ -29,11 +29,11 @@
// match SELECT DISTINCT? id (AS id)? (, id (AS id)?)*
static final Pattern SELECT_PATTERN = Pattern.compile(
"^\\\\s*SELECT\\\\s+((?:DISTINCT\\\\s+)?\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+AS\\\\s+\\\\w+)?(\\\\s*,\\\\s*\\\\w+(?:\\\\.\\\\w+)*(?:\\\\s+AS\\\\s+\\\\w+)?)*\\\\s+(.*)",
- Pattern.CASE_INSENSITIVE);
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
// match FROM
static final Pattern FROM_PATTERN = Pattern.compile("^\\\\s*FROM\\\\s+.*",
- Pattern.CASE_INSENSITIVE);
+ Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
private interface NonThrowingCloseable extends AutoCloseable {
@Override
diff --git a/extensions/panache/hibernate-orm-panache-common/runtime/src/test/java/io/quarkus/hibernate/orm/panache/common/runtime/QueryMatcherTest.java b/extensions/panache/hibernate-orm-panache-common/runtime/src/test/java/io/quarkus/hibernate/orm/panache/common/runtime/QueryMatcherTest.java
index 8f7ec5a5314..95fee841074 100644
--- a/extensions/panache/hibernate-orm-panache-common/runtime/src/test/java/io/quarkus/hibernate/orm/panache/common/runtime/QueryMatcherTest.java
+++ b/extensions/panache/hibernate-orm-panache-common/runtime/src/test/java/io/quarkus/hibernate/orm/panache/common/runtime/QueryMatcherTest.java
@@ -9,22 +9,28 @@ public class QueryMatcherTest {
@Test
public void testSelectMatcher() {
- testMatch("from bar", null);
- testMatch("select foo from bar", "from bar");
- testMatch(" select foo from bar ", "from bar ");
- testMatch("select foo as fff from bar", "from bar");
- testMatch("select foo,bar from bar", "from bar");
- testMatch("select foo , bar from bar", "from bar");
- testMatch("select foo as f,bar as b from bar", "from bar");
- testMatch("select foo as f , bar as b from bar", "from bar");
-
- testMatch("select foo.bar.gee as f , bar.sup as b from bar", "from bar");
-
- testMatch("select distinct foo from bar", "from bar");
- testMatch("select distinct foo,bar from bar", "from bar");
+ testSelectMatch("from bar", null);
+ testSelectMatch("select foo from bar", "from bar");
+ testSelectMatch(" select foo from bar ", "from bar ");
+ testSelectMatch("select foo as fff from bar", "from bar");
+ testSelectMatch("select foo,bar from bar", "from bar");
+ testSelectMatch("select foo , bar from bar", "from bar");
+ testSelectMatch("select foo as f,bar as b from bar", "from bar");
+ testSelectMatch("select foo as f , bar as b from bar", "from bar");
+ testSelectMatch("select foo.bar.gee as f , bar.sup as b from bar", "from bar");
+ testSelectMatch("select distinct foo from bar \\n where field = :value",
+ "from bar \\n where field = :value");
+ testSelectMatch("select distinct foo from bar", "from bar");
+ testSelectMatch("select distinct foo,bar from bar", "from bar");
+ testSelectMatch("select foo from bar where field = :value", "from bar where field = :value");
+ testSelectMatch("select foo from bar \\n where field = :value",
+ "from bar \\n where field = :value");
+ testSelectMatch("select foo from bar \\n where field = :value " +
+ "\\n\\r and fieldTwo :valueTwo \\r\\n :fieldThree = :valueThree",
+ "from bar \\n where field = :value \\n\\r and fieldTwo :valueTwo \\r\\n :fieldThree = :valueThree");
}
- private void testMatch(String select, String result) {
+ private void testSelectMatch(String select, String result) {
Matcher matcher = CommonPanacheQueryImpl.SELECT_PATTERN.matcher(select);
if (result != null) {
Assertions.assertTrue(matcher.matches());
@@ -33,4 +39,25 @@ private void testMatch(String select, String result) {
Assertions.assertFalse(matcher.matches());
}
}
+
+ @Test
+ public void testFromMatcher() {
+ testFromMatch("from bar");
+ testFromMatch(" from bar ");
+ testFromMatch("from bar where field = :value");
+ testFromMatch("from bar where fieldOne = :valueOne and fieldTwo :valueTwo");
+ testFromMatch("from bar where fieldOne = :valueOne \\n and fieldTwo :valueTwo");
+ testFromMatch("from bar where fieldOne = :valueOne \\n\\r and fieldTwo :valueTwo");
+ testFromMatch("from bar where fieldOne = :valueOne \\r\\n and fieldTwo :valueTwo \\n" +
+ "\\n :fieldThree = :valueThree");
+ testFromMatch("from \\n bar where field = :value");
+ testFromMatch("from \\n bar \\n\\r where \\r\\n field = :value");
+ testFromMatch("from \\n bar b \\n\\r where \\r\\n b.field = :value");
+ }
+
+ private void testFromMatch(String query) {
+ Matcher matcher = CommonPanacheQueryImpl.FROM_PATTERN.matcher(query);
+ Assertions.assertTrue(matcher.matches());
+ }
+
} | ['extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/CommonPanacheQueryImpl.java', 'extensions/panache/hibernate-orm-panache-common/runtime/src/test/java/io/quarkus/hibernate/orm/panache/common/runtime/QueryMatcherTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,026,961 | 1,952,040 | 260,544 | 2,739 | 193 | 42 | 4 | 1 | 1,567 | 118 | 392 | 26 | 0 | 0 | 1970-01-01T00:26: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 |
3,014 | quarkusio/quarkus/10751/10742 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10742 | https://github.com/quarkusio/quarkus/pull/10751 | https://github.com/quarkusio/quarkus/pull/10751 | 1 | resolves | Jandex warning at boot time about JsonString | **Describe the bug**
At system start, the following warning is printed:
```
2020-07-15 11:54:34,465 WARN [io.qua.dep.ste.ReflectiveHierarchyStep] (build-32) Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- javax.json.JsonString (source: com.redhat.cloud.policies.app.rest.PolicyCrudService[javax.ws.rs.core.Response validateName(@NotNull javax.json.JsonString policyName, java.util.UUID id)])
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.");.
```
Code looks like
```
@POST
@Path("/validate-name")
public Response validateName(@NotNull JsonString policyName, @QueryParam("id") UUID id) {
```
`JsonString` is pulled into Quarkus via
* io.quarkus:quarkus-resteasy-jsonb:1.6.0.Final
** org.jboss.resteasy:resteasy-json-binding-provider:4.5.5.Final
*** org.glassfish:jakarta.json:1.1.6
so I would expect that this is already registered in Quarkus by default.
This warning was not printed before 1.6
**Expected behavior**
Print no warning, as it is already registered
| 475b2b424612105db92c40b041a74ca46ccede80 | 6c68dbacde385319f10e525483ec022919ccb1b5 | https://github.com/quarkusio/quarkus/compare/475b2b424612105db92c40b041a74ca46ccede80...6c68dbacde385319f10e525483ec022919ccb1b5 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
index ed0d30f703f..3fd15dfa0be 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
@@ -32,9 +32,9 @@
public final class ReflectiveHierarchyBuildItem extends MultiBuildItem {
private final Type type;
- private IndexView index;
+ private final IndexView index;
private final Predicate<DotName> ignorePredicate;
- private String source;
+ private final String source;
public ReflectiveHierarchyBuildItem(Type type) {
this(type, DefaultIgnorePredicate.INSTANCE);
diff --git a/extensions/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java b/extensions/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
index 1e67bf64acf..e73d6c46758 100755
--- a/extensions/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
+++ b/extensions/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
@@ -740,8 +740,9 @@ private static void registerReflectionForSerialization(BuildProducer<ReflectiveC
// Declare reflection for all the types implicated in the Rest end points (return types and parameters).
// It might be needed for serialization.
for (DotName annotationType : annotations) {
- scanMethodParameters(annotationType, reflectiveHierarchy, index);
- scanMethodParameters(annotationType, reflectiveHierarchy, beanArchiveIndex);
+ Set<AnnotationInstance> processedAnnotations = new HashSet<>();
+ scanMethods(annotationType, reflectiveHierarchy, beanArchiveIndex, processedAnnotations);
+ scanMethods(annotationType, reflectiveHierarchy, index, processedAnnotations);
}
// In the case of a constraint violation, these elements might be returned as entities and will be serialized
@@ -749,14 +750,18 @@ private static void registerReflectionForSerialization(BuildProducer<ReflectiveC
reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, ResteasyConstraintViolation.class.getName()));
}
- private static void scanMethodParameters(DotName annotationType,
- BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, IndexView index) {
+ private static void scanMethods(DotName annotationType,
+ BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, IndexView index,
+ Set<AnnotationInstance> processedAnnotations) {
Collection<AnnotationInstance> instances = index.getAnnotations(annotationType);
for (AnnotationInstance instance : instances) {
if (instance.target().kind() != Kind.METHOD) {
continue;
}
-
+ if (processedAnnotations.contains(instance)) {
+ continue;
+ }
+ processedAnnotations.add(instance);
MethodInfo method = instance.target().asMethod();
String source = method.declaringClass() + "[" + method + "]";
| ['extensions/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,068,066 | 1,959,297 | 261,446 | 2,746 | 1,104 | 182 | 19 | 2 | 1,229 | 130 | 312 | 34 | 0 | 2 | 1970-01-01T00:26: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 |
3,013 | quarkusio/quarkus/10777/10750 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10750 | https://github.com/quarkusio/quarkus/pull/10777 | https://github.com/quarkusio/quarkus/pull/10777 | 1 | fixes | Colon in resource @Path does not work | **Describe the bug**
REST resources that use the colon character (`:`) in their `@Path` cannot be requested. This issue is present on Windows when running the application and on Windows and Linux when running a JUnit test.
**Expected behavior**
REST resources that use the colon character can be requested in tests and when running the application.
**Actual behavior**
When running a JUnit test (Windows & Linux): a 404 response is returned.
When running the application (Windows only): the following error message is returned.
```
java.nio.file.InvalidPathException: Illegal char <:> at index 90: C:/Users/redacted/workspace/rest-json-quickstart/src/main/resources/META-INF/resources/fruits:test
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
at java.base/java.nio.file.Path.resolve(Path.java:515)
at io.quarkus.bootstrap.classloading.DirectoryClassPathElement.getResource(DirectoryClassPathElement.java:39)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.getResource(QuarkusClassLoader.java:281)
at io.vertx.core.file.impl.FileResolver.getValidClassLoaderResource(FileResolver.java:201)
at io.vertx.core.file.impl.FileResolver.resolveFile(FileResolver.java:175)
at io.vertx.core.impl.VertxImpl.resolveFile(VertxImpl.java:805)
at io.vertx.core.file.impl.FileSystemImpl$20.perform(FileSystemImpl.java:930)
at io.vertx.core.file.impl.FileSystemImpl$20.perform(FileSystemImpl.java:928)
at io.vertx.core.file.impl.FileSystemImpl$BlockingAction.handle(FileSystemImpl.java:971)
at io.vertx.core.file.impl.FileSystemImpl$BlockingAction.handle(FileSystemImpl.java:951)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:313)
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
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)
at java.base/java.lang.Thread.run(Thread.java:834)
```
**To Reproduce**
Steps to reproduce the behavior on Windows or Linux:
1. `git clone https://github.com/kekbur/quarkus-path-colon-issue.git && cd quarkus-path-colon-issue`
2. `./mvnw test`
Steps to reproduce the behavior on Windows:
1. `git clone https://github.com/kekbur/quarkus-path-colon-issue.git && cd quarkus-path-colon-issue`
2. `./mvnw quarkus:dev`
3. `curl localhost:8080/fruits:test`
**Environment (please complete the following information):**
Windows:
- Output of `uname -a` or `ver`: CYGWIN_NT-10.0 DESKTOP 3.1.4(0.340/5/3) 2020-02-19 08:49 x86_64 Cygwin
- 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)
- GraalVM version (if different from Java): N/A
- Quarkus version or git rev: 1.6.0.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Linux:
- Output of `uname -a` or `ver`: Linux LAPTOP 4.4.0-19041-Microsoft #1-Microsoft Fri Dec 06 14:06:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`: openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-2ubuntu218.04)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-2ubuntu218.04, mixed mode, sharing)
**Additional context**
The issue is probably with Quarkus and not Resteasy, because using a colon in a pure Reasteasy project works just fine. Sample project: https://github.com/kekbur/resteasy-colon-in-path-test/blob/master/src/main/java/org/jboss/resteasy/examples/service/Library.java
http://localhost:9095/resteasy/library/books/badger:test
| d05217dc00778d40d3b4756b04c9ab82d5365ced | 0c138e9b2b59233f162bf400b5cb349247479ad6 | https://github.com/quarkusio/quarkus/compare/d05217dc00778d40d3b4756b04c9ab82d5365ced...0c138e9b2b59233f162bf400b5cb349247479ad6 | diff --git a/core/deployment/src/test/java/io/quarkus/runner/classloading/DirectoryClassPathElementTestCase.java b/core/deployment/src/test/java/io/quarkus/runner/classloading/DirectoryClassPathElementTestCase.java
index 5f3a41378a5..ed372c921f3 100644
--- a/core/deployment/src/test/java/io/quarkus/runner/classloading/DirectoryClassPathElementTestCase.java
+++ b/core/deployment/src/test/java/io/quarkus/runner/classloading/DirectoryClassPathElementTestCase.java
@@ -5,6 +5,7 @@
import java.nio.file.Path;
import java.util.Arrays;
import java.util.HashSet;
+import java.util.Locale;
import java.util.Set;
import org.junit.jupiter.api.AfterAll;
@@ -49,4 +50,17 @@ public void testGetResource() {
Assertions.assertNotNull(res);
Assertions.assertEquals("subdir file", new String(res.getData(), StandardCharsets.UTF_8));
}
+
+ @Test
+ public void testInvalidPath() {
+ final String invalidPath;
+ if (System.getProperty("os.name").toLowerCase(Locale.ENGLISH).contains("windows")) {
+ invalidPath = "D:\\\\*";
+ } else {
+ invalidPath = "hello\\u0000world";
+ }
+ final DirectoryClassPathElement classPathElement = new DirectoryClassPathElement(root);
+ final ClassPathResource resource = classPathElement.getResource(invalidPath);
+ Assertions.assertNull(resource, "DirectoryClassPathElement wasn't expected to return a resource for an invalid path");
+ }
}
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
index cbd32f11011..c5d8dfd697d 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
@@ -7,6 +7,7 @@
import java.net.URI;
import java.net.URL;
import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.CodeSource;
@@ -36,7 +37,13 @@ public Path getRoot() {
@Override
public ClassPathResource getResource(String name) {
- Path file = root.resolve(name);
+ final Path file;
+ try {
+ file = root.resolve(name);
+ } catch (InvalidPathException ipe) {
+ // can't resolve the resource
+ return null;
+ }
Path normal = file.normalize();
String cn = name;
if (File.separatorChar == '\\\\') { | ['core/deployment/src/test/java/io/quarkus/runner/classloading/DirectoryClassPathElementTestCase.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,128,296 | 1,971,109 | 263,057 | 2,768 | 291 | 56 | 9 | 1 | 4,136 | 323 | 1,085 | 66 | 4 | 1 | 1970-01-01T00:26: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,994 | quarkusio/quarkus/11209/11208 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11208 | https://github.com/quarkusio/quarkus/pull/11209 | https://github.com/quarkusio/quarkus/pull/11209 | 1 | fixes | JsonNode not in Jandex after upgrade to 1.7.0.CR1 | **Describe the bug**
In 1.6.1.Final the maven build don't show any warning, but changing the version to 1.7.0.CR1 triggers a WARNING about `com.fasterxml.jackson.databind.JsonNode` that is not in the index.
Is a multi-module project using RESTEasy, so I would assume there is the ignore for ReflectiveHierarchyStep set.
**Expected behavior**
No log warning message.
**Actual behavior**
```
[WARNING] [io.quarkus.deployment.steps.ReflectiveHierarchyStep] Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- com.fasterxml.jackson.databind.JsonNode (source: io.fabric8.kubernetes.api.model.HasMetadata)
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.");.
```
**To Reproduce**
** Not sure how to reproduce it easily **
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Linux qk 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`: OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)
- GraalVM version (if different from Java):
- Quarkus version or git rev: 1.7.0.CR1
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): 3.6.3
| dfefc2cb5a54ecee5f82a2c6e47eb78f45953004 | c69a90d128b5fc56cdd3932d6e1b2f8a3ad5f86b | https://github.com/quarkusio/quarkus/compare/dfefc2cb5a54ecee5f82a2c6e47eb78f45953004...c69a90d128b5fc56cdd3932d6e1b2f8a3ad5f86b | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
index 3fd15dfa0be..779ed093048 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java
@@ -96,7 +96,8 @@ public static class DefaultIgnorePredicate implements Predicate<DotName> {
public static final DefaultIgnorePredicate INSTANCE = new DefaultIgnorePredicate();
private static final List<String> DEFAULT_IGNORED_PACKAGES = Arrays.asList("java.", "io.reactivex.",
- "org.reactivestreams.", "org.slf4j.");
+ "org.reactivestreams.", "org.slf4j.", "javax.json.", "com.fasterxml.jackson.databind.",
+ "io.vertx.core.json.");
// if this gets more complicated we will need to move to some tree like structure
static final Set<String> WHITELISTED_FROM_IGNORED_PACKAGES = new HashSet<>(
Arrays.asList("java.math.BigDecimal", "java.math.BigInteger"));
diff --git a/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java b/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java
index 75239b57294..d4efe8da48b 100644
--- a/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java
+++ b/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java
@@ -80,28 +80,19 @@ public boolean test(DotName dotName) {
// Types ignored for reflection used by the RESTEasy and SmallRye REST client extensions.
private static final Set<DotName> TYPES_IGNORED_FOR_REFLECTION = new HashSet<>(Arrays.asList(
- // Jackson
- DotName.createSimple("com.fasterxml.jackson.databind.JsonNode"),
+ // Consider adding packages below instead if it makes more sense
+ ));
+ private static final String[] PACKAGES_IGNORED_FOR_REFLECTION = {
+ // JSON-P
+ "javax.json.",
+ // Jackson
+ "com.fasterxml.jackson.databind.",
// JAX-RS
- DotName.createSimple("javax.ws.rs.core.Response"),
- DotName.createSimple("javax.ws.rs.core.Response.StatusType"),
- DotName.createSimple("javax.ws.rs.container.AsyncResponse"),
- DotName.createSimple("javax.ws.rs.core.StreamingOutput"),
- DotName.createSimple("javax.ws.rs.core.Form"),
- DotName.createSimple("javax.ws.rs.core.MultivaluedMap"),
-
+ "javax.ws.rs.",
// RESTEasy
- DotName.createSimple("org.jboss.resteasy.plugins.providers.multipart.MultipartInput"),
- DotName.createSimple("org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput"),
- DotName.createSimple("org.jboss.resteasy.plugins.providers.multipart.MultipartOutput"),
- DotName.createSimple("org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataOutput"),
-
- // Vert-x
- DotName.createSimple("io.vertx.core.json.JsonArray"),
- DotName.createSimple("io.vertx.core.json.JsonObject")));
-
- private static final String[] PACKAGES_IGNORED_FOR_REFLECTION = {
- "javax.json."
+ "org.jboss.resteasy.",
+ // Vert.x JSON layer
+ "io.vertx.core.json."
};
} | ['extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/nativeimage/ReflectiveHierarchyBuildItem.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,484,527 | 2,040,928 | 272,796 | 2,921 | 1,805 | 356 | 34 | 2 | 1,412 | 185 | 383 | 24 | 0 | 1 | 1970-01-01T00:26:36 | 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,995 | quarkusio/quarkus/11196/11136 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11136 | https://github.com/quarkusio/quarkus/pull/11196 | https://github.com/quarkusio/quarkus/pull/11196 | 1 | resolves | Injection error in start with 1.7.CR1 | check out https://github.com/RedHatInsights/policies-ui-backend , do mvn clean test -> all good with 1.6.0 (and all versions before)
Now replace in pom. xml the 1.6.Final with 1.7.CR1 -> the above fails. Run with mvn quarkus:dev, the following is printed at startup:
```
2020-07-31 22:00:38,141 ERROR [io.qua.run.boo.StartupActionImpl] (Quarkus Main Thread) Error running Quarkus: java.lang.reflect.InvocationTargetException
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:145)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ExceptionInInitializerError
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:60)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
... 6 more
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:436)
... 15 more
Caused by: java.lang.RuntimeException: Error injecting com.redhat.cloud.policies.app.RbacServer com.redhat.cloud.policies.app.auth.RbacFilter.rbac
at com.redhat.cloud.policies.app.auth.RbacFilter_Bean.create(RbacFilter_Bean.zig:376)
at com.redhat.cloud.policies.app.auth.RbacFilter_Bean.create(RbacFilter_Bean.zig:528)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:88)
at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
at com.redhat.cloud.policies.app.auth.RbacFilter_Bean.get(RbacFilter_Bean.zig:560)
at com.redhat.cloud.policies.app.auth.RbacFilter_Bean.get(RbacFilter_Bean.zig:576)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:408)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:421)
at io.quarkus.arc.impl.ArcContainerImpl$1.get(ArcContainerImpl.java:249)
at io.quarkus.arc.impl.ArcContainerImpl$1.get(ArcContainerImpl.java:246)
at io.quarkus.arc.runtime.ArcRecorder$2$1.create(ArcRecorder.java:84)
at io.quarkus.resteasy.common.runtime.QuarkusConstructorInjector.construct(QuarkusConstructorInjector.java:39)
at org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl.injectedInstance(ResteasyProviderFactoryImpl.java:1398)
at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$AbstractInterceptorFactory.createInterceptor(JaxrsInterceptorRegistryImpl.java:150)
at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$OnDemandInterceptorFactory.initialize(JaxrsInterceptorRegistryImpl.java:168)
at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$OnDemandInterceptorFactory.checkInitialize(JaxrsInterceptorRegistryImpl.java:183)
at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$OnDemandInterceptorFactory.getInterceptor(JaxrsInterceptorRegistryImpl.java:194)
at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl$AbstractInterceptorFactory.postMatch(JaxrsInterceptorRegistryImpl.java:131)
at org.jboss.resteasy.core.interception.jaxrs.JaxrsInterceptorRegistryImpl.postMatch(JaxrsInterceptorRegistryImpl.java:283)
at org.jboss.resteasy.core.interception.jaxrs.ContainerRequestFilterRegistryImpl.postMatch(ContainerRequestFilterRegistryImpl.java:30)
at org.jboss.resteasy.core.interception.jaxrs.ContainerRequestFilterRegistryImpl.postMatch(ContainerRequestFilterRegistryImpl.java:12)
at org.jboss.resteasy.core.ResourceMethodInvoker.<init>(ResourceMethodInvoker.java:140)
at org.jboss.resteasy.core.ResourceMethodRegistry.processMethod(ResourceMethodRegistry.java:382)
at org.jboss.resteasy.core.ResourceMethodRegistry.register(ResourceMethodRegistry.java:309)
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:260)
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:227)
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:208)
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:192)
at org.jboss.resteasy.core.ResourceMethodRegistry.addResourceFactory(ResourceMethodRegistry.java:175)
at org.jboss.resteasy.core.ResourceMethodRegistry.addPerRequestResource(ResourceMethodRegistry.java:87)
at org.jboss.resteasy.core.ResteasyDeploymentImpl.registerResources(ResteasyDeploymentImpl.java:515)
at org.jboss.resteasy.core.ResteasyDeploymentImpl.registration(ResteasyDeploymentImpl.java:472)
at org.jboss.resteasy.core.ResteasyDeploymentImpl.startInternal(ResteasyDeploymentImpl.java:162)
at org.jboss.resteasy.core.ResteasyDeploymentImpl.start(ResteasyDeploymentImpl.java:118)
at io.quarkus.resteasy.runtime.standalone.ResteasyStandaloneRecorder.staticInit(ResteasyStandaloneRecorder.java:71)
at io.quarkus.deployment.steps.ResteasyStandaloneBuildStep$staticInit-210558872.deploy_0(ResteasyStandaloneBuildStep$staticInit-210558872.zig:810)
at io.quarkus.deployment.steps.ResteasyStandaloneBuildStep$staticInit-210558872.deploy(ResteasyStandaloneBuildStep$staticInit-210558872.zig:40)
at io.quarkus.runner.ApplicationImpl.<clinit>(ApplicationImpl.zig:394)
... 15 more
Caused by: javax.enterprise.inject.CreationException: Synthetic bean instance not initialized yet: org_eclipse_microprofile_context_ManagedExecutor_97d170e1550eee4afc0af065b78cda302a97674c
at org.eclipse.microprofile.context.ManagedExecutor_29efa7b6c09f5f806580e59c31b0b9832488e1e4_Synthetic_Bean.create(ManagedExecutor_29efa7b6c09f5f806580e59c31b0b9832488e1e4_Synthetic_Bean.zig:115)
at org.eclipse.microprofile.context.ManagedExecutor_29efa7b6c09f5f806580e59c31b0b9832488e1e4_Synthetic_Bean.create(ManagedExecutor_29efa7b6c09f5f806580e59c31b0b9832488e1e4_Synthetic_Bean.zig:138)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:88)
at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
at org.eclipse.microprofile.context.ManagedExecutor_29efa7b6c09f5f806580e59c31b0b9832488e1e4_Synthetic_Bean.get(ManagedExecutor_29efa7b6c09f5f806580e59c31b0b9832488e1e4_Synthetic_Bean.zig:170)
at org.eclipse.microprofile.context.ManagedExecutor_29efa7b6c09f5f806580e59c31b0b9832488e1e4_Synthetic_Bean.get(ManagedExecutor_29efa7b6c09f5f806580e59c31b0b9832488e1e4_Synthetic_Bean.zig:186)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:408)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:421)
at io.quarkus.arc.impl.ArcContainerImpl.instanceHandle(ArcContainerImpl.java:391)
at io.quarkus.arc.impl.ArcContainerImpl.instance(ArcContainerImpl.java:205)
at io.quarkus.restclient.runtime.RestClientBase.create(RestClientBase.java:60)
at com.redhat.cloud.policies.app.RbacServer_175c6127e4261f4f0b6cddf18a2ed3ab43163b13_Synthetic_Bean.create(RbacServer_175c6127e4261f4f0b6cddf18a2ed3ab43163b13_Synthetic_Bean.zig:188)
at com.redhat.cloud.policies.app.RbacServer_175c6127e4261f4f0b6cddf18a2ed3ab43163b13_Synthetic_Bean.get(RbacServer_175c6127e4261f4f0b6cddf18a2ed3ab43163b13_Synthetic_Bean.zig:219)
at com.redhat.cloud.policies.app.RbacServer_175c6127e4261f4f0b6cddf18a2ed3ab43163b13_Synthetic_Bean.get(RbacServer_175c6127e4261f4f0b6cddf18a2ed3ab43163b13_Synthetic_Bean.zig:242)
at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:52)
at com.redhat.cloud.policies.app.auth.RbacFilter_Bean.create(RbacFilter_Bean.zig:359)
... 55 more
```
| 7259ad364600d6b782a2e9ca1680aae1380b6e3c | f701df4b13bc781737cbdd3d31a5d0c139af5ccb | https://github.com/quarkusio/quarkus/compare/7259ad364600d6b782a2e9ca1680aae1380b6e3c...f701df4b13bc781737cbdd3d31a5d0c139af5ccb | diff --git a/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java b/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
index 6d59bfbb87e..067b30ee81d 100644
--- a/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
+++ b/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
@@ -4,7 +4,7 @@
import java.util.ArrayList;
import java.util.List;
-import javax.inject.Singleton;
+import javax.enterprise.context.ApplicationScoped;
import org.eclipse.microprofile.context.ManagedExecutor;
import org.eclipse.microprofile.context.spi.ContextManagerExtension;
@@ -76,7 +76,10 @@ void build(SmallRyeContextPropagationRecorder recorder,
// Synthetic bean for ManagedExecutor
syntheticBeans.produce(
- SyntheticBeanBuildItem.configure(ManagedExecutor.class).scope(Singleton.class).defaultBean().unremovable()
+ SyntheticBeanBuildItem.configure(ManagedExecutor.class)
+ .scope(ApplicationScoped.class)
+ .defaultBean()
+ .unremovable()
.supplier(recorder.initializeManagedExecutor(executorBuildItem.getExecutorProxy()))
.setRuntimeInit().done());
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
index ec88d6e85c3..19db35f09c5 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
@@ -12,7 +12,6 @@
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
-import java.util.Optional;
import java.util.Set;
import java.util.function.Consumer;
import javax.enterprise.context.NormalScope;
@@ -135,8 +134,13 @@ public B scope(ScopeInfo scope) {
public B scope(Class<? extends Annotation> scope) {
DotName scopeName = DotName.createSimple(scope.getName());
- this.scope = Optional.ofNullable(BuiltinScope.from(scopeName)).map(BuiltinScope::getInfo).orElse(new ScopeInfo(
- scopeName, scope.isAnnotationPresent(NormalScope.class), scope.isAnnotationPresent(Inherited.class)));
+ BuiltinScope builtinScope = BuiltinScope.from(scopeName);
+ if (builtinScope != null) {
+ this.scope = builtinScope.getInfo();
+ } else {
+ this.scope = new ScopeInfo(scopeName, scope.isAnnotationPresent(NormalScope.class),
+ scope.isAnnotationPresent(Inherited.class));
+ }
return self();
}
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinScope.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinScope.java
index 97a7948ae32..55c342c873e 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinScope.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinScope.java
@@ -30,9 +30,9 @@ public DotName getName() {
return info.getDotName();
}
- public static BuiltinScope from(DotName name) {
+ public static BuiltinScope from(DotName scopeAnnotationName) {
for (BuiltinScope scope : BuiltinScope.values()) {
- if (scope.getInfo().getDotName().equals(name)) {
+ if (scope.getInfo().getDotName().equals(scopeAnnotationName)) {
return scope;
}
} | ['extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinScope.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 10,479,463 | 2,040,080 | 272,689 | 2,921 | 1,290 | 240 | 21 | 3 | 9,491 | 246 | 2,484 | 97 | 1 | 1 | 1970-01-01T00:26:36 | 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,997 | quarkusio/quarkus/11124/11102 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11102 | https://github.com/quarkusio/quarkus/pull/11124 | https://github.com/quarkusio/quarkus/pull/11124 | 1 | fixes | Runner jar is deployed with a classifier that does not match quarkus.package.runner-suffix when building uber-jar | **Describe the bug**
when using the property
```
quarkus.package.runner-suffix=-fitnesse
```
the jar is created with the right suffix (my-artifactId-1.0.0-SNAPSHOT-fitnesse.jar), but it is installed in the local repository as my-artifactId-1.0.0-SNAPSHOT-runner.jar
mvn install logs:
```
[INFO] Installing /Projets/my-artifactId/target/my-artifactId-1.0.0-SNAPSHOT-fitnesse.jar to /home/loic/.m2/repository/my-groupId/my-artifactId/1.0.0-SNAPSHOT/my-artifactId-1.0.0-SNAPSHOT-runner.jar
```
This make it impossible to create two jars with different build time configuration.
**Expected behavior**
(Describe the expected behavior clearly and concisely.)
either the runner is not attached and it is responsibility of the user to attach it with the build-helper-maven-plugin, either the classifier used to attach the artifact match the quarkus.package.runner-suffix value
**Actual behavior**
(Describe the actual behavior clearly and concisely.)
the classifier is always runner
**To Reproduce**
Steps to reproduce the behavior:
1. create an empty quarkus project
2. add quarkus.package.uber-jar=true in application.properties
2. mvn install -Dquarkus.package.runner-suffix=-fitnesse
3. observe the local repository content
Edit: this only occurs when quarkus.package.uber-jar=true in application.properties. if not, the runner is not attached.
| 5694012bcef76bb47324bbb949f349eb115e1ead | c2934e4c3c088aea39c40875dad38cb9a0017b35 | https://github.com/quarkusio/quarkus/compare/5694012bcef76bb47324bbb949f349eb115e1ead...c2934e4c3c088aea39c40875dad38cb9a0017b35 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/JarBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/JarBuildItem.java
index 2a27f9d42c0..5db2a885bee 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/JarBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/JarBuildItem.java
@@ -11,12 +11,14 @@ public final class JarBuildItem extends SimpleBuildItem {
private final Path originalArtifact;
private final Path libraryDir;
private final String type;
+ private final String classifier;
- public JarBuildItem(Path path, Path originalArtifact, Path libraryDir, String type) {
+ public JarBuildItem(Path path, Path originalArtifact, Path libraryDir, String type, String classifier) {
this.path = path;
this.originalArtifact = originalArtifact;
this.libraryDir = libraryDir;
this.type = type;
+ this.classifier = classifier;
}
public boolean isUberJar() {
@@ -39,7 +41,11 @@ public String getType() {
return type;
}
+ public String getClassifier() {
+ return classifier;
+ }
+
public JarResult toJarResult() {
- return new JarResult(path, originalArtifact, libraryDir, type);
+ return new JarResult(path, originalArtifact, libraryDir, type, classifier);
}
}
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 f1dfdc84ce4..e6e5d12856a 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
@@ -263,7 +263,12 @@ private JarBuildItem buildUberJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
originalJar = null;
}
- return new JarBuildItem(runnerJar, originalJar, null, PackageConfig.UBER_JAR);
+ return new JarBuildItem(runnerJar, originalJar, null, PackageConfig.UBER_JAR,
+ suffixToClassifier(packageConfig.runnerSuffix));
+ }
+
+ private String suffixToClassifier(String suffix) {
+ return suffix.startsWith("-") ? suffix.substring(1) : suffix;
}
private void buildUberJar0(CurateOutcomeBuildItem curateOutcomeBuildItem,
@@ -421,7 +426,7 @@ private JarBuildItem buildLegacyThinJar(CurateOutcomeBuildItem curateOutcomeBuil
}
runnerJar.toFile().setReadable(true, false);
- return new JarBuildItem(runnerJar, null, libDir, PackageConfig.LEGACY);
+ return new JarBuildItem(runnerJar, null, libDir, PackageConfig.LEGACY, suffixToClassifier(packageConfig.runnerSuffix));
}
private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
@@ -628,7 +633,7 @@ public void accept(Path path) {
}
});
}
- return new JarBuildItem(initJar, null, libDir, packageConfig.type);
+ return new JarBuildItem(initJar, null, libDir, packageConfig.type, null);
}
private void copyDependency(CurateOutcomeBuildItem curateOutcomeBuildItem, Map<AppArtifactKey, List<Path>> runtimeArtifacts,
diff --git a/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java
index 6d00bd0193e..588f3b22c12 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java
@@ -221,6 +221,7 @@ public void execute() throws MojoExecutionException {
Artifact original = project.getArtifact();
if (result.getJar() != null) {
+
if (result.getJar().isUberJar() && result.getJar().getOriginalArtifact() != null) {
final Path standardJar = curatedApplication.getAppModel().getAppArtifact().getPaths().getSinglePath();
if (Files.exists(standardJar)) {
@@ -234,7 +235,8 @@ public void execute() throws MojoExecutionException {
}
}
if (result.getJar().isUberJar()) {
- projectHelper.attachArtifact(project, result.getJar().getPath().toFile(), "runner");
+ projectHelper.attachArtifact(project, result.getJar().getPath().toFile(),
+ result.getJar().getClassifier());
}
}
}
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/JarResult.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/JarResult.java
index c9bd1b903f5..0a0f5a27d3c 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/JarResult.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/JarResult.java
@@ -8,12 +8,14 @@ public final class JarResult {
private final Path originalArtifact;
private final Path libraryDir;
private final String type;
+ private final String classifier;
- public JarResult(Path path, Path originalArtifact, Path libraryDir, String type) {
+ public JarResult(Path path, Path originalArtifact, Path libraryDir, String type, String classifier) {
this.path = path;
this.originalArtifact = originalArtifact;
this.libraryDir = libraryDir;
this.type = type;
+ this.classifier = classifier;
}
public boolean isUberJar() {
@@ -36,4 +38,7 @@ public String getType() {
return type;
}
+ public String getClassifier() {
+ return classifier;
+ }
} | ['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java', 'devtools/maven/src/main/java/io/quarkus/maven/BuildMojo.java', 'core/deployment/src/main/java/io/quarkus/deployment/pkg/builditem/JarBuildItem.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/JarResult.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 10,487,438 | 2,041,558 | 272,875 | 2,924 | 1,875 | 382 | 32 | 4 | 1,387 | 149 | 348 | 35 | 0 | 2 | 1970-01-01T00:26:36 | 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,998 | quarkusio/quarkus/11113/10712 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10712 | https://github.com/quarkusio/quarkus/pull/11113 | https://github.com/quarkusio/quarkus/pull/11113 | 1 | fixes | Quarkus resource not found on subdir | **Describe the bug**
Quarkus app doesn't serve default index.html resource on subdirs property with prod profile, on subdirs it gives a resource not found
**Expected behavior**
Serve the default index.html on subdirs like is happening launching the app with quarkus:dev
**Actual behavior**
put an index.html inside src/main/resources/META-INF/resources one ndex.html insede src/main/resources/META-INF/resources/subdir
do a clean package then, run java -jar *-runner.jar then use a broweser to get localhost:8080/subdir responds me resource not found
**Configuration**
i used the rest-json-quickstart to reproduce it
**Environment (please complete the following information):**
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
| 858851b16ff0b9ea04caa424a332e351330176a3 | ec701f3e626f43cb9885906e60cd46df35c009da | https://github.com/quarkusio/quarkus/compare/858851b16ff0b9ea04caa424a332e351330176a3...ec701f3e626f43cb9885906e60cd46df35c009da | diff --git a/extensions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/files/StaticFileWithResourcesTest.java b/extensions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/files/StaticFileWithResourcesTest.java
index eaa922a350a..2f57a588867 100644
--- a/extensions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/files/StaticFileWithResourcesTest.java
+++ b/extensions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/files/StaticFileWithResourcesTest.java
@@ -47,6 +47,10 @@ public void test() {
.statusCode(200)
.body(containsString("<h1>Hello</h1>"));
+ RestAssured.get("/web/").then()
+ .statusCode(200)
+ .body(containsString("<h1>Hello</h1>"));
+
RestAssured.get("/lorem.txt").then()
.statusCode(200)
.body(containsString("Lorem"));
diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/StaticResourcesProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/StaticResourcesProcessor.java
index 609e0b65969..4560c6c7219 100644
--- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/StaticResourcesProcessor.java
+++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/StaticResourcesProcessor.java
@@ -107,9 +107,19 @@ private void collectKnownPaths(Path resource, Set<String> knownPaths) {
@Override
public FileVisitResult visitFile(Path p, BasicFileAttributes attrs)
throws IOException {
+ String simpleName = p.getFileName().toString();
String file = resource.relativize(p).toString();
- if (file.equals("index.html") || file.equals("index.htm")) {
- knownPaths.add("/");
+ if (simpleName.equals("index.html") || simpleName.equals("index.htm")) {
+ Path parent = resource.relativize(p).getParent();
+ if (parent == null) {
+ knownPaths.add("/");
+ } else {
+ String parentString = parent.toString();
+ if (!parentString.startsWith("/")) {
+ parentString = "/" + parentString;
+ }
+ knownPaths.add(parentString + "/");
+ }
}
if (!file.startsWith("/")) {
file = "/" + file; | ['extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/StaticResourcesProcessor.java', 'extensions/resteasy/deployment/src/test/java/io/quarkus/resteasy/test/files/StaticFileWithResourcesTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 10,412,583 | 2,026,220 | 270,759 | 2,885 | 823 | 123 | 14 | 1 | 849 | 105 | 216 | 19 | 0 | 0 | 1970-01-01T00:26:36 | 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,999 | quarkusio/quarkus/11100/10637 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10637 | https://github.com/quarkusio/quarkus/pull/11100 | https://github.com/quarkusio/quarkus/pull/11100 | 1 | closes | Quarkus NativeImageBuildStep fails with perm denied with podman 2.x | **Describe the bug**
This bug originated here:
https://bugzilla.redhat.com/show_bug.cgi?id=1854738
and here:
https://groups.google.com/g/quarkus-dev/c/8LVoqk4G5uc/m/M5MAVopLAwAJ
Basically with podman 1.x --userns=keep-id contained a bug which got fixed with 2.x which results in quarkus build failures with options `-Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman` in rootless mode.
**Expected behavior**
Native image build passes. No "Permission Denied" error.
**Actual behavior**
Native image build in the container with mounted volume fails due to "Permission Denied".
**To Reproduce**
Steps to reproduce the behavior:
1. Install podman 2.0 (for example in F32)
2. `mvn package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman`
**Additional context**
Looking at this podman bug:
https://github.com/containers/podman/issues/3990
... it seems podman won't help with getting permissions correctly set up for volume mounts.
My experiments showed that doing some `podman unshare` tricks prior the native image build might work. Something like this:
```
$ CONTAINER_UID=$(podman run --rm --entrypoint /bin/bash -ti quay.io/quarkus/ubi-quarkus-native-image:19.3.1-java11 -c 'id -u' | sed 's/\\r//g')
$ podman unshare chown -R $CONTAINER_UID target/getting-started-1.0-SNAPSHOT-native-image-source-jar
$ podman run -v getting-started/target/getting-started-1.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --rm quay.io/quarkus/ubi-quarkus-native-image:19.3.1-java11 -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=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\\$BySpaceAndTime -H:+JNI -jar getting-started-1.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:-IncludeAllTimeZones -H:EnableURLProtocols=http --no-server -H:-UseServiceLoaderFeature -H:+StackTrace getting-started-1.0-SNAPSHOT-runner
```
Getting the UID the container runs as that way is important as it might change. | f886139d3c6ae7e7d454102a6932df377162bdd0 | 6776b59f893dc355fe0712d4d2d701e3c9a24e52 | https://github.com/quarkusio/quarkus/compare/f886139d3c6ae7e7d454102a6932df377162bdd0...6776b59f893dc355fe0712d4d2d701e3c9a24e52 | 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 4d5779363bd..ab016b09f8b 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
@@ -101,15 +101,14 @@ public NativeImageBuildItem build(NativeConfig nativeConfig, NativeImageSourceJa
outputPath + ":" + CONTAINER_BUILD_VOLUME_PATH + ":z", "--env", "LANG=C");
if (SystemUtils.IS_OS_LINUX) {
- if ("docker".equals(containerRuntime)) {
- String uid = getLinuxID("-ur");
- String gid = getLinuxID("-gr");
- if (uid != null && gid != null && !"".equals(uid) && !"".equals(gid)) {
- Collections.addAll(nativeImage, "--user", uid + ":" + gid);
+ String uid = getLinuxID("-ur");
+ String gid = getLinuxID("-gr");
+ if (uid != null && gid != null && !"".equals(uid) && !"".equals(gid)) {
+ Collections.addAll(nativeImage, "--user", uid + ":" + gid);
+ if ("podman".equals(containerRuntime)) {
+ // Needed to avoid AccessDeniedExceptions
+ nativeImage.add("--userns=keep-id");
}
- } else if ("podman".equals(containerRuntime)) {
- // Needed to avoid AccessDeniedExceptions
- nativeImage.add("--userns=keep-id");
}
}
nativeConfig.containerRuntimeOptions.ifPresent(nativeImage::addAll); | ['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,390,568 | 2,022,399 | 270,325 | 2,883 | 986 | 194 | 15 | 1 | 2,418 | 196 | 656 | 33 | 3 | 1 | 1970-01-01T00:26:36 | 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 |
3,002 | quarkusio/quarkus/11015/11007 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/11007 | https://github.com/quarkusio/quarkus/pull/11015 | https://github.com/quarkusio/quarkus/pull/11015 | 1 | fixes | Qute dev-mode Classloader issue | **Describe the bug**
Getting java.lang.NoClassDefFoundError when running Qute project with a separate jar dependency in dev-mode.
Was OK in 1.5.2 but failing in 1.6.1 (1.6.0 not tested).
Reproducer attached.
**To Reproduce**
Reproducer is a parent pom with two modules. One is a jar library. The other is a Quarkus REST service:
- tar xvf qute-classloader-issue.tar
- cd qute-classloader-issue
- mvn clean install
- cd getting_started
- mvn quarkus:dev
- curl -w “\\n” http://localhost:8080/hello
It will fail. Change the quarkus version in getting-started/pom.xml to 1.5.2.Final and it works.
[qute-classloader-issue.tar.zip](https://github.com/quarkusio/quarkus/files/4985086/qute-classloader-issue.tar.zip) | 94af236f064f39749d6c0af1b06597a630c02fce | 35d94fca7bc310925bfda9d5517bb935871facd1 | https://github.com/quarkusio/quarkus/compare/94af236f064f39749d6c0af1b06597a630c02fce...35d94fca7bc310925bfda9d5517bb935871facd1 | 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 5efef354c22..24fc53d6f55 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
@@ -56,6 +56,7 @@
import io.quarkus.arc.processor.BuildExtension;
import io.quarkus.arc.processor.DotNames;
import io.quarkus.arc.processor.InjectionPointInfo;
+import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.deployment.ApplicationArchive;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.GeneratedClassGizmoAdaptor;
@@ -700,15 +701,13 @@ public boolean test(String name) {
if (idx == -1) {
idx = name.lastIndexOf(ValueResolverGenerator.SUFFIX);
}
- String className = name.substring(0, idx).replace("/", ".");
+ String className = name.substring(0, idx);
if (className.contains(ValueResolverGenerator.NESTED_SEPARATOR)) {
className = className.replace(ValueResolverGenerator.NESTED_SEPARATOR, "$");
}
- if (applicationArchivesBuildItem.getRootArchive().getIndex()
- .getClassByName(DotName.createSimple(className)) != null) {
- return true;
- }
- return false;
+ //if the class is (directly) in the TCCL (and not its parent) then it is an application class
+ QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
+ return !cl.getElementsWithResource(className + ".class", true).isEmpty();
}
});
| ['extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,331,170 | 2,010,727 | 268,769 | 2,861 | 758 | 139 | 11 | 1 | 733 | 88 | 208 | 20 | 2 | 0 | 1970-01-01T00:26: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 |
3,003 | quarkusio/quarkus/11014/10960 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10960 | https://github.com/quarkusio/quarkus/pull/11014 | https://github.com/quarkusio/quarkus/pull/11014 | 1 | fixes | Produced MIME type declaration not honoured in reactive routes | With Quarkus 1.6.1.Final and the following reactive routes code:
```java
@ApplicationScoped
public class Routes {
@Route(methods = HttpMethod.GET, path = "/hello", produces = "text/plain")
void hello(RoutingContext context) {
context.response().end("hello");
}
@Route(methods = HttpMethod.GET, path = "/hi/:name", produces = "application/json")
void hi(RoutingExchange routing) {
String name = routing.getParam("name").orElse("what?");
routing.ok(new JsonObject()
.put("name", name)
.put("timestamp", System.currentTimeMillis()).encode());
}
}
```
then the produced MIME content is not honoured (the `Content-Type` header is missing), see:
```
$ http :8080/hi/mrbean
HTTP/1.1 200 OK
content-length: 43
{"name":"mrbean","timestamp":1595608877519}
```
and:
```
$ http :8080/hello
HTTP/1.1 200 OK
content-length: 5
hello
``` | 7ef59777b6db4376bc4ecc12f1d13123b3605200 | e28b6125c680f5c8443026d324f399fefa71e308 | https://github.com/quarkusio/quarkus/compare/7ef59777b6db4376bc4ecc12f1d13123b3605200...e28b6125c680f5c8443026d324f399fefa71e308 | diff --git a/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/Methods.java b/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/Methods.java
index ed63d6c1eb4..24530fad50f 100644
--- a/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/Methods.java
+++ b/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/Methods.java
@@ -163,7 +163,7 @@ class Methods {
static final MethodDescriptor OBJECT_CONSTRUCTOR = MethodDescriptor.ofConstructor(Object.class);
static final MethodDescriptor ROUTE_HANDLERS_SET_CONTENT_TYPE = MethodDescriptor
- .ofMethod(RouteHandlers.class, "setContentType", void.class, RoutingContext.class);
+ .ofMethod(RouteHandlers.class, "setContentType", void.class, RoutingContext.class, String.class);
static final MethodDescriptor OPTIONAL_OF_NULLABLE = MethodDescriptor
.ofMethod(Optional.class, "ofNullable", Optional.class, Object.class);
diff --git a/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java b/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java
index e5bf83a03fa..404c6040a21 100644
--- a/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java
+++ b/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java
@@ -232,14 +232,6 @@ void addAdditionalRoutes(
for (AnnotationInstance route : businessMethod.getRoutes()) {
String routeString = route.toString(true);
Handler<RoutingContext> routeHandler = routeHandlers.get(routeString);
- if (routeHandler == null) {
- String handlerClass = generateHandler(new HandlerDescriptor(businessMethod.getMethod()),
- businessMethod.getBean(), businessMethod.getMethod(), classOutput, transformedAnnotations,
- routeString, reflectiveHierarchy);
- reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, handlerClass));
- routeHandler = recorder.createHandler(handlerClass);
- routeHandlers.put(routeString, routeHandler);
- }
AnnotationValue regexValue = route.value(VALUE_REGEX);
AnnotationValue pathValue = route.value(VALUE_PATH);
@@ -252,6 +244,7 @@ void addAdditionalRoutes(
String regex = null;
String[] produces = producesValue.asStringArray();
String[] consumes = consumesValue.asStringArray();
+
HttpMethod[] methods = Arrays.stream(methodsValue.asEnumArray()).map(HttpMethod::valueOf)
.toArray(HttpMethod[]::new);
Integer order = orderValue.asInt();
@@ -287,6 +280,15 @@ void addAdditionalRoutes(
consumes = baseConsumes;
}
+ if (routeHandler == null) {
+ String handlerClass = generateHandler(new HandlerDescriptor(businessMethod.getMethod()),
+ businessMethod.getBean(), businessMethod.getMethod(), classOutput, transformedAnnotations,
+ routeString, reflectiveHierarchy, produces.length > 0 ? produces[0] : null);
+ reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, handlerClass));
+ routeHandler = recorder.createHandler(handlerClass);
+ routeHandlers.put(routeString, routeHandler);
+ }
+
RouteMatcher matcher = new RouteMatcher(path, regex, produces, consumes, methods, order);
matchers.put(matcher, businessMethod.getMethod());
Function<Router, io.vertx.ext.web.Route> routeFunction = recorder.createRouteFunction(matcher,
@@ -316,7 +318,7 @@ void addAdditionalRoutes(
for (AnnotatedRouteFilterBuildItem filterMethod : routeFilterBusinessMethods) {
String handlerClass = generateHandler(new HandlerDescriptor(filterMethod.getMethod()),
filterMethod.getBean(), filterMethod.getMethod(), classOutput, transformedAnnotations,
- filterMethod.getRouteFilter().toString(true), reflectiveHierarchy);
+ filterMethod.getRouteFilter().toString(true), reflectiveHierarchy, null);
reflectiveClasses.produce(new ReflectiveClassBuildItem(false, false, handlerClass));
Handler<RoutingContext> routingHandler = recorder.createHandler(handlerClass);
AnnotationValue priorityValue = filterMethod.getRouteFilter().value();
@@ -408,7 +410,7 @@ private void validateRouteMethod(BeanInfo bean, MethodInfo method, TransformedAn
private String generateHandler(HandlerDescriptor desc, BeanInfo bean, MethodInfo method, ClassOutput classOutput,
TransformedAnnotationsBuildItem transformedAnnotations, String hashSuffix,
- BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy) {
+ BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, String defaultProduces) {
String baseName;
if (bean.getImplClazz().enclosingClass() != null) {
@@ -446,7 +448,7 @@ private String generateHandler(HandlerDescriptor desc, BeanInfo bean, MethodInfo
implementConstructor(bean, invokerCreator, beanField, contextField, containerField);
implementInvoke(desc, bean, method, invokerCreator, beanField, contextField, containerField, transformedAnnotations,
- reflectiveHierarchy);
+ reflectiveHierarchy, defaultProduces);
invokerCreator.close();
return generatedName.replace('/', '.');
@@ -482,7 +484,7 @@ void implementConstructor(BeanInfo bean, ClassCreator invokerCreator, FieldCreat
void implementInvoke(HandlerDescriptor descriptor, BeanInfo bean, MethodInfo method, ClassCreator invokerCreator,
FieldCreator beanField, FieldCreator contextField, FieldCreator containerField,
TransformedAnnotationsBuildItem transformedAnnotations,
- BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy) {
+ BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, String defaultProduces) {
// The descriptor is: void invoke(RoutingContext rc)
MethodCreator invoke = invokerCreator.getMethodCreator("invoke", void.class, RoutingContext.class);
ResultHandle beanHandle = invoke.readInstanceField(beanField.getFieldDescriptor(), invoke.getThis());
@@ -544,12 +546,14 @@ void implementInvoke(HandlerDescriptor descriptor, BeanInfo bean, MethodInfo met
MethodDescriptor methodDescriptor = MethodDescriptor
.ofMethod(bean.getImplClazz().name().toString(), method.name(), returnType, parameterTypes);
+ // If no content-type header is set then try to use the most acceptable content type
+ // the business method can override this manually if required
+ invoke.invokeStaticMethod(Methods.ROUTE_HANDLERS_SET_CONTENT_TYPE, routingContext,
+ defaultProduces == null ? invoke.loadNull() : invoke.load(defaultProduces));
+
// Invoke the business method handler
ResultHandle res = invoke.invokeVirtualMethod(methodDescriptor, beanInstanceHandle, paramHandles);
- // If no content-type header is set then try to use the most acceptable content type
- invoke.invokeStaticMethod(Methods.ROUTE_HANDLERS_SET_CONTENT_TYPE, routingContext);
-
// Get the response: HttpServerResponse response = rc.response()
MethodDescriptor end = Methods.getEndMethodForContentType(descriptor);
if (descriptor.isReturningUni()) {
diff --git a/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SyncRouteTest.java b/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SyncRouteTest.java
index 8357a73d2ed..de9c6dae80c 100644
--- a/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SyncRouteTest.java
+++ b/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SyncRouteTest.java
@@ -3,13 +3,26 @@
import static io.restassured.RestAssured.when;
import static org.hamcrest.Matchers.*;
+import java.net.URL;
+
+import javax.json.Json;
+import javax.json.JsonObject;
+import javax.json.stream.JsonParser;
+
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClientBuilder;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import io.quarkus.test.QuarkusUnitTest;
+import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.vertx.web.Route;
+import io.quarkus.vertx.web.RoutingExchange;
import io.vertx.core.buffer.Buffer;
import io.vertx.ext.web.RoutingContext;
@@ -19,6 +32,9 @@ public class SyncRouteTest {
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class).addClasses(SimpleBean.class));
+ @TestHTTPResource
+ URL url;
+
@Test
public void testSynchronousRoute() {
when().get("hello-sync").then().statusCode(200)
@@ -49,6 +65,21 @@ public void testSynchronousRoute() {
.body(containsString("boom"));
}
+ //https://github.com/quarkusio/quarkus/issues/10960
+ @Test
+ public void testNoAcceptHeaderContentType() throws Exception {
+ //RESTAssured always sets an Accept header
+ try (CloseableHttpClient client = HttpClientBuilder.create().build()) {
+ CloseableHttpResponse res = client.execute(new HttpGet(this.url.toExternalForm() + "/default-content-type"));
+ JsonParser parser = Json.createParser(res.getEntity().getContent());
+ parser.next();
+ JsonObject obj = parser.getObject();
+ Assertions.assertEquals("neo", obj.getString("name"));
+ Assertions.assertEquals(12345, obj.getInt("id"));
+ Assertions.assertEquals("application/json", res.getFirstHeader("content-type").getValue());
+ }
+ }
+
static class SimpleBean {
@Route(path = "hello-sync")
@@ -87,6 +118,13 @@ Person getPersonUtf8(RoutingContext context) {
return new Person("neo", 12345);
}
+ @Route(path = "default-content-type", produces = "application/json")
+ void hi(RoutingExchange routing) {
+ routing.ok(new io.vertx.core.json.JsonObject()
+ .put("name", "neo")
+ .put("id", 12345).encode());
+ }
+
}
static class Person {
diff --git a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/Route.java b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/Route.java
index 634e29dc110..19a460b6e5f 100644
--- a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/Route.java
+++ b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/Route.java
@@ -110,7 +110,7 @@
/**
* If set to a positive number, it indicates the place of the route in the chain.
*
- * @see io.vertx.ext.web.Route#order()
+ * @see io.vertx.ext.web.Route#order(int)
*/
int order() default 0;
@@ -118,6 +118,9 @@
* Used for content-based routing.
* <p>
* If no {@code Content-Type} header is set then try to use the most acceptable content type.
+ *
+ * If the request does not contain an 'Accept' header and no content type is explicitly set in the
+ * handler then the content type will be set to the first content type in the array.
*
* @see io.vertx.ext.web.Route#produces(String)
* @see RoutingContext#getAcceptableContentType()
diff --git a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/RouteHandlers.java b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/RouteHandlers.java
index a2f37cac5b3..7bc476142e6 100644
--- a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/RouteHandlers.java
+++ b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/RouteHandlers.java
@@ -5,6 +5,7 @@
import io.quarkus.arc.Arc;
import io.quarkus.arc.impl.LazyValue;
import io.quarkus.security.identity.SecurityIdentity;
+import io.vertx.core.Handler;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.ext.web.RoutingContext;
@@ -18,14 +19,22 @@ private RouteHandlers() {
private static final LazyValue<Event<SecurityIdentity>> SECURITY_IDENTITY_EVENT = new LazyValue<>(
RouteHandlers::createEvent);
- public static void setContentType(RoutingContext context) {
+ public static void setContentType(RoutingContext context, String defaultContentType) {
HttpServerResponse response = context.response();
- if (response.headers().get(CONTENT_TYPE) == null) {
- String acceptableContentType = context.getAcceptableContentType();
- if (acceptableContentType != null) {
- response.putHeader(CONTENT_TYPE, acceptableContentType);
+ context.addHeadersEndHandler(new Handler<Void>() {
+ @Override
+ public void handle(Void aVoid) {
+ //use a listener to set the content type if it has not been set
+ if (response.headers().get(CONTENT_TYPE) == null) {
+ String acceptableContentType = context.getAcceptableContentType();
+ if (acceptableContentType != null) {
+ response.putHeader(CONTENT_TYPE, acceptableContentType);
+ } else if (defaultContentType != null) {
+ response.putHeader(CONTENT_TYPE, defaultContentType);
+ }
+ }
}
- }
+ });
}
static void fireSecurityIdentity(SecurityIdentity identity) { | ['extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/Methods.java', 'extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java', 'extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SyncRouteTest.java', 'extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/Route.java', 'extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/RouteHandlers.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 10,341,953 | 2,012,686 | 268,965 | 2,863 | 4,109 | 702 | 62 | 4 | 949 | 93 | 238 | 40 | 0 | 3 | 1970-01-01T00:26: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 |
3,004 | quarkusio/quarkus/11011/10813 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10813 | https://github.com/quarkusio/quarkus/pull/11011 | https://github.com/quarkusio/quarkus/pull/11011 | 1 | fixes | Resource not closed warning with rest client | This is a bit hard to reproduce for me. Like in #10804 I am doing remote calls via the MP Rest Client
```
@Inject
@RestClient
RbacServer rbac;
...
try {
result = getRbacInfo(user.getRawRhIdHeader());
} catch (Throwable e) {
...
@CacheResult(cacheName = "rbac-cache")
RbacRaw getRbacInfo(String xrhidHeader) {
RbacRaw result;
result = rbac.getRbacInfo("policies", xrhidHeader); // <---
return result;
}
```
And I get (not always) the following in the logs:
`2020-07-17 16:58:30,999 WARN [org.jbo.res.cli.jax.i18n] (Finalizer) RESTEASY004687: Closing a class org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine instance for you. Please close clients yourself.
`
Locally I could reproduce it now with the remote service returning a 401, but I also see that on our production instance, where I do not see any errors from the remote call.
```
2020-07-17 17:38:59,103 WARNING [RbacFilter] (executor-thread-1) Call to RBAC took 1301ms
2020-07-17 17:38:59,102 WARNING [com.git.ben.caf.cac.LocalAsyncCache] (Thread-13) Exception thrown during asynchronous load: java.util.concurrent.CompletionException: javax.ws.rs.WebApplicationException: Unknown error, status code 401
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$AsyncSupply.run(CompletableFuture.java:1702)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.ws.rs.WebApplicationException: Unknown error, status code 401
at org.jboss.resteasy.microprofile.client.DefaultResponseExceptionMapper.toThrowable(DefaultResponseExceptionMapper.java:16)
at org.jboss.resteasy.microprofile.client.ExceptionMapping$HandlerException.mapException(ExceptionMapping.java:38)
at org.jboss.resteasy.microprofile.client.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:151)
at com.sun.proxy.$Proxy75.getRbacInfo(Unknown Source)
at com.redhat.cloud.policies.app.auth.RbacFilter.getRbacInfo(RbacFilter.java:95)
at com.redhat.cloud.policies.app.auth.RbacFilter_Subclass.getRbacInfo$$superaccessor1(RbacFilter_Subclass.zig:205)
at com.redhat.cloud.policies.app.auth.RbacFilter_Subclass$$function$$1.apply(RbacFilter_Subclass$$function$$1.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.cache.runtime.CacheResultInterceptor.lambda$intercept$0(CacheResultInterceptor.java:27)
at io.quarkus.cache.runtime.caffeine.CaffeineCache$MappingSupplier.get(CaffeineCache.java:136)
at io.quarkus.cache.runtime.caffeine.CaffeineCache.lambda$get$0(CaffeineCache.java:58)
at com.github.benmanes.caffeine.cache.LocalAsyncCache.lambda$get$0(LocalAsyncCache.java:77)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
... 1 more
{"date":"Fri, 17 Jul 2020 15:38:57 GMT","method":"GET","uri":"/api/policies/v1.0/policies/123","acct":"901578","http_version":"HTTP/1.1","status":403,"content_length":0,"duration":1318,"user_agent":"curl/7.54.0","remote":"0:0:0:0:0:0:0:1"}
2020-07-17 17:39:09,854 WARN [org.jbo.res.cli.jax.i18n] (Finalizer) RESTEASY004687: Closing a class org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient43Engine instance for you. Please close clients yourself.
```
Commenting out the `@CacheResult()` makes the warning/stack trace go away, but still shows the Finalizer-warning.
| 602bc3c77b1de91f48aaf8d7abc1f4aba93b3710 | 70099e7f89a51c0903d41f4a0446cd8155826591 | https://github.com/quarkusio/quarkus/compare/602bc3c77b1de91f48aaf8d7abc1f4aba93b3710...70099e7f89a51c0903d41f4a0446cd8155826591 | diff --git a/extensions/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java b/extensions/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java
index 60e9667279c..ff9674ec6df 100644
--- a/extensions/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java
+++ b/extensions/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java
@@ -44,6 +44,7 @@
import org.jboss.resteasy.microprofile.client.async.AsyncInterceptorRxInvokerProvider;
import org.jboss.resteasy.spi.ResteasyConfiguration;
+import io.quarkus.arc.BeanDestroyer;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanContainerListenerBuildItem;
import io.quarkus.arc.deployment.BeanRegistrarBuildItem;
@@ -218,6 +219,7 @@ public void register(RegistrationContext registrationContext) {
MethodDescriptor.ofMethod(RestClientBase.class, "create", Object.class), baseHandle);
m.returnValue(ret);
});
+ configurator.destroyer(BeanDestroyer.CloseableDestroyer.class);
configurator.done();
}
}
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
index 0b9f2097096..ec88d6e85c3 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java
@@ -224,7 +224,7 @@ public <U extends T> B destroyer(Class<? extends BeanDestroyer<U>> destroyerClaz
ResultHandle destoyerHandle = mc.newInstance(MethodDescriptor.ofConstructor(destroyerClazz));
ResultHandle[] params = { mc.getMethodParam(0), mc.getMethodParam(1), paramsHandle };
mc.invokeInterfaceMethod(
- MethodDescriptor.ofMethod(BeanDestroyer.class, "destroy", Void.class, Object.class, CreationalContext.class,
+ MethodDescriptor.ofMethod(BeanDestroyer.class, "destroy", void.class, Object.class, CreationalContext.class,
Map.class),
destoyerHandle, params);
mc.returnValue(null);
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java
index 84745960c68..46958c80e32 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java
@@ -283,7 +283,7 @@ boolean hasDefaultDestroy() {
return getLifecycleInterceptors(InterceptionType.PRE_DESTROY).isEmpty()
&& Beans.getCallbacks(target.get().asClass(), DotNames.PRE_DESTROY, beanDeployment.getIndex()).isEmpty();
} else {
- return disposer == null;
+ return disposer == null && destroyerConsumer == null;
}
}
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanDestroyer.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanDestroyer.java
index f622c382e70..f5580f3e15b 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanDestroyer.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanDestroyer.java
@@ -1,5 +1,7 @@
package io.quarkus.arc;
+import java.io.Closeable;
+import java.io.IOException;
import java.util.Map;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
@@ -20,4 +22,15 @@
*/
void destroy(T instance, CreationalContext<T> creationalContext, Map<String, Object> params);
+ class CloseableDestroyer implements BeanDestroyer<Closeable> {
+ @Override
+ public void destroy(Closeable instance, CreationalContext<Closeable> creationalContext, Map<String, Object> params) {
+ try {
+ instance.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
+
}
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 91a4b1d05f4..544126979f1 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
@@ -10,6 +10,7 @@
import io.quarkus.arc.Arc;
import io.quarkus.arc.BeanCreator;
+import io.quarkus.arc.BeanDestroyer;
import io.quarkus.arc.processor.BeanConfigurator;
import io.quarkus.arc.processor.BeanInfo;
import io.quarkus.arc.processor.BeanRegistrar;
@@ -25,17 +26,27 @@
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.util.AnnotationLiteral;
import javax.inject.Qualifier;
+import javax.inject.Singleton;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
public class BeanRegistrarTest {
+ public static volatile boolean beanDestroyerInvoked = false;
+
@RegisterExtension
public ArcTestContainer container = ArcTestContainer.builder()
.beanClasses(UselessBean.class, MyQualifier.class, NextQualifier.class)
.removeUnusedBeans(true)
.beanRegistrars(new TestRegistrar()).build();
+ @AfterAll
+ public static void assertDestroyerInvoked() {
+ Assertions.assertTrue(beanDestroyerInvoked);
+ }
+
@SuppressWarnings("serial")
static class NextQualifierLiteral extends AnnotationLiteral<NextQualifier> implements NextQualifier {
@@ -85,6 +96,8 @@ public void register(RegistrationContext context) {
ResultHandle ret = mc.newInstance(MethodDescriptor.ofConstructor(Integer.class, int.class), mc.load(152));
mc.returnValue(ret);
});
+ integerConfigurator.destroyer(SimpleDestroyer.class);
+ integerConfigurator.scope(Singleton.class);
integerConfigurator.done();
context.configure(String.class).unremovable().types(String.class).param("name", "Frantisek")
@@ -107,6 +120,14 @@ public String create(CreationalContext<String> creationalContext, Map<String, Ob
}
+ public static class SimpleDestroyer implements BeanDestroyer<Integer> {
+
+ @Override
+ public void destroy(Integer instance, CreationalContext<Integer> creationalContext, Map<String, Object> params) {
+ beanDestroyerInvoked = true;
+ }
+ }
+
@Qualifier
@Inherited
@Target({ TYPE, METHOD, FIELD, PARAMETER }) | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanConfiguratorBase.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/buildextension/beans/BeanRegistrarTest.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanDestroyer.java', 'extensions/rest-client/deployment/src/main/java/io/quarkus/restclient/deployment/RestClientProcessor.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 10,331,170 | 2,010,727 | 268,769 | 2,861 | 930 | 179 | 19 | 4 | 3,716 | 232 | 966 | 57 | 0 | 2 | 1970-01-01T00:26: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 |
3,005 | quarkusio/quarkus/10985/10963 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10963 | https://github.com/quarkusio/quarkus/pull/10985 | https://github.com/quarkusio/quarkus/pull/10985 | 1 | resolves | Can't inject ManagedExecutor since quarkus 1.6.0 | **Describe the bug**
I'm trying to inject a ManagedExecutor (using Kotlin and injecting into `@Singleton` bean that extends `MutinyExampleServiceGrpc.ExampleServiceImplBase` if that matters) and get
```
Parameter specified as non-null is null: method com.example.Example.<init>, parameter managedExecutor"
```
I tried both constructor injection as well as field injection via `lateinit var`
**Expected behavior**
ManagedExecutor is injected
**Actual behavior**
ManagedExecutor is not injected to my bean (both 1.6.0.Final and 1.6.1.Final)
But it's injected successfully if I change the version to 1.5.2.Final
| 3747a78a4ff9b5e4091b37eb5602ad2b132fe643 | 26f1fda51a37c5215f779fbe4a9c76eb0cccde03 | https://github.com/quarkusio/quarkus/compare/3747a78a4ff9b5e4091b37eb5602ad2b132fe643...26f1fda51a37c5215f779fbe4a9c76eb0cccde03 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/ManagedExecutorInitializedBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/ManagedExecutorInitializedBuildItem.java
index 702b54664a0..420a78500f7 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/ManagedExecutorInitializedBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/ManagedExecutorInitializedBuildItem.java
@@ -37,6 +37,9 @@
* }
* </pre>
* </p>
+ *
+ * @deprecated This build item should not be needed anymore and will be removed at some point after Quarkus 1.7.
*/
+@Deprecated
public final class ManagedExecutorInitializedBuildItem extends SimpleBuildItem {
}
diff --git a/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/CacheProcessor.java b/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/CacheProcessor.java
index 355b1a9140d..4358b4d236b 100644
--- a/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/CacheProcessor.java
+++ b/extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/CacheProcessor.java
@@ -10,7 +10,6 @@
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
-import java.util.Optional;
import java.util.Set;
import javax.enterprise.inject.spi.DeploymentException;
@@ -38,7 +37,6 @@
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.builditem.ManagedExecutorInitializedBuildItem;
class CacheProcessor {
@@ -80,8 +78,7 @@ ValidationErrorBuildItem validateBeanDeployment(ValidationPhaseBuildItem validat
@Record(RUNTIME_INIT)
void recordCachesBuild(CombinedIndexBuildItem combinedIndex, BeanContainerBuildItem beanContainer, CacheConfig config,
CaffeineCacheBuildRecorder caffeineRecorder,
- List<AdditionalCacheNameBuildItem> additionalCacheNames,
- Optional<ManagedExecutorInitializedBuildItem> managedExecutorInitialized) {
+ List<AdditionalCacheNameBuildItem> additionalCacheNames) {
Set<String> cacheNames = getCacheNames(combinedIndex.getIndex());
for (AdditionalCacheNameBuildItem additionalCacheName : additionalCacheNames) {
cacheNames.add(additionalCacheName.getName());
@@ -89,7 +86,7 @@ void recordCachesBuild(CombinedIndexBuildItem combinedIndex, BeanContainerBuildI
switch (config.type) {
case CacheDeploymentConstants.CAFFEINE_CACHE_TYPE:
Set<CaffeineCacheInfo> cacheInfos = CaffeineCacheInfoBuilder.build(cacheNames, config);
- caffeineRecorder.buildCaches(managedExecutorInitialized.isPresent(), beanContainer.getValue(), cacheInfos);
+ caffeineRecorder.buildCaches(beanContainer.getValue(), cacheInfos);
break;
default:
throw new DeploymentException("Unknown cache type: " + config.type);
diff --git a/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/caffeine/CaffeineCacheBuildRecorder.java b/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/caffeine/CaffeineCacheBuildRecorder.java
index 9910264a872..3c06dc89e71 100644
--- a/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/caffeine/CaffeineCacheBuildRecorder.java
+++ b/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/caffeine/CaffeineCacheBuildRecorder.java
@@ -7,6 +7,7 @@
import org.eclipse.microprofile.context.ManagedExecutor;
import org.jboss.logging.Logger;
+import io.quarkus.arc.Arc;
import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.cache.runtime.CacheRepository;
import io.quarkus.runtime.annotations.Recorder;
@@ -16,15 +17,12 @@ public class CaffeineCacheBuildRecorder {
private static final Logger LOGGER = Logger.getLogger(CaffeineCacheBuildRecorder.class);
- public void buildCaches(boolean managedExecutorInitialized, BeanContainer beanContainer,
+ public void buildCaches(BeanContainer beanContainer,
Set<CaffeineCacheInfo> cacheInfos) {
// The number of caches is known at build time so we can use fixed initialCapacity and loadFactor for the caches map.
Map<String, CaffeineCache> caches = new HashMap<>(cacheInfos.size() + 1, 1.0F);
- ManagedExecutor managedExecutor = null;
- if (managedExecutorInitialized) {
- managedExecutor = beanContainer.instance(ManagedExecutor.class);
- }
+ ManagedExecutor managedExecutor = Arc.container().instance(ManagedExecutor.class).orElse(null);
for (CaffeineCacheInfo cacheInfo : cacheInfos) {
if (LOGGER.isDebugEnabled()) {
diff --git a/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java b/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
index b293b0f93df..6d59bfbb87e 100644
--- a/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
+++ b/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
@@ -4,12 +4,14 @@
import java.util.ArrayList;
import java.util.List;
+import javax.inject.Singleton;
+
+import org.eclipse.microprofile.context.ManagedExecutor;
import org.eclipse.microprofile.context.spi.ContextManagerExtension;
import org.eclipse.microprofile.context.spi.ThreadContextProvider;
-import org.jboss.logging.Logger;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
-import io.quarkus.arc.deployment.BeanContainerBuildItem;
+import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
import io.quarkus.deployment.Feature;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
@@ -26,7 +28,6 @@
* The deployment processor for MP-CP applications
*/
class SmallRyeContextPropagationProcessor {
- private static final Logger log = Logger.getLogger(SmallRyeContextPropagationProcessor.class.getName());
@BuildStep
void registerBean(BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
@@ -65,13 +66,21 @@ void buildStatic(SmallRyeContextPropagationRecorder recorder)
@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
void build(SmallRyeContextPropagationRecorder recorder,
- BeanContainerBuildItem beanContainer,
ExecutorBuildItem executorBuildItem,
BuildProducer<FeatureBuildItem> feature,
- BuildProducer<ManagedExecutorInitializedBuildItem> managedExecutorInitialized) {
+ BuildProducer<ManagedExecutorInitializedBuildItem> managedExecutorInitialized,
+ BuildProducer<SyntheticBeanBuildItem> syntheticBeans) {
feature.produce(new FeatureBuildItem(Feature.SMALLRYE_CONTEXT_PROPAGATION));
- recorder.configureRuntime(beanContainer.getValue(), executorBuildItem.getExecutorProxy());
+ recorder.configureRuntime(executorBuildItem.getExecutorProxy());
+
+ // Synthetic bean for ManagedExecutor
+ syntheticBeans.produce(
+ SyntheticBeanBuildItem.configure(ManagedExecutor.class).scope(Singleton.class).defaultBean().unremovable()
+ .supplier(recorder.initializeManagedExecutor(executorBuildItem.getExecutorProxy()))
+ .setRuntimeInit().done());
+
+ // This should be removed at some point after Quarkus 1.7
managedExecutorInitialized.produce(new ManagedExecutorInitializedBuildItem());
}
}
diff --git a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationProvider.java b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationProvider.java
index 92b42cd539f..bdafe1a0d7b 100644
--- a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationProvider.java
+++ b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationProvider.java
@@ -1,40 +1,16 @@
package io.quarkus.smallrye.context.runtime;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-
-import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Produces;
-import javax.enterprise.inject.Typed;
import javax.inject.Singleton;
-import org.eclipse.microprofile.context.ManagedExecutor;
import org.eclipse.microprofile.context.ThreadContext;
import io.quarkus.arc.DefaultBean;
-import io.smallrye.context.SmallRyeManagedExecutor;
-import io.smallrye.context.SmallRyeThreadContext;
-@ApplicationScoped
+@Dependent
public class SmallRyeContextPropagationProvider {
- private volatile SmallRyeManagedExecutor managedExecutor;
-
- void initialize(ExecutorService executorService) {
- managedExecutor = new SmallRyeManagedExecutor(-1, -1, (SmallRyeThreadContext) getAllThreadContext(), executorService,
- "no-ip") {
- @Override
- public void shutdown() {
- throw new IllegalStateException("This executor is managed by the container and cannot be shut down.");
- }
-
- @Override
- public List<Runnable> shutdownNow() {
- throw new IllegalStateException("This executor is managed by the container and cannot be shut down.");
- }
- };
- }
-
@Produces
@Singleton
@DefaultBean
@@ -42,12 +18,4 @@ public ThreadContext getAllThreadContext() {
return ThreadContext.builder().propagated(ThreadContext.ALL_REMAINING).cleared().unchanged().build();
}
- @Typed(ManagedExecutor.class)
- @Produces
- @Singleton
- @DefaultBean
- public ManagedExecutor getAllManagedExecutor() {
- return managedExecutor;
- }
-
}
diff --git a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java
index 9a56175b549..def1211fa46 100644
--- a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java
+++ b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java
@@ -2,15 +2,19 @@
import java.util.List;
import java.util.concurrent.ExecutorService;
+import java.util.function.Supplier;
+import org.eclipse.microprofile.context.ThreadContext;
import org.eclipse.microprofile.context.spi.ContextManagerExtension;
import org.eclipse.microprofile.context.spi.ContextManagerProvider;
import org.eclipse.microprofile.context.spi.ThreadContextProvider;
-import io.quarkus.arc.runtime.BeanContainer;
+import io.quarkus.arc.Arc;
import io.quarkus.runtime.annotations.Recorder;
import io.smallrye.context.SmallRyeContextManager;
import io.smallrye.context.SmallRyeContextManagerProvider;
+import io.smallrye.context.SmallRyeManagedExecutor;
+import io.smallrye.context.SmallRyeThreadContext;
/**
* The runtime value service used to create values related to the MP-JWT services
@@ -36,7 +40,7 @@ public void configureStaticInit(List<ThreadContextProvider> discoveredProviders,
builder.withContextManagerExtensions(discoveredExtensions.toArray(new ContextManagerExtension[0]));
}
- public void configureRuntime(BeanContainer container, ExecutorService executorService) {
+ public void configureRuntime(ExecutorService executorService) {
// associate the static init manager to the runtime CL
ContextManagerProvider contextManagerProvider = ContextManagerProvider.instance();
// finish building our manager
@@ -45,9 +49,26 @@ public void configureRuntime(BeanContainer container, ExecutorService executorSe
SmallRyeContextManager contextManager = builder.build();
contextManagerProvider.registerContextManager(contextManager, Thread.currentThread().getContextClassLoader());
+ }
+
+ public Supplier<Object> initializeManagedExecutor(ExecutorService executorService) {
+ return new Supplier<Object>() {
+ @Override
+ public Object get() {
+ ThreadContext threadContext = Arc.container().instance(ThreadContext.class).get();
+ return new SmallRyeManagedExecutor(-1, -1, (SmallRyeThreadContext) threadContext, executorService,
+ "no-ip") {
+ @Override
+ public void shutdown() {
+ throw new IllegalStateException("This executor is managed by the container and cannot be shut down.");
+ }
- // initialise injection
- SmallRyeContextPropagationProvider cpProvider = container.instance(SmallRyeContextPropagationProvider.class);
- cpProvider.initialize(executorService);
+ @Override
+ public List<Runnable> shutdownNow() {
+ throw new IllegalStateException("This executor is managed by the container and cannot be shut down.");
+ }
+ };
+ }
+ };
}
}
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceHandle.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceHandle.java
index ed421f38ee2..abcfd67f37a 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceHandle.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceHandle.java
@@ -26,6 +26,18 @@ default boolean isAvailable() {
return get() != null;
}
+ /**
+ * If an instance is available, returns the value, otherwise returns
+ * {@code other}.
+ *
+ * @param other
+ * @return the instance if available, otherwise {@code other}
+ */
+ default T orElse(T other) {
+ T val = get();
+ return val != null ? val : other;
+ }
+
/**
* Destroy the instance as defined by
* {@link javax.enterprise.context.spi.Contextual#destroy(Object, javax.enterprise.context.spi.CreationalContext)}. If this | ['extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/caffeine/CaffeineCacheBuildRecorder.java', 'extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java', 'extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java', 'extensions/cache/deployment/src/main/java/io/quarkus/cache/deployment/CacheProcessor.java', 'extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationProvider.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceHandle.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/ManagedExecutorInitializedBuildItem.java'] | {'.java': 7} | 7 | 7 | 0 | 0 | 7 | 10,327,792 | 2,010,170 | 268,677 | 2,861 | 5,612 | 1,026 | 118 | 7 | 625 | 78 | 147 | 14 | 0 | 1 | 1970-01-01T00:26: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 |
3,006 | quarkusio/quarkus/10974/10972 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10972 | https://github.com/quarkusio/quarkus/pull/10974 | https://github.com/quarkusio/quarkus/pull/10974 | 1 | fixes | io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1 when refreshing a page | **Describe the bug**
When refreshing a page that is already processing something, the following error appears in the logs:
```java
2020-07-26 21:59:17,015 WARN [io.net.cha.AbstractChannelHandlerContext] (vert.x-eventloop-thread-8) Failed to mark a promise as failure because it has failed already: DefaultChannelPromise@3e14144f(failure: java.nio.channels.ClosedChannelException), unnotified cause: java.nio.channels.ClosedChannelException
at io.netty.channel.AbstractChannel$AbstractUnsafe.newClosedChannelException(AbstractChannel.java:957)
at io.netty.channel.AbstractChannel$AbstractUnsafe.write(AbstractChannel.java:865)
at io.netty.channel.DefaultChannelPipeline$HeadContext.write(DefaultChannelPipeline.java:1367)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:767)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:767)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:767)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
at io.vertx.core.net.impl.ConnectionBase.write(ConnectionBase.java:124)
at io.vertx.core.net.impl.ConnectionBase.lambda$queueForWrite$2(ConnectionBase.java:215)
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.base/java.lang.Thread.run(Thread.java:834)
: io.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1
at io.netty.util.internal.ReferenceCountUpdater.toLiveRealRefCnt(ReferenceCountUpdater.java:74)
at io.netty.util.internal.ReferenceCountUpdater.release(ReferenceCountUpdater.java:138)
at io.netty.buffer.AbstractReferenceCountedByteBuf.release(AbstractReferenceCountedByteBuf.java:100)
at io.vertx.core.http.impl.AssembledHttpResponse.release(AssembledHttpResponse.java:159)
at io.netty.util.ReferenceCountUtil.release(ReferenceCountUtil.java:88)
at io.netty.channel.AbstractChannel$AbstractUnsafe.write(AbstractChannel.java:867)
at io.netty.channel.DefaultChannelPipeline$HeadContext.write(DefaultChannelPipeline.java:1367)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:767)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:767)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:767)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790)
at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758)
at io.vertx.core.net.impl.ConnectionBase.write(ConnectionBase.java:124)
at io.vertx.core.net.impl.ConnectionBase.lambda$queueForWrite$2(ConnectionBase.java:215)
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.base/java.lang.Thread.run(Thread.java:834)
```
**Expected behavior**
No error in the logs
**Actual behavior**
Error (although harmless) appears in the logs
**To Reproduce**
Steps to reproduce the behavior:
1. Clone https://github.com/gastaldi/quarkus-backports/tree/graphql
2. Go to http://localhost:8080/backports/1.1.0.Final/
3. Before the page is rendered, hit refresh in your browser. You should see the error in the logs
**Configuration**
Create an `.env` file in the project root with the following content:
```properties
BACKPORTS_TOKEN=<YOUR_GITHUB_TOKEN>
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Fedora 32
- Output of `java -version`:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment 18.9 (build 11.0.6+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.6+10, mixed mode)
- GraalVM version (if different from Java): Not used
- Quarkus version or git rev: 1.6.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/ggastald/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.6, vendor: Oracle Corporation, runtime: /home/ggastald/.sdkman/candidates/java/11.0.6-open
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.7.8-200.fc32.x86_64", arch: "amd64", family: "unix"
```
**Additional Context**
It happens with quarkus:dev and with java -jar too | a08136080482075fee83a4334a8120b83596e43f | dabf7484566267029c0da7dc2798cec92b03b5d0 | https://github.com/quarkusio/quarkus/compare/a08136080482075fee83a4334a8120b83596e43f...dabf7484566267029c0da7dc2798cec92b03b5d0 | diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java
index 804f383dcd2..217da8e6115 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java
@@ -106,16 +106,8 @@ public CompletionStage<Void> writeNonBlocking(ByteBuf data, boolean last) {
} else {
request.response().write(buffer, handler(ret));
}
- return ret.handle((v, t) -> {
- if (t != null) {
- if (data != null && data.refCnt() > 0) {
- data.release();
- }
- rethrow(new IOException("Failed to write", t));
- }
-
- return v;
- });
+ //no need to free 'data', the write will handle this
+ return ret;
}
private <T extends Throwable> void rethrow(Throwable x) throws T {
diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java
index 8f0276495e3..10a9191585c 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java
@@ -9,6 +9,7 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
+import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
@@ -32,6 +33,7 @@
import org.jboss.resteasy.spi.RunnableWithException;
import io.quarkus.arc.ManagedContext;
+import io.quarkus.runtime.BlockingOperationControl;
import io.vertx.core.Context;
import io.vertx.ext.web.RoutingContext;
@@ -56,6 +58,7 @@ public final class VertxHttpRequest extends BaseHttpRequest {
private final Context context;
private final ManagedContext requestContext;
private final ManagedContext.ContextState requestContextState;
+ private final Executor executor;
public VertxHttpRequest(Context context,
RoutingContext routingContext,
@@ -64,8 +67,11 @@ public VertxHttpRequest(Context context,
String httpMethod,
LazyHostSupplier remoteHost,
SynchronousDispatcher dispatcher,
- VertxHttpResponse response, ManagedContext requestContext) {
+ VertxHttpResponse response,
+ ManagedContext requestContext,
+ Executor executor) {
super(uri);
+ this.executor = executor;
this.context = context;
this.response = response;
this.httpHeaders = httpHeaders;
@@ -309,7 +315,16 @@ public void complete() {
done = true;
requestContext.activate(requestContextState);
requestContext.terminate();
- vertxFlush();
+ if (BlockingOperationControl.isBlockingAllowed()) {
+ vertxFlush();
+ } else {
+ executor.execute(new Runnable() {
+ @Override
+ public void run() {
+ vertxFlush();
+ }
+ });
+ }
}
}
diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxOutputStream.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxOutputStream.java
index c82387d3bba..ea3e339db0d 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxOutputStream.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxOutputStream.java
@@ -177,11 +177,7 @@ public CompletionStage<Void> asyncWrite(final byte[] b, final int off, final int
if (!buffer.isWritable()) {
ByteBuf tmpBuf = buffer;
this.pooledBuffer = buffer = allocator.allocateBuffer();
- ret = ret.thenCompose(v -> response.writeNonBlocking(tmpBuf, false)
- .whenComplete((v2, t) -> {
- if (t != null)
- tmpBuf.release();
- }));
+ ret = ret.thenCompose(v -> response.writeNonBlocking(tmpBuf, false));
}
}
return ret.thenCompose(v -> asyncUpdateWritten(len));
diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
index bc0f301a3b1..8f6a97b66bd 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
@@ -124,7 +124,7 @@ private void dispatch(RoutingContext routingContext, InputStream is, VertxOutput
VertxHttpRequest vertxRequest = new VertxHttpRequest(ctx, routingContext, headers, uriInfo, request.rawMethod(),
hostSupplier,
- dispatcher.getDispatcher(), vertxResponse, requestContext);
+ dispatcher.getDispatcher(), vertxResponse, requestContext, executor);
vertxRequest.setInputStream(is);
try {
ResteasyContext.pushContext(SecurityContext.class, new QuarkusResteasySecurityContext(request, routingContext)); | ['extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java', 'extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java', 'extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java', 'extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxOutputStream.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 10,327,113 | 2,010,119 | 268,670 | 2,861 | 1,713 | 277 | 39 | 4 | 7,210 | 331 | 1,546 | 101 | 2 | 3 | 1970-01-01T00:26: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 |
3,007 | quarkusio/quarkus/10973/10943 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10943 | https://github.com/quarkusio/quarkus/pull/10973 | https://github.com/quarkusio/quarkus/pull/10973 | 1 | fixes | Spring PathMatchingResourcePatternResolver does not return the subdirectory of a URL resource. | **Describe the bug**
I use `org.springframework.core.io.support.PathMatchingResourcePatternResolver` to find resources packaged inside a jar which are in a subdirectory.
When I do this in a normal Java application the resource that is found correctly looks like this:
URL [jar:file:/home/nbasjes/.m2/repository/org/acme/resourcelib/1.0-SNAPSHOT/resourcelib-1.0-SNAPSHOT.jar!/Content/world.txt]
yet when I run the exact same code in a Quarkus application it finds the file yet the returned resource does not have the subdirectory of the file.
URL [jar:file:/home/nbasjes/.m2/repository/org/acme/resourcelib/1.0-SNAPSHOT/resourcelib-1.0-SNAPSHOT.jar!/world.txt]
So the difference is that in the Quarkus setup the resource is not reported in the actual subdirectory it is really stored in.
Thus: loading the resource will fail with a file not found.
**Expected behavior**
The located resources are found in the correct place.
**Actual behavior**
The subdirectory name is missing in the path of the found resources.
**To Reproduce**
https://github.com/nielsbasjes/BugReport-SpringQuarkus-ResourceLoading
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Linux lw7-06766 4.4.0-185-generic #215-Ubuntu SMP Mon Jun 8 21:53:19 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux`
- Output of `java -version`: `openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 25.252-b09-jvmci-20.1-b02, mixed mode)`
- GraalVM version (if different from Java):
- Quarkus version or git rev: `1.6.1.Final`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): `Apache Maven 3.6.2`
**Additional context**
This was reported as a bug in the library I have written: https://github.com/nielsbasjes/yauaa/issues/216
| a08136080482075fee83a4334a8120b83596e43f | 8b9c78882ae0a7aedf79c87dccbc73c81fe2f7eb | https://github.com/quarkusio/quarkus/compare/a08136080482075fee83a4334a8120b83596e43f...8b9c78882ae0a7aedf79c87dccbc73c81fe2f7eb | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResource.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResource.java
index 4d2bd36f4e0..315cd0cd02e 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResource.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResource.java
@@ -30,4 +30,10 @@ public interface ClassPathResource {
*/
byte[] getData();
+ /**
+ *
+ * @return <code>true</code> if the entry is a directory
+ */
+ boolean isDirectory();
+
}
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
index c5d8dfd697d..d1042eb3688 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
@@ -108,6 +108,11 @@ public byte[] getData() {
throw new RuntimeException("Unable to read " + file, e);
}
}
+
+ @Override
+ public boolean isDirectory() {
+ return Files.isDirectory(file);
+ }
};
}
return null;
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 06f7baa41ce..e3d0cb0779e 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
@@ -105,6 +105,11 @@ public byte[] apply(JarFile jarFile) {
}
});
}
+
+ @Override
+ public boolean isDirectory() {
+ return res.getName().endsWith("/");
+ }
};
}
return null;
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
index 94c5baa2a79..05db1d17360 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
@@ -79,6 +79,11 @@ public URL getUrl() {
public byte[] getData() {
return res;
}
+
+ @Override
+ public boolean isDirectory() {
+ return false;
+ }
};
}
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
index 2c82d5497b1..00e9579101b 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
import java.net.URL;
import java.security.ProtectionDomain;
import java.util.ArrayList;
@@ -152,6 +153,7 @@ public void reset(Map<String, byte[]> resources,
@Override
public Enumeration<URL> getResources(String unsanitisedName) throws IOException {
+ boolean endsWithTrailingSlash = unsanitisedName.endsWith("/");
ClassLoaderState state = getState();
String name = sanitizeName(unsanitisedName);
//for resources banned means that we don't delegate to the parent, as there can be multiple resources
@@ -184,7 +186,21 @@ public Enumeration<URL> getResources(String unsanitisedName) throws IOException
ClassPathElement[] providers = state.loadableResources.get(name);
if (providers != null) {
for (ClassPathElement element : providers) {
- resources.add(element.getResource(name).getUrl());
+ ClassPathResource res = element.getResource(name);
+ //if the requested name ends with a trailing / we make sure
+ //that the resource is a directory, and return a URL that ends with a /
+ //this matches the behaviour of URLClassLoader
+ if (endsWithTrailingSlash) {
+ if (res.isDirectory()) {
+ try {
+ resources.add(new URL(res.getUrl().toString() + "/"));
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ } else {
+ resources.add(res.getUrl());
+ }
}
} else if (name.isEmpty()) {
for (ClassPathElement i : elements) {
@@ -263,6 +279,7 @@ private ClassLoaderState getState() {
@Override
public URL getResource(String unsantisedName) {
+ boolean endsWithTrailingSlash = unsantisedName.endsWith("/");
String name = sanitizeName(unsantisedName);
ClassLoaderState state = getState();
if (state.bannedResources.contains(name)) {
@@ -271,7 +288,7 @@ public URL getResource(String unsantisedName) {
//TODO: because of dev mode we iterate, to see if any resources were added
//not for .class files though, adding them causes a restart
//this is very important for bytebuddy performance
- if (name.endsWith(".class")) {
+ if (name.endsWith(".class") && !endsWithTrailingSlash) {
ClassPathElement[] providers = state.loadableResources.get(name);
if (providers != null) {
return providers[0].getResource(name).getUrl();
@@ -280,7 +297,20 @@ public URL getResource(String unsantisedName) {
for (ClassPathElement i : elements) {
ClassPathResource res = i.getResource(name);
if (res != null) {
- return res.getUrl();
+ //if the requested name ends with a trailing / we make sure
+ //that the resource is a directory, and return a URL that ends with a /
+ //this matches the behaviour of URLClassLoader
+ if (endsWithTrailingSlash) {
+ if (res.isDirectory()) {
+ try {
+ return new URL(res.getUrl().toString() + "/");
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ } else {
+ return res.getUrl();
+ }
}
}
} | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathResource.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 10,327,113 | 2,010,119 | 268,670 | 2,861 | 2,475 | 386 | 57 | 5 | 1,871 | 225 | 523 | 35 | 2 | 0 | 1970-01-01T00:26: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 |
3,009 | quarkusio/quarkus/10931/10924 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10924 | https://github.com/quarkusio/quarkus/pull/10931 | https://github.com/quarkusio/quarkus/pull/10931 | 1 | fixes | OIDC refresh token lost if not resent by provider | **Describe the bug**
When using Google OpenID Connect as Quarkus OIDC provider, the application receives both an access and refresh token, when `access_type=offline` is sent to Google.
It work that Quarkus uses this refresh token under the hood to refresh the expired access token, however, Google sends the refresh token only for the very first time (and never again), when a token is requested.
`CodeAuthenticationMechanism` then causes the refresh token to be lost in the `q_session` cookie, since it overrides the value with the result from the refresh, and there the refresh token is non-existent.
**Expected behavior**
To save and reuse the refresh token, since it might not be resent -- this is the case for Google, not sure how other OIDC providers do this.
**Potential fix**
I've fixed this issue in my project by manually building `quarkus-oidc` with the [following patch](https://github.com/sdaschner/quarkus/commit/9d7aac49d1176252ef4efefa9a7a4698c878c73d)
Happy to provide a PR, however, I'm not quite sure whether this is just a dirty hack or solves it in all solutions; in general, it would be good if the OIDC extension wouldn't loose refresh tokens that are only issues once, like for Google.
| 05a0ec5580dc26bf96b680db004a79dc94b211a2 | c5d158226b1a91372712b5f178eb5c1ac50207db | https://github.com/quarkusio/quarkus/compare/05a0ec5580dc26bf96b680db004a79dc94b211a2...c5d158226b1a91372712b5f178eb5c1ac50207db | 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 ffa6358f851..ba91c1dd8e4 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
@@ -303,7 +303,8 @@ public void accept(SecurityIdentity identity) {
LOG.debug("ID Token is required to contain 'exp' and 'iat' claims");
uniEmitter.fail(new AuthenticationCompletionException());
}
- processSuccessfulAuthentication(context, configContext, result, identity);
+ processSuccessfulAuthentication(context, configContext, result,
+ result.opaqueRefreshToken(), identity);
if (configContext.oidcConfig.authentication.isRemoveRedirectParameters()
&& context.request().query() != null) {
@@ -348,15 +349,12 @@ private String signJwtWithClientSecret(OidcTenantConfig cfg) {
}
private void processSuccessfulAuthentication(RoutingContext context, TenantConfigContext configContext,
- AccessToken result, SecurityIdentity securityIdentity) {
-
+ AccessToken result, String refreshToken, SecurityIdentity securityIdentity) {
removeCookie(context, configContext, getSessionCookieName(configContext));
- String cookieValue = new StringBuilder(result.opaqueIdToken())
- .append(COOKIE_DELIM)
- .append(result.opaqueAccessToken())
- .append(COOKIE_DELIM)
- .append(result.opaqueRefreshToken()).toString();
+ String cookieValue = result.opaqueIdToken() + COOKIE_DELIM
+ + result.opaqueAccessToken() + COOKIE_DELIM
+ + refreshToken;
long maxAge = result.idToken().getLong("exp") - result.idToken().getLong("iat");
if (configContext.oidcConfig.token.lifespanGrace.isPresent()) {
@@ -470,8 +468,12 @@ public void handle(AsyncResult<Void> result) {
.subscribe().with(new Consumer<SecurityIdentity>() {
@Override
public void accept(SecurityIdentity identity) {
- // after a successful refresh, rebuild the identity and update the cookie
- processSuccessfulAuthentication(context, configContext, token,
+ // the refresh token might not have been send in the response again
+ String refresh = token.opaqueRefreshToken() != null
+ ? token.opaqueRefreshToken()
+ : refreshToken;
+ // after a successful refresh, rebuild the identity and update the cookie
+ processSuccessfulAuthentication(context, configContext, token, refresh,
identity);
// update the token so that blocking threads get the latest one
emitter.complete( | ['extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,260,009 | 1,996,422 | 266,609 | 2,822 | 1,792 | 232 | 22 | 1 | 1,231 | 187 | 286 | 16 | 1 | 0 | 1970-01-01T00:26: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 |
3,010 | quarkusio/quarkus/10914/9458 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9458 | https://github.com/quarkusio/quarkus/pull/10914 | https://github.com/quarkusio/quarkus/pull/10914 | 1 | fixes | quarkus:dev finds duplicate beans if a different version of the dependency is in the maven reactor | **Describe the bug**
This was discovered while using a "local aggregator" pom to make importing a group of related projects into the IDE easier.
We have a group of related mukti-module projects: let's call them `common-lib`, `openwebbeans-app` and `quarkus-app`.
All these projects are in separate git repositories.
Some developers like to checkout each project in its own IDE window.
Others like me create a "local aggregator" that throws them all together in the same IDE, e.g.
```
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>localdomain.localhost</groupId>
<artifactId>localhost-aggregator</artifactId>
<version>1.x-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>common-lib</module>
<module>openwebbeans-app</module>
<module>quarkus-app</module>
</modules>
</project>
```
The check-out version of all our projects is always `1.x-SNAPSHOT` (yes a literal `x`) and our CI system will replace the `x-SNAPSHOT` with a version number (using something similar to https://github.com/stephenc/git-timestamp-maven-plugin)... I do not expect this mechanism to be relevant to the bug, just noting it
Our downstream projects always depend on *release versions* of their upstream dependencies, thus `quarkus-app` will have something like:
```
<properties>
<common-lib-version>1.435</common-lib-version>
</properties>
...
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.example.common-lib</groupId>
<artifactId>common-lib-bom</artifactId>
<version>${common-lib-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
...
<profiles>
<profile>
<id>with-common-lib-snapshot</id>
<properties>
<common-lib-version>1.x-SNAPSHOT</common-lib-version>
</properties>
</profile>
</profiles>
```
If you open the project in your IDE you can enable or disable the `with-common-lib-snapshot` profile and get the classpaths merged or leave them separate depending on whether you are working on something that spans the two repositories or not.
The bug is that when `quarkus-app` has a dependency on a specific version of `common-lib`, say `1.435` and there is an unexpected local aggreagtor `pom.xml` in the parent directory of `quarkus-app` then *both* the `1.435` and the `1.x-SNAPSHOT` versions of `common-lib` dependencies end up on the classpath and if any of those have `beans.xml` files you will end up with duplicate beans, but only when running `mvn clean package quarkus:dev` in the `quarkus-app` project
The duplicate beans disappear if you do any of the following:
* Activate the `with-common-lib-snapshot` profile, e.g. `mvn clean package quarkus:dev -P+with-common-lib-snapshot`
* Change the non-profile version of the property to `1.x-SNAPSHOT`
* Set the property from the command line, e.g. `mvn clean package quarkus:dev -Dcommon-lib-version=1.x-SNAPSHOT`
* Edit the local aggregator to remove the `<module>common-lib</module>`
* Introduce a layer of separation between the local aggregator and the app, e.g. `mkdir sep && mv quarkus-app sep && sed -i -e 's:module>quarkus-app:module>sep/quarkus-app:' pom.xml`
* Run with the sibling helper functionality disabled, e.g. `mvn clean package quarkus:dev -DnoDeps`
NOTE: RE: "unexpected local aggregator". The `quarkus-app` `pom.xml` does not have a `<parent>` tag. It is a standalone `pom.xml`, so there is no requirement to walk up the `<relativePath>../pom.xml</relativePath>` default value that would apply if `<parent>` had been specified... also the local aggregator would not match the default value empty `<groupId/><artifactId/>` from the non-present `<parent>`.
**Expected behavior**
Sibling modules in the reactor should only be injected if the dependency version is the same as the version in the sibling module.
**Actual behavior**
Sibling modules in the reactor are always injected even when the version does not match. Additionally, this was only discovered because the part that removes the `.jar` from the sibling appears to actually be paying attention to the version and is thus noticing that they are not equivalent duplicates and thus we get two versions on the classpath.
**To Reproduce**
Steps to reproduce the behavior:
1. See bug description.
2.
3.
**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`:
- Output of `java -version`: 8 and 11
- GraalVM version (if different from Java):
- Quarkus version or git rev: 1.4.2
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Maven 3.6.3
**Additional context**
(Add any other context about the problem here.)
https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/strange.20duplicate.20beans.20with.20.60quarkus.3Adev.60
| 7094391ec2af593861da09fc75aa23c19c173278 | a16e1461cdb813ff9bbaa9cc3bee35af8ae51648 | https://github.com/quarkusio/quarkus/compare/7094391ec2af593861da09fc75aa23c19c173278...a16e1461cdb813ff9bbaa9cc3bee35af8ae51648 | 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 f69f4bda765..37222164dc8 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -925,6 +925,11 @@ private List<LocalProject> filterExtensionDependencies(LocalProject localProject
if (project == null) {
continue;
}
+ if (!project.getVersion().equals(a.getVersion())) {
+ getLog().warn(depKey + " is excluded from live coding since the application depends on version "
+ + a.getVersion() + " while the version present in the workspace is " + project.getVersion());
+ continue;
+ }
if (project.getClassesDir() != null &&
//if this project also contains Quarkus extensions we do no want to include these in the discovery
//a bit of an edge case, but if you try and include a sample project with your extension you will | ['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 10,256,097 | 1,995,615 | 266,509 | 2,821 | 339 | 57 | 5 | 1 | 5,296 | 625 | 1,332 | 110 | 6 | 3 | 1970-01-01T00:26: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 |
3,011 | quarkusio/quarkus/10849/10826 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/10826 | https://github.com/quarkusio/quarkus/pull/10849 | https://github.com/quarkusio/quarkus/pull/10849 | 1 | fixes | Maven Add Extension command fails with error about BOM | **Describe the bug**
Running the Add Extension command fails with the following message:
```
The Quarkus BOM is required to add a Quarkus extension
```
**Expected behavior**
The extension is added correctly.
**Actual behavior**
The extension isn't added as the command fails.
**To Reproduce**
Steps to reproduce the behavior:
1. Use the [Amazon Lambda HTTP guide](https://quarkus.io/guides/amazon-lambda-http) to generate a project using the artefact `quarkus-amazon-lambda-http-archetype` version `1.6.0.Final`.
2. Use Maven to add an extension to this new project:
```
mvn -X quarkus:add-extension -Dextensions="smallrye-jwt"
```
The command will fail with the following stacktrace:
```
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.6.0.Final:add-extension (default-cli) on project artifactid1: Unable to update the pom.xml file: The Quarkus BOM is required to add a Quarkus extension -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:1.6.0.Final:add-extension (default-cli) on project artifactid1: Unable to update the pom.xml file
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to update the pom.xml file
at io.quarkus.maven.AddExtensionMojo.doExecute (AddExtensionMojo.java:67)
at io.quarkus.maven.QuarkusProjectMojoBase.execute (QuarkusProjectMojoBase.java:67)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.IllegalStateException: The Quarkus BOM is required to add a Quarkus extension
at io.quarkus.devtools.project.buildfile.BuildFile.install (BuildFile.java:43)
at io.quarkus.devtools.commands.handlers.AddExtensionsCommandHandler.execute (AddExtensionsCommandHandler.java:37)
at io.quarkus.devtools.commands.AddExtensions.execute (AddExtensions.java:43)
at io.quarkus.maven.AddExtensionMojo.doExecute (AddExtensionMojo.java:62)
at io.quarkus.maven.QuarkusProjectMojoBase.execute (QuarkusProjectMojoBase.java:67)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:564)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Linux DESKTOP-GJJ95MV 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux`
- Output of `java -version`: NA
- GraalVM version (if different from Java): NA
- Quarkus version or git rev: `1.6.0.Final`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/rich/.sdkman/candidates/maven/current
Java version: 14.0.1, vendor: AdoptOpenJDK, runtime: /home/rich/.sdkman/candidates/java/14.0.1.hs-adpt
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "4.19.104-microsoft-standard", arch: "amd64", family: "unix"
```
**Additional context**
(Add any other context about the problem here.)
| b0220564f45b0318b24d9a65e1b70200522c82fa | c7bf30441548c88c14ede1237490abfaea28aab0 | https://github.com/quarkusio/quarkus/compare/b0220564f45b0318b24d9a65e1b70200522c82fa...c7bf30441548c88c14ede1237490abfaea28aab0 | diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java
index 948404b10fd..6c85b42629e 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java
@@ -97,13 +97,6 @@ protected void removeDependencyFromBuildFile(AppArtifactKey key) throws IOExcept
getModel().setBuildContent(newBuildContent.toString());
}
- @Override
- protected boolean containsBOM(String groupId, String artifactId) throws IOException {
- String buildContent = getModel().getBuildContent();
- return buildContent.contains("enforcedPlatform(\\"${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:")
- || buildContent.contains("enforcedPlatform(\\"" + groupId + ":" + artifactId + ":");
- }
-
@Override
public String getProperty(String propertyName) throws IOException {
final String property = getModel().getPropertiesContent().getProperty(propertyName);
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/BuildFile.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/BuildFile.java
index 640df137b4b..97996678cad 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/BuildFile.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/BuildFile.java
@@ -32,16 +32,8 @@ public BuildFile(final Path projectDirPath, final QuarkusPlatformDescriptor plat
this.platformDescriptor = requireNonNull(platformDescriptor, "platformDescriptor is required");
}
- @Override
- public final boolean hasQuarkusPlatformBom() throws IOException {
- return containsBOM(platformDescriptor.getBomGroupId(), platformDescriptor.getBomArtifactId());
- }
-
@Override
public final InstallResult install(Collection<AppArtifactCoords> coords) throws IOException {
- if (!hasQuarkusPlatformBom()) {
- throw new IllegalStateException("The Quarkus BOM is required to add a Quarkus extension");
- }
this.refreshData();
final Set<AppArtifactKey> existingKeys = getDependenciesKeys();
final List<AppArtifactCoords> installed = coords.stream()
@@ -97,8 +89,6 @@ public final UninstallResult uninstall(Collection<AppArtifactKey> keys) throws I
protected abstract String getProperty(String propertyName) throws IOException;
- protected abstract boolean containsBOM(String groupId, String artifactId) throws IOException;
-
protected abstract void refreshData();
protected Path getProjectDirPath() {
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/GenericGradleBuildFile.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/GenericGradleBuildFile.java
index 51501741f8d..29b7bf0d541 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/GenericGradleBuildFile.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/GenericGradleBuildFile.java
@@ -22,11 +22,6 @@ public Collection<AppArtifactCoords> getInstalled() throws IOException {
throw new IllegalStateException("This feature is not yet implemented outside of the Gradle Plugin.");
}
- @Override
- public boolean hasQuarkusPlatformBom() throws IOException {
- throw new IllegalStateException("This feature is not yet implemented outside of the Gradle Plugin.");
- }
-
@Override
public InstallResult install(Collection<AppArtifactCoords> coords) throws IOException {
throw new IllegalStateException("This feature is not yet implemented outside of the Gradle Plugin.");
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenBuildFile.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenBuildFile.java
index 8a1061f6bb3..8ccb4cf2a96 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenBuildFile.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenBuildFile.java
@@ -67,22 +67,6 @@ public List<Dependency> getDependencies() throws IOException {
return getModel() == null ? Collections.emptyList() : getModel().getDependencies();
}
- @Override
- protected boolean containsBOM(String groupId, String artifactId) throws IOException {
- if (getModel() == null || getModel().getDependencyManagement() == null) {
- return false;
- }
- List<Dependency> dependencies = getModel().getDependencyManagement().getDependencies();
- return dependencies.stream()
- // Find bom
- .filter(dependency -> "import".equals(dependency.getScope()))
- .filter(dependency -> "pom".equals(dependency.getType()))
- // Does it matches the bom artifact name
- .anyMatch(dependency -> dependency.getArtifactId()
- .equals(MojoUtils.TEMPLATE_PROPERTY_QUARKUS_PLATFORM_ARTIFACT_ID_VALUE)
- && dependency.getGroupId().equals(MojoUtils.TEMPLATE_PROPERTY_QUARKUS_PLATFORM_GROUP_ID_VALUE));
- }
-
@Override
protected void refreshData() {
this.modelRef.set(null);
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/extensions/ExtensionManager.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/extensions/ExtensionManager.java
index b339ba8ebb8..6f55c44103a 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/extensions/ExtensionManager.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/extensions/ExtensionManager.java
@@ -37,22 +37,12 @@ default boolean isInstalled(AppArtifactKey key) throws IOException {
return getInstalled().stream().anyMatch(i -> Objects.equals(i.getKey(), key));
}
- /**
- * Check that the Quarkus Platform bom is defined in the project.
- * The Quarkus Platform Bom role is to define version to use for Quarkus extensions.
- *
- * @return true if it's defined, false else
- * @throws IOException if a problem occurs while reading the project build file(s)
- */
- boolean hasQuarkusPlatformBom() throws IOException;
-
/**
* This is going to install/add all the specified extensions to the project build file(s).
*
* <pre>
- * - If the project Quarkus platform bom is not defined, an {@link IllegalStateException} will be thrown
* - Extensions which are already installed will ALWAYS be skipped whatever the specified version
- * - The provided version will be used wasn't already installed
+ * - The provided version will be used if it wasn't already installed
* </pre>
*
* @param coords the list of {@link AppArtifactCoords} for the extensions to install | ['independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/MavenBuildFile.java', 'independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/GenericGradleBuildFile.java', 'independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/BuildFile.java', 'independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/buildfile/AbstractGradleBuildFile.java', 'independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/project/extensions/ExtensionManager.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 10,154,153 | 1,976,174 | 263,758 | 2,782 | 2,586 | 519 | 50 | 5 | 8,517 | 480 | 2,098 | 121 | 1 | 4 | 1970-01-01T00:26: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 |
3,132 | quarkusio/quarkus/7537/7528 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7528 | https://github.com/quarkusio/quarkus/pull/7537 | https://github.com/quarkusio/quarkus/pull/7537 | 1 | fixes | JsonNode missing in Index | **Describe the bug**
I get a log output about missing `com.fasterxml.jackson.databind.JsonNode` in the jandex index.
That class comes from jackson.
**Expected behavior**
No warn log output about missing classes in the index.
**Actual behavior**
I get the following output:
```
03.03.2020 09:02:22 WARN [io.quarkus.deployment.steps.ReflectiveHierarchyStep] Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- com.fasterxml.jackson.databind.JsonNode
Consider adding them to the index either by creating a Jandex index for your dependency via the Maven plugin, an empty META-INF/beans.xml or quarkus.index-dependency properties.");.
```
**To Reproduce**
Have JsonNode as part of a request body.
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
MSYS_NT-10.0 SOMEHOST 2.10.0(0.325/5/3) 2018-06-13 23:34 x86_64 Msys
- Output of `java -version`:
java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)
- Quarkus version or git rev:
1.3.0.Alpha2
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: C:\\eclipse\\tools\\apache-maven-3.5.3\\bin\\..
Java version: 1.8.0_181, vendor: Oracle Corporation
Java home: C:\\Program Files\\Java\\jdk1.8.0_181\\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
| f1abb07de43d99944e0c8cdb4954ed262cd20eb0 | 45933181f5a2e6e21e1ffc62f7fbcbecaeb48c4e | https://github.com/quarkusio/quarkus/compare/f1abb07de43d99944e0c8cdb4954ed262cd20eb0...45933181f5a2e6e21e1ffc62f7fbcbecaeb48c4e | diff --git a/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java b/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java
index 5fbf042a842..03fdff754ac 100644
--- a/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java
+++ b/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java
@@ -73,11 +73,15 @@ private boolean isInIgnoredPackage(String name) {
DotName.createSimple("javax.json.JsonObject"),
DotName.createSimple("javax.json.JsonArray"),
+ // Jackson
+ DotName.createSimple("com.fasterxml.jackson.databind.JsonNode"),
+
// JAX-RS
DotName.createSimple("javax.ws.rs.core.Response"),
DotName.createSimple("javax.ws.rs.container.AsyncResponse"),
DotName.createSimple("javax.ws.rs.core.StreamingOutput"),
DotName.createSimple("javax.ws.rs.core.Form"),
+ DotName.createSimple("javax.ws.rs.core.MultivaluedMap"),
// RESTEasy
DotName.createSimple("org.jboss.resteasy.plugins.providers.multipart.MultipartInput"), | ['extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,813,345 | 1,517,813 | 202,217 | 2,107 | 173 | 33 | 4 | 1 | 1,637 | 197 | 500 | 37 | 0 | 1 | 1970-01-01T00:26: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 |
3,134 | quarkusio/quarkus/7445/7444 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7444 | https://github.com/quarkusio/quarkus/pull/7445 | https://github.com/quarkusio/quarkus/pull/7445 | 1 | fixes | IllegalMonitorStateException in VertxBlockingOutput | **Describe the bug**
```
SEVERE [io.ver.cor.imp.ContextImpl] (vert.x-eventloop-thread-3) Unhandled exception: java.lang.IllegalMonitorStateException
at java.base/java.lang.Object.notifyAll(Native Method)
at io.quarkus.resteasy.runtime.standalone.VertxBlockingOutput$3.handle(VertxBlockingOutput.java:114)
at io.quarkus.resteasy.runtime.standalone.VertxBlockingOutput$3.handle(VertxBlockingOutput.java:110)
at io.vertx.core.http.impl.HttpServerResponseImpl.handleClosed(HttpServerResponseImpl.java:622)
at io.vertx.core.http.impl.HttpServerResponseImpl.handleException(HttpServerResponseImpl.java:590)
at io.vertx.core.http.impl.HttpServerRequestImpl.handleException(HttpServerRequestImpl.java:577)
at io.vertx.core.http.impl.Http1xServerConnection.handleClosed(Http1xServerConnection.java:413)
at io.vertx.core.net.impl.VertxHandler.lambda$channelInactive$4(VertxHandler.java:162)
```
**To Reproduce**
Can reproduce often if streaming a video via a Response.ok(File file) jaxrs request.
**Environment (please complete the following information):**
- Quarkus version or git rev: 1.2.1.Final
| 69cdd593328b1698e6afb8780b8e04ba70d7e203 | e762b5fe9376254fcad12b3e6d1fbecca122493f | https://github.com/quarkusio/quarkus/compare/69cdd593328b1698e6afb8780b8e04ba70d7e203...e762b5fe9376254fcad12b3e6d1fbecca122493f | diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java
index fafae708f2f..e2775f5a0ce 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java
@@ -9,6 +9,7 @@
import io.vertx.core.Context;
import io.vertx.core.Handler;
import io.vertx.core.buffer.Buffer;
+import io.vertx.core.http.HttpConnection;
import io.vertx.core.http.HttpServerRequest;
public class VertxBlockingOutput implements VertxOutput {
@@ -111,7 +112,10 @@ private void awaitWriteable() throws IOException {
@Override
public void handle(Void event) {
if (waitingForDrain) {
- request.connection().notifyAll();
+ HttpConnection connection = request.connection();
+ synchronized (connection) {
+ connection.notifyAll();
+ }
}
}
}; | ['extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxBlockingOutput.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,705,272 | 1,497,002 | 199,560 | 2,073 | 329 | 36 | 6 | 1 | 1,177 | 56 | 272 | 20 | 0 | 1 | 1970-01-01T00:26: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 |
3,263 | quarkusio/quarkus/2968/2967 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2967 | https://github.com/quarkusio/quarkus/pull/2968 | https://github.com/quarkusio/quarkus/pull/2968 | 1 | fixes | OpenAPI: Use standard value for query parameter "format" | As discussed with @EricWittmann on gitter, the MicroProfile specification is clear about the optional query parameter `format` that is used to control the format of the OpenAPI specification:
```
GET http://<host>:<port>/openapi?format=<value>
```
The `<value>` can be:
* `YAML`
* `JSON`
See: https://github.com/eclipse/microprofile-open-api/blob/1.x/spec/src/main/asciidoc/microprofile-openapi-spec.adoc#53-query-parameters
—
The current implementation checks for following values:
* `application/yaml`
* `application/json`
Those are the values expected for the `Accept` header (that can also be used to control the format of the generated OpenAPI) | 3d742844582129c813091f6a23a05aa8d8bd52b5 | 53a6625e68801075447a6947b3cbf101c623c257 | https://github.com/quarkusio/quarkus/compare/3d742844582129c813091f6a23a05aa8d8bd52b5...53a6625e68801075447a6947b3cbf101c623c257 | diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiDefaultPathTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiDefaultPathTestCase.java
index eae4a54f953..da5501a9658 100644
--- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiDefaultPathTestCase.java
+++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiDefaultPathTestCase.java
@@ -18,9 +18,17 @@ public class OpenApiDefaultPathTestCase {
@Test
public void testOpenApiPathAccessResource() {
- RestAssured.given().queryParam("format", "application/yaml").when().get(OPEN_API_PATH).then().header("Content-Type",
- "application/yaml;charset=UTF-8");
- RestAssured.given().queryParam("format", "application/json").when().get(OPEN_API_PATH).then().header("Content-Type",
- "application/json;charset=UTF-8");
+ RestAssured.given().header("Accept", "application/yaml")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/yaml;charset=UTF-8");
+ RestAssured.given().queryParam("format", "YAML")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/yaml;charset=UTF-8");
+ RestAssured.given().header("Accept", "application/json")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/json;charset=UTF-8");
+ RestAssured.given().queryParam("format", "JSON")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/json;charset=UTF-8");
}
}
diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithSegmentsTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithSegmentsTestCase.java
index b1ec005f240..6be40d3ff73 100644
--- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithSegmentsTestCase.java
+++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithSegmentsTestCase.java
@@ -21,9 +21,17 @@ public class OpenApiPathWithSegmentsTestCase {
@Test
public void testOpenApiPathAccessResource() {
- RestAssured.given().queryParam("format", "application/yaml").when().get(OPEN_API_PATH).then().header("Content-Type",
- "application/yaml;charset=UTF-8");
- RestAssured.given().queryParam("format", "application/json").when().get(OPEN_API_PATH).then().header("Content-Type",
- "application/json;charset=UTF-8");
+ RestAssured.given().header("Accept", "application/yaml")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/yaml;charset=UTF-8");
+ RestAssured.given().queryParam("format", "YAML")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/yaml;charset=UTF-8");
+ RestAssured.given().header("Accept", "application/json")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/json;charset=UTF-8");
+ RestAssured.given().queryParam("format", "JSON")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/json;charset=UTF-8");
}
}
diff --git a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithoutSegmentsTestCase.java b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithoutSegmentsTestCase.java
index 5c2cc02a479..03088b70d02 100644
--- a/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithoutSegmentsTestCase.java
+++ b/extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithoutSegmentsTestCase.java
@@ -21,9 +21,17 @@ public class OpenApiPathWithoutSegmentsTestCase {
@Test
public void testOpenApiPathAccessResource() {
- RestAssured.given().queryParam("format", "application/yaml").when().get(OPEN_API_PATH).then().header("Content-Type",
- "application/yaml;charset=UTF-8");
- RestAssured.given().queryParam("format", "application/json").when().get(OPEN_API_PATH).then().header("Content-Type",
- "application/json;charset=UTF-8");
+ RestAssured.given().header("Accept", "application/yaml")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/yaml;charset=UTF-8");
+ RestAssured.given().queryParam("format", "YAML")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/yaml;charset=UTF-8");
+ RestAssured.given().header("Accept", "application/json")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/json;charset=UTF-8");
+ RestAssured.given().queryParam("format", "JSON")
+ .when().get(OPEN_API_PATH)
+ .then().header("Content-Type", "application/json;charset=UTF-8");
}
}
diff --git a/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiServlet.java b/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiServlet.java
index c5b00379a90..1584f7fd9a5 100644
--- a/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiServlet.java
+++ b/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiServlet.java
@@ -39,7 +39,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
// Check Accept, then query parameter "format" for JSON; else use YAML.
if ((accept != null && accept.contains(OpenApiSerializer.Format.JSON.getMimeType())) ||
- (OpenApiSerializer.Format.JSON.getMimeType().equalsIgnoreCase(formatParam))) {
+ ("JSON".equalsIgnoreCase(formatParam))) {
format = OpenApiSerializer.Format.JSON;
}
| ['extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithoutSegmentsTestCase.java', 'extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiServlet.java', 'extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiPathWithSegmentsTestCase.java', 'extensions/smallrye-openapi/deployment/src/test/java/io/quarkus/smallrye/openapi/test/OpenApiDefaultPathTestCase.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 3,772,852 | 726,855 | 97,857 | 1,044 | 154 | 24 | 2 | 1 | 675 | 76 | 163 | 20 | 2 | 1 | 1970-01-01T00:26: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 |
3,254 | quarkusio/quarkus/3117/3094 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3094 | https://github.com/quarkusio/quarkus/pull/3117 | https://github.com/quarkusio/quarkus/pull/3117 | 1 | fixes | Bean created three times instead of one after renaming test package | Cloning from https://github.com/apache/camel-quarkus/issues/24 so that this can be assigned to a milestone (hopefully 0.19.0). @aloubyansky has a fix that I have verified. | f4c46ebd91b70aee4d92fdbe0d7f59105a274703 | 8507c3aec409338ff7152a21a96e43926f8a58f8 | https://github.com/quarkusio/quarkus/compare/f4c46ebd91b70aee4d92fdbe0d7f59105a274703...8507c3aec409338ff7152a21a96e43926f8a58f8 | 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 9238e8801fa..d203d022ce9 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
@@ -5,6 +5,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Properties;
@@ -42,6 +44,7 @@ public class QuarkusAugmentor {
private final List<Consumer<BuildChainBuilder>> buildChainCustomizers;
private final LaunchMode launchMode;
private final List<Path> additionalApplicationArchives;
+ private final Collection<Path> excludedFromIndexing;
private final LiveReloadBuildItem liveReloadBuildItem;
private final Properties buildSystemProperties;
@@ -53,6 +56,7 @@ public class QuarkusAugmentor {
this.buildChainCustomizers = new ArrayList<>(builder.buildChainCustomizers);
this.launchMode = builder.launchMode;
this.additionalApplicationArchives = new ArrayList<>(builder.additionalApplicationArchives);
+ this.excludedFromIndexing = builder.excludedFromIndexing;
this.liveReloadBuildItem = builder.liveReloadState;
this.buildSystemProperties = builder.buildSystemProperties;
}
@@ -101,7 +105,7 @@ public BuildResult run() throws Exception {
BuildExecutionBuilder execBuilder = chain.createExecutionBuilder("main")
.produce(QuarkusConfig.INSTANCE)
.produce(liveReloadBuildItem)
- .produce(new ArchiveRootBuildItem(root, rootFs == null ? root : rootFs.getPath("/")))
+ .produce(new ArchiveRootBuildItem(root, rootFs == null ? root : rootFs.getPath("/"), excludedFromIndexing))
.produce(new ClassOutputBuildItem(output))
.produce(new ShutdownContextBuildItem())
.produce(new LaunchModeBuildItem(launchMode))
@@ -144,6 +148,7 @@ public static Builder builder() {
public static final class Builder {
List<Path> additionalApplicationArchives = new ArrayList<>();
+ Collection<Path> excludedFromIndexing = Collections.emptySet();
ClassOutput output;
ClassLoader classLoader;
Path root;
@@ -167,6 +172,11 @@ public Builder addAdditionalApplicationArchive(Path archive) {
return this;
}
+ public Builder excludeFromIndexing(Collection<Path> excludedFromIndexing) {
+ this.excludedFromIndexing = excludedFromIndexing;
+ return this;
+ }
+
public ClassOutput getOutput() {
return output;
}
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 fa935eb1eee..35a241d2cb8 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
@@ -2,6 +2,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.Collection;
+import java.util.Collections;
import io.quarkus.builder.item.SimpleBuildItem;
@@ -9,17 +11,23 @@ public final class ArchiveRootBuildItem extends SimpleBuildItem {
private final Path archiveLocation;
private final Path archiveRoot;
+ private final Collection<Path> excludedFromIndexing;
public ArchiveRootBuildItem(Path appClassesDir) {
this(appClassesDir, appClassesDir);
}
public ArchiveRootBuildItem(Path archiveLocation, Path archiveRoot) {
+ this(archiveLocation, archiveRoot, Collections.emptySet());
+ }
+
+ public ArchiveRootBuildItem(Path archiveLocation, Path archiveRoot, Collection<Path> excludedFromIndexing) {
this.archiveLocation = archiveLocation;
if (!Files.isDirectory(archiveRoot)) {
throw new IllegalArgumentException(archiveRoot + " does not point to the application classes directory");
}
this.archiveRoot = archiveRoot;
+ this.excludedFromIndexing = excludedFromIndexing;
}
/**
@@ -48,4 +56,8 @@ public Path getArchiveLocation() {
public Path getArchiveRoot() {
return archiveRoot;
}
+
+ public boolean isExcludedFromIndexing(Path p) {
+ return excludedFromIndexing.contains(p);
+ }
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
index d13b71c424d..52a2001af8a 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
@@ -84,25 +84,26 @@ ApplicationArchivesBuildItem build(ArchiveRootBuildItem root, ApplicationIndexBu
}
List<ApplicationArchive> applicationArchives = scanForOtherIndexes(Thread.currentThread().getContextClassLoader(),
- markerFiles, root.getArchiveLocation(), additionalApplicationArchiveBuildItem, indexCache);
+ markerFiles, root, additionalApplicationArchiveBuildItem, indexCache);
return new ApplicationArchivesBuildItem(
new ApplicationArchiveImpl(appindex.getIndex(), root.getArchiveRoot(), null, false, root.getArchiveLocation()),
applicationArchives);
}
private List<ApplicationArchive> scanForOtherIndexes(ClassLoader classLoader, Set<String> applicationArchiveFiles,
- Path appRoot, List<AdditionalApplicationArchiveBuildItem> additionalApplicationArchives, IndexCache indexCache)
+ ArchiveRootBuildItem root, List<AdditionalApplicationArchiveBuildItem> additionalApplicationArchives,
+ IndexCache indexCache)
throws IOException {
Set<Path> dependenciesToIndex = new HashSet<>();
//get paths that are included via index-dependencies
- dependenciesToIndex.addAll(getIndexDependencyPaths(classLoader));
+ dependenciesToIndex.addAll(getIndexDependencyPaths(classLoader, root));
//get paths that are included via marker files
Set<String> markers = new HashSet<>(applicationArchiveFiles);
markers.add(JANDEX_INDEX);
- dependenciesToIndex.addAll(getMarkerFilePaths(classLoader, markers));
+ dependenciesToIndex.addAll(getMarkerFilePaths(classLoader, markers, root));
//we don't index the application root, this is handled elsewhere
- dependenciesToIndex.remove(appRoot);
+ dependenciesToIndex.remove(root.getArchiveLocation());
for (AdditionalApplicationArchiveBuildItem i : additionalApplicationArchives) {
dependenciesToIndex.add(i.getPath());
@@ -111,7 +112,7 @@ private List<ApplicationArchive> scanForOtherIndexes(ClassLoader classLoader, Se
return indexPaths(dependenciesToIndex, classLoader, indexCache);
}
- public List<Path> getIndexDependencyPaths(ClassLoader classLoader) {
+ public List<Path> getIndexDependencyPaths(ClassLoader classLoader, ArchiveRootBuildItem root) {
ArtifactIndex artifactIndex = new ArtifactIndex(new ClassPathArtifactResolver(classLoader));
try {
List<Path> ret = new ArrayList<>();
@@ -124,7 +125,9 @@ public List<Path> getIndexDependencyPaths(ClassLoader classLoader) {
path = artifactIndex.getPath(entry.getValue().groupId, entry.getValue().artifactId,
entry.getValue().classifier);
}
- ret.add(path);
+ if (!root.isExcludedFromIndexing(path)) {
+ ret.add(path);
+ }
}
return ret;
} catch (Exception e) {
@@ -152,29 +155,39 @@ private static List<ApplicationArchive> indexPaths(Set<Path> dependenciesToIndex
return ret;
}
- private static Collection<? extends Path> getMarkerFilePaths(ClassLoader classLoader, Set<String> applicationArchiveFiles)
+ private static Collection<? extends Path> getMarkerFilePaths(ClassLoader classLoader, Set<String> applicationArchiveFiles,
+ ArchiveRootBuildItem root)
throws IOException {
List<Path> ret = new ArrayList<>();
for (String file : applicationArchiveFiles) {
Enumeration<URL> e = classLoader.getResources(file);
while (e.hasMoreElements()) {
- URL url = e.nextElement();
- ret.add(urlToPath(url));
+ final URL url = e.nextElement();
+ final Path path = urlToPath(url, file);
+ if (!root.isExcludedFromIndexing(path)) {
+ ret.add(path);
+ }
}
}
return ret;
}
// package protected for testing purpose
- static Path urlToPath(URL url) {
+ static Path urlToPath(URL url, String resource) {
try {
if (url.getProtocol().equals("jar")) {
String jarPath = url.getPath().substring(0, url.getPath().lastIndexOf('!'));
return Paths.get(new URI(jarPath));
} else if (url.getProtocol().equals("file")) {
final Path path = Paths.get(url.toURI());
+ if (resource.isEmpty()) {
+ return path;
+ }
final String filePath = path.toString();
- final int index = filePath.lastIndexOf(File.separator + "META-INF");
+ if (File.separatorChar != '/') {
+ resource = resource.replace('/', File.separatorChar);
+ }
+ final int index = filePath.lastIndexOf(File.separator + resource);
if (index == -1) {
return path;
}
@@ -222,26 +235,24 @@ private static Index handleJarPath(Path path, IndexCache indexCache) throws IOEx
return indexCache.cache.computeIfAbsent(path, new Function<Path, Index>() {
@Override
public Index apply(Path path) {
- try {
- try (JarFile file = new JarFile(path.toFile())) {
- ZipEntry existing = file.getEntry(JANDEX_INDEX);
- if (existing != null) {
- try (InputStream in = file.getInputStream(existing)) {
- IndexReader reader = new IndexReader(in);
- if (reader.getIndexVersion() < REQUIRED_INDEX_VERSION) {
- LOGGER.warnf(
- "Re-indexing %s - at least Jandex 2.1 must be used to index an application dependency",
- path);
- return indexJar(file);
- } else {
- return reader.read();
- }
+ try (JarFile file = new JarFile(path.toFile())) {
+ ZipEntry existing = file.getEntry(JANDEX_INDEX);
+ if (existing != null) {
+ try (InputStream in = file.getInputStream(existing)) {
+ IndexReader reader = new IndexReader(in);
+ if (reader.getIndexVersion() < REQUIRED_INDEX_VERSION) {
+ LOGGER.warnf(
+ "Re-indexing %s - at least Jandex 2.1 must be used to index an application dependency",
+ path);
+ return indexJar(file);
+ } else {
+ return reader.read();
}
}
- return indexJar(file);
}
+ return indexJar(file);
} catch (IOException e) {
- throw new RuntimeException(e);
+ throw new RuntimeException("Failed to process " + path, e);
}
}
});
diff --git a/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java b/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java
index 60cb49c135d..943c803aefd 100644
--- a/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java
+++ b/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java
@@ -7,10 +7,13 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.logging.Handler;
@@ -41,6 +44,7 @@ public class RuntimeRunner implements Runnable, Closeable {
private final TransformerTarget transformerTarget;
private Closeable closeTask;
private final List<Path> additionalArchives;
+ private final Collection<Path> excludedFromIndexing;
private final List<Consumer<BuildChainBuilder>> chainCustomizers;
private final LaunchMode launchMode;
private final LiveReloadBuildItem liveReloadState;
@@ -49,6 +53,7 @@ public class RuntimeRunner implements Runnable, Closeable {
public RuntimeRunner(Builder builder) {
this.target = builder.target;
this.additionalArchives = new ArrayList<>(builder.additionalArchives);
+ this.excludedFromIndexing = builder.excludedFromIndexing;
this.chainCustomizers = new ArrayList<>(builder.chainCustomizers);
this.launchMode = builder.launchMode;
this.liveReloadState = builder.liveReloadState;
@@ -92,6 +97,7 @@ public void run() {
for (Path i : additionalArchives) {
builder.addAdditionalApplicationArchive(i);
}
+ builder.excludeFromIndexing(excludedFromIndexing);
for (Consumer<BuildChainBuilder> i : chainCustomizers) {
builder.addBuildChainCustomizer(i);
}
@@ -153,6 +159,8 @@ public static class Builder {
private Path transformerCache;
private LaunchMode launchMode = LaunchMode.NORMAL;
private final List<Path> additionalArchives = new ArrayList<>();
+ private Set<Path> excludedFromIndexing = Collections.emptySet();
+
/**
* additional classes directories that may be hot deployed
*/
@@ -213,6 +221,14 @@ public Builder addChainCustomizers(Collection<Consumer<BuildChainBuilder>> chain
return this;
}
+ public Builder excludeFromIndexing(Path p) {
+ if (excludedFromIndexing.isEmpty()) {
+ excludedFromIndexing = new HashSet<>(1);
+ }
+ excludedFromIndexing.add(p);
+ return this;
+ }
+
public Builder setLaunchMode(LaunchMode launchMode) {
this.launchMode = launchMode;
return this;
@@ -249,7 +265,9 @@ Path getWiringClassesDir() {
}
public RuntimeRunner build() {
- return new RuntimeRunner(this);
+ final RuntimeRunner runtimeRunner = new RuntimeRunner(this);
+ excludedFromIndexing = Collections.emptySet();
+ return runtimeRunner;
}
}
}
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java b/core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java
index 16211109c1b..6f573a3ea8a 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java
@@ -12,18 +12,18 @@
public class ApplicationArchiveBuildStepTestCase {
@Test
public void testUrlToPath() throws MalformedURLException {
- assertEquals(Paths.get("/a/path"), urlToPath(new URL("jar:file:/a/path!/META-INF/services/my.Service")));
+ assertEquals(Paths.get("/a/path"), urlToPath(new URL("jar:file:/a/path!/META-INF/services/my.Service"), "META-INF"));
assertEquals(Paths.get("/a/path with whitespace"),
- urlToPath(new URL("jar:file:/a/path%20with%20whitespace!/META-INF/services/my.Service")));
- assertEquals(Paths.get("/a/path"), urlToPath(new URL("file:/a/path/META-INF/services/my.Service")));
+ urlToPath(new URL("jar:file:/a/path%20with%20whitespace!/META-INF/services/my.Service"), "META-INF"));
+ assertEquals(Paths.get("/a/path"), urlToPath(new URL("file:/a/path/META-INF/services/my.Service"), "META-INF"));
assertEquals(Paths.get("/a/path with whitespace"),
- urlToPath(new URL("file:/a/path%20with%20whitespace/META-INF/services/my.Service")));
- assertEquals(Paths.get("/a/path"), urlToPath(new URL("file:/a/path")));
- assertEquals(Paths.get("/a/path with whitespace"), urlToPath(new URL("file:/a/path%20with%20whitespace")));
+ urlToPath(new URL("file:/a/path%20with%20whitespace/META-INF/services/my.Service"), "META-INF"));
+ assertEquals(Paths.get("/a/path"), urlToPath(new URL("file:/a/path"), ""));
+ assertEquals(Paths.get("/a/path with whitespace"), urlToPath(new URL("file:/a/path%20with%20whitespace"), ""));
}
@Test(expected = RuntimeException.class)
public void testUrlToPathWithWrongProtocol() throws MalformedURLException {
- urlToPath(new URL("http://a/path"));
+ urlToPath(new URL("http://a/path"), "");
}
}
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 f8b5949760c..656d958f532 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -423,7 +423,7 @@ private void addToClassPaths(StringBuilder classPathManifest, DevModeContext cla
}
String path = uri.getRawPath();
classPathManifest.append(path);
- if (file.isDirectory()) {
+ if (file.isDirectory() && path.charAt(path.length() - 1) != '/') {
classPathManifest.append("/");
}
classPathManifest.append(" ");
diff --git a/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusUnitTest.java b/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusUnitTest.java
index 315b3faec87..d8a86bc12a6 100644
--- a/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusUnitTest.java
+++ b/test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusUnitTest.java
@@ -223,11 +223,14 @@ public void execute(BuildContext context) {
//ignore
}
+ final Path testLocation = PathTestHelper.getTestClassesLocation(testClass);
+
runtimeRunner = RuntimeRunner.builder()
.setLaunchMode(LaunchMode.TEST)
.setClassLoader(testClass.getClassLoader())
.setTarget(deploymentDir)
- .setFrameworkClassesPath(PathTestHelper.getTestClassesLocation(testClass))
+ .excludeFromIndexing(testLocation)
+ .setFrameworkClassesPath(testLocation)
.addChainCustomizers(customiers)
.build();
| ['core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java', 'core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java', 'test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusUnitTest.java', 'core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java', 'core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java', 'devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java'] | {'.java': 7} | 7 | 7 | 0 | 0 | 7 | 4,144,293 | 803,312 | 107,571 | 1,110 | 6,334 | 1,087 | 113 | 5 | 171 | 22 | 48 | 1 | 1 | 0 | 1970-01-01T00:26: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 |
3,255 | quarkusio/quarkus/3108/3048 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3048 | https://github.com/quarkusio/quarkus/pull/3108 | https://github.com/quarkusio/quarkus/pull/3108 | 1 | fix | native-image location | **Describe the bug**
io.quarkus:quarkus-maven-plugin:0.18.0:native-image
expects the native-image to be located in: /Java/JavaVirtualMachines/graalvm-ce-19.0.2/bin/native-image
The actual location is: /graalvm-ce-19.0.2/Contents/Home/bin
**Expected behavior**
After `gu install native-image` quarkus should pick-up the native-image without any additional configuration.
**Actual behavior**
Image is not found
**To Reproduce**
Steps to reproduce the behavior:
1. Install GraalVM 19.0.2
2. Run `gu install native-image`
3. Run `mvn io.quarkus:quarkus-maven-plugin:0.18.0:create`
4. Run `mvn clean install -Pnative
**Environment (please complete the following information):**
18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-20190523183630.graal2.jdk8u-src-tar-gz-b03)
OpenJDK 64-Bit GraalVM CE 19.0.2 (build 25.212-b03-jvmci-19-b04, mixed mode)
Quarkus version: 18.0.0 | 9c2232a3a255622aba8be52a632db91d627500c2 | 0ac4a3b1d35d07bf073e9496234323f318b97f12 | https://github.com/quarkusio/quarkus/compare/9c2232a3a255622aba8be52a632db91d627500c2...0ac4a3b1d35d07bf073e9496234323f318b97f12 | diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java b/core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java
index 0c1efe0a0c0..3cfb2c681fb 100644
--- a/core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java
+++ b/core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java
@@ -15,6 +15,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.Properties;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Collectors;
@@ -44,11 +45,26 @@ public class NativeImagePhase implements AppCreationPhase<NativeImagePhase>, Nat
private static final String GRAALVM_HOME = "GRAALVM_HOME";
+ /**
+ * Name of the <em>system</em> property to retrieve JAVA_HOME
+ */
+ private static final String JAVA_HOME_SYS = "java.home";
+
+ /**
+ * Name of the <em>environment</em> variable to retrieve JAVA_HOME
+ */
+ private static final String JAVA_HOME_ENV = "JAVA_HOME";
+
private static final String QUARKUS_PREFIX = "quarkus.";
private static final boolean IS_LINUX = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("linux");
private static final boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
+ /**
+ * The name of the environment variable containing the system path.
+ */
+ private static final String PATH = "PATH";
+
private Path outputDir;
private boolean reportErrorsAtRuntime;
@@ -75,6 +91,8 @@ public class NativeImagePhase implements AppCreationPhase<NativeImagePhase>, Nat
private String graalvmHome;
+ private File javaHome;
+
private boolean enableServer;
private boolean enableJni;
@@ -173,6 +191,11 @@ public NativeImagePhase setGraalvmHome(String graalvmHome) {
return this;
}
+ public NativeImagePhase setJavaHome(File javaHome) {
+ this.javaHome = javaHome;
+ return this;
+ }
+
public NativeImagePhase setEnableServer(boolean enableServer) {
this.enableServer = enableServer;
return this;
@@ -327,21 +350,27 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException {
noPIE = detectNoPIE();
}
- String graalvmHome = this.graalvmHome;
- if (graalvmHome != null) {
- env.put(GRAALVM_HOME, graalvmHome);
+ String graal = this.graalvmHome;
+ File java = this.javaHome;
+ if (graal != null) {
+ env.put(GRAALVM_HOME, graal);
} else {
- graalvmHome = env.get(GRAALVM_HOME);
- if (graalvmHome == null) {
- throw new AppCreatorException("GRAALVM_HOME was not set");
+ graal = env.get(GRAALVM_HOME);
+ }
+ if (java == null) {
+ // try system property first - it will be the JAVA_HOME used by the current JVM
+ String home = System.getProperty(JAVA_HOME_SYS);
+ if (home == null) {
+ // No luck, somewhat a odd JVM not enforcing this property
+ // try with the JAVA_HOME environment variable
+ home = env.get(JAVA_HOME_ENV);
+ }
+
+ if (home != null) {
+ java = new File(home);
}
}
- String imageName = IS_WINDOWS ? "native-image.cmd" : "native-image";
- nativeImage = Collections.singletonList(graalvmHome + File.separator + "bin" + File.separator + imageName);
- if (Files.notExists(Paths.get(nativeImage.get(0)))) {
- throw new AppCreatorException("The `native-image` tool (" + nativeImage.get(0)
- + ") is not installed, this can be done by running `gu install native-image`");
- }
+ nativeImage = Collections.singletonList(getNativeImageExecutable(graal, java, env).getAbsolutePath());
}
try {
@@ -530,6 +559,43 @@ private boolean isThisGraalVMRCObsolete() {
return false;
}
+ private static File getNativeImageExecutable(String graalVmHome, File javaHome, Map<String, String> env)
+ throws AppCreatorException {
+ String imageName = IS_WINDOWS ? "native-image.cmd" : "native-image";
+ if (graalVmHome != null) {
+ File file = Paths.get(graalVmHome, "bin", imageName).toFile();
+ if (file.exists()) {
+ return file;
+ }
+ }
+
+ if (javaHome != null) {
+ File file = new File(javaHome, "bin/" + imageName);
+ if (file.exists()) {
+ return file;
+ }
+ }
+
+ // System path
+ String systemPath = env.get(PATH);
+ if (systemPath != null) {
+ String[] pathDirs = systemPath.split(File.pathSeparator);
+ for (String pathDir : pathDirs) {
+ File dir = new File(pathDir);
+ if (dir.isDirectory()) {
+ File file = new File(dir, imageName);
+ if (file.exists()) {
+ return file;
+ }
+ }
+ }
+ }
+
+ throw new AppCreatorException("Cannot find the `" + imageName + "` in the GRAALVM_HOME, JAVA_HOME and System " +
+ "PATH. Install it using `gu install native-image`");
+
+ }
+
private static String getLinuxID(String option) {
Process process;
diff --git a/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java
index 0a24f4820b7..f22224014c6 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java
@@ -46,6 +46,9 @@ public class NativeImageMojo extends AbstractMojo {
@Parameter(defaultValue = "${project}", readonly = true, required = true)
protected MavenProject project;
+ @Parameter(defaultValue = "${java.home}", required = true, readonly = true)
+ public File javaHome;
+
@Parameter(defaultValue = "${project.build.directory}")
private File buildDir;
@@ -355,6 +358,7 @@ public Path getOriginalJar() {
.setEnableVMInspection(enableVMInspection)
.setFullStackTraces(fullStackTraces)
.setGraalvmHome(graalvmHome)
+ .setJavaHome(javaHome)
.setNativeImageXmx(nativeImageXmx)
.setReportErrorsAtRuntime(reportErrorsAtRuntime)
.setReportExceptionStackTraces(reportExceptionStackTraces)); | ['core/creator/src/main/java/io/quarkus/creator/phase/nativeimage/NativeImagePhase.java', 'devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 3,795,700 | 731,244 | 98,515 | 1,049 | 3,805 | 794 | 94 | 2 | 1,046 | 103 | 343 | 32 | 0 | 0 | 1970-01-01T00:26: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 |
3,256 | quarkusio/quarkus/3070/3034 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3034 | https://github.com/quarkusio/quarkus/pull/3070 | https://github.com/quarkusio/quarkus/pull/3070 | 1 | fixes | Quarkus projects do not compile when project path contains whitespaces | **Describe the bug**
I am trying to build a quarkus project on our company jenkins. The path to the project in jenkins contains whitespaces.
"/var/lib/jenkins/jobs/wolf - project/workspace/project-web/target/classes"
The build fails.
If I remove these whitespaces, the build is successfull.
**Expected behavior**
The project builds without errors caused by internal quarkus maven plugin problems.
**Actual behavior**
Build fails with the following error:
```
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.18.0:build (default) on project documentrepository-web: Failed to build a runnable JAR: Failed to build a runner jar: Failed to augment application classes: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.index.ApplicationArchiveBuildStep#build threw an exception: java.lang.RuntimeException: java.io.FileNotFoundException: /var/lib/jenkins/jobs/wolf%20-%20project/workspace/project-web/target/classes (Datei oder Verzeichnis nicht gefunden)
[ERROR] -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :project-web
```
**To Reproduce**
Steps to reproduce the behavior:
1. Move an existing, successfully compiling quarkus project into a path with whitespaces
2. Compile
3. Does not compile
**Additional context**
quarkus 018.0
java 8
Maven 3.6.1
| 2fbd080e3e7b861f6afaccf48467d1c9749ab133 | 5c910eee39474d021dbef7000f444c288de0dd16 | https://github.com/quarkusio/quarkus/compare/2fbd080e3e7b861f6afaccf48467d1c9749ab133...5c910eee39474d021dbef7000f444c288de0dd16 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
index 58c21f6b063..d13b71c424d 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
@@ -1,5 +1,6 @@
package io.quarkus.deployment.index;
+import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -171,13 +172,13 @@ static Path urlToPath(URL url) {
String jarPath = url.getPath().substring(0, url.getPath().lastIndexOf('!'));
return Paths.get(new URI(jarPath));
} else if (url.getProtocol().equals("file")) {
- int index = url.getPath().lastIndexOf("/META-INF");
+ final Path path = Paths.get(url.toURI());
+ final String filePath = path.toString();
+ final int index = filePath.lastIndexOf(File.separator + "META-INF");
if (index == -1) {
- return Paths.get(url.getPath());
+ return path;
}
- String pathString = url.getPath().substring(0, index);
- Path path = Paths.get(new URI(url.getProtocol(), url.getHost(), pathString, null));
- return path;
+ return Paths.get(filePath.substring(0, index));
}
throw new RuntimeException("Unknown URL type " + url.getProtocol());
} catch (URISyntaxException e) {
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java b/core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java
index 0df051e2cd3..16211109c1b 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java
@@ -13,8 +13,13 @@ public class ApplicationArchiveBuildStepTestCase {
@Test
public void testUrlToPath() throws MalformedURLException {
assertEquals(Paths.get("/a/path"), urlToPath(new URL("jar:file:/a/path!/META-INF/services/my.Service")));
+ assertEquals(Paths.get("/a/path with whitespace"),
+ urlToPath(new URL("jar:file:/a/path%20with%20whitespace!/META-INF/services/my.Service")));
assertEquals(Paths.get("/a/path"), urlToPath(new URL("file:/a/path/META-INF/services/my.Service")));
+ assertEquals(Paths.get("/a/path with whitespace"),
+ urlToPath(new URL("file:/a/path%20with%20whitespace/META-INF/services/my.Service")));
assertEquals(Paths.get("/a/path"), urlToPath(new URL("file:/a/path")));
+ assertEquals(Paths.get("/a/path with whitespace"), urlToPath(new URL("file:/a/path%20with%20whitespace")));
}
@Test(expected = RuntimeException.class) | ['core/deployment/src/test/java/io/quarkus/deployment/index/ApplicationArchiveBuildStepTestCase.java', 'core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 3,795,700 | 731,244 | 98,515 | 1,049 | 649 | 111 | 11 | 1 | 1,799 | 219 | 432 | 38 | 1 | 1 | 1970-01-01T00:26: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 |
3,257 | quarkusio/quarkus/3068/3030 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3030 | https://github.com/quarkusio/quarkus/pull/3068 | https://github.com/quarkusio/quarkus/pull/3068 | 2 | fixes | Apply default values during property expansion | **Description**
Default values are not applied during expansion of config values. E.g. given a config in _application.properties_ like this:
quarkus.kafka-streams.application-server=${hostname}:${quarkus.http.port}
Then the HTTP port should default to the value from the config item, but instead an error is raised:
Build step io.quarkus.deployment.steps.ConfigurationSetup#initializeConfiguration threw an exception: java.util.NoSuchElementException: Property quarkus.http.port not found
Things work when specifying a value explicitly for `quarkus.http.port` or when giving a default value within the expanded expression (${quarkus.http.port:8080}).
CC @dmlloyd | 2f00cedaca1e9d0e30fa0ca9625dd8abc44ddf35 | b240c91fc0ab0e6aa5da30418314495fe51247b9 | https://github.com/quarkusio/quarkus/compare/2f00cedaca1e9d0e30fa0ca9625dd8abc44ddf35...b240c91fc0ab0e6aa5da30418314495fe51247b9 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigDefinition.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigDefinition.java
index 2f5df05b613..3923606c59d 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigDefinition.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigDefinition.java
@@ -73,13 +73,19 @@ public class ConfigDefinition extends CompoundConfigType {
private final TreeMap<String, RootInfo> rootTypesByContainingName = new TreeMap<>();
private final FieldDescriptor rootField;
private final TreeMap<String, String> loadedProperties = new TreeMap<>();
+ private final boolean deferResolution;
- public ConfigDefinition(final FieldDescriptor rootField) {
+ public ConfigDefinition(final FieldDescriptor rootField, final boolean deferResolution) {
super(null, null, false);
+ this.deferResolution = deferResolution;
Assert.checkNotNullParam("rootField", rootField);
this.rootField = rootField;
}
+ public ConfigDefinition(final FieldDescriptor rootField) {
+ this(rootField, false);
+ }
+
void acceptConfigurationValueIntoLeaf(final LeafConfigType leafType, final NameIterator name,
final ExpandingConfigSource.Cache cache, final SmallRyeConfig config) {
// primitive/leaf values without a config group
@@ -388,7 +394,16 @@ public static void loadConfiguration(final ExpandingConfigSource.Cache cache, Sm
name.goToEnd();
leafType.acceptConfigurationValue(name, cache, config);
final String nameString = name.toString();
- definition.loadedProperties.put(nameString, config.getValue(nameString, String.class));
+ if (definition.deferResolution) {
+ boolean old = ExpandingConfigSource.setExpanding(false);
+ try {
+ definition.loadedProperties.put(nameString, config.getValue(nameString, String.class));
+ } finally {
+ ExpandingConfigSource.setExpanding(old);
+ }
+ } else {
+ definition.loadedProperties.put(nameString, config.getValue(nameString, String.class));
+ }
continue outer;
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigurationSetup.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigurationSetup.java
index a5d8a9f353a..d75889cef86 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigurationSetup.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigurationSetup.java
@@ -189,7 +189,7 @@ public void initializeConfiguration(
// set up the configuration definitions
final ConfigDefinition buildTimeConfig = new ConfigDefinition(FieldDescriptor.of("Bogus", "No field", "Nothing"));
final ConfigDefinition buildTimeRunTimeConfig = new ConfigDefinition(BUILD_TIME_CONFIG_FIELD);
- final ConfigDefinition runTimeConfig = new ConfigDefinition(RUN_TIME_CONFIG_FIELD);
+ final ConfigDefinition runTimeConfig = new ConfigDefinition(RUN_TIME_CONFIG_FIELD, true);
// populate it with all known types
for (Class<?> clazz : ServiceUtil.classesNamedIn(extensionClassLoaderBuildItem.getExtensionClassLoader(), | ['core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigurationSetup.java', 'core/deployment/src/main/java/io/quarkus/deployment/configuration/ConfigDefinition.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 3,792,954 | 730,688 | 98,449 | 1,048 | 1,330 | 192 | 21 | 2 | 687 | 72 | 142 | 12 | 0 | 0 | 1970-01-01T00:26: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 |
3,260 | quarkusio/quarkus/3016/2898 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2898 | https://github.com/quarkusio/quarkus/pull/3016 | https://github.com/quarkusio/quarkus/pull/3016 | 1 | resolves | Setting of system property java.io.tmpdir having no effect on VertxTemplate in native mode | **Describe the bug**
Setting of system property `java.io.tmpdir` in native mode has no effect for vert.x quickstart. This is part of the discussion [here](https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Native.20builds.3A.20JVM.20options.20at.20runtime/near/168516155).
**Expected behavior**
Setting the `java.io.tmpdir` system property should work correctly since the `VertxTemplate` is a RuntTime init template
**Actual behavior**
The system property is ignored
**To Reproduce**
Steps to reproduce the behavior:
1. Use the vertx quickstart :https://github.com/quarkusio/quarkus-quickstarts/tree/master/using-vertx
2. Create a native binary
3. Attempt to set the system property by doing something like: `target/using-vertx-1.0-SNAPSHOT-runner -Djava.io.tmpdir=/dummy`. This should fail normally since the directory does not exist (and it of course does fail when running `java -Djava.io.tmpdir=/dummy -jar target/using-vertx-1.0-SNAPSHOT-runner.jar`).
| 219c5a9b041042df3adf69a1af59cabf03b39eaa | 9c880392bbf3e52dc031b5f0ea390c553c6b7af3 | https://github.com/quarkusio/quarkus/compare/219c5a9b041042df3adf69a1af59cabf03b39eaa...9c880392bbf3e52dc031b5f0ea390c553c6b7af3 | diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxTemplate.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxTemplate.java
index e75c5bdfd48..2fc0474df37 100644
--- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxTemplate.java
+++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxTemplate.java
@@ -1,5 +1,8 @@
package io.quarkus.vertx.runtime;
+import static io.vertx.core.file.impl.FileResolver.CACHE_DIR_BASE_PROP_NAME;
+
+import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
@@ -76,9 +79,7 @@ void initialize(VertxConfiguration conf) {
System.setProperty("vertx.disableDnsResolver", "true");
}
- System.setProperty("vertx.cacheDirBase", System.getProperty("java.io.tmpdir"));
-
- if (options.isClustered()) {
+ if (options.getEventBusOptions().isClustered()) {
AtomicReference<Throwable> failure = new AtomicReference<>();
CountDownLatch latch = new CountDownLatch(1);
Vertx.clusteredVertx(options, ar -> {
@@ -111,8 +112,12 @@ private VertxOptions convertToVertxOptions(VertxConfiguration conf) {
setEventBusOptions(conf, options);
initializeClusterOptions(conf, options);
+ String fileCacheDir = System.getProperty(CACHE_DIR_BASE_PROP_NAME,
+ System.getProperty("java.io.tmpdir", ".") + File.separator + "vertx-cache");
+
options.setFileSystemOptions(new FileSystemOptions()
.setFileCachingEnabled(conf.caching)
+ .setFileCacheDir(fileCacheDir)
.setClassPathResolvingEnabled(conf.classpathResolving));
options.setWorkerPoolSize(conf.workerPoolSize);
options.setBlockedThreadCheckInterval(conf.warningExceptionTime.toMillis()); | ['extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxTemplate.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 3,783,543 | 728,855 | 98,161 | 1,046 | 509 | 109 | 11 | 1 | 996 | 102 | 262 | 18 | 2 | 0 | 1970-01-01T00:26: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 |
3,261 | quarkusio/quarkus/2973/2963 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2963 | https://github.com/quarkusio/quarkus/pull/2973 | https://github.com/quarkusio/quarkus/pull/2973 | 1 | resolves | Build warnings when using quarkus-smallrye-health extension | **Describe the bug**
The following warnings are shown during the build:
```
[WARNING] [io.quarkus.arc.processor.Methods] Method io.smallrye.health.SmallRyeHealthReporter.getHealth() is final, skipped during generation of corresponding intercepted subclass
[WARNING] [io.quarkus.arc.processor.Methods] Method io.smallrye.health.SmallRyeHealthReporter.getHealth() is final, skipped during generation of corresponding client proxy
```
**Expected behavior**
No warnings
**Actual behavior**
Warning is shown
**To Reproduce**
Steps to reproduce the behavior:
1.
```
mvn io.quarkus:quarkus-maven-plugin:0.17.0:create \\
-DprojectGroupId=org.acme \\
-DprojectArtifactId=getting-started \\
-DclassName="org.acme.quickstart.GreetingResource" \\
-Dpath="/hello" \\
-Dextensions="quarkus-smallrye-health"
```
2. cd getting-started
3. mvn package
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Linux ggastald-laptop 5.1.6-300.fc30.x86_64 #1 SMP Fri May 31 17:43:23 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux`
- Output of `java -version`:
```
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)
```
- GraalVM version (if different from Java): Not installed
- Quarkus version or git rev: 0.17.0
| 38a665f4aa2923da6b97839855aca4eaf35db7b2 | db6e42f4f8fce8002af75f0fd41c6bb336a666d9 | https://github.com/quarkusio/quarkus/compare/38a665f4aa2923da6b97839855aca4eaf35db7b2...db6e42f4f8fce8002af75f0fd41c6bb336a666d9 | 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 4da53eac518..d9743970b7f 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
@@ -76,13 +76,7 @@ static void addDelegatingMethods(IndexView index, ClassInfo classInfo, Map<Metho
}
private static boolean skipForClientProxy(MethodInfo method) {
- short flags = method.flags();
- String className = method.declaringClass().name().toString();
- if (Modifier.isFinal(flags) && !className.startsWith("java.")) {
- LOGGER.warn(String.format("Method %s.%s() is final, skipped during generation of corresponding client proxy",
- className, method.name()));
- }
- if (Modifier.isStatic(flags) || Modifier.isFinal(flags) || Modifier.isPrivate(flags)) {
+ if (Modifier.isStatic(method.flags()) || Modifier.isPrivate(method.flags())) {
return true;
}
if (IGNORED_METHODS.contains(method.name())) {
@@ -91,6 +85,15 @@ private static boolean skipForClientProxy(MethodInfo method) {
if (method.declaringClass().name().equals(DotNames.OBJECT)) {
return true;
}
+ if (Modifier.isFinal(method.flags())) {
+ String className = method.declaringClass().name().toString();
+ if (!className.startsWith("java.")) {
+ LOGGER.warn(
+ String.format("Method %s.%s() is final, skipped during generation of the corresponding client proxy",
+ className, method.name()));
+ }
+ return true;
+ }
return false;
}
@@ -108,12 +111,23 @@ static void addInterceptedMethodCandidates(BeanDeployment beanDeployment, ClassI
Set<AnnotationInstance> merged = new HashSet<>();
merged.addAll(methodLevelBindings);
for (AnnotationInstance classLevelBinding : classLevelBindings) {
- if (methodLevelBindings.stream().noneMatch(a -> classLevelBinding.name().equals(a.name()))) {
+ if (methodLevelBindings.isEmpty()
+ || methodLevelBindings.stream().noneMatch(a -> classLevelBinding.name().equals(a.name()))) {
merged.add(classLevelBinding);
}
}
if (!merged.isEmpty()) {
- candidates.computeIfAbsent(new Methods.MethodKey(method), key -> merged);
+ if (Modifier.isFinal(method.flags())) {
+ String className = method.declaringClass().name().toString();
+ if (!className.startsWith("java.")) {
+ LOGGER.warn(
+ String.format(
+ "Method %s.%s() is final, skipped during generation of the corresponding intercepted subclass",
+ className, method.name()));
+ }
+ } else {
+ candidates.computeIfAbsent(new Methods.MethodKey(method), key -> merged);
+ }
}
}
if (classInfo.superClassType() != null) {
@@ -125,14 +139,7 @@ static void addInterceptedMethodCandidates(BeanDeployment beanDeployment, ClassI
}
private static boolean skipForSubclass(MethodInfo method) {
- short flags = method.flags();
- String className = method.declaringClass().name().toString();
- if (Modifier.isFinal(flags) && !className.startsWith("java.")) {
- LOGGER.warn(
- String.format("Method %s.%s() is final, skipped during generation of corresponding intercepted subclass",
- className, method.name()));
- }
- if (Modifier.isStatic(flags) || Modifier.isFinal(flags)) {
+ if (Modifier.isStatic(method.flags())) {
return true;
}
if (IGNORED_METHODS.contains(method.name())) {
@@ -141,6 +148,7 @@ private static boolean skipForSubclass(MethodInfo method) {
if (method.declaringClass().name().equals(DotNames.OBJECT)) {
return true;
}
+ // We intentionally do not skip final methods here - these are handled later
return false;
}
| ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 3,774,927 | 727,182 | 97,901 | 1,044 | 2,630 | 450 | 42 | 1 | 1,400 | 143 | 398 | 39 | 0 | 3 | 1970-01-01T00:26: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 |
3,262 | quarkusio/quarkus/2970/2959 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2959 | https://github.com/quarkusio/quarkus/pull/2970 | https://github.com/quarkusio/quarkus/pull/2970 | 1 | fixes | Native image - java.lang.ClassNotFoundException: com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector | Native image build process throws java.lang.ClassNotFoundException: com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector
Native image is generated, but console is polluted with stacktrace.
Running Quarkus master and GraalVM 19.0.2 CE.
```
[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] /Users/rsvoboda/.sdkman/candidates/java/19.0.2-grl/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar getting-started-1.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+PrintAnalysisCallTree -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-SpawnIsolates -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
[getting-started-1.0-SNAPSHOT-runner:21236] classlist: 4,446.30 ms
[getting-started-1.0-SNAPSHOT-runner:21236] (cap): 2,193.08 ms
[getting-started-1.0-SNAPSHOT-runner:21236] setup: 3,750.74 ms
java.lang.ClassNotFoundException: com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at io.quarkus.runner.AutoFeature.registerClass9(AutoFeature.zig:1773)
at io.quarkus.runner.AutoFeature.beforeAnalysis(AutoFeature.zig:350)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:667)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:64)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:667)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:523)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:441)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ser.std.SqlDateSerializer
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at io.quarkus.runner.AutoFeature.registerClass10(AutoFeature.zig:2321)
at io.quarkus.runner.AutoFeature.beforeAnalysis(AutoFeature.zig:352)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:667)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:64)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:667)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:523)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:441)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
```
```
mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create \\
-DprojectGroupId=org.acme \\
-DprojectArtifactId=getting-started \\
-DclassName="org.acme.quickstart.GreetingResource" \\
-Dpath="/hello"
```
Running `mvn verify -Dnative` passes but console is polluted with stacktrace | 38a665f4aa2923da6b97839855aca4eaf35db7b2 | 7dca4d8f08ab2833ce352822eab72a9b3752bf34 | https://github.com/quarkusio/quarkus/compare/38a665f4aa2923da6b97839855aca4eaf35db7b2...7dca4d8f08ab2833ce352822eab72a9b3752bf34 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateAutoFeatureStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateAutoFeatureStep.java
index 69c9d0f79ea..2f32e0d39dd 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateAutoFeatureStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateAutoFeatureStep.java
@@ -261,7 +261,7 @@ SubstrateOutputBuildItem generateFeature(ClassOutputBuildItem output,
}
}
CatchBlockCreator cc = tc.addCatch(Throwable.class);
- cc.invokeVirtualMethod(ofMethod(Throwable.class, "printStackTrace", void.class), cc.getCaughtException());
+ //cc.invokeVirtualMethod(ofMethod(Throwable.class, "printStackTrace", void.class), cc.getCaughtException());
mv.returnValue(null);
}
CatchBlockCreator print = overallCatch.addCatch(Throwable.class); | ['core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateAutoFeatureStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 3,774,927 | 727,182 | 97,901 | 1,044 | 241 | 47 | 2 | 1 | 4,146 | 154 | 1,053 | 57 | 0 | 2 | 1970-01-01T00:26: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 |
3,264 | quarkusio/quarkus/2956/2955 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2955 | https://github.com/quarkusio/quarkus/pull/2956 | https://github.com/quarkusio/quarkus/pull/2956 | 1 | fixes | ArchiveRootBuildItem should include archive location and the archive root paths | It's currently initialized with a single path, which is practically application classes directory. However, when an instance of `ApplicationArchiveImpl` is created using `ArchiveRootBuildItem`, it expects two different arguments: one representing a path to the archive, the other one - app classes dir. It works in case the app archive is represented with the app classes dir but if the app archive is an actual archive it's not going to work.
NOTE: this is about enabling support for building Quarkus applications from user apps provided as JARs. However, I am being careful here not to imply that it's all that's needed to enable that. This change will definitely allow testing and building native images which is my primary focus at the moment. Building proper runner jars will require a bit more work. | 364ac8ec60e5aa1ee410645d6ecdb48e10db728f | dab08c873b8ceace1597b7f4dbba4628cf1b95c6 | https://github.com/quarkusio/quarkus/compare/364ac8ec60e5aa1ee410645d6ecdb48e10db728f...dab08c873b8ceace1597b7f4dbba4628cf1b95c6 | 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 a757a6bc13d..5e96a027466 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
@@ -1,5 +1,8 @@
package io.quarkus.deployment;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashSet;
@@ -53,6 +56,7 @@ public BuildResult run() throws Exception {
long time = System.currentTimeMillis();
log.info("Beginning quarkus augmentation");
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
+ FileSystem rootFs = null;
try {
Thread.currentThread().setContextClassLoader(classLoader);
@@ -82,10 +86,13 @@ public BuildResult run() throws Exception {
BuildChain chain = chainBuilder
.build();
+ if (!Files.isDirectory(root)) {
+ rootFs = FileSystems.newFileSystem(root, null);
+ }
BuildExecutionBuilder execBuilder = chain.createExecutionBuilder("main")
.produce(QuarkusConfig.INSTANCE)
.produce(liveReloadBuildItem)
- .produce(new ArchiveRootBuildItem(root))
+ .produce(new ArchiveRootBuildItem(root, rootFs == null ? root : rootFs.getPath("/")))
.produce(new ClassOutputBuildItem(output))
.produce(new ShutdownContextBuildItem())
.produce(new LaunchModeBuildItem(launchMode))
@@ -106,6 +113,12 @@ public BuildResult run() throws Exception {
log.info("Quarkus augmentation completed in " + (System.currentTimeMillis() - time) + "ms");
return buildResult;
} finally {
+ if (rootFs != null) {
+ try {
+ rootFs.close();
+ } catch (Exception e) {
+ }
+ }
Thread.currentThread().setContextClassLoader(originalClassLoader);
}
}
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 08d3d3fdefd..fa935eb1eee 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
@@ -1,18 +1,51 @@
package io.quarkus.deployment.builditem;
+import java.nio.file.Files;
import java.nio.file.Path;
import io.quarkus.builder.item.SimpleBuildItem;
public final class ArchiveRootBuildItem extends SimpleBuildItem {
- private final Path path;
+ private final Path archiveLocation;
+ private final Path archiveRoot;
- public ArchiveRootBuildItem(Path path) {
- this.path = path;
+ public ArchiveRootBuildItem(Path appClassesDir) {
+ this(appClassesDir, appClassesDir);
}
+ public ArchiveRootBuildItem(Path archiveLocation, Path archiveRoot) {
+ this.archiveLocation = archiveLocation;
+ if (!Files.isDirectory(archiveRoot)) {
+ throw new IllegalArgumentException(archiveRoot + " does not point to the application classes directory");
+ }
+ this.archiveRoot = archiveRoot;
+ }
+
+ /**
+ * Deprecated in favor of getArhiveLocation()
+ */
+ @Deprecated
public Path getPath() {
- return path;
+ return getArchiveLocation();
+ }
+
+ /**
+ * If this archive is a jar file it will return the path to the jar file on the file system,
+ * otherwise it will return the directory that this corresponds to.
+ */
+ public Path getArchiveLocation() {
+ return archiveLocation;
+ }
+
+ /**
+ *
+ * Returns a path representing the archive root. Note that if this is a jar archive this is not the path to the
+ * jar, but rather a path to the root of the mounted {@link com.sun.nio.zipfs.ZipFileSystem}
+ *
+ * @return The archive root.
+ */
+ public Path getArchiveRoot() {
+ return archiveRoot;
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
index a0c7b822282..58c21f6b063 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
@@ -83,9 +83,9 @@ ApplicationArchivesBuildItem build(ArchiveRootBuildItem root, ApplicationIndexBu
}
List<ApplicationArchive> applicationArchives = scanForOtherIndexes(Thread.currentThread().getContextClassLoader(),
- markerFiles, root.getPath(), additionalApplicationArchiveBuildItem, indexCache);
+ markerFiles, root.getArchiveLocation(), additionalApplicationArchiveBuildItem, indexCache);
return new ApplicationArchivesBuildItem(
- new ApplicationArchiveImpl(appindex.getIndex(), root.getPath(), null, false, root.getPath()),
+ new ApplicationArchiveImpl(appindex.getIndex(), root.getArchiveRoot(), null, false, root.getArchiveLocation()),
applicationArchives);
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationIndexBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationIndexBuildStep.java
index c052add0a5f..8b6c80447d2 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationIndexBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationIndexBuildStep.java
@@ -21,7 +21,7 @@ public class ApplicationIndexBuildStep {
ApplicationIndexBuildItem build(ArchiveRootBuildItem root) throws IOException {
Indexer indexer = new Indexer();
- Files.walkFileTree(root.getPath(), new FileVisitor<Path>() {
+ Files.walkFileTree(root.getArchiveRoot(), new FileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
return FileVisitResult.CONTINUE;
@@ -51,4 +51,4 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx
return new ApplicationIndexBuildItem(appIndex);
}
-}
+}
\\ No newline at end of file
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateSystemPropertiesBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateSystemPropertiesBuildStep.java
index 1ca0ca2aac2..63c6b6efdbf 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateSystemPropertiesBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateSystemPropertiesBuildStep.java
@@ -26,7 +26,7 @@ SubstrateOutputBuildItem writeNativeProps(ArchiveRootBuildItem root,
}
properties.put(i.getKey(), i.getValue());
}
- try (FileOutputStream os = new FileOutputStream(new File(root.getPath().toFile(), "native-image.properties"))) {
+ try (FileOutputStream os = new FileOutputStream(new File(root.getArchiveRoot().toFile(), "native-image.properties"))) {
try (OutputStreamWriter osw = new OutputStreamWriter(os, StandardCharsets.UTF_8)) {
properties.store(osw, "Generated properties (do not edit)");
}
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 66a0435caaa..968d98460f6 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
@@ -431,7 +431,7 @@ private void handleHibernateORMWithNoPersistenceXml(
loadScriptPath
.filter(path -> !Files.isDirectory(path))
.ifPresent(path -> {
- String resourceAsString = root.getPath().relativize(loadScriptPath.get()).toString();
+ String resourceAsString = root.getArchiveRoot().relativize(loadScriptPath.get()).toString();
resourceProducer.produce(new SubstrateResourceBuildItem(resourceAsString));
desc.getProperties().setProperty(AvailableSettings.HBM2DDL_IMPORT_FILES, importFile);
}); | ['core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/ArchiveRootBuildItem.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/SubstrateSystemPropertiesBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java', 'extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/ApplicationIndexBuildStep.java'] | {'.java': 6} | 6 | 6 | 0 | 0 | 6 | 3,770,375 | 726,353 | 97,796 | 1,044 | 3,115 | 600 | 68 | 6 | 808 | 131 | 161 | 3 | 0 | 0 | 1970-01-01T00:26: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 |
3,252 | quarkusio/quarkus/3152/3139 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3139 | https://github.com/quarkusio/quarkus/pull/3152 | https://github.com/quarkusio/quarkus/pull/3152 | 1 | resolves | After adding various extentsion, maven build fails | Had no problems running & compiling at the beginning, but after adding some extensions, the maven build failed.
```
$ ./mvnw clean compile quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< ai.labs:quarkus-test >------------------------
[INFO] Building quarkus-test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ quarkus-test ---
[INFO] Deleting C:\\dev\\git\\quarkus-test\\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ quarkus-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ quarkus-test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\\dev\\git\\quarkus-test\\target\\classes
[INFO]
[INFO] --- quarkus-maven-plugin:0.18.0:dev (default-cli) @ quarkus-test ---
Listening for transport dt_socket at address: 5005
19:14:58,640 INFO [io.qua.dep.QuarkusAugmentor] Beginning quarkus augmentation
19:14:58,842 INFO [org.jbo.threads] JBoss Threads version 3.0.0.Beta4
19:15:00,488 INFO [io.qua.dep.QuarkusAugmentor] Quarkus augmentation completed in 1848ms
19:15:00,517 ERROR [io.qua.dev.DevModeMain] Failed to start quarkus: java.lang.ExceptionInInitializerError
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.runner.RuntimeRunner.run(RuntimeRunner.java:117)
at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:166)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:88)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl1.<clinit>(ApplicationImpl1.zig:293)
... 8 more
Caused by: java.lang.RuntimeException: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
at [Source: UNKNOWN; line: 1, column: 0]
at org.keycloak.adapters.KeycloakDeploymentBuilder.loadAdapterConfig(KeycloakDeploymentBuilder.java:198)
at org.keycloak.adapters.KeycloakDeploymentBuilder.build(KeycloakDeploymentBuilder.java:187)
at io.quarkus.keycloak.KeycloakTemplate.createKeycloakDeploymentContext(KeycloakTemplate.java:36)
at io.quarkus.deployment.steps.KeycloakAdapterProcessor$configureAdapter4.deploy_0(KeycloakAdapterProcessor$configureAdapter4.zig:47)
at io.quarkus.deployment.steps.KeycloakAdapterProcessor$configureAdapter4.deploy(KeycloakAdapterProcessor$configureAdapter4.zig:106)
at io.quarkus.runner.ApplicationImpl1.<clinit>(ApplicationImpl1.zig:191)
... 8 more
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
at [Source: UNKNOWN; line: 1, column: 0]
at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:59)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:4145)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4000)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3070)
at org.keycloak.adapters.KeycloakDeploymentBuilder.loadAdapterConfig(KeycloakDeploymentBuilder.java:196)
... 13 more
19:15:00,522 ERROR [io.qua.dev.DevModeMain] Failed to start Quarkus, attempting to start hot replacement endpoint to recover
19:15:00,540 INFO [org.xnio] XNIO version 3.7.2.Final
19:15:00,552 INFO [org.xni.nio] XNIO NIO Implementation Version 3.7.2.Final
```
POM-file:
```
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>ai.labs</groupId>
<artifactId>quarkus-test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<surefire-plugin.version>2.22.0</surefire-plugin.version>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<quarkus.version>0.18.0</quarkus.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</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-mailer</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-scheduler</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-keycloak</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemProperties>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<systemProperties>
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
```
Here is the project:
[quarkus-test.zip](https://github.com/quarkusio/quarkus/files/3369499/quarkus-test.zip)
| 1a94fedc46771530e537219e97759414759924ad | 602c16b1451b345549d233c1581caeea65ba3c31 | https://github.com/quarkusio/quarkus/compare/1a94fedc46771530e537219e97759414759924ad...602c16b1451b345549d233c1581caeea65ba3c31 | diff --git a/extensions/keycloak/runtime/src/main/java/io/quarkus/keycloak/KeycloakRecorder.java b/extensions/keycloak/runtime/src/main/java/io/quarkus/keycloak/KeycloakRecorder.java
index c883ca2bb12..e0ec9e931b6 100644
--- a/extensions/keycloak/runtime/src/main/java/io/quarkus/keycloak/KeycloakRecorder.java
+++ b/extensions/keycloak/runtime/src/main/java/io/quarkus/keycloak/KeycloakRecorder.java
@@ -33,6 +33,11 @@ public QuarkusDeploymentContext createKeycloakDeploymentContext(AdapterConfig de
config = loadConfig(getClass().getClassLoader());
}
+ if (config == null) {
+ throw new IllegalStateException(
+ "Keycloak configuration not found, please refer to the Quarkus documentation to learn how to configure your application");
+ }
+
deployment = KeycloakDeploymentBuilder.build(config);
} else {
deployment = KeycloakDeploymentBuilder.build(defaultConfig); | ['extensions/keycloak/runtime/src/main/java/io/quarkus/keycloak/KeycloakRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 3,875,755 | 747,139 | 100,586 | 1,074 | 249 | 39 | 5 | 1 | 8,587 | 402 | 2,107 | 200 | 5 | 2 | 1970-01-01T00:26: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 |
3,265 | quarkusio/quarkus/2932/2719 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2719 | https://github.com/quarkusio/quarkus/pull/2932 | https://github.com/quarkusio/quarkus/pull/2932 | 1 | fixes | Infinite iteration in LocalProject.loadRootModel | **Describe the bug**
When <relativePath> of <parent> is set to empty value, loadRootModel iterates indefinitely
**Expected behavior**
iteration should quit
**Actual behavior**
iteration continues forever
**To Reproduce**
Steps to reproduce the behavior:
1. set pom.xml to contain a parent similar to:
```xml
<parent>
<groupId>com.example.quarkus</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<relativePath></relativePath>
</parent>
```
**Environment (please complete the following information):**
- Quarkus version or git rev: 0.16.0
**Additional context**
io.quarkus.bootstrap.resolver.maven.workspace.LocalProject
line 86:
if(parent.getRelativePath() != null) {
should be
if(parent.getRelativePath() != null && !parent.getRelativePath().isEmpty) {
| fdaea528938716f32560539eab710ad3a8fcd66d | a06cca45dc9253d1e27789e8bb10c3d0d1f0bae2 | https://github.com/quarkusio/quarkus/compare/fdaea528938716f32560539eab710ad3a8fcd66d...a06cca45dc9253d1e27789e8bb10c3d0d1f0bae2 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
index 3cf591fe9d9..1d912f4ff68 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
@@ -67,7 +67,7 @@ private static Model loadRootModel(Path currentProjectDir) throws BootstrapExcep
Model model = readModel(pomXml);
Parent parent = model.getParent();
while(parent != null) {
- if(parent.getRelativePath() != null) {
+ if(parent.getRelativePath() != null && !parent.getRelativePath().isEmpty()) {
pomXml = pomXml.getParent().resolve(parent.getRelativePath()).normalize();
if(!Files.exists(pomXml)) {
return model;
diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java
index bff9ef7de27..155e76f4464 100644
--- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java
+++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java
@@ -46,6 +46,12 @@ public static void setup() throws Exception {
parent.setArtifactId("parent");
parent.setVersion(MvnProjectBuilder.DEFAULT_VERSION);
parent.setRelativePath(null);
+
+ final Parent parentWithEmptyRelativePath = new Parent();
+ parent.setGroupId(MvnProjectBuilder.DEFAULT_GROUP_ID);
+ parent.setArtifactId("parent-empty-path");
+ parent.setVersion(MvnProjectBuilder.DEFAULT_VERSION);
+ parent.setRelativePath("");
MvnProjectBuilder.forArtifact("root")
.setParent(parent)
@@ -62,6 +68,9 @@ public static void setup() throws Exception {
.addModule("other/module3", "root-module-not-direct-child", true)
.getParent()
+
+ .addModule("module4", "empty-parent-relative-path-module").setParent(parentWithEmptyRelativePath)
+ .getParent()
.build(workDir.resolve("root"));
@@ -90,7 +99,8 @@ public static void cleanup() {
@Test
public void loadIndependentProjectInTheWorkspaceTree() throws Exception {
- final LocalProject project = LocalProject.loadWorkspace(workDir.resolve("root").resolve("independent").resolve("target").resolve("classes"));
+ final LocalProject project = LocalProject
+ .loadWorkspace(workDir.resolve("root").resolve("independent").resolve("target").resolve("classes"));
assertNotNull(project);
assertNotNull(project.getWorkspace());
assertEquals(MvnProjectBuilder.DEFAULT_GROUP_ID, project.getGroupId());
@@ -105,7 +115,8 @@ public void loadIndependentProjectInTheWorkspaceTree() throws Exception {
@Test
public void loadModuleProjectWithoutParent() throws Exception {
- final LocalProject project = LocalProject.load(workDir.resolve("root").resolve("module1").resolve("target").resolve("classes"));
+ final LocalProject project = LocalProject
+ .load(workDir.resolve("root").resolve("module1").resolve("target").resolve("classes"));
assertNotNull(project);
assertNull(project.getWorkspace());
assertEquals(MvnProjectBuilder.DEFAULT_GROUP_ID, project.getGroupId());
@@ -116,7 +127,8 @@ public void loadModuleProjectWithoutParent() throws Exception {
@Test
public void loadWorkspaceForModuleWithoutParent() throws Exception {
- final LocalProject project = LocalProject.loadWorkspace(workDir.resolve("root").resolve("module1").resolve("target").resolve("classes"));
+ final LocalProject project = LocalProject
+ .loadWorkspace(workDir.resolve("root").resolve("module1").resolve("target").resolve("classes"));
assertNotNull(project);
assertEquals(MvnProjectBuilder.DEFAULT_GROUP_ID, project.getGroupId());
assertEquals("root-no-parent-module", project.getArtifactId());
@@ -130,7 +142,8 @@ public void loadWorkspaceForModuleWithoutParent() throws Exception {
@Test
public void loadModuleProjectWithParent() throws Exception {
- final LocalProject project = LocalProject.load(workDir.resolve("root").resolve("module2").resolve("target").resolve("classes"));
+ final LocalProject project = LocalProject
+ .load(workDir.resolve("root").resolve("module2").resolve("target").resolve("classes"));
assertNotNull(project);
assertNull(project.getWorkspace());
assertEquals(MvnProjectBuilder.DEFAULT_GROUP_ID, project.getGroupId());
@@ -141,7 +154,8 @@ public void loadModuleProjectWithParent() throws Exception {
@Test
public void loadWorkspaceForModuleWithParent() throws Exception {
- final LocalProject project = LocalProject.loadWorkspace(workDir.resolve("root").resolve("module2").resolve("target").resolve("classes"));
+ final LocalProject project = LocalProject
+ .loadWorkspace(workDir.resolve("root").resolve("module2").resolve("target").resolve("classes"));
assertNotNull(project);
assertNotNull(project.getWorkspace());
assertEquals(MvnProjectBuilder.DEFAULT_GROUP_ID, project.getGroupId());
@@ -154,7 +168,8 @@ public void loadWorkspaceForModuleWithParent() throws Exception {
@Test
public void loadWorkspaceForModuleWithNotDirectParentPath() throws Exception {
- final LocalProject project = LocalProject.loadWorkspace(workDir.resolve("root").resolve("other").resolve("module3").resolve("target").resolve("classes"));
+ final LocalProject project = LocalProject.loadWorkspace(
+ workDir.resolve("root").resolve("other").resolve("module3").resolve("target").resolve("classes"));
assertNotNull(project);
assertNotNull(project.getWorkspace());
assertEquals(MvnProjectBuilder.DEFAULT_GROUP_ID, project.getGroupId());
@@ -167,27 +182,49 @@ public void loadWorkspaceForModuleWithNotDirectParentPath() throws Exception {
@Test
public void loadNonModuleChildProject() throws Exception {
- final LocalProject project = LocalProject.loadWorkspace(workDir.resolve("root").resolve("non-module-child").resolve("target").resolve("classes"));
+ final LocalProject project = LocalProject
+ .loadWorkspace(workDir.resolve("root").resolve("non-module-child").resolve("target").resolve("classes"));
assertNotNull(project);
assertNotNull(project.getWorkspace());
assertEquals("non-module-child", project.getArtifactId());
final Map<AppArtifactKey, LocalProject> projects = project.getWorkspace().getProjects();
- assertEquals(6, projects.size());
+ assertEquals(7, projects.size());
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-no-parent-module")));
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-module-with-parent")));
- assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-module-not-direct-child")));
+ assertTrue(
+ projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-module-not-direct-child")));
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root")));
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "non-module-child")));
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "another-child")));
+ assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "empty-parent-relative-path-module")));
assertLocalDeps(project, "another-child");
}
+
+ /**
+ * Empty relativePath is a hack sometimes used to always resolve parent from repository and skip default "../" lookup
+ */
+ @Test
+ public void loadWorkspaceForModuleWithEmptyRelativePathParent() throws Exception {
+ final LocalProject project = LocalProject.loadWorkspace(
+ workDir.resolve("root").resolve("module4").resolve("target").resolve("classes"));
+ assertNotNull(project);
+ assertNotNull(project.getWorkspace());
+ assertEquals(MvnProjectBuilder.DEFAULT_GROUP_ID, project.getGroupId());
+ assertEquals("empty-parent-relative-path-module", project.getArtifactId());
+ assertEquals(MvnProjectBuilder.DEFAULT_VERSION, project.getVersion());
+
+ assertCompleteWorkspace(project);
+ assertLocalDeps(project);
+ }
private void assertCompleteWorkspace(final LocalProject project) {
final Map<AppArtifactKey, LocalProject> projects = project.getWorkspace().getProjects();
- assertEquals(4, projects.size());
+ assertEquals(5, projects.size());
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-no-parent-module")));
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-module-with-parent")));
- assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-module-not-direct-child")));
+ assertTrue(
+ projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-module-not-direct-child")));
+ assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "empty-parent-relative-path-module")));
assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root")));
}
@@ -195,7 +232,7 @@ private static void assertLocalDeps(LocalProject project, String... deps) {
final List<LocalProject> list = project.getSelfWithLocalDeps();
assertEquals(deps.length + 1, list.size());
int i = 0;
- while(i < deps.length) {
+ while (i < deps.length) {
final LocalProject dep = list.get(i);
assertEquals(deps[i++], dep.getArtifactId());
assertEquals(project.getGroupId(), dep.getGroupId()); | ['independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/workspace/test/LocalWorkspaceDiscoveryTest.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 3,752,624 | 722,937 | 97,426 | 1,044 | 142 | 30 | 2 | 1 | 852 | 79 | 199 | 31 | 0 | 1 | 1970-01-01T00:26: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 |
3,266 | quarkusio/quarkus/2884/2413 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2413 | https://github.com/quarkusio/quarkus/pull/2884 | https://github.com/quarkusio/quarkus/pull/2884 | 1 | fixes | JDBC driver not detected while building Quarkus with Gradle | Hi Quarkus team!
I am in the middle of migrating a Thorntail project to Quarkus and it looks like I'm blocked by a bug that was supposed to be fixed here: https://github.com/quarkusio/quarkus/issues/1645
Here is a reproduction repository: https://github.com/gwenneg/quarkus-quickstarts/tree/master/hibernate-orm-resteasy
Run the `./gradlew clean build --stacktrace` command to get the following error:
```
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':quarkusBuild'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:151)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.accept(ExecuteActionsTaskExecuter.java:148)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:191)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:141)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionStateTaskExecuter.execute(ResolveBeforeExecutionStateTaskExecuter.java:75)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:108)
at org.gradle.api.internal.tasks.execution.ResolveBeforeExecutionOutputsTaskExecuter.execute(ResolveBeforeExecutionOutputsTaskExecuter.java:67)
at org.gradle.api.internal.tasks.execution.ResolveAfterPreviousExecutionStateTaskExecuter.execute(ResolveAfterPreviousExecutionStateTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:94)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:95)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:73)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:49)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:49)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:43)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:355)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:343)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:336)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:322)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:134)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker$1.execute(DefaultPlanExecutor.java:129)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:202)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:193)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:129)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.GradleException: Failed to build a runnable JAR
at io.quarkus.gradle.tasks.QuarkusBuild.buildQuarkus(QuarkusBuild.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 org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:103)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:48)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:41)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:702)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:669)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$5.run(ExecuteActionsTaskExecuter.java:404)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:393)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:376)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$200(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:213)
at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:58)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:48)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:33)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:39)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:35)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:45)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:31)
at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:201)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:70)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:45)
at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:43)
at org.gradle.internal.execution.steps.StoreSnapshotsStep.execute(StoreSnapshotsStep.java:32)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:96)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:89)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:54)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:38)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:77)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:90)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:48)
at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:120)
... 35 more
Caused by: io.quarkus.creator.AppCreatorException: Failed to build a runner jar
at io.quarkus.creator.phase.runnerjar.RunnerJarPhase.provideOutcome(RunnerJarPhase.java:224)
at io.quarkus.creator.phase.runnerjar.RunnerJarPhase.provideOutcome(RunnerJarPhase.java:70)
at io.quarkus.creator.outcome.OutcomeResolver.resolve(OutcomeResolver.java:48)
at io.quarkus.creator.AppCreator.resolveOutcome(AppCreator.java:256)
at io.quarkus.gradle.tasks.QuarkusBuild.buildQuarkus(QuarkusBuild.java:183)
... 90 more
Caused by: io.quarkus.creator.AppCreatorException: Failed to augment application classes
at io.quarkus.creator.phase.augment.AugmentPhase.doProcess(AugmentPhase.java:360)
at io.quarkus.creator.phase.augment.AugmentPhase.provideOutcome(AugmentPhase.java:205)
at io.quarkus.creator.phase.augment.AugmentPhase.provideOutcome(AugmentPhase.java:75)
at io.quarkus.creator.outcome.OutcomeResolver.resolve(OutcomeResolver.java:48)
at io.quarkus.creator.AppCreator.resolveOutcome(AppCreator.java:256)
at io.quarkus.creator.phase.runnerjar.RunnerJarPhase.provideOutcome(RunnerJarPhase.java:222)
... 94 more
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor#build threw an exception: io.quarkus.deployment.configuration.ConfigurationError: Hibernate extension cannot guess the dialect as no JDBC driver is specified by 'quarkus.datasource.driver'
at io.quarkus.builder.Execution.run(Execution.java:124)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:137)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:108)
at io.quarkus.creator.phase.augment.AugmentPhase.doProcess(AugmentPhase.java:280)
... 99 more
Caused by: io.quarkus.deployment.configuration.ConfigurationError: Hibernate extension cannot guess the dialect as no JDBC driver is specified by 'quarkus.datasource.driver'
at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.guessDialect(HibernateOrmProcessor.java:481)
at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.handleHibernateORMWithNoPersistenceXml(HibernateOrmProcessor.java:335)
at io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor.build(HibernateOrmProcessor.java:172)
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 io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:507)
at io.quarkus.builder.BuildContext.run(BuildContext.java:414)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1998)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1525)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1416)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
```
| f38ded232a2deea5d241d58aed6711b38dec2c06 | ae9409527a97ab917deb33117b125803acf9f522 | https://github.com/quarkusio/quarkus/compare/f38ded232a2deea5d241d58aed6711b38dec2c06...ae9409527a97ab917deb33117b125803acf9f522 | diff --git a/core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java b/core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
index 50805f3986d..b20411708ec 100644
--- a/core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
+++ b/core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
@@ -44,7 +44,7 @@ public class DevModeMain {
private static volatile ClassLoader currentAppClassLoader;
private static volatile URLClassLoader runtimeCl;
- private static File classesRoot;
+ private static List<File> classesRoots;
private static File wiringDir;
private static File cacheDir;
private static DevModeContext context;
@@ -70,8 +70,14 @@ public static void main(String... args) throws Exception {
System.setProperty(i.getKey(), i.getValue());
}
}
- //the path that contains the compiled classes
- classesRoot = new File(args[0]);
+
+ // we can potentially have multiple roots separated by commas
+ final String[] classesRootsParts = args[0].split(",");
+ classesRoots = new ArrayList<>(classesRootsParts.length);
+ for (String classesRootsPart : classesRootsParts) {
+ classesRoots.add(new File(classesRootsPart));
+ }
+
wiringDir = new File(args[1]);
cacheDir = new File(args[2]);
@@ -115,7 +121,11 @@ public void run() {
private static synchronized void doStart(boolean liveReload, Set<String> changedResources) {
try {
- runtimeCl = new URLClassLoader(new URL[] { classesRoot.toURL() }, ClassLoader.getSystemClassLoader());
+ final URL[] urls = new URL[classesRoots.size()];
+ for (int i = 0; i < classesRoots.size(); i++) {
+ urls[i] = classesRoots.get(i).toURL();
+ }
+ runtimeCl = new URLClassLoader(urls, ClassLoader.getSystemClassLoader());
currentAppClassLoader = runtimeCl;
ClassLoader old = Thread.currentThread().getContextClassLoader();
//we can potentially throw away this class loader, and reload the app
@@ -125,7 +135,8 @@ private static synchronized void doStart(boolean liveReload, Set<String> changed
.setLaunchMode(LaunchMode.DEVELOPMENT)
.setLiveReloadState(new LiveReloadBuildItem(liveReload, changedResources, liveReloadContext))
.setClassLoader(runtimeCl)
- .setTarget(classesRoot.toPath())
+ // just use the first item in classesRoot which is where the actual class files are written
+ .setTarget(classesRoots.get(0).toPath())
.setFrameworkClassesPath(wiringDir.toPath())
.setTransformerCache(cacheDir.toPath());
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 c3382692fa3..69744e928c5 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
@@ -267,7 +267,15 @@ public void startDev() {
args.add("-jar");
args.add(tempFile.getAbsolutePath());
- args.add(extension.outputDirectory().getAbsolutePath());
+ final String outputClassDirectory = extension.outputDirectory().getAbsolutePath();
+ final String outputResourcesDirectory = extension.outputConfigDirectory().getAbsolutePath();
+ if (outputClassDirectory.equals(outputResourcesDirectory)) {
+ args.add(outputClassDirectory);
+ } else {
+ // we pass both the output class directory and the output config directory (which differ by default)
+ // so both can be added as classloader roots
+ args.add(outputClassDirectory + "," + outputResourcesDirectory);
+ }
args.add(wiringClassesDirectory.getAbsolutePath());
args.add(new File(getBuildDir(), "transformer-cache").getAbsolutePath());
ProcessBuilder pb = new ProcessBuilder(args.toArray(new String[0])); | ['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java', 'core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 3,746,444 | 721,652 | 97,293 | 1,042 | 1,847 | 349 | 31 | 2 | 15,034 | 393 | 3,067 | 145 | 2 | 1 | 1970-01-01T00:26: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 |
3,267 | quarkusio/quarkus/2882/2830 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2830 | https://github.com/quarkusio/quarkus/pull/2882 | https://github.com/quarkusio/quarkus/pull/2882 | 1 | fixes | Native compilation again does't like spaces in project directory in 0.15.0 and 0.16.0 ver | **Describe the bug**
Native compilation doesn't like space in project directory. It is a old bug anf fixed in 0.13.0 release reference ticket no: #1673 . i am facing the samer issue with 0.15.0 and 0.16.0 releases.
**Expected behavior**
Native compilation should allow spaces in the project directory path.
**Actual behavior**
Throwing the below error
12:57:08 Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: /home/jenkins/workspace/Online%20Service%20Name%20CRP/NameService/target/NameService-0.0.1-SNAPSHOT-runner.jar (No such file or directory)
12:57:08 at io.quarkus.undertow.runtime.graal.URLResourceSubstitution$ResourceInfo.<clinit>(URLResourceSubstitution.java:103)
12:57:08 ... 40 more
12:57:08 Caused by: java.io.FileNotFoundException: /home/jenkins/workspace/Online%20Service%20Name%20CRP/NameService/target/NameService-0.0.1-SNAPSHOT-runner.jar (No such file or directory)
**To Reproduce**
Steps to reproduce the behavior:
1. Create project directory name with space and execute a native compile
| 30a6e37d30aca0122be5a7fca71b892d7ebe817c | 92a108e797f2a6b7962dbf3132beef60f4bf46a4 | https://github.com/quarkusio/quarkus/compare/30a6e37d30aca0122be5a7fca71b892d7ebe817c...92a108e797f2a6b7962dbf3132beef60f4bf46a4 | diff --git a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/graal/URLResourceSubstitution.java b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/graal/URLResourceSubstitution.java
index 09279327a7f..e3cb0d279ee 100644
--- a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/graal/URLResourceSubstitution.java
+++ b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/graal/URLResourceSubstitution.java
@@ -1,6 +1,7 @@
package io.quarkus.undertow.runtime.graal;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collections;
@@ -73,7 +74,7 @@ static final class ResourceInfo {
URLClassLoader ucl = (URLClassLoader) cl;
for (URL res : ucl.getURLs()) {
if (res.getProtocol().equals("file") && res.getPath().endsWith(".jar")) {
- try (JarFile file = new JarFile(res.getPath())) {
+ try (JarFile file = new JarFile(res.toURI().getPath())) {
Enumeration<JarEntry> e = file.entries();
while (e.hasMoreElements()) {
JarEntry entry = e.nextElement();
@@ -83,7 +84,7 @@ static final class ResourceInfo {
}
}
- } catch (IOException e) {
+ } catch (IOException | URISyntaxException e) {
throw new RuntimeException(e);
}
} | ['extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/graal/URLResourceSubstitution.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 3,733,855 | 719,070 | 96,890 | 1,037 | 301 | 56 | 5 | 1 | 1,057 | 102 | 277 | 20 | 0 | 0 | 1970-01-01T00:26: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 |
3,268 | quarkusio/quarkus/2868/2867 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2867 | https://github.com/quarkusio/quarkus/pull/2868 | https://github.com/quarkusio/quarkus/pull/2868 | 1 | fixes | e.printStackTrace() in TransactionalInterceptorBase | **Describe the bug**
In da8212107dd210ebc0207273a755e4f3686ca82b e.printStackTrace() was added in TransactionalInterceptorBase#handleExceptionNoThrow(). Now every exception that causes a transaction rollback is printed in the log.
I assume this was added for debugging and then was committed accidentally. So just removing that line again should fix the issue.
**Expected behavior**
The exception and stack trace should not be printed by TransactionalInterceptorBase.
**Actual behavior**
The exception and stack trace are printed by TransactionalInterceptorBase.
**To Reproduce**
Steps to reproduce the behavior:
1. Throw a RuntimeException in a `@Transactional` method.
2. Catch it and handle it outside the `@Transactional` method without printing or logging it.
3. The exception is still printed.
**Environment:**
- Output of `java -version`: openjdk version "1.8.0_212"
- Quarkus version: 0.16.1
| 8c9b9fcca5cd7df420609ef4cdfd3f02b89da50c | fef1926e65377083032c34abf8b2ba342c7e8f34 | https://github.com/quarkusio/quarkus/compare/8c9b9fcca5cd7df420609ef4cdfd3f02b89da50c...fef1926e65377083032c34abf8b2ba342c7e8f34 | diff --git a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorBase.java b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorBase.java
index 218f38c288b..fb4377d6e53 100644
--- a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorBase.java
+++ b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorBase.java
@@ -233,7 +233,6 @@ protected Object invokeInNoTx(InvocationContext ic) throws Exception {
protected void handleExceptionNoThrow(InvocationContext ic, Throwable e, Transaction tx)
throws IllegalStateException, SystemException {
- e.printStackTrace();
Transactional transactional = getTransactional(ic);
| ['extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/interceptor/TransactionalInterceptorBase.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 3,720,941 | 716,600 | 96,561 | 1,032 | 29 | 4 | 1 | 1 | 933 | 118 | 208 | 24 | 0 | 0 | 1970-01-01T00:26: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 |
3,269 | quarkusio/quarkus/2864/2861 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2861 | https://github.com/quarkusio/quarkus/pull/2864 | https://github.com/quarkusio/quarkus/pull/2864 | 1 | resolves | Instance.destroy() - support client proxies | Currently, we only support `@Dependent` contextual instances. | 7f959a5afe0b8b5f894e10f35215aef1857b46b7 | 3dd175aeadd789aff56c33c440d0e2d9f308d7c0 | https://github.com/quarkusio/quarkus/compare/7f959a5afe0b8b5f894e10f35215aef1857b46b7...3dd175aeadd789aff56c33c440d0e2d9f308d7c0 | diff --git a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ClientProxyUnwrapper.java b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ClientProxyUnwrapper.java
index 83adb8a6732..0a9e3e44d55 100644
--- a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ClientProxyUnwrapper.java
+++ b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ClientProxyUnwrapper.java
@@ -8,7 +8,7 @@ public class ClientProxyUnwrapper implements Function<Object, Object> {
@Override
public Object apply(Object o) {
if (o instanceof ClientProxy) {
- return ((ClientProxy) o).getContextualInstance();
+ return ((ClientProxy) o).arc_contextualInstance();
}
return o;
}
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 65e681d7673..fb25eacbf2e 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
@@ -39,7 +39,8 @@ public class ClientProxyGenerator extends AbstractGenerator {
static final String CLIENT_PROXY_SUFFIX = "_ClientProxy";
static final String DELEGATE_METHOD_NAME = "arc$delegate";
- static final String GET_CONTEXTUAL_INSTANCE_METHOD_NAME = "getContextualInstance";
+ static final String GET_CONTEXTUAL_INSTANCE_METHOD_NAME = "arc_contextualInstance";
+ static final String GET_BEAN = "arc_bean";
private final Predicate<DotName> applicationClassPredicate;
@@ -86,6 +87,7 @@ Collection<Resource> generate(BeanInfo bean, String beanClassName, ReflectionReg
createConstructor(clientProxy, beanClassName, superClass, beanField.getFieldDescriptor());
implementDelegate(clientProxy, providerTypeName, beanField.getFieldDescriptor());
implementGetContextualInstance(clientProxy, providerTypeName);
+ implementGetBean(clientProxy, beanField.getFieldDescriptor());
for (MethodInfo method : getDelegatingMethods(bean)) {
@@ -209,6 +211,12 @@ void implementGetContextualInstance(ClassCreator clientProxy, String providerTyp
creator.getThis()));
}
+ void implementGetBean(ClassCreator clientProxy, FieldDescriptor beanField) {
+ MethodCreator creator = clientProxy.getMethodCreator(GET_BEAN, InjectableBean.class)
+ .setModifiers(Modifier.PUBLIC);
+ creator.returnValue(creator.readInstanceField(beanField, creator.getThis()));
+ }
+
Collection<MethodInfo> getDelegatingMethods(BeanInfo bean) {
Map<Methods.MethodKey, MethodInfo> methods = new HashMap<>();
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ClientProxy.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ClientProxy.java
index 9dba1635d7b..cda38781588 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ClientProxy.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ClientProxy.java
@@ -7,6 +7,8 @@
*/
public interface ClientProxy {
- Object getContextualInstance();
+ Object arc_contextualInstance();
+
+ InjectableBean<?> arc_bean();
}
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceImpl.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceImpl.java
index 728e4e4eddf..b67bb0da3f8 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceImpl.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceImpl.java
@@ -9,7 +9,9 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Objects;
import java.util.Set;
+import javax.enterprise.context.ContextNotActiveException;
import javax.enterprise.inject.AmbiguousResolutionException;
import javax.enterprise.inject.Instance;
import javax.enterprise.inject.UnsatisfiedResolutionException;
@@ -114,11 +116,18 @@ public boolean isAmbiguous() {
@Override
public void destroy(T instance) {
+ Objects.requireNonNull(instance);
if (instance instanceof ClientProxy) {
- throw new UnsupportedOperationException();
+ ClientProxy proxy = (ClientProxy) instance;
+ InjectableContext context = Arc.container().getActiveContext(proxy.arc_bean().getScope());
+ if (context == null) {
+ throw new ContextNotActiveException("No active context found for: " + proxy.arc_bean().getScope());
+ }
+ context.destroy(proxy.arc_bean());
+ } else {
+ // Try to destroy a dependent instance
+ creationalContext.destroyDependentInstance(instance);
}
- // Try to destroy a dependent instance
- creationalContext.destroyDependentInstance(instance);
}
void destroy() {
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/ClientProxyGetContextualInstanceTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/ClientProxyGetContextualInstanceTest.java
index 1f0968e79f6..ee20e2d2c6a 100644
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/ClientProxyGetContextualInstanceTest.java
+++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/ClientProxyGetContextualInstanceTest.java
@@ -21,7 +21,7 @@ public class ClientProxyGetContextualInstanceTest {
public void testProducer() throws IOException {
Moo moo = Arc.container().instance(Moo.class).get();
assertTrue(moo instanceof ClientProxy);
- assertEquals(10, ((Moo) ((ClientProxy) moo).getContextualInstance()).val);
+ assertEquals(10, ((Moo) ((ClientProxy) moo).arc_contextualInstance()).val);
}
@ApplicationScoped
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ClientProxyConstructorGuardTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ClientProxyConstructorGuardTest.java
index b4fd1462388..fc56ff783bb 100644
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ClientProxyConstructorGuardTest.java
+++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ClientProxyConstructorGuardTest.java
@@ -20,7 +20,7 @@ public class ClientProxyConstructorGuardTest {
public void testProducer() throws IOException {
Moo moo = Arc.container().instance(Moo.class).get();
assertTrue(moo instanceof ClientProxy);
- assertEquals(10, ((Moo) ((ClientProxy) moo).getContextualInstance()).val);
+ assertEquals(10, ((Moo) ((ClientProxy) moo).arc_contextualInstance()).val);
}
@ApplicationScoped
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/instance/destroy/InstanceDestroyTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/instance/destroy/InstanceDestroyTest.java
index c317171f983..5135c32daba 100644
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/instance/destroy/InstanceDestroyTest.java
+++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/instance/destroy/InstanceDestroyTest.java
@@ -1,12 +1,16 @@
package io.quarkus.arc.test.instance.destroy;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import io.quarkus.arc.Arc;
import io.quarkus.arc.test.ArcTestContainer;
+import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
+import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
+import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
@@ -17,13 +21,19 @@
public class InstanceDestroyTest {
@Rule
- public ArcTestContainer container = new ArcTestContainer(Alpha.class, Washcloth.class);
+ public ArcTestContainer container = new ArcTestContainer(Alpha.class, Washcloth.class, Knight.class);
@Test
public void testDestroy() {
assertFalse(Washcloth.DESTROYED.get());
Arc.container().instance(Alpha.class).get().doSomething();
assertTrue(Washcloth.DESTROYED.get());
+ // App scoped beans
+ Knight knight1 = Arc.container().instance(Knight.class).get();
+ String id1 = knight1.getId();
+ Arc.container().beanManager().createInstance().destroy(knight1);
+ assertTrue(Knight.DESTROYED.get());
+ assertNotEquals(id1, Arc.container().instance(Knight.class).get().getId());
}
@Singleton
@@ -55,4 +65,27 @@ void destroy() {
}
+ @ApplicationScoped
+ static class Knight {
+
+ static final AtomicBoolean DESTROYED = new AtomicBoolean(false);
+
+ String id;
+
+ String getId() {
+ return id;
+ }
+
+ @PostConstruct
+ void init() {
+ this.id = UUID.randomUUID().toString();
+ }
+
+ @PreDestroy
+ void destroy() {
+ DESTROYED.set(true);
+ }
+
+ }
+
} | ['independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ClientProxy.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/ClientProxyGetContextualInstanceTest.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/instance/destroy/InstanceDestroyTest.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ClientProxyConstructorGuardTest.java', 'extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ClientProxyUnwrapper.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceImpl.java'] | {'.java': 7} | 7 | 7 | 0 | 0 | 7 | 3,720,002 | 716,415 | 96,542 | 1,032 | 1,664 | 301 | 31 | 4 | 61 | 7 | 13 | 1 | 0 | 0 | 1970-01-01T00:26: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 |
3,271 | quarkusio/quarkus/2849/2848 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2848 | https://github.com/quarkusio/quarkus/pull/2849 | https://github.com/quarkusio/quarkus/pull/2849 | 1 | fixes | ConcurrentModificationException in TransactionEntityManagers.getEntityManager | **Describe the bug**
I get `ConcurrentModificationException` at the start of a `ab` (https://httpd.apache.org/docs/2.4/programs/ab.html) benchmark session if the benchmarked REST endpoint needs database access. The issue only seems to appear if a concurrency level > 4 (i.e. `ab -c 5`) is used for the benchmark and `ab` is started prior to any request involving database access.
I think the concurrency value may depend on your machine - I am testing this on an Intel Core i7-6700HQ (4 cores, 8 threads) and with 5 I am able to trigger the bug ~90% of the time.
I wrote a little application displaying the issue. It uses:
* `quarkus-hibernate-orm-panache`
* `quarkus-jdbc-h2`
* `quarkus-resteasy-jsonb`
It can be found at https://github.com/j-be/quarkus-concurrent-modification-bug
I did NOT yet check native images yet, just the good-old ` java -jar`. I will update this report if I find out anything on that front.
I am working on a pull-request and will publish it shortly.
**Expected behavior**
No `ConcurrentModificationException` when running
**Actual behavior**
```
2019-06-16 14:29:19,306 ERROR [io.und.request] (executor-thread-3) UT005023: Exception handling request to /genre: org.jboss.resteasy.spi.UnhandledException: java.util.ConcurrentModificationException
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:209)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:496)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:252)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:153)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:156)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:238)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:234)
at io.quarkus.resteasy.runtime.ResteasyFilter$ResteasyResponseWrapper.sendError(ResteasyFilter.java:72)
at io.undertow.servlet.handlers.DefaultServlet.doGet(DefaultServlet.java:175)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:686)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at io.quarkus.resteasy.runtime.ResteasyFilter.doFilter(ResteasyFilter.java:43)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentTemplate$7$1$1.call(UndertowDeploymentTemplate.java:469)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:197)
at io.undertow.server.handlers.HttpContinueReadHandler.handleRequest(HttpContinueReadHandler.java:65)
at io.quarkus.undertow.runtime.UndertowDeploymentTemplate$1.handleRequest(UndertowDeploymentTemplate.java:104)
at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49)
at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup.handleHotDeploymentRequest(UndertowHotReplacementSetup.java:77)
at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup$1$1.handleRequest(UndertowHotReplacementSetup.java:56)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:243)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1395)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:32)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.util.ConcurrentModificationException
at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
at io.quarkus.hibernate.orm.runtime.TransactionEntityManagers.getEntityManager(TransactionEntityManagers.java:51)
at io.quarkus.hibernate.orm.runtime.JPAResourceReferenceProvider$1.delegate(JPAResourceReferenceProvider.java:54)
at io.quarkus.hibernate.orm.runtime.entitymanager.ForwardingEntityManager.createQuery(ForwardingEntityManager.java:158)
at io.quarkus.hibernate.orm.panache.runtime.JpaOperations.count(JpaOperations.java:293)
at org.duckdns.owly.quarkus.service.GerneService.count(GerneService.java)
at org.duckdns.owly.quarkus.service.GerneService_ClientProxy.count(Unknown Source)
at org.duckdns.owly.quarkus.resources.GenreResource.getCount(GenreResource.java:23)
at org.duckdns.owly.quarkus.resources.GenreResource_ClientProxy.getCount(Unknown Source)
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 org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:151)
at org.jboss.resteasy.core.MethodInjectorImpl.lambda$invoke$3(MethodInjectorImpl.java:122)
at java.base/java.util.concurrent.CompletableFuture.uniApplyNow(CompletableFuture.java:680)
at java.base/java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:658)
at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:2094)
at java.base/java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:143)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:122)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:568)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:442)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:396)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:398)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:367)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invoke$1(ResourceMethodInvoker.java:341)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:143)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:341)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:477)
... 56 more
```
**To Reproduce**
Prerequisits:
* Ubuntu Linux 18.04 LTS with:
* `mvn 3.6.0` from package repositories
* `openJDK 11` from package repositories
* `apache2-utils` from package repositories
Steps to reproduce the behavior:
1. clone https://github.com/j-be/quarkus-concurrent-modification-bug
2. Run `mvn clean package quarkus:dev` (you may `-DskipTests` if you want)
3. Open a second terminal and run `ab -n 100 -c 5 localhost:8080/genre`
4. You should now see a `java.util.ConcurrentModificationException`. If not, stop the quarkus server, start it again and increase `ab`'s concurrency.
**Configuration**
I doubt this is of any relevance, yet for completeness sake:
```properties
# Configuration file
# key = value
# configure your datasource
quarkus.datasource.url = jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=TRUE
quarkus.datasource.driver = org.h2.Driver
quarkus.datasource.username = sa
quarkus.datasource.password =
# drop and create the database at startup (use `update` to only update the schema)
quarkus.hibernate-orm.database.generation = create
```
**Screenshots**
Not applicable.
**Environment (please complete the following information):**
- Output of `uname -a`:
Linux albatros 4.15.0-51-generic #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`:
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment (build 11.0.3+7-Ubuntu-1ubuntu218.04.1)
OpenJDK 64-Bit Server VM (build 11.0.3+7-Ubuntu-1ubuntu218.04.1, mixed mode, sharing)
- GraalVM version (if different from Java):
Not applicable (yet)
- Quarkus version or git rev:
both `0.16.1` from Maven Central and current HEAD of master (59c85e3ba31535be5ef9bfe1566304d3ae31bb1a)
**Additional context**
Not applicable (I guess) | 931368d38d53764c80d525b7544e7d4bfb41b779 | 87e8e5e9b8eebcd60b09e253d45ae8a7a0a16f1b | https://github.com/quarkusio/quarkus/compare/931368d38d53764c80d525b7544e7d4bfb41b779...87e8e5e9b8eebcd60b09e253d45ae8a7a0a16f1b | diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/TransactionEntityManagers.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/TransactionEntityManagers.java
index 056d4c63a6a..69407b17021 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/TransactionEntityManagers.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/TransactionEntityManagers.java
@@ -1,8 +1,9 @@
package io.quarkus.hibernate.orm.runtime;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Instance;
import javax.inject.Inject;
import javax.persistence.EntityManager;
@@ -11,13 +12,14 @@
import io.quarkus.hibernate.orm.runtime.entitymanager.TransactionScopedEntityManager;
+@ApplicationScoped
public class TransactionEntityManagers {
@Inject
- TransactionSynchronizationRegistry tsr;
+ TransactionSynchronizationRegistry transactionSynchronizationRegistry;
@Inject
- TransactionManager tm;
+ TransactionManager transactionManager;
@Inject
JPAConfig jpaConfig;
@@ -25,16 +27,20 @@ public class TransactionEntityManagers {
@Inject
Instance<RequestScopedEntityManagerHolder> requestScopedEntityManagers;
- private final Map<String, TransactionScopedEntityManager> managers;
+ private final ConcurrentMap<String, TransactionScopedEntityManager> managers;
public TransactionEntityManagers() {
- this.managers = new HashMap<>();
+ this.managers = new ConcurrentHashMap<>();
}
public EntityManager getEntityManager(String unitName) {
- return managers.computeIfAbsent(unitName,
- un -> new TransactionScopedEntityManager(tm, tsr, jpaConfig.getEntityManagerFactory(un), unitName,
- requestScopedEntityManagers));
+ TransactionScopedEntityManager entityManager = managers.get(unitName);
+ if (entityManager != null) {
+ return entityManager;
+ }
+ return managers.computeIfAbsent(unitName, (un) -> new TransactionScopedEntityManager(
+ transactionManager, transactionSynchronizationRegistry, jpaConfig.getEntityManagerFactory(un), un,
+ requestScopedEntityManagers));
}
} | ['extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/TransactionEntityManagers.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 3,720,912 | 716,596 | 96,560 | 1,032 | 1,302 | 213 | 24 | 1 | 12,206 | 587 | 2,851 | 166 | 3 | 2 | 1970-01-01T00:26: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 |
3,272 | quarkusio/quarkus/2741/2728 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2728 | https://github.com/quarkusio/quarkus/pull/2741 | https://github.com/quarkusio/quarkus/pull/2741 | 1 | fix | Improper shutdown exception | Upon quarkus:dev mode shutdown via CTRL+C, I receive the following error
```
mvn compile quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.issue_2482:reproducer >----------------------
[INFO] Building reproducer 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ reproducer ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ reproducer ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:999-SNAPSHOT:dev (default-cli) @ reproducer ---
Listening for transport dt_socket at address: 5005
2019-06-05 11:16:10,209 INFO [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus augmentation
2019-06-05 11:16:10,982 INFO [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 773ms
2019-06-05 11:16:11,298 INFO [io.qua.swa.run.SwaggerUiServletExtension] (main) Swagger UI available at /swagger-ui
2019-06-05 11:16:11,993 INFO [io.quarkus] (main) Quarkus 999-SNAPSHOT started in 1.927s. Listening on: http://[::]:8080
2019-06-05 11:16:11,995 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, narayana-jta, resteasy, resteasy-jsonb, smallrye-openapi, swagger-ui]
^C2019-06-05 11:16:25,986 ERROR [io.qua.run.StartupContext] (Quarkus Shutdown Thread) Running a shutdown task failed: java.util.concurrent.RejectedExecutionException
at org.jboss.threads.RejectingExecutor.execute(RejectingExecutor.java:38)
at org.jboss.threads.EnhancedQueueExecutor.rejectShutdown(EnhancedQueueExecutor.java:2055)
at org.jboss.threads.EnhancedQueueExecutor.execute(EnhancedQueueExecutor.java:765)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
at io.quarkus.runtime.CleanableExecutor.submit(CleanableExecutor.java:122)
at io.quarkus.runtime.CleanableExecutor.clean(CleanableExecutor.java:67)
at io.quarkus.runtime.ExecutorTemplate$1.run(ExecutorTemplate.java:63)
at io.quarkus.runtime.StartupContext.close(StartupContext.java:59)
at io.quarkus.runner.ApplicationImpl1.doStop(Unknown Source)
at io.quarkus.runtime.Application.stop(Application.java:167)
at io.quarkus.runner.RuntimeRunner$1.close(RuntimeRunner.java:138)
at io.quarkus.runner.RuntimeRunner.close(RuntimeRunner.java:84)
at io.quarkus.dev.DevModeMain$1.run(DevModeMain.java:113)
at java.lang.Thread.run(Thread.java:748)
Suppressed: java.util.concurrent.RejectedExecutionException: Executor is being shut down
at org.jboss.threads.EnhancedQueueExecutor.rejectShutdown(EnhancedQueueExecutor.java:2057)
... 12 more
2019-06-05 11:16:25,991 INFO [io.quarkus] (Quarkus Shutdown Thread) Quarkus stopped in 0.009s
```
The app uses the extensions mentioned in the log and connect to H2 server.
```
quarkus.datasource.url=jdbc:h2:tcp://localhost/~/Downloads/nobackup/test
quarkus.datasource.driver=org.h2.Driver
quarkus.datasource.username=sa
quarkus.datasource.password=
quarkus.hibernate-orm.database.generation=update
``` | 5e6b4acfe997041fa6d41d9cec4f5cb2b4cf7bbd | a3d9bbdbe5405909f3c15015806d456f4f7a1fb8 | https://github.com/quarkusio/quarkus/compare/5e6b4acfe997041fa6d41d9cec4f5cb2b4cf7bbd...a3d9bbdbe5405909f3c15015806d456f4f7a1fb8 | diff --git a/core/runtime/src/main/java/io/quarkus/runtime/CleanableExecutor.java b/core/runtime/src/main/java/io/quarkus/runtime/CleanableExecutor.java
index b5d5db18aef..8857bf9da43 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/CleanableExecutor.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/CleanableExecutor.java
@@ -11,6 +11,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
+import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicInteger;
@@ -63,8 +64,14 @@ public void run() {
//threadlocal state. It does not really matter if this does not work, however if these threads are holding
//state that is stopping things being GC'ed it can help with memory usage
try {
- for (int i = 0; i < executor.getMaximumPoolSize(); ++i) {
- submit(empty);
+ if (!executor.isShutdown()) {
+ for (int i = 0; i < executor.getMaximumPoolSize(); ++i) {
+ try {
+ submit(empty);
+ } catch (RejectedExecutionException e) {
+ //ignore
+ }
+ }
}
} finally {
latch.countDown(); | ['core/runtime/src/main/java/io/quarkus/runtime/CleanableExecutor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 4,012,284 | 782,947 | 104,184 | 1,009 | 482 | 88 | 11 | 1 | 3,365 | 230 | 915 | 56 | 1 | 2 | 1970-01-01T00:25:59 | 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 |
3,273 | quarkusio/quarkus/2740/2703 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/2703 | https://github.com/quarkusio/quarkus/pull/2740 | https://github.com/quarkusio/quarkus/pull/2740 | 1 | fixes | NPE in new QuarkusExceptionHandler | Just got that for an async jaxrs exception:
```
Jun 04, 2019 11:25:49 AM io.quarkus.undertow.runtime.QuarkusExceptionHandler handleThrowable
ERROR: Exception handling request dbe37070-88d5-4cda-b7a1-e41998dcc160-1 to /@QuarkusError
java.lang.RuntimeException: java.lang.NullPointerException
at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:508)
at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:420)
at io.undertow.servlet.spec.HttpServletResponseImpl.doErrorDispatch(HttpServletResponseImpl.java:164)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:299)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentTemplate$7$1$1.call(UndertowDeploymentTemplate.java:485)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1538)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1395)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:32)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.NullPointerException
at io.quarkus.undertow.runtime.QuarkusErrorServlet.generateHeaderMessage(QuarkusErrorServlet.java:134)
at io.quarkus.undertow.runtime.QuarkusErrorServlet.doGet(QuarkusErrorServlet.java:114)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:686)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:274)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:209)
at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:502)
... 22 more
```
I can work around it by checking if the exception is `null`, but I don't quite understand why it's `null` and where it's actually set.
@stuartwdouglas ? | 5e6b4acfe997041fa6d41d9cec4f5cb2b4cf7bbd | fa2937192139f2d827e5f1dea5eb90f4cc83e7be | https://github.com/quarkusio/quarkus/compare/5e6b4acfe997041fa6d41d9cec4f5cb2b4cf7bbd...fa2937192139f2d827e5f1dea5eb90f4cc83e7be | diff --git a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java
index 86ec0a51aeb..a78bbb9a633 100644
--- a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java
+++ b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java
@@ -110,12 +110,16 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
String stack = "";
Object uuid = req.getAttribute(QuarkusExceptionHandler.ERROR_ID);
Throwable exception = (Throwable) req.getAttribute(RequestDispatcher.ERROR_EXCEPTION);
- if (Boolean.parseBoolean(getInitParameter(SHOW_STACK))) {
+ String errorMessage = (String) req.getAttribute(RequestDispatcher.ERROR_MESSAGE);
+ if (errorMessage != null) {
+ details = errorMessage;
+ }
+ if (Boolean.parseBoolean(getInitParameter(SHOW_STACK)) && exception != null) {
details = generateHeaderMessage(exception, uuid == null ? null : uuid.toString());
stack = generateStackTrace(exception);
} else if (uuid != null) {
- details = "Error id " + uuid;
+ details += "Error id " + uuid;
}
resp.setContentType("text/html"); | ['extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 4,012,284 | 782,947 | 104,184 | 1,009 | 417 | 82 | 8 | 1 | 3,849 | 131 | 902 | 49 | 0 | 1 | 1970-01-01T00:25:59 | 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 |