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
unknown
stars
int64
10
44.3k
language
stringclasses
8 values
languages
stringclasses
296 values
license
stringclasses
2 values
3,253
quarkusio/quarkus/3125/3091
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3091
https://github.com/quarkusio/quarkus/pull/3125
https://github.com/quarkusio/quarkus/pull/3125
1
fixes
No redirect to index.html in subdirectory when running as uberjar
**Describe the bug** I have a custom index.html in my /src/main/resources/META-INF/resources/subdirectory/ directory. I get automaticly redirected to this index.html, when I run the quarkus using quarkus:dev, and access localhost:8080/subdirectory. Running as uberjar, when I try to access the "localhost:8080/subdirectory" page, i get a Not Found Error. **Expected behavior** index.html is automaticly used when i just access "localhost:8080/subdirectory", in quarkus:dev and uberjar mode. quarkus:dev should at least have the same behavior in that regard to running as jar. **Actual behavior** index.html does not get used automaticly when running as uberjar. **To Reproduce** Steps to reproduce the behavior: 1. Create a new project, with an index.html in /src/main/resources/META-INF/resources/subdirectory/ 2. Run usin "compile quarkus:dev" 3. Access localhost:8080/subdirectory 4. You get automaticly redirected to the index 5. Build the project as uberjar. 6. Start the jar 7. Access localhost:8080/subdirectory 8. You do not get automaticly redirected to the index **Environment (please complete the following information):** - MSYS_NT-10.0 NANB7NLNVP2 2.10.0(0.325/5/3) 2018-06-13 23:34 x86_64 Msys - java version "1.8.0_211" -- Java(TM) SE Runtime Environment (build 1.8.0_211-b12) -- Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode) - Quarkus 0.18.0
83354368cf1eb8bac61b68d3de17bccb7c85a2b0
2234e3e6014d5b6f971d05b824d5c5536a4f1378
https://github.com/quarkusio/quarkus/compare/83354368cf1eb8bac61b68d3de17bccb7c85a2b0...2234e3e6014d5b6f971d05b824d5c5536a4f1378
diff --git a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java index bdc6a79c615..251fef00654 100644 --- a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java +++ b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java @@ -60,7 +60,7 @@ public void accept(Path path) { return; } Path rel = resource.relativize(path); - if (Files.isDirectory(rel)) { + if (Files.isDirectory(path)) { knownDirectories.add(rel.toString()); } else { knownFiles.add(rel.toString());
['extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java']
{'.java': 1}
1
1
0
0
1
3,795,697
731,239
98,516
1,049
110
16
2
1
1,420
183
390
33
0
0
"2019-07-06T09:56:28"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,239
quarkusio/quarkus/3508/3462
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3462
https://github.com/quarkusio/quarkus/pull/3508
https://github.com/quarkusio/quarkus/pull/3508
2
fixes
TypeNotPresentException during entity augmentation
**Describe the bug** I'm seeing Maven build failures from the package phase (and later phases) due to entity class augmentation failures. **Expected behavior** Jar files are created for the project. **Actual behavior** No jar files are created. This is failing on an entity that is catching a `NoResultException` or a `NonUniqueResultException`. These classes are in the dependency tree of the project, and show up in the class path and constructed class loader during the build. **To Reproduce** Run `./mvnw clean package` on the attached example project. **Screenshots** ``` [INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 2155ms [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.066 s [INFO] Finished at: 2019-08-08T10:03:17-04:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.20.0:build (default) on project getting-started: Failed to build a runnable JAR: Failed to build a runner jar: Failed to augment application classes: java.lang.TypeNotPresentException: Type javax/persistence/NoResultException not present: javax.persistence.NoResultException -> [Help 1] ``` **Environment (please complete the following information):** - Output of `uname -a` or `ver`: `Linux **** 5.0.0-23-generic #24-Ubuntu SMP Mon Jul 29 15:36:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux` - Output of `java -version`: ``` openjdk version "11.0.4" 2019-07-16 OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu219.04) OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu219.04, mixed mode, sharing) ``` - GraalVM version (if different from Java): n/a (not using GraalVM) - Quarkus version or git rev: 0.20.0 **Additional context** It looks like when `HibernateEnhancingClassVisitor` is constructed, it does not pass along the class loader to the new instance of `ClassWriter`. It somehow gets a different class loader, which knows nothing about the carefully constructed class loader from Quarkus, so it throws a `ClassNotFound` exception when it processes the entity class, trying to find `NoResultException` or `NonUniqueResultException`.
2c7975034ad4ac02513d1b6af38e53cf5a3d73a7
1d97e23526eeac603dccc1fdbc7368fc1c70bf19
https://github.com/quarkusio/quarkus/compare/2c7975034ad4ac02513d1b6af38e53cf5a3d73a7...1d97e23526eeac603dccc1fdbc7368fc1c70bf19
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusClassWriter.java b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusClassWriter.java index 198829dc44c..1b32a46a504 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusClassWriter.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusClassWriter.java @@ -15,6 +15,10 @@ public QuarkusClassWriter(final ClassReader classReader, final int flags) { super(classReader, flags); } + public QuarkusClassWriter(final int flags) { + super(flags); + } + @Override protected String getCommonSuperClass(String type1, String type2) { ClassLoader cl = getClassLoader(); diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateEntityEnhancer.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateEntityEnhancer.java index 6b0a88f6893..6d618920e57 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateEntityEnhancer.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateEntityEnhancer.java @@ -10,6 +10,8 @@ import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; +import io.quarkus.deployment.QuarkusClassWriter; + /** * Used to transform bytecode by registering to * io.quarkus.deployment.ProcessorContext#addByteCodeTransformer(java.util.function.Function). @@ -38,7 +40,7 @@ private class HibernateEnhancingClassVisitor extends ClassVisitor { private final Enhancer enhancer; public HibernateEnhancingClassVisitor(String className, ClassVisitor outputClassVisitor) { - super(Opcodes.ASM7, new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS)); + super(Opcodes.ASM7, new QuarkusClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS)); this.className = className; this.outputClassVisitor = outputClassVisitor; //note that as getLoadingClassLoader is resolved immediately this can't be created until transform time
['extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateEntityEnhancer.java', 'core/deployment/src/main/java/io/quarkus/deployment/QuarkusClassWriter.java']
{'.java': 2}
2
2
0
0
2
4,285,583
829,949
110,603
1,117
351
84
8
2
2,382
280
588
39
0
2
"2019-08-14T07:42:18"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,230
quarkusio/quarkus/3736/3730
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3730
https://github.com/quarkusio/quarkus/pull/3736
https://github.com/quarkusio/quarkus/pull/3736
1
fixes
[Jaeger] Metrics are wrongly added to base metrics
**Describe the bug** The Jaeger metrics are displayed as **base** metrics, but they should be **vendor** metrics as **base** metrics should only be the one listed on the [MP metrics specification](https://github.com/eclipse/microprofile-metrics/blob/master/spec/src/main/asciidoc/required-metrics.adoc) **Expected behavior** Jaeger metrics are displayed under **vendor** metrics. **Actual behavior** Jaeger metrics are displayed under **base** metrics. **To Reproduce** Steps to reproduce the behavior: 1. Add `quarkus-smallrye-metrics` extension. 2. Add `quarkus-smallrye-opentracing` extension. 3. Navigate to the `/metrics/base` endpoint you will see Jaeger metrics. **Environment (please complete the following information):** - Quarkus version or git rev: 0.21.1 **Additional context** This has been discuss with @jmartisk that agreed it's a bug. If I have some time this week I will works on a PR for this as it should be very simple to fix :)
9bf8398e45107a31588437e7912c3c60a9c2c62c
8cb8704cf42c7bca8c9bbbd6028dd8b6bc6978e8
https://github.com/quarkusio/quarkus/compare/9bf8398e45107a31588437e7912c3c60a9c2c62c...8cb8704cf42c7bca8c9bbbd6028dd8b6bc6978e8
diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMetricsFactory.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMetricsFactory.java index 03897450fe3..d28a1f02326 100644 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMetricsFactory.java +++ b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMetricsFactory.java @@ -17,7 +17,7 @@ public class QuarkusJaegerMetricsFactory implements MetricsFactory { - MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.BASE); + MetricRegistry registry = MetricRegistries.get(MetricRegistry.Type.VENDOR); @Override public Counter createCounter(final String name, final Map<String, String> tags) {
['extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerMetricsFactory.java']
{'.java': 1}
1
1
0
0
1
4,603,547
888,206
118,236
1,182
159
33
2
1
976
125
230
21
1
0
"2019-08-27T12:10: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,231
quarkusio/quarkus/3712/3710
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3710
https://github.com/quarkusio/quarkus/pull/3712
https://github.com/quarkusio/quarkus/pull/3712
1
fixes
[Smallrye Metrics] Some memory pool metrics are missing
**Describe the bug** When using quarkus-smallrye-metric extension, some memory pool metrics are missing. Looking at the code in `SmallRyeMetricsRecorder.memoryPoolMetrics` it registers metrics for all pools. Running Java 11 I have the following pools ``` CodeHeap 'non-nmethods' Metaspace Compressed Class Space G1 Eden Space G1 Old Gen G1 Survivor Space CodeHeap 'non-profiled nmethods' ``` But only metrics for three pools are displayed: ``` "memoryPool.usage.max;name=G1 Old Gen": 9825056, "memoryPool.usage.max;name=G1 Survivor Space": 16777216, "memoryPool.usage.max;name=G1 Eden Space": 157286400, "memoryPool.usage;name=G1 Eden Space": 0, "memoryPool.usage;name=G1 Survivor Space": 14680064, "memoryPool.usage;name=G1 Old Gen": 0, ``` All non-heap memory pools are missing. **Expected behavior** Metrics for all memory pools should be displayed when going to the /metrics endpoint. **Actual behavior** Some memory pool metrics are missing. **To Reproduce** Steps to reproduce the behavior: 1. Add quarkus-smallrye-metric extension to your project. 2. Go to /metrics endpoint. **Environment (please complete the following information):** - Output of `uname -a` or `ver`: Linux 5.0.0-25-generic #26-Ubuntu SMP Thu Aug 1 12:04:58 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux - Output of `java -version`: openjdk version "11.0.4" 2019-07-16 - Quarkus version or git rev: master
5ca74add8aac8534bee45204bf814257c3097bb0
96b8cebb735786cf1b367dc9534b41f0f2129789
https://github.com/quarkusio/quarkus/compare/5ca74add8aac8534bee45204bf814257c3097bb0...96b8cebb735786cf1b367dc9534b41f0f2129789
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 d5f1bdac04d..ed09afc43f7 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 @@ -354,10 +354,20 @@ private void memoryPoolMetrics(MetricRegistry registry, List<String> names) { .build(); for (MemoryPoolMXBean mp : mps) { if (mp.getCollectionUsage() != null && mp.getPeakUsage() != null) { + // this will be the case for the heap memory pools registry.register(usageMetadata, new LambdaGauge(() -> mp.getCollectionUsage().getUsed()), new Tag("name", mp.getName())); names.add(usageMetadata.getName()); + registry.register(maxMetadata, new LambdaGauge(() -> mp.getPeakUsage().getUsed()), + new Tag("name", mp.getName())); + names.add(maxMetadata.getName()); + } else if (mp.getUsage() != null && mp.getPeakUsage() != null) { + // this will be the case for the non-heap memory pools + registry.register(usageMetadata, new LambdaGauge(() -> mp.getUsage().getUsed()), + new Tag("name", mp.getName())); + names.add(usageMetadata.getName()); + registry.register(maxMetadata, new LambdaGauge(() -> mp.getPeakUsage().getUsed()), new Tag("name", mp.getName())); names.add(maxMetadata.getName());
['extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java']
{'.java': 1}
1
1
0
0
1
4,408,065
853,195
113,993
1,155
671
124
10
1
1,453
179
395
42
0
2
"2019-08-26T15:46: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
3,232
quarkusio/quarkus/3701/3409
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3409
https://github.com/quarkusio/quarkus/pull/3701
https://github.com/quarkusio/quarkus/pull/3701
1
fixes
Build failure on hot reload [Development environment]
**Bug Description** In the application.properties, I'm using the wildcard to config database user, password, url... for 2 environments (dev, prod) examples: - %dev.quarkus.datasource.password=xxxxxxxx - %prod.quarkus.datasource.password=xxxxxxxx In the development environment using `mvnw compile quarkus:dev:` the first build is ok, work's fine . But, when i change any class and try to send a request, the hot reload throws an Exception: `2019-08-02 11:37:49,564 ERROR [io.qua.dev.DevModeMain] (executor-thread-12) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.deployment.steps.ConfigurationSetup#initializeConfiguration threw an exception: java.util.NoSuchElementException: Property quarkus.datasource.password not found at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:141) at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:171) at io.quarkus.dev.DevModeMain.restartApp(DevModeMain.java:198) at io.quarkus.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:109) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup.handleHotDeploymentRequest(UndertowHotReplacementSetup.java:67) 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:224) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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 org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29) at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29) at java.lang.Thread.run(Thread.java:745) at org.jboss.threads.JBossThread.run(JBossThread.java:479) Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step io.quarkus.deployment.steps.ConfigurationSetup#initializeConfiguration threw an exception: java.util.NoSuchElementException: Property quarkus.datasource.password not found at io.quarkus.builder.Execution.run(Execution.java:108) at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:121) at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:115) at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:107) ... 18 more Caused by: java.util.NoSuchElementException: Property quarkus.datasource.password not found at io.smallrye.config.SmallRyeConfig.getValue(SmallRyeConfig.java:89) at io.quarkus.deployment.steps.ConfigurationSetup.initializeConfiguration(ConfigurationSetup.java:225) 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:483) at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:768) at io.quarkus.builder.BuildContext.run(BuildContext.java:415) at io.quarkus.builder.BuildContext$$Lambda$116/2101929518.run(Unknown Source) 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) ... 2 more` **To Reproduce** Steps to reproduce the behavior: 1. Make database configuration for dev and prod in application.properties 2. Start api in dev mode `mvnw compile quarkus:dev:` 3. Change any class in project to make a hot reload 4. Make a request and take a look on log **Configuration** ```properties # %dev.quarkus.datasource.password=xxxxxxxx # %prod.quarkus.datasource.password=xxxxxxxx ``` **Environment ** - Quarkus version or git rev: 0.20.0 My question is: This is a bug or any new configuration needed ?
9430e89910aa16b771e1caa06c1ec09ab2562774
99f5b697bf9764b34906602860a8b315e891f652
https://github.com/quarkusio/quarkus/compare/9430e89910aa16b771e1caa06c1ec09ab2562774...99f5b697bf9764b34906602860a8b315e891f652
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 97da87b9aa3..f264b68200f 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java +++ b/core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java @@ -255,9 +255,12 @@ public void stop() { } public void close() { - stop(); - for (HotReplacementSetup i : hotReplacement) { - i.close(); + try { + stop(); + } finally { + for (HotReplacementSetup i : hotReplacement) { + i.close(); + } } } } 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 19da83a928b..157e78d1bb0 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/Application.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/Application.java @@ -4,6 +4,7 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.LockSupport; +import org.eclipse.microprofile.config.spi.ConfigProviderResolver; import org.graalvm.nativeimage.ImageInfo; import org.wildfly.common.Assert; import org.wildfly.common.lock.Locks; @@ -37,6 +38,12 @@ public abstract class Application { private volatile boolean shutdownRequested; private static volatile Application currentApplication; + /** + * The generated config code will install a new resolver, we save the original one here and make sure + * to restore it on shutdown. + */ + private final static ConfigProviderResolver originalResolver = ConfigProviderResolver.instance(); + /** * Construct a new instance. */ @@ -151,6 +158,7 @@ public final void stop() { doStop(); } finally { currentApplication = null; + ConfigProviderResolver.setInstance(originalResolver); stateLock.lock(); try { state = ST_STOPPED;
['core/runtime/src/main/java/io/quarkus/runtime/Application.java', 'core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java']
{'.java': 2}
2
2
0
0
2
4,406,591
852,912
113,953
1,154
655
117
17
2
4,732
274
1,123
75
0
1
"2019-08-26T08:39:27"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,233
quarkusio/quarkus/3683/3681
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3681
https://github.com/quarkusio/quarkus/pull/3683
https://github.com/quarkusio/quarkus/pull/3683
1
fixes
CORS Allowed-Headers shouldn't be case sensitive
**Describe the bug** CORS config `quarkus.http.cors.headers` shouldn't be case sensitive, since [HTTP headers are case-insensitive](https://tools.ietf.org/html/rfc2616#section-4.2). **Expected behavior** Setting `quarkus.http.cors.headers=Content-Type` on `application.properties` should cause [pre-flight `OPTIONS` http requests](https://developer.mozilla.org/en-US/docs/Glossary/Preflight_request) with `Access-Control-Request-Headers: content-type` to return a response with header `Access-Control-Allow-Headers: content-type`. **Actual behavior** Lower case allow-headers `content-type` is not returned when client asks for camel-case `Content-Type`. **To Reproduce** Steps to reproduce the behavior: 1. [Configure the Quarkus CORS filter](https://quarkus.io/guides/undertow-reference#cors-filter) with `quarkus.http.cors.headers=Content-Typet` 2. Make a pre-flight `OPTIONS` request with the header `Access-Control-Request-Headers: content-type` 3. Notice the missing `Access-Control-Allow-Headers: content-type` in the response headers. **Configuration** ```properties #CORS quarkus.http.cors=true quarkus.http.cors.headers=Content-Type ``` **Environment (please complete the following information):** - Quarkus version or git rev: 0.21.1 **Additional context** HTTP headers are case-insensitive, from [RFC 2616 - Hypertext Transfer Protocol -- HTTP/1.1, section 4.2 - Message Headers](https://tools.ietf.org/html/rfc2616#section-4.2),.
2f519a49cdb6ecfa81874e9e1cb7a4d6423c3a23
6194bf9ff08cee3c405a3f8ea017260ed8e8cb38
https://github.com/quarkusio/quarkus/compare/2f519a49cdb6ecfa81874e9e1cb7a4d6423c3a23...6194bf9ff08cee3c405a3f8ea017260ed8e8cb38
diff --git a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/cors/CORSFilter.java b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/cors/CORSFilter.java index 05810ec5170..74460bcda01 100644 --- a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/cors/CORSFilter.java +++ b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/cors/CORSFilter.java @@ -1,6 +1,9 @@ package io.quarkus.vertx.web.runtime.cors; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; +import java.util.regex.Pattern; import java.util.stream.Collectors; import io.vertx.core.Handler; @@ -12,6 +15,8 @@ public class CORSFilter implements Handler<RoutingContext> { + private static final Pattern COMMA_SEPARATED_SPLIT_REGEX = Pattern.compile("\\\\s*,\\\\s*"); + // This is set in the recorder at runtime. // Must be static because the filter is created(deployed) at build time and runtime config is still not available final CORSConfig corsConfig; @@ -20,34 +25,46 @@ public CORSFilter(CORSConfig corsConfig) { this.corsConfig = corsConfig; } - private void processRequestedHeaders(HttpServerResponse response, String requestedHeaders) { + private void processRequestedHeaders(HttpServerResponse response, String allowHeadersValue) { if (corsConfig.headers.isEmpty()) { - response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, requestedHeaders); + response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, allowHeadersValue); } else { - final String validRequestHeaders = corsConfig.headers - .stream() - .filter(requestedHeaders::contains) - .collect(Collectors.joining(",")); + List<String> requestedHeaders = new ArrayList<>(); + for (String requestedHeader : COMMA_SEPARATED_SPLIT_REGEX.split(allowHeadersValue)) { + requestedHeaders.add(requestedHeader.toLowerCase()); + } + + List<String> validRequestedHeaders = new ArrayList<>(); + for (String configHeader : corsConfig.headers) { + if (requestedHeaders.contains(configHeader.toLowerCase())) { + validRequestedHeaders.add(configHeader); + } + } - if (!validRequestHeaders.isEmpty()) { - response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, validRequestHeaders); + if (!validRequestedHeaders.isEmpty()) { + response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, String.join(",", validRequestedHeaders)); } } } - private void processMethods(HttpServerResponse response, String requestedMethods) { + private void processMethods(HttpServerResponse response, String allowMethodsValue) { if (corsConfig.methods.isEmpty()) { - response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, requestedMethods); + response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, allowMethodsValue); } else { + List<String> requestedMethods = new ArrayList<>(); + for (String requestedMethod : COMMA_SEPARATED_SPLIT_REGEX.split(allowMethodsValue)) { + requestedMethods.add(requestedMethod.toLowerCase()); + } - final String validRequestedMethods = corsConfig.methods - .stream() - .filter(method -> requestedMethods.contains(method.name())) - .map(HttpMethod::name) - .collect(Collectors.joining(",")); + List<String> validRequestedMethods = new ArrayList<>(); + for (HttpMethod configMethod : corsConfig.methods) { + if (requestedMethods.contains(configMethod.name().toLowerCase())) { + validRequestedMethods.add(configMethod.name()); + } + } if (!validRequestedMethods.isEmpty()) { - response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, validRequestedMethods); + response.headers().set(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, String.join(",", validRequestedMethods)); } } }
['extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/cors/CORSFilter.java']
{'.java': 1}
1
1
0
0
1
4,453,994
861,813
115,247
1,166
3,127
511
49
1
1,480
128
365
28
4
1
"2019-08-24T08:42:05"
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,234
quarkusio/quarkus/3613/3448
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3448
https://github.com/quarkusio/quarkus/pull/3613
https://github.com/quarkusio/quarkus/pull/3613
2
fixes
Cleanup on live reload also removes generated classes
**Describe the bug** Generated classes are removed during live reload. **Expected behavior** Generated classes are not deleted. **To Reproduce** Steps to reproduce the behavior: 1. `git clone https://github.com/antoniomacri/quarkus-rocker-class-cleanup.git` 2. `mvn install` 3. `ll target/classes/views` -> `HostingPage.class` 4. `mvn quarkus:dev` (+ `mvn install` + F5 on `http://localhost:8080/`) 5. `ll target/classes/views` -> `HostingPage.class` deleted **Environment:** - Output of `java -version`: 1.8 - Quarkus version or git rev: 0.20.0
184ce49db24a76ffed6129dc58d18c213aaabe57
1dfc5850b250818d48c8f9306252cabb1a1cb8e2
https://github.com/quarkusio/quarkus/compare/184ce49db24a76ffed6129dc58d18c213aaabe57...1dfc5850b250818d48c8f9306252cabb1a1cb8e2
diff --git a/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java b/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java index 064b89633b2..65280e047e2 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java +++ b/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java @@ -202,12 +202,8 @@ private boolean checkForClassFilesChangesInModule(DevModeContext.ModuleInfo modu for (Path classFilePath : classFilePaths) { final Path sourceFilePath = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles, module); - if (sourceFilePath == null) { - Files.deleteIfExists(classFilePath); - classFilePathToSourceFilePath.remove(classFilePath); - hasChanges = true; - } else { - final long classFileModificationTime = Files.getLastModifiedTime(classFilePath).toMillis(); + final long classFileModificationTime = Files.getLastModifiedTime(classFilePath).toMillis(); + if (sourceFilePath != null) { if (Files.notExists(sourceFilePath)) { // Source file has been deleted. Delete class and restart Files.deleteIfExists(classFilePath); @@ -226,6 +222,8 @@ private boolean checkForClassFilesChangesInModule(DevModeContext.ModuleInfo modu hasChanges = true; } } + } else if (classFileModificationTime > lastChange) { + hasChanges = true; } } }
['core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java']
{'.java': 1}
1
1
0
0
1
4,342,000
840,347
112,253
1,136
663
101
10
1
570
66
162
18
2
0
"2019-08-21T11:45:43"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,235
quarkusio/quarkus/3601/3596
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3596
https://github.com/quarkusio/quarkus/pull/3601
https://github.com/quarkusio/quarkus/pull/3601
1
fixes
MicroProfile JWT application works with Payara Micro, Thorntail, TomEE and fails with Quarkus
Hello, I am working on adding Quarkus runtime to https://start.microprofile.io/ project generator, [MicroProfile Starter issue 195](https://github.com/eclipse/microprofile-starter/issues/195), [Quarkus issue 1310](https://github.com/quarkusio/quarkus/issues/1310). I seem to be having a weird issue with our JWT example that fails with Quarkus unless Java code is modified. I do realize Quarkus is neither MP22 nor MP30 TCK compliant at the time of writing. For the propose of the exercise, I work with MP22 as seen below. I will show an example that works and then I break it by removing Quarkus specific hack. ## Generate and build the starter example ### Quarkus * ```curl -O -J 'https://starter.karms.biz/api/project?mpVersion=MP22&supportedServer=QUARKUS&selectedSpecs=JWT_AUTH'``` * ```unzip demo.zip -d q_jwt``` * Split into two terminals, one for service-a and the other for service-b * ```cd q_jwt/demo/service-a``` * ```mvn clean compile quarkus:build && java -jar target/demo-runner.jar``` * ```cd q_jwt/demo/service-b``` * ```mvn clean compile quarkus:build && java -Dquarkus.http.port=8180 -jar target/demo-runner.jar``` * ``` curl -i http://localhost:8080/data/secured/test``` ```Claim value within JWT of 'custom-value' : Protected Resource; Custom value : "Jessie specific value"``` That is the expected outcome :heavy_check_mark:. Service A acts as a client to Service B and the contents of the claim is "Jessie specific value". ### Thorntail * ```rm -rf demo.zip``` * ```curl -O -J 'https://starter.karms.biz/api/project?mpVersion=MP22&supportedServer=THORNTAIL_V2&selectedSpecs=JWT_AUTH'``` * ```unzip demo.zip -d t_jwt``` * ```cd t_jwt/demo/service-a``` * ```mvn clean package && java -jar target/demo-thorntail.jar``` * ```cd t_jwt/demo/service-b``` * ```mvn clean package && java -jar target/demo-thorntail.jar -Dswarm.port.offset=100``` * ```curl -i http://localhost:8080/data/secured/test``` ```Claim value within JWT of 'custom-value' : Protected Resource; Custom value : Jessie specific value``` Both Thorntail and Quarkus work :heavy_check_mark: . **The problem is the Java code had to be adapted for Quarkus with a hack...** See the difference between classes that are supposed to be the same: ```diff q_jwt/demo/service-b/src/main/java/com/example/demo/secure/ProtectedController.java t_jwt/demo/service-b/src/main/java/com/example/demo/secure/ProtectedController.java``` **Pertinent part:** ``` < return "Protected Resource; Custom value : " + (Object) custom.getValue(); --- > return "Protected Resource; Custom value : " + custom.getValue(); ``` Quarkus cannot cast ```org.glassfish.json.JsonStringImpl``` to ```java.lang.String```, hence the ```(Object)``` cast. Let's copy Thorntail code to Quarkus and run it again: ### Quarkus fails :x: * ```mv q_jwt/demo/service-b/src/main/java/com/example/demo/secure/ProtectedController.java q_jwt/demo/service-b/src/main/java/com/example/demo/secure/ProtectedController.java.backup``` * ```cp t_jwt/demo/service-b/src/main/java/com/example/demo/secure/ProtectedController.java q_jwt/demo/service-b/src/main/java/com/example/demo/secure/ProtectedController.java``` And we run Quarkus example again: * ```cd q_jwt/demo/service-a``` * ```mvn clean compile quarkus:build && java -jar target/demo-runner.jar``` * ```cd q_jwt/demo/service-b``` * ```mvn clean compile quarkus:build && java -Dquarkus.http.port=8180 -jar target/demo-runner.jar``` * ```curl -i http://localhost:8080/data/secured/test``` ``` <h1 class="container">Internal Server Error</h1> <div class="exception-message"> <h2 class="container">java.lang.ClassCastException: org.glassfish.json.JsonStringImpl cannot be cast to java.base/java.lang.StringError id 91aa7964-4a51-4087-8070-11794337b74c-1</h2> </div> ``` #### Logs: ``` 2019-08-20 14:30:11,842 INFO [io.quarkus] (main) Quarkus 0.20.0 started in 0.784s. Listening on: http://[::]:8180 2019-08-20 14:30:11,865 INFO [io.quarkus] (main) Installed features: [cdi, resteasy, security, smallrye-jwt] 2019-08-20 14:30:20,699 ERROR [io.und.req.io] (executor-thread-1) Exception handling request 91aa7964-4a51-4087-8070-11794337b74c-1 to /data/protected: org.jboss.resteasy.spi.UnhandledException: java.lang.ClassCastException: org.glassfish.json.JsonStringImpl cannot be cast to java.base/java.lang.String 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:363) 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:249) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:60) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) 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.quarkus.elytron.security.runtime.SecurityContextPrincipalHandler.handleRequest(SecurityContextPrincipalHandler.java:24) 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.UndertowDeploymentRecorder$8$1$1.call(UndertowDeploymentRecorder.java:489) 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:1535) 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:29) at java.base/java.lang.Thread.run(Thread.java:831) at org.jboss.threads.JBossThread.run(JBossThread.java:479) Caused by: java.lang.ClassCastException: org.glassfish.json.JsonStringImpl cannot be cast to java.base/java.lang.String at com.example.demo.secure.ProtectedController.getJWTBasedValue(ProtectedController.java:26) at com.example.demo.secure.ProtectedController_ClientProxy.getJWTBasedValue(ProtectedController_ClientProxy.zig:54) 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:569) 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:580) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:454) at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:408) at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:363) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:410) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:379) at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invoke$1(ResourceMethodInvoker.java:353) 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:353) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:477) ... 44 more ``` **It is noteworthy, that Thorntail's code works with TomEE and Payara Micro while it fails with Quarkus.** Ideas? Hints? Thoughts on the JWT example app?
61f8ad9ceba93bf282d41129ba9a1e9c54ca571d
bb5699450a49bea1990b15c02f20be1e6f7a538b
https://github.com/quarkusio/quarkus/compare/61f8ad9ceba93bf282d41129ba9a1e9c54ca571d...bb5699450a49bea1990b15c02f20be1e6f7a538b
diff --git a/extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/JwtCallerPrincipalUnitTest.java b/extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/JwtCallerPrincipalUnitTest.java index 4ebdad105f5..9ee3c7c28bf 100644 --- a/extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/JwtCallerPrincipalUnitTest.java +++ b/extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/JwtCallerPrincipalUnitTest.java @@ -9,7 +9,6 @@ import javax.json.JsonArray; import javax.json.JsonNumber; import javax.json.JsonObject; -import javax.json.JsonString; import org.eclipse.microprofile.jwt.Claims; import org.jose4j.jwt.JwtClaims; @@ -62,8 +61,7 @@ public void testAllClaims() throws InvalidJwtException { Assertions.assertEquals(Json.createValue(4.4), customDoubleArray.getJsonNumber(4)); // "customString": "customStringValue", - JsonString customString = principal.getClaim("customString"); - Assertions.assertEquals(Json.createValue("customStringValue"), customString); + Assertions.assertEquals("customStringValue", principal.getClaim("customString")); // "customInteger": 123456789, JsonNumber customInteger = principal.getClaim("customInteger"); Assertions.assertEquals(Json.createValue(123456789), customInteger); diff --git a/extensions/smallrye-jwt/runtime/src/main/java/io/quarkus/smallrye/jwt/runtime/auth/ElytronJwtCallerPrincipal.java b/extensions/smallrye-jwt/runtime/src/main/java/io/quarkus/smallrye/jwt/runtime/auth/ElytronJwtCallerPrincipal.java index 5116636f334..f16ab8153b0 100644 --- a/extensions/smallrye-jwt/runtime/src/main/java/io/quarkus/smallrye/jwt/runtime/auth/ElytronJwtCallerPrincipal.java +++ b/extensions/smallrye-jwt/runtime/src/main/java/io/quarkus/smallrye/jwt/runtime/auth/ElytronJwtCallerPrincipal.java @@ -1,8 +1,5 @@ package io.quarkus.smallrye.jwt.runtime.auth; -import javax.json.JsonStructure; - -import org.eclipse.microprofile.jwt.Claims; import org.jose4j.jwt.JwtClaims; import org.wildfly.security.authz.Attributes; @@ -46,15 +43,4 @@ public String getName() { return customPrincipalName != null ? customPrincipalName : super.getName(); } - @Override - protected Object getClaimValue(String claimName) { - Object value = super.getClaimValue(claimName); - - Claims claimType = getClaimType(claimName); - if (claimType == Claims.UNKNOWN && !(value instanceof JsonStructure)) { - value = wrapClaimValue(value); - } - - return value; - } }
['extensions/smallrye-jwt/deployment/src/test/java/io/quarkus/jwt/test/JwtCallerPrincipalUnitTest.java', 'extensions/smallrye-jwt/runtime/src/main/java/io/quarkus/smallrye/jwt/runtime/auth/ElytronJwtCallerPrincipal.java']
{'.java': 2}
2
2
0
0
2
4,301,579
832,643
111,090
1,124
430
85
14
1
12,245
626
2,889
161
9
31
"2019-08-20T16:36: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,236
quarkusio/quarkus/3597/2063
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2063
https://github.com/quarkusio/quarkus/pull/3597
https://github.com/quarkusio/quarkus/pull/3597
1
fixes
QuarkusNative now depends on Docker while building from Gradle?
This is kinda of a question more than a bug report or something. I was able to successfully try to use quarkus `0.13.1` to build a sample application, but what I found strange is that even though I have set (as I did in `0.12.0`) the `GRAALVM_HOME` variable, now it is using docker to build the application. Is there an option to disable the need of using docker to build the native binary?
4fdfa0dba34267a8733626f6dbbd8bac2ed77274
dd6b89a1ec5ee2c4503a2a51097bcb0000c46c3e
https://github.com/quarkusio/quarkus/compare/4fdfa0dba34267a8733626f6dbbd8bac2ed77274...dd6b89a1ec5ee2c4503a2a51097bcb0000c46c3e
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java index 8ec05064312..b8d0ade47a1 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java @@ -56,7 +56,7 @@ public class QuarkusNative extends QuarkusTask { private String nativeImageXmx; - private String containerRuntime = "docker"; + private String containerRuntime; private String containerRuntimeOptions;
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java']
{'.java': 1}
1
1
0
0
1
4,300,950
832,576
111,089
1,124
86
15
2
1
394
73
98
4
0
0
"2019-08-20T13:07: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,237
quarkusio/quarkus/3570/3565
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3565
https://github.com/quarkusio/quarkus/pull/3570
https://github.com/quarkusio/quarkus/pull/3570
1
fixes
Add META-INF/io.netty.versions.properties to the uberJar ignore list
> [WARNING] [io.quarkus.creator.phase.runnerjar.RunnerJarPhase] Duplicate entry META-INF/io.netty.versions.properties entry from io.netty:netty-handler::jar:4.1.34.Final(compile) will be ignored. Existing file was provided by io.netty:netty-codec::jar:4.1.34.Final(compile) > [WARNING] [io.quarkus.creator.phase.runnerjar.RunnerJarPhase] Duplicate entry META-INF/io.netty.versions.properties entry from io.netty:netty-common::jar:4.1.34.Final(compile) will be ignored. Existing file was provided by io.netty:netty-codec::jar:4.1.34.Final(compile) > [WARNING] [io.quarkus.creator.phase.runnerjar.RunnerJarPhase] Duplicate entry META-INF/io.netty.versions.properties entry from io.netty:netty-transport::jar:4.1.34.Final(compile) will be ignored. Existing file was provided by io.netty:netty-codec::jar:4.1.34.Final(compile)
e51ecb98b252168c404560af476049442323db2b
d30e8a5a135f9ea57b2d94777e714957278669b5
https://github.com/quarkusio/quarkus/compare/e51ecb98b252168c404560af476049442323db2b...d30e8a5a135f9ea57b2d94777e714957278669b5
diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java b/core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java index ebb7980c50b..0e0eb4d3683 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java @@ -77,6 +77,7 @@ public class RunnerJarPhase implements AppCreationPhase<RunnerJarPhase>, RunnerJ "META-INF/README.md", "META-INF/DEPENDENCIES", "META-INF/beans.xml", + "META-INF/io.netty.versions.properties", "META-INF/quarkus-config-roots.list", "META-INF/quarkus-javadoc.properties", "META-INF/quarkus-extension.properties",
['core/creator/src/main/java/io/quarkus/creator/phase/runnerjar/RunnerJarPhase.java']
{'.java': 1}
1
1
0
0
1
4,289,292
830,328
110,773
1,120
53
10
1
1
824
54
232
3
0
0
"2019-08-19T12:16:27"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,238
quarkusio/quarkus/3561/3560
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3560
https://github.com/quarkusio/quarkus/pull/3561
https://github.com/quarkusio/quarkus/pull/3561
1
fixes
java.nio.file.NoSuchFileException thrown for string delimited with ':' (path) supplied by Gradle when multiple source path used (e.g. Kotlin of generated sourceSet)
**Describe the bug** java.nio.file.NoSuchFileException thrown for string delimited with ':' (path) supplied by Gradle when multiple source path used (e.g. Kotlin of generated sourceSet). **To Reproduce** Steps to reproduce the behavior: 1. `git clone -b quarkus-spring-mvc git@github.com:soberich/marvel.git` 2. `./gradlew -x test app:quarkusDev` **stacktrace** ```console Exception in thread "main" java.nio.file.NoSuchFileException: /Users/Projects/marvel-github/spi/build/classes/java/main:/Users/Projects/marvel-github/spi/build/classes/kotlin/main:/Users/Projects/marvel-github/spi/build/tmp/kapt3/classes/main at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55) at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144) at java.nio.file.Files.readAttributes(Files.java:1737) at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219) at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276) at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322) at java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:72) at java.nio.file.Files.walk(Files.java:3574) at java.nio.file.Files.walk(Files.java:3625) at io.quarkus.dev.RuntimeUpdatesProcessor.checkForClassFilesChangesInModule(RuntimeUpdatesProcessor.java:196) ```
19a6067c0fb40710e8ad90839257b38d8e7ee798
d6a9b6ba7b3c5607fc1fa467481f5fa8e1de3397
https://github.com/quarkusio/quarkus/compare/19a6067c0fb40710e8ad90839257b38d8e7ee798...d6a9b6ba7b3c5607fc1fa467481f5fa8e1de3397
diff --git a/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java b/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java index 65280e047e2..d2284fd27ad 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java +++ b/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java @@ -192,38 +192,40 @@ private boolean checkForClassFilesChangesInModule(DevModeContext.ModuleInfo modu } try { - final Path moduleClassesPath = Paths.get(module.getClassesPath()); - try (final Stream<Path> classesStream = Files.walk(moduleClassesPath)) { - final Set<Path> classFilePaths = classesStream - .parallel() - .filter(path -> path.toString().endsWith(CLASS_EXTENSION)) - .collect(Collectors.toSet()); - - for (Path classFilePath : classFilePaths) { - final Path sourceFilePath = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles, - module); - final long classFileModificationTime = Files.getLastModifiedTime(classFilePath).toMillis(); - if (sourceFilePath != null) { - if (Files.notExists(sourceFilePath)) { - // Source file has been deleted. Delete class and restart - Files.deleteIfExists(classFilePath); - classFilePathToSourceFilePath.remove(classFilePath); - hasChanges = true; - } else { - classFilePathToSourceFilePath.put(classFilePath, sourceFilePath); - if (classFileModificationTime > lastChange) { - // At least one class was recently modified. Restart. - hasChanges = true; - } else if (moduleChangedSourceFiles.contains(sourceFilePath)) { - // Source file has been modified, we delete the .class files as they are going to - //be recompiled anyway, this allows for simple cleanup of inner classes + for (String folder : module.getClassesPath().split(File.pathSeparator)) { + final Path moduleClassesPath = Paths.get(folder); + try (final Stream<Path> classesStream = Files.walk(moduleClassesPath)) { + final Set<Path> classFilePaths = classesStream + .parallel() + .filter(path -> path.toString().endsWith(CLASS_EXTENSION)) + .collect(Collectors.toSet()); + + for (Path classFilePath : classFilePaths) { + final Path sourceFilePath = retrieveSourceFilePathForClassFile(classFilePath, moduleChangedSourceFiles, + module); + final long classFileModificationTime = Files.getLastModifiedTime(classFilePath).toMillis(); + if (sourceFilePath != null) { + if (!sourceFilePath.toFile().exists()) { + // Source file has been deleted. Delete class and restart Files.deleteIfExists(classFilePath); classFilePathToSourceFilePath.remove(classFilePath); hasChanges = true; + } else { + classFilePathToSourceFilePath.put(classFilePath, sourceFilePath); + if (classFileModificationTime > lastChange) { + // At least one class was recently modified. Restart. + hasChanges = true; + } else if (moduleChangedSourceFiles.contains(sourceFilePath)) { + // Source file has been modified, we delete the .class files as they are going to + //be recompiled anyway, this allows for simple cleanup of inner classes + Files.deleteIfExists(classFilePath); + classFilePathToSourceFilePath.remove(classFilePath); + hasChanges = true; + } } + } else if (classFileModificationTime > lastChange) { + hasChanges = true; } - } else if (classFileModificationTime > lastChange) { - hasChanges = true; } } } @@ -249,7 +251,7 @@ private Optional<String> matchingHandledExtension(Path p) { private String getFileExtension(File file) { String name = file.getName(); - int lastIndexOf = name.lastIndexOf("."); + int lastIndexOf = name.lastIndexOf('.'); if (lastIndexOf == -1) { return ""; // empty extension } @@ -273,7 +275,7 @@ private Set<String> checkForFileChange() { for (String path : watchedFilePaths.keySet()) { Path file = root.resolve(path); - if (Files.exists(file)) { + if (file.toFile().exists()) { try { long value = Files.getLastModifiedTime(file).toMillis(); Long existing = watchedFileTimestamps.get(file); @@ -332,7 +334,7 @@ public RuntimeUpdatesProcessor setWatchedFilePaths(Map<String, Boolean> watchedF Path root = Paths.get(rootPath); for (String path : watchedFilePaths.keySet()) { Path config = root.resolve(path); - if (Files.exists(config)) { + if (config.toFile().exists()) { try { watchedFileTimestamps.put(config, Files.getLastModifiedTime(config).toMillis()); } catch (IOException e) {
['core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java']
{'.java': 1}
1
1
0
0
1
4,343,964
840,734
112,306
1,137
4,340
657
62
1
1,666
77
401
26
0
1
"2019-08-18T21:48:47"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,240
quarkusio/quarkus/3504/3505
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3505
https://github.com/quarkusio/quarkus/pull/3504
https://github.com/quarkusio/quarkus/pull/3504
1
fixes
Kubernetes client extension native: IntOrString$Serializer has no default (no arg) constructor
**Describe the bug** I have a Quarkus app which manipulates K8s resources using the standard extension for the Fabric8 client. It works fine in OpenJDK. When I run it in native mode, I get a cryptic error from Jackson. Vaguely reminiscent of #3077, but distinct, and not due to use of watches. **Expected behavior** Call works as in regular JVM mode. **Actual behavior** I get ``` io.fabric8.kubernetes.client.KubernetesClientException: Operation: [replace] for kind: [StatefulSet] with name: […] in namespace: […] failed. at io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation.lambda$replace$1(HasMetadataOperation.java:101) at io.fabric8.kubernetes.api.model.apps.DoneableStatefulSet.done(DoneableStatefulSet.java:27) at io.fabric8.kubernetes.api.model.apps.DoneableStatefulSet.done(DoneableStatefulSet.java:6) at io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation.replace(HasMetadataOperation.java:105) at io.fabric8.kubernetes.client.dsl.internal.RollableScalableResourceOperation.replace(RollableScalableResourceOperation.java:159) at io.fabric8.kubernetes.client.dsl.internal.RollableScalableResourceOperation.replace(RollableScalableResourceOperation.java:42) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:387) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.createOrReplace(BaseOperation.java:382) at … Caused by: com.fasterxml.jackson.databind.JsonMappingException: Class io.fabric8.kubernetes.api.model.IntOrString$Serializer has no default (no arg) constructor (through reference chain: io.fabric8.kubernetes.api.model.apps.StatefulSet["spec"]->io.fabric8.kubernetes.api.model.apps.StatefulSetSpec["template"]->io.fabric8.kubernetes.api.model.PodTemplateSpec["spec"]->io.fabric8.kubernetes.api.model.PodSpec["containers"]->java.util.ArrayList[0]->io.fabric8.kubernetes.api.model.Container["livenessProbe"]->io.fabric8.kubernetes.api.model.Probe["httpGet"]->io.fabric8.kubernetes.api.model.HTTPGetAction["port"]) at com.fasterxml.jackson.databind.SerializerProvider.reportMappingProblem(SerializerProvider.java:1223) at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1341) at com.fasterxml.jackson.databind.SerializerProvider.findPrimaryPropertySerializer(SerializerProvider.java:668) at com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap.findAndAddPrimarySerializer(PropertySerializerMap.java:64) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter._findAndAddDynamic(BeanPropertyWriter.java:897) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:705) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serializeContents(IndexedListSerializer.java:119) at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:79) at com.fasterxml.jackson.databind.ser.impl.IndexedListSerializer.serialize(IndexedListSerializer.java:18) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:727) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:719) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:155) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319) at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3906) at com.fasterxml.jackson.databind.ObjectMapper.writeValueAsString(ObjectMapper.java:3220) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleReplace(OperationSupport.java:270) at io.fabric8.kubernetes.client.dsl.base.OperationSupport.handleReplace(OperationSupport.java:252) at io.fabric8.kubernetes.client.dsl.base.BaseOperation.handleReplace(BaseOperation.java:801) at io.fabric8.kubernetes.client.dsl.base.HasMetadataOperation.lambda$replace$1(HasMetadataOperation.java:99) ... 79 more Caused by: java.lang.IllegalArgumentException: Class io.fabric8.kubernetes.api.model.IntOrString$Serializer has no default (no arg) constructor at com.fasterxml.jackson.databind.util.ClassUtil.createInstance(ClassUtil.java:554) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializerInstance(DefaultSerializerProvider.java:135) at com.fasterxml.jackson.databind.ser.BasicSerializerFactory.findSerializerFromAnnotation(BasicSerializerFactory.java:489) at com.fasterxml.jackson.databind.ser.BeanSerializerFactory.createSerializer(BeanSerializerFactory.java:136) at com.fasterxml.jackson.databind.SerializerProvider._createUntypedSerializer(SerializerProvider.java:1388) at com.fasterxml.jackson.databind.SerializerProvider._createAndCacheUntypedSerializer(SerializerProvider.java:1336) ... 114 more ``` Note that the class actually does have a no-arg constructor: ``` $ javap -classpath ~/.m2/repository/io/fabric8/kubernetes-model/4.3.1/kubernetes-model-4.3.1.jar 'io.fabric8.kubernetes.api.model.IntOrString$Serializer' Compiled from "IntOrString.java" public class io.fabric8.kubernetes.api.model.IntOrString$Serializer extends com.fasterxml.jackson.databind.JsonSerializer<io.fabric8.kubernetes.api.model.IntOrString> { public io.fabric8.kubernetes.api.model.IntOrString$Serializer(); public void serialize(io.fabric8.kubernetes.api.model.IntOrString, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider) throws java.io.IOException, com.fasterxml.jackson.core.JsonProcessingException; public void serialize(java.lang.Object, com.fasterxml.jackson.core.JsonGenerator, com.fasterxml.jackson.databind.SerializerProvider) throws java.io.IOException; } ``` **To Reproduce** The problematic code does something like ```java @Inject KubernetesClient k8sClient; // … StatefulSet sts = k8sClient.apps().statefulSets().withName(…).get(); sts.getSpec().setReplicas(1); k8sClient.apps().statefulSets().createOrReplace(sts); ``` and am building in `-Pnative` mode using `quay.io/quarkus/centos-quarkus-maven:19.1.1`. The resource in question seems OK acc. to `kubectl get -o json sts/… | jq '.spec.template.spec.containers[0].livenessProbe'`: ```json { "failureThreshold": 3, "httpGet": { "path": "/…", "port": 8080, "scheme": "HTTP" }, "initialDelaySeconds": 300, "periodSeconds": 10, "successThreshold": 1, "timeoutSeconds": 10 } ``` (Can try to produce a minimal test case if the problem is not obvious from what is here already.) **Configuration** No relevant configuration. **Environment (please complete the following information):** Microk8s on Ubuntu. GraalVM as per above image. Quarkus 0.20.0.
a862426165200141c234429e9a691744637f3481
162723b33983c6232d341068eb9120953db98cb9
https://github.com/quarkusio/quarkus/compare/a862426165200141c234429e9a691744637f3481...162723b33983c6232d341068eb9120953db98cb9
diff --git a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java index 12726d30cc9..87867ae9f50 100644 --- a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java +++ b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java @@ -87,6 +87,14 @@ public void process(ApplicationIndexBuildItem applicationIndex, CombinedIndexBui .toArray(String[]::new); reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, deserializerClasses)); + final String[] serializerClasses = combinedIndexBuildItem.getIndex() + .getAllKnownSubclasses(DotName.createSimple("com.fasterxml.jackson.databind.JsonSerializer")) + .stream() + .map(c -> c.name().toString()) + .filter(s -> s.startsWith("io.fabric8.kubernetes")) + .toArray(String[]::new); + reflectiveClasses.produce(new ReflectiveClassBuildItem(true, false, serializerClasses)); + reflectiveClasses .produce(new ReflectiveClassBuildItem(true, false, "io.fabric8.kubernetes.api.model.IntOrString")); reflectiveClasses
['extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/KubernetesClientProcessor.java']
{'.java': 1}
1
1
0
0
1
4,285,718
829,983
110,609
1,117
474
87
8
1
8,659
367
1,834
124
0
4
"2019-08-13T21:58: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
3,250
quarkusio/quarkus/3220/3218
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3218
https://github.com/quarkusio/quarkus/pull/3220
https://github.com/quarkusio/quarkus/pull/3220
1
fixes
Generated application.properties.example doesn't include CORS property
**Describe the bug** When generating an example application.properties files the `quarkus.http.cors` entry is missing. The other cors related entries are present as expected (i.e. `quarkus.http.cors.exposed-headers`). **Expected behavior** I would expect the example file to include all the available possible properties, including `quarkus.http.cors` along-side a relative comment. **Actual behavior** The `quarkus.http.cors` entry is not present **To Reproduce** Steps to reproduce the behavior: 1. Create a quarkus project `mvn io.quarkus:quarkus-maven-plugin:0.19.1:create` with the default values (or use an existing one) 2. From within the project `cd my-quarkus-project/` generate an `application.properties.example` file `./mvnw quarkus:generate-config` 3. Check the created file `src/main/resources/application.properties.example` for the missing entry. There is not a `quarkus.http.cors` present. The other cors related entries are present: ```bash grep 'cors' src/main/resources/application.properties.example #quarkus.http.cors.exposed-headers= #quarkus.http.cors.headers= #quarkus.http.cors.methods= #quarkus.http.cors.origins= ``` **Environment:** - Quarkus version or git rev: reproduced on quarkus 0.18, 0.19 and 0.19.1 - Maven version: `Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T21:41:47+03:00)` - Maven wrapped version: `Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-04T22:00:29+03:00)`
4e5409d193a1d9aa5f9fb2eae6188bc7f90d0ad0
7c11227eac1411d8a7baf0cdb29013512ed65be6
https://github.com/quarkusio/quarkus/compare/4e5409d193a1d9aa5f9fb2eae6188bc7f90d0ad0...7c11227eac1411d8a7baf0cdb29013512ed65be6
diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/generateconfig/GenerateConfigPhase.java b/core/creator/src/main/java/io/quarkus/creator/phase/generateconfig/GenerateConfigPhase.java index 19f5f5cdfd0..7ac54ba30b4 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/generateconfig/GenerateConfigPhase.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/generateconfig/GenerateConfigPhase.java @@ -118,7 +118,6 @@ private void doProcess(CurateOutcome appState) throws AppCreatorException { runnerClassLoader = new URLClassLoader(cpUrls.toArray(new URL[cpUrls.size()]), getClass().getClassLoader()); ClassLoader old = Thread.currentThread().getContextClassLoader(); - BuildResult result; try { Thread.currentThread().setContextClassLoader(runnerClassLoader); diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java index 4a273b512bb..c2cb9e9da1a 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java @@ -10,6 +10,7 @@ import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.BuildTimeConfigurationBuildItem; +import io.quarkus.deployment.builditem.BuildTimeRunTimeFixedConfigurationBuildItem; import io.quarkus.deployment.builditem.ConfigDescriptionBuildItem; import io.quarkus.deployment.builditem.RunTimeConfigurationBuildItem; import io.quarkus.deployment.configuration.ConfigDefinition; @@ -20,7 +21,8 @@ public class ConfigDescriptionBuildStep { @BuildStep List<ConfigDescriptionBuildItem> createConfigDescriptions( RunTimeConfigurationBuildItem runtimeConfig, - BuildTimeConfigurationBuildItem buildTimeConfig) throws Exception { + BuildTimeConfigurationBuildItem buildTimeConfig, + BuildTimeRunTimeFixedConfigurationBuildItem buildTimeRuntimeConfig) throws Exception { Properties javadoc = new Properties(); Enumeration<URL> resources = Thread.currentThread().getContextClassLoader() .getResources("META-INF/quarkus-javadoc.properties"); @@ -32,6 +34,7 @@ List<ConfigDescriptionBuildItem> createConfigDescriptions( List<ConfigDescriptionBuildItem> ret = new ArrayList<>(); processConfig(runtimeConfig.getConfigDefinition(), ret, javadoc); processConfig(buildTimeConfig.getConfigDefinition(), ret, javadoc); + processConfig(buildTimeRuntimeConfig.getConfigDefinition(), ret, javadoc); return ret; } diff --git a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/HttpBuildConfig.java b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/HttpBuildConfig.java index b399b4c329d..b3685ca5dd7 100644 --- a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/HttpBuildConfig.java +++ b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/HttpBuildConfig.java @@ -11,7 +11,7 @@ public class HttpBuildConfig { /** - * The CORS config + * Enable the CORS filter. */ @ConfigItem(name = "cors") public boolean corsEnabled = false;
['core/creator/src/main/java/io/quarkus/creator/phase/generateconfig/GenerateConfigPhase.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigDescriptionBuildStep.java', 'extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/HttpBuildConfig.java']
{'.java': 3}
3
3
0
0
3
4,155,386
805,072
107,846
1,104
498
92
8
3
1,500
153
442
30
0
1
"2019-07-14T12:40:52"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,241
quarkusio/quarkus/3490/3225
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3225
https://github.com/quarkusio/quarkus/pull/3490
https://github.com/quarkusio/quarkus/pull/3490
1
fix
NPE when trying to build a maven module that has no src folder
``` [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.19.1:build (default) on project behavior-definition: Failed to build a runnable JAR: Failed to build a runner jar: NullPointerException -> [Help 1] ``` Error handling should be improved here. Cause: the module had no src folder structure defined
aff962e4bdb0d8e95056dd1013cd6a3ec09d03ca
8b19c7ae1126cdcc3bbd7e648d6a27f2aa423edb
https://github.com/quarkusio/quarkus/compare/aff962e4bdb0d8e95056dd1013cd6a3ec09d03ca...8b19c7ae1126cdcc3bbd7e648d6a27f2aa423edb
diff --git a/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java b/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java index ebef51df795..13531a254fb 100644 --- a/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java +++ b/core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java @@ -208,10 +208,19 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException { } if (!Files.exists(appClassesDir)) { final Path appJar = appState.getAppArtifact().getPath(); - try { - ZipUtils.unzip(appJar, appClassesDir); - } catch (IOException e) { - throw new AppCreatorException("Failed to unzip " + appJar, e); + //manage project without src directory + if (appJar == null) { + try { + Files.createDirectory(appClassesDir); + } catch (IOException e) { + throw new AppCreatorException("Failed to create classes directory " + appClassesDir, e); + } + } else { + try { + ZipUtils.unzip(appJar, appClassesDir); + } catch (IOException e) { + throw new AppCreatorException("Failed to unzip " + appJar, e); + } } final Path metaInf = appClassesDir.resolve(META_INF); IoUtils.recursiveDelete(metaInf.resolve("maven"));
['core/creator/src/main/java/io/quarkus/creator/phase/augment/AugmentPhase.java']
{'.java': 1}
1
1
0
0
1
4,276,941
828,358
110,354
1,118
785
144
17
1
322
43
77
7
0
1
"2019-08-12T16:04:57"
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,242
quarkusio/quarkus/3487/3486
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3486
https://github.com/quarkusio/quarkus/pull/3487
https://github.com/quarkusio/quarkus/pull/3487
1
fixes
Hot reload: the sources encoding used during recompilation should be dynamic
**Describe the bug** Since #3467 got fixed, we're using a hardcoded `UTF-8` encoding during a hot reload compilation. **Expected behavior** Ideally, the encoding should come dynamically from the `project.build.sourceEncoding` Maven property or a Gradle equivalent.
d79248f9a5ecece092e3b5b5357257e4314c1337
64a97e2b7abcd89d53b7672301f0350a630fb143
https://github.com/quarkusio/quarkus/compare/d79248f9a5ecece092e3b5b5357257e4314c1337...64a97e2b7abcd89d53b7672301f0350a630fb143
diff --git a/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java b/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java index b1cd0b2fce4..bd0b58c0a17 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java +++ b/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java @@ -133,7 +133,8 @@ public ClassLoaderCompiler(ClassLoader classLoader, classPathElements, new File(i.getProjectDirectory()), new File(sourcePath), - new File(i.getClassesPath()))); + new File(i.getClassesPath()), + context.getSourceEncoding())); }); } } diff --git a/core/devmode/src/main/java/io/quarkus/dev/CompilationProvider.java b/core/devmode/src/main/java/io/quarkus/dev/CompilationProvider.java index b3f3f689ab7..471dd2f714e 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/CompilationProvider.java +++ b/core/devmode/src/main/java/io/quarkus/dev/CompilationProvider.java @@ -1,6 +1,8 @@ package io.quarkus.dev; import java.io.File; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.nio.file.Path; import java.util.Collections; import java.util.Set; @@ -24,19 +26,22 @@ class Context { private final File projectDirectory; private final File sourceDirectory; private final File outputDirectory; + private final Charset sourceEncoding; public Context( String name, Set<File> classpath, File projectDirectory, File sourceDirectory, - File outputDirectory) { + File outputDirectory, + String sourceEncoding) { this.name = name; this.classpath = classpath; this.projectDirectory = projectDirectory; this.sourceDirectory = sourceDirectory; this.outputDirectory = outputDirectory; + this.sourceEncoding = sourceEncoding == null ? StandardCharsets.UTF_8 : Charset.forName(sourceEncoding); } public String getName() { @@ -58,5 +63,9 @@ public File getSourceDirectory() { public File getOutputDirectory() { return outputDirectory; } + + public Charset getSourceEncoding() { + return sourceEncoding; + } } } diff --git a/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java b/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java index 66abc322235..e2ab7d443cb 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java +++ b/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java @@ -22,6 +22,7 @@ public class DevModeContext implements Serializable { private final List<ModuleInfo> modules = new ArrayList<>(); private final Map<String, String> systemProperties = new HashMap<>(); private final Map<String, String> buildSystemProperties = new HashMap<>(); + private String sourceEncoding; private final List<File> classesRoots = new ArrayList<>(); private File frameworkClassesDir; @@ -45,6 +46,14 @@ public Map<String, String> getBuildSystemProperties() { return buildSystemProperties; } + public String getSourceEncoding() { + return sourceEncoding; + } + + public void setSourceEncoding(String sourceEncoding) { + this.sourceEncoding = sourceEncoding; + } + public List<File> getClassesRoots() { return classesRoots; } diff --git a/core/devmode/src/main/java/io/quarkus/dev/JavaCompilationProvider.java b/core/devmode/src/main/java/io/quarkus/dev/JavaCompilationProvider.java index 4d278df56fe..a4accd940e2 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/JavaCompilationProvider.java +++ b/core/devmode/src/main/java/io/quarkus/dev/JavaCompilationProvider.java @@ -3,7 +3,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -44,7 +43,7 @@ public void compile(Set<File> filesToCompile, Context context) { } DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, - StandardCharsets.UTF_8)) { + context.getSourceEncoding())) { fileManager.setLocation(StandardLocation.CLASS_PATH, context.getClasspath()); fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(context.getOutputDirectory())); 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 690974dcc50..5f186ace540 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 @@ -30,12 +30,14 @@ import org.gradle.api.GradleException; import org.gradle.api.Project; +import org.gradle.api.Task; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Dependency; import org.gradle.api.artifacts.DependencySet; import org.gradle.api.artifacts.ProjectDependency; import org.gradle.api.artifacts.ResolvedDependency; import org.gradle.api.plugins.Convention; +import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPluginConvention; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.InputDirectory; @@ -43,6 +45,7 @@ import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.TaskAction; +import org.gradle.api.tasks.compile.JavaCompile; import org.gradle.api.tasks.options.Option; import io.quarkus.bootstrap.model.AppArtifact; @@ -140,6 +143,7 @@ public void startDev() { "Does the project have any source files?"); } DevModeContext context = new DevModeContext(); + context.setSourceEncoding(getSourceEncoding()); try { List<String> args = new ArrayList<>(); args.add(JavaBinFinder.findBin()); @@ -331,6 +335,14 @@ public void run() { } } + private String getSourceEncoding() { + Task javaCompile = getProject().getTasks().getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME); + if (javaCompile != null) { + return ((JavaCompile) javaCompile).getOptions().getEncoding(); + } + return null; + } + private void copyOutputToConsole(InputStream is) { try (InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); BufferedReader br = new BufferedReader(isr)) { 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 caafb049be5..74c880cd77c 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -225,6 +225,7 @@ public void execute() throws MojoFailureException, MojoExecutionException { devModeContext.getSystemProperties().put(e.getKey().toString(), (String) e.getValue()); } devModeContext.getBuildSystemProperties().putAll((Map) project.getProperties()); + devModeContext.setSourceEncoding(getSourceEncoding()); final AppModel appModel; try { @@ -368,6 +369,14 @@ public void run() { } } + private String getSourceEncoding() { + Object sourceEncodingProperty = project.getProperties().get("project.build.sourceEncoding"); + if (sourceEncodingProperty != null) { + return (String) sourceEncodingProperty; + } + return null; + } + private void addProject(DevModeContext devModeContext, LocalProject localProject) { String projectDirectory = null;
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java', 'core/devmode/src/main/java/io/quarkus/dev/CompilationProvider.java', 'core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java', 'core/devmode/src/main/java/io/quarkus/dev/JavaCompilationProvider.java', 'devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java', 'core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java']
{'.java': 6}
6
6
0
0
6
4,275,752
828,159
110,330
1,118
1,854
313
47
6
269
35
57
5
0
0
"2019-08-12T13:02:13"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,243
quarkusio/quarkus/3480/3331
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3331
https://github.com/quarkusio/quarkus/pull/3480
https://github.com/quarkusio/quarkus/pull/3480
1
closes
NPE when using io.quarkus.cli.commands.CreateProject.doCreateProject() on native image
**Describe the bug** Having NPE when using when using io.quarkus.cli.commands.CreateProject.doCreateProject() on native image. I suppose the template are not automatically included ``` 2019-07-25 11:42:30,588 ERROR [io.und.req.io] (executor-thread-1) Exception handling request de13b80e-5c67-479a-bd61-b2c9b73ba68d-1 to /api/quarkus/download: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException --   | 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:363)   | 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:249)   | at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:60)   | at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)   | 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.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.quarkus.undertow.runtime.RewriteCorrectingHandlerWrappers$PostWrapper$1.handleRequest(RewriteCorrectingHandlerWrappers.java:51)   | at io.undertow.predicate.PredicatesHandler.handleRequest(PredicatesHandler.java:110)   | at io.undertow.server.handlers.RequestDumpingHandler.handleRequest(RequestDumpingHandler.java:162)   | at io.undertow.predicate.PredicatesHandler.handleRequest(PredicatesHandler.java:93)   | at io.undertow.server.handlers.SetHeaderHandler.handleRequest(SetHeaderHandler.java:90)   | at io.undertow.predicate.PredicatesHandler.handleRequest(PredicatesHandler.java:93)   | at io.quarkus.undertow.runtime.RewriteCorrectingHandlerWrappers$PreWrapper$1.handleRequest(RewriteCorrectingHandlerWrappers.java:31)   | 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.UndertowDeploymentRecorder$8$1$1.call(UndertowDeploymentRecorder.java:483)   | 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:1429)   | 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)   | at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:473)   | at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)   | Caused by: java.lang.NullPointerException   | at java.io.Reader.<init>(Reader.java:78)   | at java.io.InputStreamReader.<init>(InputStreamReader.java:113)   | at io.quarkus.templates.rest.BasicRest.generate(BasicRest.java:119)   | at io.quarkus.templates.rest.BasicRest.initProject(BasicRest.java:98)   | at io.quarkus.templates.rest.BasicRest.generate(BasicRest.java:47)   | at io.quarkus.cli.commands.CreateProject.doCreateProject(CreateProject.java:127)   | at io.launcher.quarkus.LauncherQuarkus.download(LauncherQuarkus.kt:52)   | at io.launcher.quarkus.LauncherQuarkus_Subclass.download$$superaccessor1(LauncherQuarkus_Subclass.zig:120)   | at io.launcher.quarkus.LauncherQuarkus_Subclass$$function$$1.apply(LauncherQuarkus_Subclass$$function$$1.zig:51)   | at io.quarkus.arc.InvocationContextImpl.interceptorChainCompleted(InvocationContextImpl.java:141)   | at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:161)   | at io.quarkus.hibernate.validator.runtime.interceptor.AbstractMethodValidationInterceptor.validateMethodInvocation(AbstractMethodValidationInterceptor.java:67)   | at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor.validateMethodInvocation(JaxrsEndPointValidationInterceptor.java:29)   | at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor_Bean.intercept(JaxrsEndPointValidationInterceptor_Bean.zig:106)   | at io.quarkus.arc.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:254)   | at io.quarkus.arc.InvocationContextImpl.invokeNext(InvocationContextImpl.java:133)   | at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:157)   | at io.launcher.quarkus.LauncherQuarkus_Subclass.download(LauncherQuarkus_Subclass.zig:204)   | at java.lang.reflect.Method.invoke(Method.java:498)   | at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:151)   | at org.jboss.resteasy.core.MethodInjectorImpl.lambda$invoke$3(MethodInjectorImpl.java:122)   | at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602)   | at java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:614)   | at java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:1983)   | at java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:110)   | at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:122)   | at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:580)   | at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:454)   | at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:408)   | at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:363)   | at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:410)   | at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:379)   | at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invoke$1(ResourceMethodInvoker.java:353)   | at java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:981)   | at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2124)   | at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:110)   | at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:353)   | at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:477)   | ... 52 more ``` **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. Use `doCreateProject` with a valid `CreateProject` in a quarkus project and bind it to a rest endpoint 2. Create a native image 3. Call example: https://github.com/fabric8-launcher/launcher-quarkus/blob/master/src/main/kotlin/io/launcher/quarkus/LauncherQuarkus.kt#L52 **Workaround** ``` <plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${version.quarkus}</version> <executions> <execution> <goals> <goal>build</goal> </goals> <configuration> <additionalBuildArgs>-H:IncludeResources=templates/.*</additionalBuildArgs> </configuration> </execution> </executions> </plugin> ```
deb067251db1fadb5527c5baa737dc897df41084
826ffdbf5c9fb8dd909e41fc9418e9940dab809f
https://github.com/quarkusio/quarkus/compare/deb067251db1fadb5527c5baa737dc897df41084...826ffdbf5c9fb8dd909e41fc9418e9940dab809f
diff --git a/devtools/common/src/main/java/io/quarkus/generators/rest/BasicRestProjectGenerator.java b/devtools/common/src/main/java/io/quarkus/generators/rest/BasicRestProjectGenerator.java index bd9c600c8f7..dacd619630b 100644 --- a/devtools/common/src/main/java/io/quarkus/generators/rest/BasicRestProjectGenerator.java +++ b/devtools/common/src/main/java/io/quarkus/generators/rest/BasicRestProjectGenerator.java @@ -5,7 +5,9 @@ import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; +import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; @@ -111,9 +113,15 @@ private void generate(final String templateName, final Map<String, Object> conte throws IOException { if (!writer.exists(outputFilePath)) { String path = templateName.startsWith("/") ? templateName : "/" + templateName; - try (final BufferedReader stream = new BufferedReader( - new InputStreamReader(getClass().getResourceAsStream(path), StandardCharsets.UTF_8))) { - String template = stream.lines().collect(Collectors.joining("\\n")); + URL resource = getClass().getResource(path); + if (resource == null) { + throw new IOException("Template resource is missing: " + path); + } + try ( + InputStream resourceStream = resource.openStream(); + InputStreamReader streamReader = new InputStreamReader(resourceStream, StandardCharsets.UTF_8); + BufferedReader bufferedReader = new BufferedReader(streamReader)) { + String template = bufferedReader.lines().collect(Collectors.joining("\\n")); for (Entry<String, Object> e : context.entrySet()) { if (e.getValue() != null) { // Exclude null values (classname and path can be null) template = template.replace(format("${%s}", e.getKey()), e.getValue().toString());
['devtools/common/src/main/java/io/quarkus/generators/rest/BasicRestProjectGenerator.java']
{'.java': 1}
1
1
0
0
1
4,275,365
828,102
110,322
1,118
942
137
14
1
11,106
397
2,580
138
1
2
"2019-08-12T08:52:51"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,244
quarkusio/quarkus/3469/3468
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3468
https://github.com/quarkusio/quarkus/pull/3469
https://github.com/quarkusio/quarkus/pull/3469
1
fixes
Superfluous metrics are being created from SmallRye internal classes
Classes in `io.smallrye.metrics.interceptors` package are annotated in a way that when scanned as application classes, some metrics will be created out of them, but these are internal classes and are not meant to be scanned for metric annotations. This means we register some metrics unnecessarily, which hinders performance and makes the export contain superfluous metrics whose values will always be 0. An excerpt from such bloated OpenMetrics export: ``` # TYPE application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_total counter application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_total 0.0 # TYPE application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_rate_per_second gauge application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_rate_per_second 0.0 # TYPE application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_one_min_rate_per_second gauge application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_one_min_rate_per_second 0.0 # TYPE application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_five_min_rate_per_second gauge application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_five_min_rate_per_second 0.0 # TYPE application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_fifteen_min_rate_per_second gauge application_io_smallrye_metrics_interceptors_MeteredInterceptor_meteredMethod_fifteen_min_rate_per_second 0.0 ``` This happens for every application that has MP Metrics enabled.
5de2bedd081f7248a6dfac994a0e9967049c4da2
a4b265da08e286522bf4d594c37c75fedd0f5953
https://github.com/quarkusio/quarkus/compare/5de2bedd081f7248a6dfac994a0e9967049c4da2...a4b265da08e286522bf4d594c37c75fedd0f5953
diff --git a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java index 197cd1bffda..13af72d2877 100644 --- a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java +++ b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java @@ -167,12 +167,16 @@ void registerMetricsFromAnnotatedMethods(SmallRyeMetricsRecorder metrics, switch (metricAnnotationTarget.kind()) { case METHOD: { MethodInfo method = metricAnnotationTarget.asMethod(); - collectedMetricsMethods.add(method); + if (!method.declaringClass().name().toString().startsWith("io.smallrye.metrics")) { + collectedMetricsMethods.add(method); + } break; } case CLASS: { ClassInfo clazz = metricAnnotationTarget.asClass(); - collectMetricsClassAndSubClasses(index, collectedMetricsClasses, clazz); + if (!clazz.name().toString().startsWith("io.smallrye.metrics")) { + collectMetricsClassAndSubClasses(index, collectedMetricsClasses, clazz); + } break; } } diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/MetricsTestCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/MetricsTestCase.java index 4b617105e62..77c03160198 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/MetricsTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/MetricsTestCase.java @@ -2,6 +2,7 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; import java.util.concurrent.TimeUnit; @@ -149,6 +150,16 @@ public void testEndpointWithMetricsThrowingException() { .statusCode(404); } + /** + * Verify that no metrics are created from SmallRye internal classes (for example the + * io.smallrye.metrics.interceptors package) + */ + @Test + public void testNoMetricsFromSmallRyeInternalClasses() { + RestAssured.when().get("/metrics/application").then() + .body(not(containsString("io_smallrye_metrics"))); + } + private void assertMetricExactValue(String name, String val) { RestAssured.when().get("/metrics").then() .body(containsString(name + " " + val));
['extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java', 'integration-tests/main/src/test/java/io/quarkus/it/main/MetricsTestCase.java']
{'.java': 2}
2
2
0
0
2
4,252,085
823,575
109,728
1,111
581
87
8
1
1,607
110
340
16
0
1
"2019-08-09T11: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,245
quarkusio/quarkus/3464/2786
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2786
https://github.com/quarkusio/quarkus/pull/3464
https://github.com/quarkusio/quarkus/pull/3464
1
fixes
--docker-build flag seems to have no effect with Gradle plugin
Since 0.15.0 version, when buildNative gradle task is invoked it asks for GRAALVM_HOME environment variable regardless of whether it is being run with --docker-build=true or --docker-build=false **Expected behavior** I would expect the build to not require GRAALVM_HOME set when using docker image as a build environment **Environment (please complete the following information):** - Output of `uname -a` or `ver`: **Linux localhost.localdomain 5.1.7-300.fc30.x86_64 #1 SMP Wed Jun 5 12:32:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux** - Output of `java -version`: **openjdk version "1.8.0_212"** - GraalVM version (if different from Java): **graalvm-ce-1.0.0-rc16** - Quarkus version or git rev: **0.16.1**
5de2bedd081f7248a6dfac994a0e9967049c4da2
7050ff1058b1f60a49fb5cc95cc108c7cf62fdf4
https://github.com/quarkusio/quarkus/compare/5de2bedd081f7248a6dfac994a0e9967049c4da2...7050ff1058b1f60a49fb5cc95cc108c7cf62fdf4
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java index 40fe7119d11..8ec05064312 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java @@ -217,9 +217,6 @@ public void setEnableCodeSizeReporting(boolean enableCodeSizeReporting) { @Optional @Input public String getGraalvmHome() { - if (graalvmHome == null || graalvmHome.length() < 1) - throw new GradleException( - "The GRAALVM_HOME environment variable need to be set to your GraalVM root directory to use native mode"); return graalvmHome; }
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java']
{'.java': 1}
1
1
0
0
1
4,252,085
823,575
109,728
1,111
229
52
3
1
725
97
207
12
0
0
"2019-08-08T19:59: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,246
quarkusio/quarkus/3421/3419
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3419
https://github.com/quarkusio/quarkus/pull/3421
https://github.com/quarkusio/quarkus/pull/3421
2
fixes
OAuth2IdentityManager.verify(String id, Credential credential) - infinite loop
OAuth2IdentityManager.verify(String id, Credential credential) has infinite loop / recursive call. link to code: https://github.com/quarkusio/quarkus/blob/master/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/auth/OAuth2IdentityManager.java#L31 @loicmathieu should be current `return verify(null, credential);` changed to `return verify(credential);` ?
76f6ac5b312d9c2a872c9305501f37234a117ee9
9bc7197f215b021cf0e85ececdd877fd4dc5987e
https://github.com/quarkusio/quarkus/compare/76f6ac5b312d9c2a872c9305501f37234a117ee9...9bc7197f215b021cf0e85ececdd877fd4dc5987e
diff --git a/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/auth/OAuth2IdentityManager.java b/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/auth/OAuth2IdentityManager.java index d80f485dbc0..b876f10f978 100644 --- a/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/auth/OAuth2IdentityManager.java +++ b/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/auth/OAuth2IdentityManager.java @@ -29,7 +29,7 @@ public Account verify(Account account) { @Override public Account verify(String id, Credential credential) { - return verify(null, credential); + return null; } @Override
['extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/auth/OAuth2IdentityManager.java']
{'.java': 1}
1
1
0
0
1
4,239,678
821,224
109,470
1,111
63
11
2
1
411
26
95
5
1
0
"2019-08-05T11:29:19"
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,248
quarkusio/quarkus/3289/3268
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3268
https://github.com/quarkusio/quarkus/pull/3289
https://github.com/quarkusio/quarkus/pull/3289
1
fixes
Runtime artifact's POM repos aren't propagated to resolve the corresponding deployment deps
**Describe the bug** I'm testing camel extensions against the latest quarkus snapshot to validate the fix for https://github.com/quarkusio/quarkus/issues/3094 and when running the integration tests I see the following error: ``` [INFO] Running org.apache.camel.quarkus.core.CamelTest [ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 28.218 s <<< FAILURE! - in org.apache.camel.quarkus.core.CamelTest [ERROR] testProperties Time elapsed: 0.008 s <<< ERROR! org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [org.apache.camel.quarkus.core.CamelTest]: Failed to create the boostrap class loader Caused by: java.lang.IllegalStateException: Failed to create the boostrap class loader Caused by: io.quarkus.bootstrap.BootstrapException: Failed to create the deployment classloader for org.apache.camel.quarkus:camel-quarkus-integration-test-core::jar:0.0.1-SNAPSHOT Caused by: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to inject extension deployment dependencies for org.apache.camel.quarkus:camel-quarkus-integration-test-core:jar:0.0.1-SNAPSHOT Caused by: io.quarkus.bootstrap.BootstrapDependencyProcessingException: No dependencies collected for Quarkus extension deployment artifact io.quarkus:quarkus-resteasy-deployment:jar:999-SNAPSHOT while at least the corresponding runtime artifact io.quarkus:quarkus-resteasy:jar:999-20190718.021121-60 is expected ``` **To Reproduce** Steps to reproduce the behavior: 1. check-out https://github.com/lburgazzoli/apache-camel-quarkus/tree/test-packages 2. run `./mvnw clean install` **Environment (please complete the following information):** - Output of `uname -a` or `ver`: ``` Linux mars 5.1.17-300.fc30.x86_64 #1 SMP Wed Jul 10 15:20:27 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux ``` - Output of `java -version`: ``` openjdk version "1.8.0_212" OpenJDK Runtime Environment (build 1.8.0_212-b04) OpenJDK 64-Bit Server VM (build 25.212-b04, mixed mode) ``` - GraalVM version (if different from Java): ``` openjdk version "1.8.0_212" OpenJDK Runtime Environment (build 1.8.0_212-20190523183340.buildslave.jdk8u-src-tar--b03) OpenJDK 64-Bit GraalVM CE 19.0.2 (build 25.212-b03-jvmci-19-b04, mixed mode) ``` - Quarkus version or git rev: ``` 999-SNAPSHOT (from oss snapshot repo) ```
d17007d596c18534329ae8c5558fa83d42074885
47ec84157c649848ea807681489d0cf74c190bf3
https://github.com/quarkusio/quarkus/compare/d17007d596c18534329ae8c5558fa83d42074885...47ec84157c649848ea807681489d0cf74c190bf3
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java index 3f1ba98fb0c..b6e7057a7ff 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java @@ -17,6 +17,7 @@ import org.eclipse.aether.graph.DependencyNode; import org.eclipse.aether.graph.DependencyVisitor; import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactDescriptorResult; import org.eclipse.aether.resolution.ArtifactRequest; import org.eclipse.aether.resolution.ArtifactResult; import org.eclipse.aether.resolution.VersionRangeResult; @@ -134,68 +135,15 @@ public AppModel resolveManagedModel(AppArtifact appArtifact, List<AppDependency> private AppModel doResolveModel(AppArtifact appArtifact, List<Dependency> directMvnDeps, AppArtifact managingProject) throws AppModelResolverException { List<Dependency> managedDeps = Collections.emptyList(); + List<RemoteRepository> managedRepos = Collections.emptyList(); if(managingProject != null) { - managedDeps = mvn.resolveDescriptor(toAetherArtifact(managingProject)).getManagedDependencies(); + final ArtifactDescriptorResult managingDescr = mvn.resolveDescriptor(toAetherArtifact(managingProject)); + managedDeps = managingDescr.getManagedDependencies(); + managedRepos = mvn.newResolutionRepositories(managingDescr.getRepositories()); } - return injectDeploymentDependencies(appArtifact, mvn.resolveManagedDependencies(toAetherArtifact(appArtifact), - directMvnDeps, managedDeps, devmode ? new String[] { "test" } : new String[0]).getRoot(), managedDeps); - } - - @Override - public List<String> listLaterVersions(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppModelResolverException { - final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, appArtifact.getVersion(), false, upToVersion, inclusive); - final List<Version> resolvedVersions = rangeResult.getVersions(); - final List<String> versions = new ArrayList<>(resolvedVersions.size()); - for (Version v : resolvedVersions) { - versions.add(v.toString()); - } - return versions; - } - - @Override - public String getNextVersion(AppArtifact appArtifact, String fromVersion, boolean fromVersionIncluded, String upToVersion, boolean upToVersionInclusive) throws AppModelResolverException { - final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, fromVersion, fromVersionIncluded, upToVersion, upToVersionInclusive); - final List<Version> versions = rangeResult.getVersions(); - if(versions.isEmpty()) { - return null; - } - Version next = versions.get(0); - for(int i = 1; i < versions.size(); ++i) { - final Version candidate = versions.get(i); - if(next.compareTo(candidate) > 0) { - next = candidate; - } - } - return next.toString(); - } - - @Override - public String getLatestVersion(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppModelResolverException { - final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, appArtifact.getVersion(), false, upToVersion, inclusive); - final List<Version> versions = rangeResult.getVersions(); - if(versions.isEmpty()) { - return appArtifact.getVersion(); - } - Version latest = versions.get(0); - for(int i = 1; i < versions.size(); ++i) { - final Version candidate = versions.get(i); - if(latest.compareTo(candidate) < 0) { - latest = candidate; - } - } - return latest.toString(); - } - - public List<RemoteRepository> resolveArtifactRepos(AppArtifact appArtifact) throws AppModelResolverException { - return mvn.resolveDescriptor(toAetherArtifact(appArtifact)).getRepositories(); - } - - public void install(AppArtifact appArtifact, Path localPath) throws AppModelResolverException { - mvn.install(new DefaultArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getClassifier(), - appArtifact.getType(), appArtifact.getVersion(), Collections.emptyMap(), localPath.toFile())); - } - private AppModel injectDeploymentDependencies(AppArtifact appArtifact, DependencyNode root, List<Dependency> managedDeps) throws AppModelResolverException { + DependencyNode resolvedDeps = mvn.resolveManagedDependencies(toAetherArtifact(appArtifact), + directMvnDeps, managedDeps, managedRepos, devmode ? new String[] { "test" } : new String[0]).getRoot(); final Set<AppArtifactKey> appDeps = new HashSet<>(); final List<AppDependency> userDeps = new ArrayList<>(); @@ -215,15 +163,16 @@ public boolean visitLeave(DependencyNode node) { } return true; }}); - for(DependencyNode child : root.getChildren()) { + for(DependencyNode child : resolvedDeps.getChildren()) { child.accept(visitor); } - final DeploymentInjectingDependencyVisitor deploymentInjector = new DeploymentInjectingDependencyVisitor(mvn, managedDeps); + final DeploymentInjectingDependencyVisitor deploymentInjector = new DeploymentInjectingDependencyVisitor(mvn, + managedDeps, mvn.aggregateRepositories(managedRepos, mvn.newResolutionRepositories(mvn.resolveDescriptor(toAetherArtifact(appArtifact)).getRepositories()))); try { - root.accept(new TreeDependencyVisitor(deploymentInjector)); + resolvedDeps.accept(new TreeDependencyVisitor(deploymentInjector)); } catch (DeploymentInjectionException e) { - throw new AppModelResolverException("Failed to inject extension deployment dependencies for " + root.getArtifact(), e.getCause()); + throw new AppModelResolverException("Failed to inject extension deployment dependencies for " + resolvedDeps.getArtifact(), e.getCause()); } List<AppDependency> deploymentDeps = Collections.emptyList(); @@ -231,15 +180,15 @@ public boolean visitLeave(DependencyNode node) { final DependencyGraphTransformationContext context = new SimpleDependencyGraphTransformationContext(mvn.getSession()); try { // add conflict IDs to the added deployments - root = new ConflictMarker().transformGraph(root, context); + resolvedDeps = new ConflictMarker().transformGraph(resolvedDeps, context); // resolves version conflicts - root = new ConflictIdSorter().transformGraph(root, context); - root = mvn.getSession().getDependencyGraphTransformer().transformGraph(root, context); + resolvedDeps = new ConflictIdSorter().transformGraph(resolvedDeps, context); + resolvedDeps = mvn.getSession().getDependencyGraphTransformer().transformGraph(resolvedDeps, context); } catch (RepositoryException e) { throw new AppModelResolverException("Failed to normalize the dependency graph", e); } final BuildDependencyGraphVisitor buildDepsVisitor = new BuildDependencyGraphVisitor(appDeps, buildTreeConsumer); - buildDepsVisitor.visit(root); + buildDepsVisitor.visit(resolvedDeps); final List<ArtifactRequest> requests = buildDepsVisitor.getArtifactRequests(); if(!requests.isEmpty()) { final List<ArtifactResult> results = mvn.resolve(requests); @@ -262,6 +211,60 @@ public boolean visitLeave(DependencyNode node) { return new AppModel(appArtifact, userDeps, deploymentDeps); } + @Override + public List<String> listLaterVersions(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppModelResolverException { + final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, appArtifact.getVersion(), false, upToVersion, inclusive); + final List<Version> resolvedVersions = rangeResult.getVersions(); + final List<String> versions = new ArrayList<>(resolvedVersions.size()); + for (Version v : resolvedVersions) { + versions.add(v.toString()); + } + return versions; + } + + @Override + public String getNextVersion(AppArtifact appArtifact, String fromVersion, boolean fromVersionIncluded, String upToVersion, boolean upToVersionInclusive) throws AppModelResolverException { + final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, fromVersion, fromVersionIncluded, upToVersion, upToVersionInclusive); + final List<Version> versions = rangeResult.getVersions(); + if(versions.isEmpty()) { + return null; + } + Version next = versions.get(0); + for(int i = 1; i < versions.size(); ++i) { + final Version candidate = versions.get(i); + if(next.compareTo(candidate) > 0) { + next = candidate; + } + } + return next.toString(); + } + + @Override + public String getLatestVersion(AppArtifact appArtifact, String upToVersion, boolean inclusive) throws AppModelResolverException { + final VersionRangeResult rangeResult = resolveVersionRangeResult(appArtifact, appArtifact.getVersion(), false, upToVersion, inclusive); + final List<Version> versions = rangeResult.getVersions(); + if(versions.isEmpty()) { + return appArtifact.getVersion(); + } + Version latest = versions.get(0); + for(int i = 1; i < versions.size(); ++i) { + final Version candidate = versions.get(i); + if(latest.compareTo(candidate) < 0) { + latest = candidate; + } + } + return latest.toString(); + } + + public List<RemoteRepository> resolveArtifactRepos(AppArtifact appArtifact) throws AppModelResolverException { + return mvn.resolveDescriptor(toAetherArtifact(appArtifact)).getRepositories(); + } + + public void install(AppArtifact appArtifact, Path localPath) throws AppModelResolverException { + mvn.install(new DefaultArtifact(appArtifact.getGroupId(), appArtifact.getArtifactId(), appArtifact.getClassifier(), + appArtifact.getType(), appArtifact.getVersion(), Collections.emptyMap(), localPath.toFile())); + } + private VersionRangeResult resolveVersionRangeResult(AppArtifact appArtifact, String fromVersion, boolean fromVersionIncluded, String upToVersion, boolean upToVersionIncluded) throws AppModelResolverException { return mvn.resolveVersionRange(new DefaultArtifact(appArtifact.getGroupId(), diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java index 22d9890183a..5199430f4a4 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java @@ -15,6 +15,7 @@ import org.eclipse.aether.graph.Dependency; import org.eclipse.aether.graph.DependencyNode; import org.eclipse.aether.graph.DependencyVisitor; +import org.eclipse.aether.repository.RemoteRepository; import org.jboss.logging.Logger; import io.quarkus.bootstrap.BootstrapConstants; import io.quarkus.bootstrap.BootstrapDependencyProcessingException; @@ -37,13 +38,15 @@ public static Artifact getInjectedDependency(DependencyNode dep) { private final MavenArtifactResolver resolver; private final List<Dependency> managedDeps; + private final List<RemoteRepository> mainRepos; private DependencyNode node; boolean injectedDeps; - public DeploymentInjectingDependencyVisitor(MavenArtifactResolver resolver, List<Dependency> managedDeps) { + public DeploymentInjectingDependencyVisitor(MavenArtifactResolver resolver, List<Dependency> managedDeps, List<RemoteRepository> mainRepos) { this.resolver = resolver; this.managedDeps = managedDeps; + this.mainRepos = mainRepos; } public boolean isInjectedDeps() { @@ -124,7 +127,8 @@ private DependencyNode collectDependencies(Artifact artifact) throws BootstrapDe artifact = artifact.setVersion(node.getArtifact().getVersion()); } try { - return managedDeps.isEmpty() ? resolver.collectDependencies(artifact).getRoot() : resolver.collectManagedDependencies(artifact, Collections.emptyList(), managedDeps).getRoot(); + return managedDeps.isEmpty() ? resolver.collectDependencies(artifact, Collections.emptyList(), mainRepos).getRoot() + : resolver.collectManagedDependencies(artifact, Collections.emptyList(), managedDeps, mainRepos).getRoot(); } catch (AppModelResolverException e) { throw new DeploymentInjectionException(e); } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java index 8d52d76cc5b..a626b3552cc 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java @@ -221,7 +221,11 @@ public DependencyResult resolveDependencies(Artifact artifact) throws AppModelRe } public CollectResult collectDependencies(Artifact artifact, List<Dependency> deps) throws AppModelResolverException { - final CollectRequest request = newCollectRequest(artifact); + return collectDependencies(artifact, deps, Collections.emptyList()); + } + + public CollectResult collectDependencies(Artifact artifact, List<Dependency> deps, List<RemoteRepository> mainRepos) throws AppModelResolverException { + final CollectRequest request = newCollectRequest(artifact, mainRepos); request.setDependencies(deps); try { return repoSystem.collectDependencies(repoSession, request); @@ -231,7 +235,11 @@ public CollectResult collectDependencies(Artifact artifact, List<Dependency> dep } public DependencyResult resolveDependencies(Artifact artifact, List<Dependency> deps) throws AppModelResolverException { - final CollectRequest request = newCollectRequest(artifact); + return resolveDependencies(artifact, deps, Collections.emptyList()); + } + + public DependencyResult resolveDependencies(Artifact artifact, List<Dependency> deps, List<RemoteRepository> mainRepos) throws AppModelResolverException { + final CollectRequest request = newCollectRequest(artifact, mainRepos); request.setDependencies(deps); try { return repoSystem.resolveDependencies(repoSession, @@ -254,7 +262,7 @@ public DependencyResult resolveDependencies(Artifact artifact, String... exclude deps.add(dep); } } - final List<RemoteRepository> requestRepos = remoteRepoManager.aggregateRepositories(repoSession, remoteRepos, descr.getRepositories(), true); + final List<RemoteRepository> requestRepos = aggregateRepositories(remoteRepos, newResolutionRepositories(descr.getRepositories())); try { return repoSystem.resolveDependencies(repoSession, new DependencyRequest().setCollectRequest( @@ -269,24 +277,32 @@ public DependencyResult resolveDependencies(Artifact artifact, String... exclude } public DependencyResult resolveManagedDependencies(Artifact artifact, List<Dependency> deps, List<Dependency> managedDeps, String... excludedScopes) throws AppModelResolverException { + return resolveManagedDependencies(artifact, deps, managedDeps, Collections.emptyList(), excludedScopes); + } + + public DependencyResult resolveManagedDependencies(Artifact artifact, List<Dependency> deps, List<Dependency> managedDeps, List<RemoteRepository> mainRepos, String... excludedScopes) throws AppModelResolverException { try { return repoSystem.resolveDependencies(repoSession, new DependencyRequest().setCollectRequest( - newCollectManagedRequest(artifact, deps, managedDeps, excludedScopes))); + newCollectManagedRequest(artifact, deps, managedDeps, mainRepos, excludedScopes))); } catch (DependencyResolutionException e) { throw new AppModelResolverException("Failed to resolve dependencies for " + artifact, e); } } public CollectResult collectManagedDependencies(Artifact artifact, List<Dependency> deps, List<Dependency> managedDeps, String... excludedScopes) throws AppModelResolverException { + return collectManagedDependencies(artifact, deps, managedDeps, Collections.emptyList(), excludedScopes); + } + + public CollectResult collectManagedDependencies(Artifact artifact, List<Dependency> deps, List<Dependency> managedDeps, List<RemoteRepository> mainRepos, String... excludedScopes) throws AppModelResolverException { try { - return repoSystem.collectDependencies(repoSession, newCollectManagedRequest(artifact, deps, managedDeps, excludedScopes)); + return repoSystem.collectDependencies(repoSession, newCollectManagedRequest(artifact, deps, managedDeps, mainRepos, excludedScopes)); } catch (DependencyCollectionException e) { throw new AppModelResolverException("Failed to collect dependencies for " + artifact, e); } } - private CollectRequest newCollectManagedRequest(Artifact artifact, List<Dependency> deps, List<Dependency> managedDeps, String... excludedScopes) throws AppModelResolverException { + private CollectRequest newCollectManagedRequest(Artifact artifact, List<Dependency> deps, List<Dependency> managedDeps, List<RemoteRepository> mainRepos, String... excludedScopes) throws AppModelResolverException { final ArtifactDescriptorResult descr = resolveDescriptor(artifact); Collection<String> excluded; if(excludedScopes.length == 0) { @@ -325,11 +341,20 @@ private CollectRequest newCollectManagedRequest(Artifact artifact, List<Dependen } } + final List<RemoteRepository> repos = aggregateRepositories(mainRepos, remoteRepos); return new CollectRequest() .setRootArtifact(artifact) .setDependencies(mergeDeps(deps, originalDeps, managedVersions)) .setManagedDependencies(mergedManagedDeps) - .setRepositories(remoteRepoManager.aggregateRepositories(repoSession, remoteRepos, descr.getRepositories(), true)); + .setRepositories(aggregateRepositories(repos, newResolutionRepositories(descr.getRepositories()))); + } + + public List<RemoteRepository> newResolutionRepositories(List<RemoteRepository> repos) { + return repos.isEmpty() ? Collections.emptyList() : repoSystem.newResolutionRepositories(repoSession, repos); + } + + public List<RemoteRepository> aggregateRepositories(List<RemoteRepository> dominant, List<RemoteRepository> recessive) { + return dominant.isEmpty() ? recessive : remoteRepoManager.aggregateRepositories(repoSession, dominant, recessive, false); } public void install(Artifact artifact) throws AppModelResolverException { @@ -340,10 +365,10 @@ public void install(Artifact artifact) throws AppModelResolverException { } } - private CollectRequest newCollectRequest(Artifact artifact) throws AppModelResolverException { + private CollectRequest newCollectRequest(Artifact artifact, List<RemoteRepository> mainRepos) throws AppModelResolverException { return new CollectRequest() .setRoot(new Dependency(artifact, JavaScopes.RUNTIME)) - .setRepositories(remoteRepos); + .setRepositories(aggregateRepositories(mainRepos, remoteRepos)); } private List<Dependency> mergeDeps(List<Dependency> dominant, List<Dependency> recessive, Map<AppArtifactKey, String> managedVersions) {
['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/DeploymentInjectingDependencyVisitor.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java']
{'.java': 3}
3
3
0
0
3
4,165,606
807,575
108,194
1,114
12,966
2,474
188
3
2,430
238
685
43
2
5
"2019-07-19T13:03:04"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,249
quarkusio/quarkus/3244/2907
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2907
https://github.com/quarkusio/quarkus/pull/3244
https://github.com/quarkusio/quarkus/pull/3244
2
fixes
OpenAPI with static files instead of annotation scanning
**Describe the bug** It seems that all the `microprofile-open-api` features are not supported yet by quarkus. One setup example: Add the config property `mp.openapi.scan.disable=true` and a static OpenAPI file in `src/main/resources/META-INF/openapi.yaml`. In that case, the `microprofile-open-api` annotation scanning should be disabled and the openapi spec should be served from the static file. See https://github.com/eclipse/microprofile-open-api/blob/master/spec/src/main/asciidoc/microprofile-openapi-spec.adoc#static-openapi-files **Expected behavior** You see the static file served at http://localhost:8080/openapi **Actual behavior** I did not manage to see my local file, the server is always serving the generated one **To Reproduce** Steps to reproduce the behavior: 1. Create a project with Quarkus RESTEasy 2. Add the openapi extension and configure as described **Configuration** ```properties mp.openapi.scan.disable=true ``` Static OpenAPI file (that would be different from the generated one): ```yaml --- openapi: 3.0.1 info: title: My HelloWorld API version: "1.0" license: name: Eclipse Public License 2.0 url: 'https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html' paths: /hello: get: description: hello world method responses: 200: description: OK content: text/plain: schema: type: string ``` **Environment (please complete the following information):** - Output of `uname -a` or `ver`: ``` Darwin 18.5.0 Darwin Kernel Version 18.5.0: Mon Mar 11 20:40:32 PDT 2019; root:xnu-4903.251.3~3/RELEASE_X86_64 x86_64 ``` - Output of `java -version`: ``` java version "1.8.0_161" Java(TM) SE Runtime Environment (build 1.8.0_161-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode) ``` - GraalVM version (if different from Java): [not used] - Quarkus version or git rev: 0.16.1 --- We had a quick look at the code with @emmanuelbernard at Voxxed Days Luxembourg 2019. There is one integration test for the default setup (generated spec based on the annotation) https://github.com/quarkusio/quarkus/blob/master/integration-tests/main/src/test/java/io/quarkus/it/main/OpenApiTestCase.java But other scenario should be tested as test of the "deployment" module of "smallrye-openapi" https://github.com/quarkusio/quarkus/tree/master/extensions/smallrye-openapi/deployment/ cc: @kenfinnigan
5f948526e88573eac8c713dcc3bd339f54ab3029
eaa55994e4410c939029f92357ade0bdb1cbb522
https://github.com/quarkusio/quarkus/compare/5f948526e88573eac8c713dcc3bd339f54ab3029...eaa55994e4410c939029f92357ade0bdb1cbb522
diff --git a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java index 90aab3f5459..d2db855ac8d 100644 --- a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java +++ b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java @@ -84,6 +84,7 @@ public class SmallRyeOpenApiProcessor { SmallRyeOpenApiConfig openapi; + @BuildStep List<HotDeploymentWatchedFileBuildItem> configFiles() { return Stream.of(META_INF_OPENAPI_YAML, WEB_INF_CLASSES_META_INF_OPENAPI_YAML, META_INF_OPENAPI_YML, WEB_INF_CLASSES_META_INF_OPENAPI_YML,
['extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java']
{'.java': 1}
1
1
0
0
1
4,144,182
803,286
107,569
1,110
15
5
1
1
2,523
276
652
75
5
4
"2019-07-16T11:47:41"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,274
quarkusio/quarkus/2738/2726
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2726
https://github.com/quarkusio/quarkus/pull/2738
https://github.com/quarkusio/quarkus/pull/2738
1
fixes
Broken access in openapi and swagger-ui extensions
**Describe the bug** Openapi and swagger-ui intergrations are broken. https://github.com/quarkusio/quarkus-quickstarts/tree/master/using-openapi-swaggerui is also broken. It starts up, but /openapi endpoint and /swagger-ui respond with errors. **Expected behavior** Cool openapi and swagger pages, heh **Symptoms** Adding config key resolves problem in production env, but dev still errors. ``` quarkus.swagger-ui.always-include=true ``` Also it's strange that when I'm not adding this line, openapi is still available in production - not sure how safe is this. **Openapi error info** ``` Context Path: Servlet Path: /openapi Path Info: null Query String: null Stack Trace: java.io.FileNotFoundException: /quarkus-generated-openapi-doc.YAML at io.undertow.servlet.handlers.DefaultServlet.doGet(DefaultServlet.java:173) 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.handleRequest(FilterHandler.java:81) 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.dispatchToServlet(ServletInitialHandler.java:219) at io.undertow.servlet.spec.RequestDispatcherImpl.includeImpl(RequestDispatcherImpl.java:392) at io.undertow.servlet.spec.RequestDispatcherImpl.setupIncludeImpl(RequestDispatcherImpl.java:327) at io.undertow.servlet.spec.RequestDispatcherImpl.include(RequestDispatcherImpl.java:291) at io.quarkus.smallrye.openapi.runtime.OpenApiServlet.doGet(OpenApiServlet.java:65) 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.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.PathHandler.handleRequest(PathHandler.java:91) 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:236) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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:1429) 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) ``` **To Reproduce** Steps to reproduce the behavior: 1. clone https://github.com/quarkusio/quarkus-quickstarts 2. cd /using-openapi-swaggerui/ 3. ./mvnw compile quarkus:dev 4. http://localhost:8080/openapi - BANG 5. http://localhost:8080/swagger-ui - TWO TIME BANG :) **Environment** - OpenSUSE Tumbleweed, kernel 5.1.3-1 - JVM Version: Zulu 8.36.0.1 - Quarkus 0.16.0: **Linked issue in this repo** https://github.com/quarkusio/quarkus/issues/2597 **Linked issue in this quarkus-quickstarts repo** https://github.com/quarkusio/quarkus-quickstarts/issues/207 **Probable cause** https://github.com/quarkusio/quarkus/commit/4dcb8131f8018a46ddf098bd5c14beb4aa230404 - this commit added ability to enable swagger-ui in production env, and there was a lot of code, so some bug ought to be there.
5e6b4acfe997041fa6d41d9cec4f5cb2b4cf7bbd
f2f38b4a184ca702290ca37c2ad47804ad3cc590
https://github.com/quarkusio/quarkus/compare/5e6b4acfe997041fa6d41d9cec4f5cb2b4cf7bbd...f2f38b4a184ca702290ca37c2ad47804ad3cc590
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 f78d8f5456a..dabdd16d6f0 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -280,8 +280,12 @@ public void execute() throws MojoFailureException, MojoExecutionException { } args.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager"); + //wiring devmode is used for CDI beans that are not part of the user application (i.e. beans in 3rd party jars) + //we need this because these beans cannot be loaded by the runtime class loader, they must be loaded by the platform + //class loader File wiringClassesDirectory = new File(buildDir, "wiring-devmode"); wiringClassesDirectory.mkdirs(); + addToClassPaths(classPathManifest, devModeContext, wiringClassesDirectory); //we also want to add the maven plugin jar to the class path diff --git a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java index 92f22bd654f..bdc6a79c615 100644 --- a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java +++ b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java @@ -26,6 +26,15 @@ public class UndertowStaticResourcesBuildStep { protected static final String META_INF_RESOURCES_SLASH = "META-INF/resources/"; protected static final String META_INF_RESOURCES = "META-INF/resources"; + @BuildStep + void handleGeneratedWebResources(BuildProducer<GeneratedResourceBuildItem> generatedResources, + List<GeneratedWebResourceBuildItem> generatedWebResources) throws Exception { + for (GeneratedWebResourceBuildItem genResource : generatedWebResources) { + generatedResources.produce(new GeneratedResourceBuildItem(META_INF_RESOURCES_SLASH + genResource.getName(), + genResource.getClassData())); + } + } + @BuildStep KnownPathsBuildItem scanStaticResources(ApplicationArchivesBuildItem applicationArchivesBuildItem, BuildProducer<GeneratedResourceBuildItem> generatedResources, @@ -83,8 +92,6 @@ public void accept(Path path) { } } for (GeneratedWebResourceBuildItem genResource : generatedWebResources) { - generatedResources.produce(new GeneratedResourceBuildItem(META_INF_RESOURCES_SLASH + genResource.getName(), - genResource.getClassData())); String sub = genResource.getName(); if (sub.startsWith("/")) { sub = sub.substring(1);
['extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java', 'devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java']
{'.java': 2}
2
2
0
0
2
4,012,284
782,947
104,184
1,009
937
174
15
2
7,412
294
1,720
103
7
2
"2019-06-06T00:50:54"
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,275
quarkusio/quarkus/2733/2710
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2710
https://github.com/quarkusio/quarkus/pull/2733
https://github.com/quarkusio/quarkus/pull/2733
1
resolves
Shutdown task failed: java.lang.IllegalArgumentException - quarkus-hibernate-orm and quarkus-smallrye-fault-tolerance enabled
I see `java.lang.IllegalArgumentException` thrown at the end of test phase when `quarkus-hibernate-orm` and `quarkus-smallrye-fault-tolerance` are enabled. Stacktrace includes keywords like HystrixThreadEventStream and io.quarkus.smallrye.faulttolerance. This error message is present only if quarkus-hibernate-orm extension is used too. There is no exception when only quarkus-smallrye-fault-tolerance is enabled. ``` 2019-06-04 15:53:16,096 ERROR [io.qua.run.StartupContext] (main) Running a shutdown task failed: java.lang.IllegalArgumentException ``` ``` mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create \\ -DprojectGroupId=io.quarkus.qe \\ -DprojectArtifactId=scenario-101-getting-started \\ -DprojectVersion=1.0.0-SNAPSHOT \\ -DclassName="io.quarkus.qe.hello.GreetingResource" \\ -Dextensions=io.quarkus:quarkus-hibernate-orm,io.quarkus:quarkus-smallrye-fault-tolerance ``` ``` mvn clean package ... [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 3.884 s - in io.quarkus.qe.hello.GreetingResourceTest 2019-06-04 15:53:16,096 ERROR [io.qua.run.StartupContext] (main) Running a shutdown task failed: java.lang.IllegalArgumentException at io.quarkus.arc.ArcContainerImpl.unwrap(ArcContainerImpl.java:558) at io.quarkus.arc.ArcContainerImpl.instance(ArcContainerImpl.java:563) at io.quarkus.arc.InstanceImpl.resolve(InstanceImpl.java:163) at io.quarkus.arc.InstanceImpl.<init>(InstanceImpl.java:75) at io.quarkus.arc.InstanceImpl.<init>(InstanceImpl.java:61) at io.quarkus.arc.InstanceImpl.select(InstanceImpl.java:111) at io.quarkus.arc.ArcCDIProvider$ArcCDI.select(ArcCDIProvider.java:60) at io.smallrye.context.jta.context.propagation.JtaContextProvider.tm(JtaContextProvider.java:86) at io.smallrye.context.jta.context.propagation.JtaContextProvider.currentTransaction(JtaContextProvider.java:78) at io.smallrye.context.jta.context.propagation.JtaContextProvider.currentContext(JtaContextProvider.java:25) at io.smallrye.context.impl.CapturedContextState.<init>(CapturedContextState.java:21) at io.smallrye.context.SmallRyeContextManager.captureContext(SmallRyeContextManager.java:60) at io.smallrye.context.SmallRyeThreadContext.currentContextExecutor(SmallRyeThreadContext.java:208) at io.smallrye.context.propagators.rxjava1.ContextPropagatorOnObservableCreateAction.call(ContextPropagatorOnObservableCreateAction.java:24) at io.smallrye.context.propagators.rxjava1.ContextPropagatorOnObservableCreateAction.call(ContextPropagatorOnObservableCreateAction.java:12) at rx.plugins.RxJavaHooks.onCreate(RxJavaHooks.java:337) at rx.Observable.unsafeCreate(Observable.java:162) at rx.Observable.lift(Observable.java:299) at rx.Observable.onBackpressureBuffer(Observable.java:7883) at com.netflix.hystrix.metric.HystrixThreadEventStream.<init>(HystrixThreadEventStream.java:111) at com.netflix.hystrix.metric.HystrixThreadEventStream$1.initialValue(HystrixThreadEventStream.java:66) at com.netflix.hystrix.metric.HystrixThreadEventStream$1.initialValue(HystrixThreadEventStream.java:63) at java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:180) at java.lang.ThreadLocal.get(ThreadLocal.java:170) at com.netflix.hystrix.metric.HystrixThreadEventStream.getInstance(HystrixThreadEventStream.java:128) at io.quarkus.smallrye.faulttolerance.runtime.SmallryeFaultToleranceTemplate$1.run(SmallryeFaultToleranceTemplate.java:25) 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.test.junit.QuarkusTestExtension$5.close(QuarkusTestExtension.java:241) at io.quarkus.test.junit.QuarkusTestExtension$ExtensionState.close(QuarkusTestExtension.java:354) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.execution.ExtensionValuesStore.closeAllStoredCloseableValues(ExtensionValuesStore.java:61) at org.junit.jupiter.engine.descriptor.AbstractExtensionContext.close(AbstractExtensionContext.java:73) at org.junit.jupiter.engine.execution.JupiterEngineExecutionContext.close(JupiterEngineExecutionContext.java:53) at org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.cleanUp(JupiterEngineDescriptor.java:67) at org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.cleanUp(JupiterEngineDescriptor.java:30) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$cleanUp$9(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.cleanUp(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:83) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:142) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417) ```
a7df99eaa4581c345adb939ebd8c40f744050063
6c719a957e1876ff538be9eb695257050d0e612b
https://github.com/quarkusio/quarkus/compare/a7df99eaa4581c345adb939ebd8c40f744050063...6c719a957e1876ff538be9eb695257050d0e612b
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcCDIProvider.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcCDIProvider.java index 2b85487c527..166d5550fcf 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcCDIProvider.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcCDIProvider.java @@ -37,6 +37,9 @@ public ArcCDIProvider() { @Override public CDI<Object> getCDI() { + if (Arc.container() == null) { + throw new IllegalStateException("No CDI container is available"); + } return arcCDI; }
['independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcCDIProvider.java']
{'.java': 1}
1
1
0
0
1
4,012,157
782,923
104,181
1,009
129
24
3
1
6,267
216
1,510
78
0
3
"2019-06-05T13:48:09"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,276
quarkusio/quarkus/2713/2712
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2712
https://github.com/quarkusio/quarkus/pull/2713
https://github.com/quarkusio/quarkus/pull/2713
1
fixes
Trailing comma for extensions definition of `quarkus-maven-plugin:create` causes NPE
Trailing comma for extensions definition of `quarkus-maven-plugin:create` causes NPE and mvn command fail ``` mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create \\ -DprojectGroupId=io.quarkus.qe \\ -DprojectArtifactId=scenario-101-getting-started \\ -DprojectVersion=1.0.0-SNAPSHOT \\ -DclassName="io.quarkus.qe.hello.GreetingResource" \\ -Dextensions=io.quarkus:quarkus-smallrye-jwt, ``` ``` [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:999-SNAPSHOT:create (default-cli) @ standalone-pom --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.214 s [INFO] Finished at: 2019-06-04T16:04:03+02:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create (default-cli) on project standalone-pom: Execution default-cli of goal io.quarkus:quarkus- maven-plugin:999-SNAPSHOT:create failed.: NullPointerException -> [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/PluginExecutionException ```
8d8436c50d708e0797be09d221e2e3aad4473de3
ecfb9787ce28637d88a3dd6d109434b37e44de23
https://github.com/quarkusio/quarkus/compare/8d8436c50d708e0797be09d221e2e3aad4473de3...ecfb9787ce28637d88a3dd6d109434b37e44de23
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 4ce1fefe547..1ccdbd9ab2b 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java @@ -33,6 +33,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -141,6 +142,7 @@ public void execute() throws MojoExecutionException { boolean success; try { + sanitizeExtensions(); final SourceType sourceType = CreateProject.determineSourceType(extensions); sanitizeOptions(sourceType); @@ -290,8 +292,10 @@ private void sanitizeOptions(SourceType sourceType) { path = "/" + path; } } + } - extensions = extensions.stream().map(String::trim).collect(Collectors.toSet()); + private void sanitizeExtensions() { + extensions = extensions.stream().filter(Objects::nonNull).map(String::trim).collect(Collectors.toSet()); } private void printUserInstructions(File root) {
['devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java']
{'.java': 1}
1
1
0
0
1
4,011,616
782,801
104,156
1,009
312
57
6
1
1,746
146
432
34
1
2
"2019-06-04T14:42:19"
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,310
quarkusio/quarkus/1100/1099
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1099
https://github.com/quarkusio/quarkus/pull/1100
https://github.com/quarkusio/quarkus/pull/1100
1
fixes
Dev mode exception returns HTTP 200 reponse
If there is an build error in dev mode, the exception is returned in the body of a http response with HTTP 200 status code. I would have expected a HTTP 500 response code if the request failed due to a build error. The exception below triggered in release 0.9.1, but am not running into a build error with latest master. e.g. the following request `http://localhost:8080/insurance/rest/authentication/getToken?username=Herb.Daschke_1` Resulted in an exception in the application: ``` Error Restarting Shamrock Stack Trace: java.lang.RuntimeException: org.jboss.builder.BuildException: Build failure: Build failed due to errors [error]: Build step org.jboss.shamrock.arc.deployment.ArcAnnotationProcessor#build threw an exception: javax.enterprise.inject.UnsatisfiedResolutionException: InjectionPointInfo [requiredType=org.jboss.protean.benchmark.common.broker.IAgentsService, requiredQualifiers=[@RestClient]] on CLASS bean [types=[org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService, java.lang.Object], qualifiers=[@Default, @Any], target=org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService] at org.jboss.shamrock.runner.RuntimeRunner.run(RuntimeRunner.java:119) at org.jboss.shamrock.dev.DevModeMain.doStart(DevModeMain.java:122) at org.jboss.shamrock.dev.DevModeMain.main(DevModeMain.java:83) Caused by: org.jboss.builder.BuildException: Build failure: Build failed due to errors [error]: Build step org.jboss.shamrock.arc.deployment.ArcAnnotationProcessor#build threw an exception: javax.enterprise.inject.UnsatisfiedResolutionException: InjectionPointInfo [requiredType=org.jboss.protean.benchmark.common.broker.IAgentsService, requiredQualifiers=[@RestClient]] on CLASS bean [types=[org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService, java.lang.Object], qualifiers=[@Default, @Any], target=org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService] at org.jboss.builder.Execution.run(Execution.java:116) at org.jboss.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:136) at org.jboss.shamrock.deployment.ShamrockAugmentor.run(ShamrockAugmentor.java:101) at org.jboss.shamrock.runner.RuntimeRunner.run(RuntimeRunner.java:86) ... 2 more Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: InjectionPointInfo [requiredType=org.jboss.protean.benchmark.common.broker.IAgentsService, requiredQualifiers=[@RestClient]] on CLASS bean [types=[org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService, java.lang.Object], qualifiers=[@Default, @Any], target=org.jboss.protean.benchmark.insurance.service.InsuranceAgentsService] at org.jboss.protean.arc.processor.Beans.resolveInjectionPoint(Beans.java:318) at org.jboss.protean.arc.processor.BeanInfo.init(BeanInfo.java:349) at java.base/java.util.ArrayList.forEach(ArrayList.java:1378) at org.jboss.protean.arc.processor.BeanDeployment.init(BeanDeployment.java:281) at org.jboss.protean.arc.processor.BeanProcessor.process(BeanProcessor.java:159) at org.jboss.shamrock.arc.deployment.ArcAnnotationProcessor.build(ArcAnnotationProcessor.java:237) 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.jboss.shamrock.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:383) at org.jboss.builder.BuildContext.run(BuildContext.java:402) 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 java.base/java.lang.Thread.run(Thread.java:844) at org.jboss.threads.JBossThread.run(JBossThread.java:479) ``` With the following HTTP response header: ``` HTTP/1.1 200 OK Connection: keep-alive Content-Type: text/html; charset=UTF-8 Content-Length: 8197 Date: Thu, 28 Feb 2019 09:16:03 GMT ```
d4f7abef42ea618cc4afbc8bb491b2be5499ea45
48cc5a4b01bbad65d5e55c4a6c4fb6ed281f083a
https://github.com/quarkusio/quarkus/compare/d4f7abef42ea618cc4afbc8bb491b2be5499ea45...48cc5a4b01bbad65d5e55c4a6c4fb6ed281f083a
diff --git a/devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java b/devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java index 5ece94a960f..c7457500f29 100644 --- a/devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java +++ b/devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java @@ -230,7 +230,7 @@ public void testThatApplicationRecoversCompilationIssue() throws MavenInvocation await() .pollDelay(1, TimeUnit.SECONDS) .atMost(1, TimeUnit.MINUTES).until(() -> { - String content = getHttpResponse("/app/hello"); + String content = getHttpResponse("/app/hello", true); last.set(content); return content.contains(uuid); }); diff --git a/devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java b/devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java index c19e2dbd984..6328c8d60bc 100644 --- a/devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java +++ b/devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java @@ -7,6 +7,7 @@ import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; +import java.net.URLConnection; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -159,13 +160,27 @@ static String getHttpResponse() { } static String getHttpResponse(String path) { + return getHttpResponse(path, false); + } + + static String getHttpResponse(String path, boolean allowError) { AtomicReference<String> resp = new AtomicReference<>(); await() .pollDelay(1, TimeUnit.SECONDS) .atMost(1, TimeUnit.MINUTES).until(() -> { try { URL url = new URL("http://localhost:8080" + ((path.startsWith("/") ? path : "/" + path))); - String content = IOUtils.toString(url, "UTF-8"); + String content; + if (!allowError) { + content = IOUtils.toString(url, "UTF-8"); + } else { + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + if (conn.getResponseCode() >= 400) { + content = IOUtils.toString(conn.getErrorStream(), "UTF-8"); + } else { + content = IOUtils.toString(conn.getInputStream(), "UTF-8"); + } + } resp.set(content); return true; } catch (Exception e) { diff --git a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java index 295714e0af5..506f7eaefae 100644 --- a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java +++ b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java @@ -93,6 +93,7 @@ public class ReplacementDebugPage { "</style>"; public static void handleRequest(HttpServerExchange exchange, final Throwable exception) throws IOException { + exchange.setStatusCode(500); StringBuilder sb = new StringBuilder(); //todo: make this good sb.append("<html><head><title>ERROR</title>");
['extensions/undertow/deployment/src/main/java/io/quarkus/undertow/devmode/ReplacementDebugPage.java', 'devtools/maven/src/test/java/io/quarkus/maven/it/MojoTestBase.java', 'devtools/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java']
{'.java': 3}
3
3
0
0
3
3,735,348
742,755
99,098
868
37
7
1
1
4,357
230
1,013
55
1
2
"2019-02-28T14:03:56"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,301
quarkusio/quarkus/1726/1725
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1725
https://github.com/quarkusio/quarkus/pull/1726
https://github.com/quarkusio/quarkus/pull/1726
1
fix
Fix mvn (and others?) project create which asks a misleading question
``` $ mvn io.quarkus:quarkus-maven-plugin:0.12.0:create Set the project groupId [org.acme.quarkus.sample]: Set the project artifactId [my-quarkus-project]: Set the Quarkus version [1.0-SNAPSHOT]: ``` I suppose it should be `Set the project version`
c6454ddbf6335bba5d6e17057851f3fd266756cc
dc64b413eefa9a44992056fab7253a2877fc0108
https://github.com/quarkusio/quarkus/compare/c6454ddbf6335bba5d6e17057851f3fd266756cc...dc64b413eefa9a44992056fab7253a2877fc0108
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 647935fd141..c34fa06ed7a 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java @@ -237,7 +237,7 @@ private void askTheUserForMissingValues() throws MojoExecutionException { } if (StringUtils.isBlank(projectVersion)) { - projectVersion = prompter.promptWithDefaultValue("Set the Quarkus version", + projectVersion = prompter.promptWithDefaultValue("Set the project version", "1.0-SNAPSHOT"); }
['devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java']
{'.java': 1}
1
1
0
0
1
3,423,689
670,602
89,368
872
185
32
2
1
260
29
76
10
0
1
"2019-03-28T10:54:13"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,302
quarkusio/quarkus/1682/1672
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1672
https://github.com/quarkusio/quarkus/pull/1682
https://github.com/quarkusio/quarkus/pull/1682
1
resolves
Should the CamelRuntimeProducer be marked as unremovable?
A user reported having this in his logs: ``` 2019-03-25 12:20:39,124 WARN [io.qua.arc.run.ArcDeploymentTemplate] (main) Bean matching class io.quarkus.camel.core.runtime.CamelRuntimeProducer was marked as unused and removed during build. Extensions can eliminate false positives using: - a custom UnremovableBeanBuildItem - AdditionalBeanBuildItem(false, beanClazz) ``` I think the `CamelRuntimeProducer` bean should probably be marked as unremovable.
db6a0124e59ebd8e926b7a89216c78ff10621717
95d2a84455e11f8fc0c999f8445a12d7517424a7
https://github.com/quarkusio/quarkus/compare/db6a0124e59ebd8e926b7a89216c78ff10621717...95d2a84455e11f8fc0c999f8445a12d7517424a7
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java b/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java index 381fd434841..4664f9e3add 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java @@ -255,7 +255,8 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl return "Runtime proxy of " + returnType + " with id " + key; } throw new RuntimeException( - "You cannot invoke directly on an object returned from the bytecode recorded, you can only pass is back into the recorder as a parameter"); + "You cannot invoke " + method.getName() + + "() directly on an object returned from the bytecode recorder, you can only pass it back into the recorder as a parameter"); } }); ProxyInstance instance = new ProxyInstance(proxyInstance, key); diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanBuildItem.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanBuildItem.java index 799a005f611..b632f4fe90a 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanBuildItem.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanBuildItem.java @@ -10,6 +10,8 @@ import org.jboss.builder.item.MultiBuildItem; +import io.quarkus.runtime.RuntimeValue; + /** * Represents a bean that can be easily produced through a template (or other runtime Supplier implementation) */ @@ -18,14 +20,22 @@ public final class RuntimeBeanBuildItem extends MultiBuildItem { final String scope; final String type; final Supplier<Object> supplier; + final RuntimeValue<?> runtimeValue; final NavigableMap<String, NavigableMap<String, Object>> qualifiers; + final boolean removable; RuntimeBeanBuildItem(String scope, String type, Supplier<Object> supplier, - NavigableMap<String, NavigableMap<String, Object>> qualifiers) { + NavigableMap<String, NavigableMap<String, Object>> qualifiers, boolean removable, + RuntimeValue<?> runtimeValue) { + if (supplier != null && runtimeValue != null) { + throw new IllegalArgumentException("It is not possible to specify both - a supplier and a runtime value"); + } this.scope = scope; this.type = type; this.supplier = supplier; this.qualifiers = qualifiers; + this.removable = removable; + this.runtimeValue = runtimeValue; } public String getScope() { @@ -40,26 +50,38 @@ public Supplier<Object> getSupplier() { return supplier; } + public RuntimeValue<?> getRuntimeValue() { + return runtimeValue; + } + + public boolean isRemovable() { + return removable; + } + public NavigableMap<String, NavigableMap<String, Object>> getQualifiers() { return qualifiers; } - public static Builder builder(String type, Supplier<Object> supplier) { + public static Builder builder(Class<?> type) { + return builder(type.getName()); + } + + public static Builder builder(String type) { Objects.requireNonNull(type); - Objects.requireNonNull(supplier); - return new Builder(type, supplier); + return new Builder(type); } public static class Builder { String scope = Dependent.class.getName(); + boolean removable = true; final String type; - final Supplier<Object> supplier; + Supplier<Object> supplier; + RuntimeValue<?> value; final NavigableMap<String, NavigableMap<String, Object>> qualifiers = new TreeMap<>(); - public Builder(String type, Supplier<Object> supplier) { + public Builder(String type) { this.type = type; - this.supplier = supplier; } public Builder setScope(String scope) { @@ -90,8 +112,23 @@ public Builder addQualifier(Class<? extends Annotation> type, NavigableMap<Strin return addQualifier(type.getName(), values); } + public Builder setRemovable(boolean removable) { + this.removable = removable; + return this; + } + + public Builder setSupplier(Supplier<Object> supplier) { + this.supplier = Objects.requireNonNull(supplier); + return this; + } + + public Builder setRuntimeValue(RuntimeValue<?> runtimeValue) { + this.value = Objects.requireNonNull(runtimeValue); + return this; + } + public RuntimeBeanBuildItem build() { - return new RuntimeBeanBuildItem(scope, type, supplier, qualifiers); + return new RuntimeBeanBuildItem(scope, type, supplier, qualifiers, removable, value); } } } diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanProcessor.java index 867ea5f4e01..2e097f75889 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanProcessor.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanProcessor.java @@ -4,11 +4,13 @@ import java.util.List; import java.util.Map; import java.util.NavigableMap; +import java.util.function.Predicate; import java.util.function.Supplier; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; +import io.quarkus.arc.processor.BeanInfo; import io.quarkus.arc.runtime.ArcDeploymentTemplate; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -29,7 +31,8 @@ public class RuntimeBeanProcessor { @Record(ExecutionTime.STATIC_INIT) void build(List<RuntimeBeanBuildItem> beans, BuildProducer<GeneratedBeanBuildItem> generatedBean, - ArcDeploymentTemplate template) { + ArcDeploymentTemplate template, + BuildProducer<UnremovableBeanBuildItem> unremovableBeans) { String beanName = "io.quarkus.arc.runtimebean.RuntimeBeanProducers"; ClassCreator c = new ClassCreator(new ClassOutput() { @@ -41,22 +44,35 @@ public void write(String name, byte[] data) { c.addAnnotation(ApplicationScoped.class); Map<String, Supplier<Object>> map = new HashMap<>(); - for (RuntimeBeanBuildItem b : beans) { + for (RuntimeBeanBuildItem bean : beans) { //deterministic name //as we know the maps are sorted this will result in the same hash for the same bean - String name = b.type.replace(".", "_") + "_" + HashUtil.sha1(b.qualifiers.toString()); - map.put(name, b.supplier); + String name = bean.type.replace(".", "_") + "_" + HashUtil.sha1(bean.qualifiers.toString()); + if (bean.runtimeValue != null) { + map.put(name, template.createSupplier(bean.runtimeValue)); + } else { + map.put(name, bean.supplier); + } - MethodCreator producer = c.getMethodCreator("produce_" + name, b.type); + MethodCreator producer = c.getMethodCreator("produce_" + name, bean.type); producer.addAnnotation(Produces.class); - producer.addAnnotation(b.scope); - for (Map.Entry<String, NavigableMap<String, Object>> i : b.qualifiers.entrySet()) { - AnnotationCreator builder = producer.addAnnotation(i.getKey()); - for (Map.Entry<String, Object> j : i.getValue().entrySet()) { - builder.addValue(i.getKey(), i.getValue()); + producer.addAnnotation(bean.scope); + for (Map.Entry<String, NavigableMap<String, Object>> qualifierEntry : bean.qualifiers.entrySet()) { + AnnotationCreator builder = producer.addAnnotation(qualifierEntry.getKey()); + for (Map.Entry<String, Object> valueEntry : qualifierEntry.getValue().entrySet()) { + builder.addValue(valueEntry.getKey(), valueEntry.getValue()); } } + if (!bean.removable) { + unremovableBeans.produce(new UnremovableBeanBuildItem(new Predicate<BeanInfo>() { + @Override + public boolean test(BeanInfo bean) { + return bean.isProducerMethod() && bean.getTarget().get().asMethod().name().equals(name); + } + })); + } + ResultHandle staticMap = producer .readStaticField(FieldDescriptor.of(ArcDeploymentTemplate.class, "supplierMap", Map.class)); ResultHandle supplier = producer.invokeInterfaceMethod( diff --git a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcDeploymentTemplate.java b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcDeploymentTemplate.java index 6c0ff61e9de..f912972a9b2 100644 --- a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcDeploymentTemplate.java +++ b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcDeploymentTemplate.java @@ -29,11 +29,11 @@ import io.quarkus.arc.ArcContainer; import io.quarkus.arc.InstanceHandle; import io.quarkus.arc.ManagedContext; +import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.ShutdownContext; import io.quarkus.runtime.annotations.Template; /** - * @author Martin Kouba */ @Template public class ArcDeploymentTemplate { @@ -64,7 +64,6 @@ public BeanContainer initBeanContainer(ArcContainer container, List<BeanContaine Collection<String> removedBeanTypes) throws Exception { BeanContainer beanContainer = new BeanContainer() { - @SuppressWarnings("unchecked") @Override public <T> Factory<T> instanceFactory(Class<T> type, Annotation... qualifiers) { Supplier<InstanceHandle<T>> handleSupplier = container.instanceSupplier(type, qualifiers); @@ -122,6 +121,15 @@ public void run() { }); } + public Supplier<Object> createSupplier(RuntimeValue<?> value) { + return new Supplier<Object>() { + @Override + public Object get() { + return value.getValue(); + } + }; + } + private static final class DefaultInstanceFactory<T> implements BeanContainer.Factory<T> { final Class<T> type; diff --git a/extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelInitProcessor.java b/extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelInitProcessor.java index 0174703ab91..8074c09b887 100644 --- a/extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelInitProcessor.java +++ b/extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelInitProcessor.java @@ -23,10 +23,8 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; -import io.quarkus.arc.deployment.AdditionalBeanBuildItem; -import io.quarkus.arc.deployment.BeanContainerListenerBuildItem; +import io.quarkus.arc.deployment.RuntimeBeanBuildItem; import io.quarkus.camel.core.runtime.CamelRuntime; -import io.quarkus.camel.core.runtime.CamelRuntimeProducer; import io.quarkus.camel.core.runtime.CamelTemplate; import io.quarkus.camel.core.runtime.RuntimeRegistry; import io.quarkus.deployment.annotations.BuildProducer; @@ -60,17 +58,10 @@ static class CamelConfig { CamelConfig config; - @Record(ExecutionTime.STATIC_INIT) - @BuildStep - AdditionalBeanBuildItem camelRuntimeProducer(BuildProducer<BeanContainerListenerBuildItem> listener, CamelTemplate template, - CamelRuntimeBuildItem runtimeBuildItem) { - listener.produce(new BeanContainerListenerBuildItem(template.initRuntimeInjection(runtimeBuildItem.getRuntime()))); - return new AdditionalBeanBuildItem(CamelRuntimeProducer.class); - } - @Record(ExecutionTime.STATIC_INIT) @BuildStep(applicationArchiveMarkers = { CamelSupport.CAMEL_SERVICE_BASE_PATH, CamelSupport.CAMEL_ROOT_PACKAGE_DIRECTORY }) - CamelRuntimeBuildItem createInitTask(RecorderContext recorderContext, CamelTemplate template) { + CamelRuntimeBuildItem createInitTask(RecorderContext recorderContext, CamelTemplate template, + BuildProducer<RuntimeBeanBuildItem> runtimeBeans) { Properties properties = new Properties(); Config configProvider = ConfigProvider.getConfig(); for (String property : configProvider.getPropertyNames()) { @@ -90,7 +81,12 @@ CamelRuntimeBuildItem createInitTask(RecorderContext recorderContext, CamelTempl visitServices((name, type) -> registry.bind(name, type, recorderContext.newInstance(type.getName()))); - return new CamelRuntimeBuildItem(template.init(runtime, registry, properties, builders)); + RuntimeValue<CamelRuntime> camelRuntime = template.init(runtime, registry, properties, builders); + + runtimeBeans + .produce(RuntimeBeanBuildItem.builder(CamelRuntime.class).setRuntimeValue(camelRuntime).build()); + + return new CamelRuntimeBuildItem(camelRuntime); } @Record(ExecutionTime.RUNTIME_INIT) diff --git a/extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelRuntimeBuildItem.java b/extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelRuntimeBuildItem.java index 375430ca5f5..f6c3898fa2d 100644 --- a/extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelRuntimeBuildItem.java +++ b/extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelRuntimeBuildItem.java @@ -3,15 +3,17 @@ import org.jboss.builder.item.SimpleBuildItem; import io.quarkus.camel.core.runtime.CamelRuntime; +import io.quarkus.runtime.RuntimeValue; public final class CamelRuntimeBuildItem extends SimpleBuildItem { - private final CamelRuntime runtime; - public CamelRuntimeBuildItem(CamelRuntime runtime) { + private final RuntimeValue<CamelRuntime> runtime; + + public CamelRuntimeBuildItem(RuntimeValue<CamelRuntime> runtime) { this.runtime = runtime; } - public CamelRuntime getRuntime() { + public RuntimeValue<CamelRuntime> getRuntime() { return runtime; } } diff --git a/extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelRuntimeProducer.java b/extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelRuntimeProducer.java deleted file mode 100644 index 19c1e5be279..00000000000 --- a/extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelRuntimeProducer.java +++ /dev/null @@ -1,19 +0,0 @@ -package io.quarkus.camel.core.runtime; - -import javax.enterprise.context.ApplicationScoped; -import javax.enterprise.inject.Produces; - -@ApplicationScoped -public class CamelRuntimeProducer { - - CamelRuntime camelRuntime; - - @Produces - public CamelRuntime getCamelRuntime() { - return camelRuntime; - } - - public void setCamelRuntime(CamelRuntime camelRuntime) { - this.camelRuntime = camelRuntime; - } -} diff --git a/extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelTemplate.java b/extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelTemplate.java index 2b8d873be9a..8b16ab640b2 100644 --- a/extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelTemplate.java +++ b/extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelTemplate.java @@ -6,8 +6,6 @@ import org.apache.camel.RoutesBuilder; -import io.quarkus.arc.runtime.BeanContainer; -import io.quarkus.arc.runtime.BeanContainerListener; import io.quarkus.runtime.RuntimeValue; import io.quarkus.runtime.ShutdownContext; import io.quarkus.runtime.annotations.Template; @@ -15,7 +13,7 @@ @Template public class CamelTemplate { - public CamelRuntime init( + public RuntimeValue<CamelRuntime> init( RuntimeValue<?> iruntime, RuntimeRegistry registry, Properties properties, @@ -28,18 +26,18 @@ public CamelRuntime init( .map(RoutesBuilder.class::cast) .collect(Collectors.toList())); runtime.init(); - return runtime; + return new RuntimeValue<>(runtime); } - public void start(final ShutdownContext shutdown, final CamelRuntime runtime) throws Exception { - runtime.start(); + public void start(final ShutdownContext shutdown, final RuntimeValue<CamelRuntime> runtime) throws Exception { + runtime.getValue().start(); //in development mode undertow is started eagerly shutdown.addShutdownTask(new Runnable() { @Override public void run() { try { - runtime.stop(); + runtime.getValue().stop(); } catch (Exception e) { throw new RuntimeException(e); } @@ -47,12 +45,4 @@ public void run() { }); } - public BeanContainerListener initRuntimeInjection(CamelRuntime runtime) { - return new BeanContainerListener() { - @Override - public void created(BeanContainer container) { - container.instance(CamelRuntimeProducer.class).setCamelRuntime(runtime); - } - }; - } } 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 8411f9e2dcb..0b5838a1dd3 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 @@ -76,11 +76,13 @@ void createExecutors(BuildProducer<RuntimeBeanBuildItem> runtimeBeanBuildItemBui Supplier<Object> boss = template.createEventLoop(1); Supplier<Object> worker = template.createEventLoop(0); - runtimeBeanBuildItemBuildProducer.produce(RuntimeBeanBuildItem.builder(EventLoopGroup.class.getName(), boss) + runtimeBeanBuildItemBuildProducer.produce(RuntimeBeanBuildItem.builder(EventLoopGroup.class) + .setSupplier(boss) .setScope(ApplicationScoped.class) .addQualifier(BossGroup.class) .build()); - runtimeBeanBuildItemBuildProducer.produce(RuntimeBeanBuildItem.builder(EventLoopGroup.class.getName(), worker) + runtimeBeanBuildItemBuildProducer.produce(RuntimeBeanBuildItem.builder(EventLoopGroup.class) + .setSupplier(worker) .setScope(ApplicationScoped.class) .build()); }
['core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java', 'extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelInitProcessor.java', 'extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java', 'extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanBuildItem.java', 'extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/RuntimeBeanProcessor.java', 'extensions/camel/camel-core/deployment/src/main/java/io/quarkus/camel/core/deployment/CamelRuntimeBuildItem.java', 'extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelTemplate.java', 'extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/ArcDeploymentTemplate.java', 'extensions/camel/camel-core/runtime/src/main/java/io/quarkus/camel/core/runtime/CamelRuntimeProducer.java']
{'.java': 9}
9
9
0
0
9
3,373,322
660,965
88,001
857
8,613
1,589
179
9
469
51
114
9
0
1
"2019-03-25T15:46:18"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,303
quarkusio/quarkus/1679/1668
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1668
https://github.com/quarkusio/quarkus/pull/1679
https://github.com/quarkusio/quarkus/pull/1679
1
fixes
@Timed and @Counted annotations fails when exceptions occurs
The following method with ```@Counted``` and ```@Timed``` annotations fails if any exception occurs during the invocation. For instance, if I want the method to throw a javax.ws.rs.NotFoundException in some cases, it doesn't work due to these annotations and I instead get a HTTP status 500. If I remove the annotations the expected HTTP status code is 404 when calling ```/greeting/notfound``` ```java @GET @Produces(MediaType.TEXT_PLAIN) @Path("/greeting/{name}") @Timed(name = "greetingTime", description = "Timing of the greeting method", absolute = true) @Counted(name = "greeting", description = "Counting of the greeting method", absolute = true, monotonic = true) public String greeting(@PathParam("name") String name) { if (name.equals("notfound")) throw new NotFoundException(); return service.greeting(name); } ``` I'm using Quarkus version 0.12.0, JDK 11 on macOS Mojave and maven 3.6.0 ``` ERROR: UT005023: Exception handling request to /greeting/fail org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: Cannot invoke method: io.smallrye.metrics.interceptors.TimedInterceptor#timedMethod on io.smallrye.metrics.interceptors.TimedInterceptor@1f4b5667 at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:103) at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:323) at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:209) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:495) 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:229) 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.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:52) 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:415) 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:1998) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1525) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1382) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: java.lang.RuntimeException: Cannot invoke method: io.smallrye.metrics.interceptors.TimedInterceptor#timedMethod on io.smallrye.metrics.interceptors.TimedInterceptor@1f4b5667 at io.quarkus.arc.Reflections.invokeMethod(Reflections.java:114) at io.smallrye.metrics.interceptors.TimedInterceptor_Bean.intercept(Unknown Source) at io.quarkus.arc.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:270) at io.quarkus.arc.InvocationContextImpl.invokeNext(InvocationContextImpl.java:149) at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:173) at se.acme.quarkus.GreetingFacade_Subclass.greeting(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:152) at org.jboss.resteasy.core.MethodInjectorImpl.lambda$invoke$3(MethodInjectorImpl.java:123) 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:123) at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:543) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:418) at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:372) at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362) at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:374) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:343) at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invoke$1(ResourceMethodInvoker.java:317) 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:317) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:476) ... 49 more Caused by: 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.arc.Reflections.invokeMethod(Reflections.java:111) ... 77 more Caused by: java.lang.RuntimeException: Cannot invoke method: io.smallrye.metrics.interceptors.CountedInterceptor#countedMethod on io.smallrye.metrics.interceptors.CountedInterceptor@13619d1d at io.quarkus.arc.Reflections.invokeMethod(Reflections.java:114) at io.smallrye.metrics.interceptors.CountedInterceptor_Bean.intercept(Unknown Source) at io.quarkus.arc.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:270) at io.quarkus.arc.InvocationContextImpl.invokeNext(InvocationContextImpl.java:149) at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:173) at io.smallrye.metrics.interceptors.TimedInterceptor.timedCallable(TimedInterceptor.java:80) at io.smallrye.metrics.interceptors.TimedInterceptor.timedMethod(TimedInterceptor.java:63) ... 82 more Caused by: 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.arc.Reflections.invokeMethod(Reflections.java:111) ... 88 more Caused by: javax.ws.rs.NotFoundException: HTTP 404 Not Found at se.acme.quarkus.GreetingFacade.greeting(GreetingFacade.java:27) at se.acme.quarkus.GreetingFacade_Subclass.greeting$$superaccessor1(Unknown Source) at se.acme.quarkus.GreetingFacade_Subclass$$function$$3.apply(Unknown Source) at io.quarkus.arc.InvocationContextImpl.interceptorChainCompleted(InvocationContextImpl.java:157) at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:177) at io.smallrye.metrics.interceptors.CountedInterceptor.countedCallable(CountedInterceptor.java:81) at io.smallrye.metrics.interceptors.CountedInterceptor.countedMethod(CountedInterceptor.java:63) ... 93 more ```
7916051ebd26db37a8ce7311dd834fbc367e3648
2fbdb458a57ad9b305c1c4088af96cfb30b6ef96
https://github.com/quarkusio/quarkus/compare/7916051ebd26db37a8ce7311dd834fbc367e3648...2fbdb458a57ad9b305c1c4088af96cfb30b6ef96
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Reflections.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Reflections.java index 3f5fa991150..36431dd2a79 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Reflections.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Reflections.java @@ -109,8 +109,13 @@ public static Object invokeMethod(Class<?> clazz, String name, Class<?>[] paramT method.setAccessible(true); } return method.invoke(instance, args); - } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException - | InvocationTargetException e) { + } catch (InvocationTargetException e) { + Throwable t = e.getTargetException(); + if (t instanceof RuntimeException) { + throw (RuntimeException) t; + } + throw new RuntimeException("Cannot invoke method: " + clazz.getName() + "#" + name + " on " + instance, e); + } catch (NoSuchMethodException | SecurityException | IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException("Cannot invoke method: " + clazz.getName() + "#" + name + " on " + instance, e); } } diff --git a/integration-tests/main/src/main/java/io/quarkus/example/metrics/MetricsResource.java b/integration-tests/main/src/main/java/io/quarkus/example/metrics/MetricsResource.java index 3558f4ad980..1e4ce5c2a12 100644 --- a/integration-tests/main/src/main/java/io/quarkus/example/metrics/MetricsResource.java +++ b/integration-tests/main/src/main/java/io/quarkus/example/metrics/MetricsResource.java @@ -18,6 +18,7 @@ import javax.inject.Inject; import javax.ws.rs.GET; +import javax.ws.rs.NotFoundException; import javax.ws.rs.Path; import org.eclipse.microprofile.metrics.Histogram; @@ -84,4 +85,11 @@ public String counterWithTags() { return "TEST"; } + @GET + @Path("/counter-throwing-not-found-exception") + @Counted(monotonic = true, name = "counter_404") + public String counterWithTagsThrowingNotFound() { + throw new NotFoundException(); + } + } diff --git a/integration-tests/main/src/test/java/io/quarkus/example/test/MetricsTestCase.java b/integration-tests/main/src/test/java/io/quarkus/example/test/MetricsTestCase.java index 78a234e804d..df9343bbba4 100644 --- a/integration-tests/main/src/test/java/io/quarkus/example/test/MetricsTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/example/test/MetricsTestCase.java @@ -138,6 +138,15 @@ public void testVendorMetrics() { .body(containsString("vendor:memory_max_non_heap_bytes ")); } + /** + * A REST method with metrics is throwing a NotFoundException, so the client should receive 404. + */ + @Test + public void testEndpointWithMetricsThrowingException() { + RestAssured.when().get("/metricsresource/counter-throwing-not-found-exception").then() + .statusCode(404); + } + private void assertMetricExactValue(String name, String val) { RestAssured.when().get("/metrics").then() .body(containsString(name + " " + val));
['independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Reflections.java', 'integration-tests/main/src/test/java/io/quarkus/example/test/MetricsTestCase.java', 'integration-tests/main/src/main/java/io/quarkus/example/metrics/MetricsResource.java']
{'.java': 3}
3
3
0
0
3
3,295,863
645,651
85,855
840
609
100
9
1
11,901
404
2,650
135
0
5
"2019-03-25T14:29:44"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,304
quarkusio/quarkus/1634/1633
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1633
https://github.com/quarkusio/quarkus/pull/1634
https://github.com/quarkusio/quarkus/pull/1634
1
fixes
Injection of @ConfigProperty double produces java.lang.ClassNotFoundException: double
If I add injection of a double field to the application-configuration quickstart solution GreetingResource: ```java @Path("/greeting") public class GreetingResource { @ConfigProperty(name = "greeting.message") String message; @ConfigProperty(name = "greeting.suffix", defaultValue="!") String suffix; @ConfigProperty(name = "greeting.name") Optional<String> name; @ConfigProperty(name = "greeting.math-pi-double") double decimalPi; ``` and then try to ```bash java.lang.ClassNotFoundException: double at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at io.quarkus.deployment.steps.ConfigBuildStep$validateConfigProperties5.deploy(Unknown Source) at io.quarkus.runner.ApplicationImpl1.doStart(Unknown Source) at io.quarkus.runtime.Application.start(Application.java:93) at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:119) at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:196) at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:80) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.lambda$invokeBeforeAllCallbacks$8(ClassTestDescriptor.java:361) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.invokeBeforeAllCallbacks(ClassTestDescriptor.java:361) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:197) at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.before(ClassTestDescriptor.java:77) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125) at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80) ``` The problem is the generated ConfigBuildStep$validateConfigProperties5 attempting to load a primitive class using Class.forName: ```java // // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) // package io.quarkus.deployment.steps; import io.quarkus.arc.runtime.ConfigDeploymentTemplate; import io.quarkus.runtime.StartupContext; import io.quarkus.runtime.StartupTask; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; // $FF: synthetic class public class ConfigBuildStep$validateConfigProperties5 implements StartupTask { public ConfigBuildStep$validateConfigProperties5() { } public void deploy(StartupContext var1) { ConfigDeploymentTemplate var13 = new ConfigDeploymentTemplate(); HashMap var7 = new HashMap(); HashSet var4 = new HashSet(); ClassLoader var2 = Thread.currentThread().getContextClassLoader(); Class var3 = Class.forName("java.lang.Double", (boolean)1, var2); ((Collection)var4).add(var3); ClassLoader var5 = Thread.currentThread().getContextClassLoader(); Class var6 = Class.forName("java.lang.String", (boolean)1, var5); ((Collection)var4).add(var6); ((Map)var7).put("greeting.math-pi", var4); HashSet var9 = new HashSet(); ClassLoader var8 = Thread.currentThread().getContextClassLoader(); Class var10 = Class.forName("double", (boolean)1, var8); ((Collection)var9).add(var10); ((Map)var7).put("greeting.math-pi-double", var9); HashSet var11 = new HashSet(); ((Collection)var11).add(var6); ((Map)var7).put("greeting.message", var11); HashSet var12 = new HashSet(); ((Collection)var12).add(var6); ((Map)var7).put("greeting.unique", var12); var13.validateConfigProperties((Map)var7); } } ``` We have to catch the use of a primitive type and reference the prmitive.class value directly.
4b43e2172439806216570e5bf3a91f62eba7c1c5
363ce5727aadad3015acbdaf03a1f3cbbec7cf40
https://github.com/quarkusio/quarkus/compare/4b43e2172439806216570e5bf3a91f62eba7c1c5...363ce5727aadad3015acbdaf03a1f3cbbec7cf40
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java b/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java index 93e13c2c565..381fd434841 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java @@ -397,16 +397,23 @@ private ResultHandle loadObjectInstance(MethodCreator method, Object param, Map< out = method.invokeVirtualMethod(ofMethod(StartupContext.class, "getValue", Object.class, String.class), method.getMethodParam(0), method.load(proxyId)); } else if (param instanceof Class<?>) { - String name = classProxies.get(param); - if (name == null) { - name = ((Class) param).getName(); + if (!((Class) param).isPrimitive()) { + // Only try to load the class by name if it is not a primitive class + String name = classProxies.get(param); + if (name == null) { + name = ((Class) param).getName(); + } + ResultHandle currentThread = method.invokeStaticMethod(ofMethod(Thread.class, "currentThread", Thread.class)); + ResultHandle tccl = method.invokeVirtualMethod( + ofMethod(Thread.class, "getContextClassLoader", ClassLoader.class), + currentThread); + out = method.invokeStaticMethod( + ofMethod(Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class), + method.load(name), method.load(true), tccl); + } else { + // Else load the primitive type by reference; double.class => Class var9 = Double.TYPE; + out = method.loadClass((Class) param); } - ResultHandle currentThread = method.invokeStaticMethod(ofMethod(Thread.class, "currentThread", Thread.class)); - ResultHandle tccl = method.invokeVirtualMethod(ofMethod(Thread.class, "getContextClassLoader", ClassLoader.class), - currentThread); - out = method.invokeStaticMethod( - ofMethod(Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class), - method.load(name), method.load(true), tccl); } else if (expectedType == boolean.class) { out = method.load((boolean) param); } else if (expectedType == Boolean.class) { diff --git a/core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java b/core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java index bcfef309fff..4801e56a4ad 100644 --- a/core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java +++ b/core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java @@ -3,6 +3,7 @@ import static io.quarkus.deployment.annotations.ExecutionTime.RUNTIME_INIT; import java.util.Collection; +import java.util.HashSet; import java.util.List; import org.jboss.jandex.AnnotationInstance; @@ -13,9 +14,7 @@ import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem; import io.quarkus.arc.deployment.BeanContainerBuildItem; -import io.quarkus.arc.deployment.BeanContainerListenerBuildItem; import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem; -import io.quarkus.arc.runtime.BeanContainerListener; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.ExecutionTime; @@ -23,7 +22,6 @@ import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.LaunchModeBuildItem; import io.quarkus.deployment.builditem.ServiceStartBuildItem; -import io.quarkus.deployment.recording.RecorderContext; import io.quarkus.extest.runtime.IConfigConsumer; import io.quarkus.extest.runtime.ObjectOfValue; import io.quarkus.extest.runtime.ObjectValueOf; @@ -32,7 +30,6 @@ import io.quarkus.extest.runtime.TestBuildTimeConfig; import io.quarkus.extest.runtime.TestRunTimeConfig; import io.quarkus.extest.runtime.TestTemplate; -import io.quarkus.runtime.RuntimeValue; /** * A test extension deployment processor @@ -199,6 +196,32 @@ void configureBeans(TestTemplate template, List<TestBeanBuildItem> testBeans, Be } } + /** + * Test for https://github.com/quarkusio/quarkus/issues/1633 + * + * @param template - runtime template + */ + @BuildStep + @Record(RUNTIME_INIT) + void referencePrimitiveTypeClasses(TestTemplate template) { + HashSet<Class<?>> allPrimitiveTypes = new HashSet<>(); + allPrimitiveTypes.add(byte.class); + allPrimitiveTypes.add(char.class); + allPrimitiveTypes.add(short.class); + allPrimitiveTypes.add(int.class); + allPrimitiveTypes.add(long.class); + allPrimitiveTypes.add(float.class); + allPrimitiveTypes.add(double.class); + allPrimitiveTypes.add(byte[].class); + allPrimitiveTypes.add(char[].class); + allPrimitiveTypes.add(short[].class); + allPrimitiveTypes.add(int[].class); + allPrimitiveTypes.add(long[].class); + allPrimitiveTypes.add(float[].class); + allPrimitiveTypes.add(double[].class); + template.validateTypes(allPrimitiveTypes); + } + @BuildStep @Record(RUNTIME_INIT) ServiceStartBuildItem boot(LaunchModeBuildItem launchMode) { diff --git a/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestTemplate.java b/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestTemplate.java index 6b2da7a1e2f..feaed1d322b 100644 --- a/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestTemplate.java +++ b/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestTemplate.java @@ -1,5 +1,7 @@ package io.quarkus.extest.runtime; +import java.util.Set; + import org.jboss.logging.Logger; import io.quarkus.arc.runtime.BeanContainer; @@ -15,12 +17,12 @@ public class TestTemplate { /** * Instantiate the given class in the given BeanContainer and passes the TestBuildAndRunTimeConfig and TestRunTimeConfig to * it - * - * @see IConfigConsumer#loadConfig(TestBuildAndRunTimeConfig, TestRunTimeConfig) + * * @param beanContainer - CDI container * @param beanClass - IConfigConsumer * @param buildTimeConfig - the extension TestBuildAndRunTimeConfig * @param runTimeConfig - the extension TestRunTimeConfig + * @see IConfigConsumer#loadConfig(TestBuildAndRunTimeConfig, TestRunTimeConfig) */ public void configureBeans(BeanContainer beanContainer, Class<IConfigConsumer> beanClass, TestBuildAndRunTimeConfig buildTimeConfig, @@ -30,4 +32,15 @@ public void configureBeans(BeanContainer beanContainer, Class<IConfigConsumer> b instance.loadConfig(buildTimeConfig, runTimeConfig); log.infof("configureBeans, instance=%s\\n", instance); } + + /** + * Access the primitive class types at runtime to validate the build step generated deploy method + * + * @param typesSet + */ + public void validateTypes(Set<Class<?>> typesSet) { + for (Class<?> type : typesSet) { + log.infof("Checking type: %s", type.getName()); + } + } }
['core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/TestTemplate.java', 'core/test-extension/deployment/src/main/java/io/quarkus/extest/deployment/TestProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java']
{'.java': 3}
3
3
0
0
3
3,274,594
641,481
85,321
834
1,706
308
25
1
4,818
264
1,035
102
0
3
"2019-03-22T05:18:44"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,305
quarkusio/quarkus/1464/1463
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1463
https://github.com/quarkusio/quarkus/pull/1464
https://github.com/quarkusio/quarkus/pull/1464
1
fixes
Hibernate missing reflection JoinedSubclassEntityPersister definition
The hibernate-orm extension does not define a constructor reflection for the JoinedSubclassEntityPersister class. This is required when using generic tables and class extension of entities.
370174f87d1440698a70198c408d83508a0186cc
20968be1f8b15f6233e192123ae60000a1361e21
https://github.com/quarkusio/quarkus/compare/370174f87d1440698a70198c408d83508a0186cc...20968be1f8b15f6233e192123ae60000a1361e21
diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmReflections.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmReflections.java index 753bebcd5dc..0c1e7ae669c 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmReflections.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmReflections.java @@ -40,6 +40,8 @@ public void registerCoreReflections(BuildProducer<ReflectiveClassBuildItem> refl allConstructors(reflectiveClass, org.hibernate.persister.collection.OneToManyPersister.class); allConstructors(reflectiveClass, org.hibernate.persister.collection.BasicCollectionPersister.class); simpleConstructor(reflectiveClass, org.hibernate.persister.entity.SingleTableEntityPersister.class); + allConstructors(reflectiveClass, org.hibernate.persister.entity.JoinedSubclassEntityPersister.class); + allConstructors(reflectiveClass, org.hibernate.persister.entity.UnionSubclassEntityPersister.class); simpleConstructor(reflectiveClass, org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorBuilderImpl.class); simpleConstructor(reflectiveClass, org.hibernate.id.enhanced.SequenceStyleGenerator.class);
['extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmReflections.java']
{'.java': 1}
1
1
0
0
1
3,156,938
620,256
82,286
808
220
48
2
1
190
25
36
1
0
0
"2019-03-13T13:47: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,306
quarkusio/quarkus/1454/1433
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1433
https://github.com/quarkusio/quarkus/pull/1454
https://github.com/quarkusio/quarkus/pull/1454
1
resolves
Incorrect behaviour for @ApplicationScoped lifecycle events
To `application-lifecycle-events/src/main/java/org/acme/events/AppLifecycleBean.java` add methods ``` public void init (@Observes @Initialized(ApplicationScoped.class) Object init) { LOGGER.info("Init"); } public void shutdown(@Observes @Destroyed(ApplicationScoped.class) Object init) { LOGGER.info("Shutdown"); } ``` The result of quickstart is ``` 2019-03-12 15:31:42,224 INFO [ListenerBean] (main) Shutdown 2019-03-12 15:31:42,224 INFO [ListenerBean] (main) Init 2019-03-12 15:31:42,368 INFO [ListenerBean] (main) Shutdown 2019-03-12 15:31:42,368 INFO [ListenerBean] (main) Init 2019-03-12 15:31:42,369 INFO [ListenerBean] (main) The application is starting...hello ``` Please note that both shutdown and init methods were called multiple times and shutdown was call even before the application was started.
2368a06b1d8e9a3b73f254cc420fa963467f7cc2
a6a606dca3456be7263c15098aada9000e4c7022
https://github.com/quarkusio/quarkus/compare/2368a06b1d8e9a3b73f254cc420fa963467f7cc2...a6a606dca3456be7263c15098aada9000e4c7022
diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcAnnotationProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcAnnotationProcessor.java index b490d49e5d6..e19e0b1d5d7 100644 --- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcAnnotationProcessor.java +++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcAnnotationProcessor.java @@ -27,7 +27,6 @@ import java.util.stream.Collectors; import javax.enterprise.context.Dependent; -import javax.enterprise.event.Observes; import javax.inject.Inject; import org.jboss.jandex.AnnotationTarget; @@ -131,8 +130,6 @@ public BeanContainerBuildItem build(ArcDeploymentTemplate arcTemplate, } additionalBeans.add(LifecycleEventRunner.class.getName()); - reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, Observes.class.getName())); // graal bug - // Index bean classes registered by quarkus Indexer indexer = new Indexer(); Set<DotName> additionalIndex = new HashSet<>(); diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanProcessor.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanProcessor.java index 14d907574ae..297992939c6 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanProcessor.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanProcessor.java @@ -33,6 +33,9 @@ import java.util.function.Predicate; import java.util.stream.Collectors; +import javax.enterprise.context.BeforeDestroyed; +import javax.enterprise.context.Destroyed; +import javax.enterprise.context.Initialized; import javax.enterprise.context.control.ActivateRequestContext; import javax.enterprise.inject.Any; import javax.enterprise.inject.Default; @@ -240,6 +243,9 @@ private static IndexView addBuiltinClasses(IndexView index) { index(indexer, Default.class.getName()); index(indexer, Any.class.getName()); index(indexer, Named.class.getName()); + index(indexer, Initialized.class.getName()); + index(indexer, BeforeDestroyed.class.getName()); + index(indexer, Destroyed.class.getName()); } return CompositeIndex.create(index, indexer.complete()); } diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java index 1a71dc2cf82..b0e4717f403 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java @@ -33,7 +33,9 @@ import java.util.stream.Collectors; import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.BeforeDestroyed; import javax.enterprise.context.Dependent; +import javax.enterprise.context.Destroyed; import javax.enterprise.context.Initialized; import javax.enterprise.inject.AmbiguousResolutionException; import javax.enterprise.inject.Any; @@ -247,8 +249,18 @@ synchronized void shutdown() { ArcCDI arcCdi = (ArcCDI) cdi; arcCdi.destroy(); } + // Fire an event with qualifier @BeforeDestroyed(ApplicationScoped.class) + Set<Annotation> beforeDestroyQualifiers = new HashSet<>(4); + beforeDestroyQualifiers.add(BeforeDestroyed.Literal.APPLICATION); + beforeDestroyQualifiers.add(Any.Literal.INSTANCE); + EventImpl.createNotifier(Object.class, Object.class, beforeDestroyQualifiers, this).notify(toString()); // Destroy contexts applicationContext.destroy(); + // Fire an event with qualifier @Destroyed(ApplicationScoped.class) + Set<Annotation> destroyQualifiers = new HashSet<>(4); + destroyQualifiers.add(Destroyed.Literal.APPLICATION); + destroyQualifiers.add(Any.Literal.INSTANCE); + EventImpl.createNotifier(Object.class, Object.class, destroyQualifiers, this).notify(toString()); singletonContext.destroy(); requestContext.terminate(); // Clear caches diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/contexts/application/ApplicationInitializedTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/contexts/application/ApplicationInitializedTest.java index 3cd9578e4f6..00a8fd80fe9 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/contexts/application/ApplicationInitializedTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/contexts/application/ApplicationInitializedTest.java @@ -16,35 +16,67 @@ package io.quarkus.arc.test.contexts.application; +import static org.junit.Assert.assertTrue; + import java.util.concurrent.atomic.AtomicBoolean; import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.BeforeDestroyed; +import javax.enterprise.context.Dependent; +import javax.enterprise.context.Destroyed; import javax.enterprise.context.Initialized; import javax.enterprise.event.Observes; -import javax.inject.Singleton; -import io.quarkus.arc.test.ArcTestContainer; import org.junit.Assert; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.RuleChain; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; + +import io.quarkus.arc.test.ArcTestContainer; public class ApplicationInitializedTest { @Rule - public ArcTestContainer container = new ArcTestContainer(Observer.class); + public RuleChain chain = RuleChain.outerRule(new TestRule() { + @Override + public Statement apply(final Statement base, Description description) { + return new Statement() { + + @Override + public void evaluate() throws Throwable { + base.evaluate(); + assertTrue(Observer.DESTROYED.get()); + assertTrue(Observer.BEFORE_DESTROYED.get()); + } + }; + } + }).around(new ArcTestContainer(Observer.class)); @Test public void testEventWasFired() { - Assert.assertTrue(Observer.OBSERVED.get()); + Assert.assertTrue(Observer.INITIALIZED.get()); } - @Singleton + @Dependent static class Observer { - static final AtomicBoolean OBSERVED = new AtomicBoolean(false); + static final AtomicBoolean INITIALIZED = new AtomicBoolean(false); + static final AtomicBoolean DESTROYED = new AtomicBoolean(false); + static final AtomicBoolean BEFORE_DESTROYED = new AtomicBoolean(false); void onStart(@Observes @Initialized(ApplicationScoped.class) Object container) { - OBSERVED.set(true); + INITIALIZED.set(true); + } + + void beforeDestroyed(@Observes @BeforeDestroyed(ApplicationScoped.class) Object container) { + BEFORE_DESTROYED.set(true); + } + + void destroyed(@Observes @Destroyed(ApplicationScoped.class) Object container) { + DESTROYED.set(true); } } diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java index 59131555e7a..5d59dad5298 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java @@ -71,6 +71,7 @@ public void testDisposers() { // A new instance is created for produce and dispose assertEquals(2, StringProducer.DESTROYED.get()); // Both producer and produced bean are application scoped + @SuppressWarnings("serial") Comparable<BigDecimal> bigDecimal = Arc.container().instance(new TypeLiteral<Comparable<BigDecimal>>() { }).get(); assertEquals(0, bigDecimal.compareTo(BigDecimal.ONE));
['extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcAnnotationProcessor.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanProcessor.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/contexts/application/ApplicationInitializedTest.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java']
{'.java': 5}
5
5
0
0
5
3,140,999
617,247
82,006
807
1,370
244
21
3
869
87
239
20
0
2
"2019-03-13T08:34: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,307
quarkusio/quarkus/1422/1373
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1373
https://github.com/quarkusio/quarkus/pull/1422
https://github.com/quarkusio/quarkus/pull/1422
1
resolves
Injecting using 'javax.inject.Provider' into JAX-RS Resource fails build
Quarkus Version: 0.11.0 Maven Version: 3.6.0 Java Version: 1.8.0_191 While using `io.quarkus:quarkus-smallrye-jwt` and performing the following: ``` @Path("v1") @Produces(APPLICATION_JSON) @DenyAll public class HelloWorldResource { @Inject private Provider<JsonWebToken> jwtProvider; ``` The build fails with: ``` ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.11.0:build (default) on project quarkus-service-example: 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.arc.deployment.ArcAnnotationProcessor#build threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type javax.inject.Provider<org.eclipse.microprofile.jwt.JsonWebToken> and qualifiers [@Default] [ERROR] - java member: acme.jaxrs.v1.HelloWorldResource#jwtProvider [ERROR] - declared on CLASS bean [types=[acme.jaxrs.v1.HelloWorldResource, java.lang.Object], qualifiers=[@Default, @Any], target=acme.jaxrs.v1.HelloWorldResource] [ERROR] -> [Help 1] ``` **Workaround** Use `javax.enterprise.inject.Instance`. Moved from quarkusio/quarkus-quickstarts#85.
6717e34093794b0fd7fb879b900cae5d20b3303c
5f660bc95169cf698353d395016bdff449bcabc1
https://github.com/quarkusio/quarkus/compare/6717e34093794b0fd7fb879b900cae5d20b3303c...5f660bc95169cf698353d395016bdff449bcabc1
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java index ecba1ecd95d..23f90afdf27 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java @@ -23,6 +23,7 @@ import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; + import io.quarkus.arc.BeanManagerProvider; import io.quarkus.arc.BeanMetadataProvider; import io.quarkus.arc.EventProvider; @@ -30,7 +31,7 @@ import io.quarkus.arc.InjectionPointProvider; import io.quarkus.arc.InstanceProvider; import io.quarkus.arc.ResourceProvider; -import io.quarkus.arc.processor.InjectionPointInfo.InjtetionPointKind; +import io.quarkus.arc.processor.InjectionPointInfo.InjectionPointKind; import io.quarkus.gizmo.ClassCreator; import io.quarkus.gizmo.ClassOutput; import io.quarkus.gizmo.FieldDescriptor; @@ -73,7 +74,8 @@ void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionP constructor.getThis(), instanceProvider); } - }), INJECTION_POINT(DotNames.INJECTION_POINT, new Generator() { + }, ip -> ip.getKind() == InjectionPointKind.CDI && (DotNames.INSTANCE.equals(ip.getRequiredType().name()) || DotNames.PROVIDER.equals(ip.getRequiredType().name()))), + INJECTION_POINT(DotNames.INJECTION_POINT, new Generator() { @Override void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, ClassCreator clazzCreator, MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { @@ -145,7 +147,7 @@ void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionP constructor.writeInstanceField(FieldDescriptor.of(clazzCreator.getClassName(), providerName, InjectableReferenceProvider.class.getName()), constructor.getThis(), resourceProvider); } - }, ip -> ip.getKind() == InjtetionPointKind.RESOURCE); + }, ip -> ip.getKind() == InjectionPointKind.RESOURCE); private final DotName rawTypeDotName; @@ -154,7 +156,7 @@ void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionP private final Predicate<InjectionPointInfo> matcher; BuiltinBean(DotName rawTypeDotName, Generator generator) { - this(rawTypeDotName, generator, ip -> ip.getKind() == InjtetionPointKind.CDI && rawTypeDotName.equals(ip.getRequiredType().name())); + this(rawTypeDotName, generator, ip -> ip.getKind() == InjectionPointKind.CDI && rawTypeDotName.equals(ip.getRequiredType().name())); } BuiltinBean(DotName rawTypeDotName, Generator generator, Predicate<InjectionPointInfo> matcher) { 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 171a9925943..c3d24e2a974 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 @@ -41,6 +41,7 @@ import javax.enterprise.util.Nonbinding; import javax.inject.Inject; import javax.inject.Named; +import javax.inject.Provider; import javax.inject.Qualifier; import javax.interceptor.AroundConstruct; import javax.interceptor.AroundInvoke; @@ -66,6 +67,7 @@ public final class DotNames { public static final DotName POST_CONSTRUCT = create(PostConstruct.class); public static final DotName PRE_DESTROY = create(PreDestroy.class); public static final DotName INSTANCE = create(Instance.class); + public static final DotName PROVIDER = create(Provider.class); public static final DotName INJECTION_POINT = create(InjectionPoint.class); public static final DotName INTERCEPTOR = create(Interceptor.class); public static final DotName INTERCEPTOR_BINDING = create(InterceptorBinding.class); diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java index 06993fc2d0c..c801ae3334a 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java @@ -50,7 +50,7 @@ static InjectionPointInfo fromField(FieldInfo field, BeanDeployment beanDeployme } static InjectionPointInfo fromResourceField(FieldInfo field, BeanDeployment beanDeployment) { - return new InjectionPointInfo(field.type(), new HashSet<>(field.annotations()), InjtetionPointKind.RESOURCE, field, -1); + return new InjectionPointInfo(field.type(), new HashSet<>(field.annotations()), InjectionPointKind.RESOURCE, field, -1); } static List<InjectionPointInfo> fromMethod(MethodInfo method, BeanDeployment beanDeployment) { @@ -94,7 +94,7 @@ static Set<AnnotationInstance> getParameterAnnotations(BeanDeployment beanDeploy private final AtomicReference<BeanInfo> resolvedBean; - private final InjtetionPointKind kind; + private final InjectionPointKind kind; private final boolean hasDefaultedQualifier; @@ -103,10 +103,10 @@ static Set<AnnotationInstance> getParameterAnnotations(BeanDeployment beanDeploy private final int position; InjectionPointInfo(Type requiredType, Set<AnnotationInstance> requiredQualifiers, AnnotationTarget target, int position) { - this(requiredType, requiredQualifiers, InjtetionPointKind.CDI, target, position); + this(requiredType, requiredQualifiers, InjectionPointKind.CDI, target, position); } - InjectionPointInfo(Type requiredType, Set<AnnotationInstance> requiredQualifiers, InjtetionPointKind kind, AnnotationTarget target, int position) { + InjectionPointInfo(Type requiredType, Set<AnnotationInstance> requiredQualifiers, InjectionPointKind kind, AnnotationTarget target, int position) { this.typeAndQualifiers = new TypeAndQualifiers(requiredType, requiredQualifiers.isEmpty() ? Collections.singleton(AnnotationInstance.create(DotNames.DEFAULT, null, Collections.emptyList())) : requiredQualifiers); @@ -125,7 +125,7 @@ BeanInfo getResolvedBean() { return resolvedBean.get(); } - InjtetionPointKind getKind() { + InjectionPointKind getKind() { return kind; } @@ -177,7 +177,7 @@ public String toString() { return "InjectionPointInfo [requiredType=" + typeAndQualifiers.type + ", requiredQualifiers=" + typeAndQualifiers.qualifiers + "]"; } - enum InjtetionPointKind { + enum InjectionPointKind { CDI, RESOURCE } 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 a7fec3496bd..ab2c323299e 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 @@ -29,6 +29,7 @@ import javax.enterprise.inject.Instance; import javax.enterprise.inject.UnsatisfiedResolutionException; import javax.enterprise.util.TypeLiteral; +import javax.inject.Provider; /** * @@ -49,7 +50,7 @@ InstanceImpl(Type type, Set<Annotation> qualifiers, CreationalContextImpl<?> creationalContext) { if (type instanceof ParameterizedType) { ParameterizedType parameterizedType = (ParameterizedType) type; - if (parameterizedType.getRawType().equals(Instance.class)) { + if (Provider.class.isAssignableFrom(Types.getRawType(parameterizedType.getRawType()))) { this.type = parameterizedType.getActualTypeArguments()[0]; } else { this.type = type; diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/unused/RemoveUnusedBeansTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/unused/RemoveUnusedBeansTest.java index d6969adeac5..1799aea460d 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/unused/RemoveUnusedBeansTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/unused/RemoveUnusedBeansTest.java @@ -6,6 +6,7 @@ import java.math.BigDecimal; +import javax.annotation.PostConstruct; import javax.annotation.Priority; import javax.enterprise.context.Dependent; import javax.enterprise.event.Observes; @@ -14,6 +15,7 @@ import javax.enterprise.inject.Produces; import javax.inject.Inject; import javax.inject.Named; +import javax.inject.Provider; import javax.inject.Singleton; import io.quarkus.arc.Arc; @@ -26,7 +28,7 @@ public class RemoveUnusedBeansTest { @Rule public ArcTestContainer container = ArcTestContainer.builder() - .beanClasses(HasObserver.class, Foo.class, FooAlternative.class, HasName.class, UnusedProducers.class, InjectedViaInstance.class, Excluded.class, UsedProducers.class) + .beanClasses(HasObserver.class, Foo.class, FooAlternative.class, HasName.class, UnusedProducers.class, InjectedViaInstance.class, InjectedViaProvider.class, Excluded.class, UsedProducers.class) .removeUnusedBeans(true) .addRemovalExclusion(b -> b.getBeanClass().toString().equals(Excluded.class.getName())) .build(); @@ -37,12 +39,15 @@ public void testRemoval() { assertTrue(container.instance(HasObserver.class).isAvailable()); assertTrue(container.instance(HasName.class).isAvailable()); assertTrue(container.instance(InjectedViaInstance.class).isAvailable()); + assertTrue(container.instance(InjectedViaProvider.class).isAvailable()); assertTrue(container.instance(String.class).isAvailable()); assertTrue(container.instance(UsedProducers.class).isAvailable()); assertFalse(container.instance(UnusedProducers.class).isAvailable()); assertFalse(container.instance(BigDecimal.class).isAvailable()); // Foo is injected in HasObserver#observe() - assertEquals(FooAlternative.class.getName(), container.instance(Foo.class).get().ping()); + Foo foo = container.instance(Foo.class).get(); + assertEquals(FooAlternative.class.getName(), foo.ping()); + assertTrue(foo.provider.get().isValid()); assertEquals(1, container.beanManager().getBeans(Foo.class).size()); assertEquals("pong", container.instance(Excluded.class).get().ping()); } @@ -63,6 +68,9 @@ static class HasName { @Dependent static class Foo { + + @Inject + Provider<InjectedViaProvider> provider; String ping() { return getClass().getName(); @@ -77,7 +85,7 @@ static class FooAlternative extends Foo { @Inject Instance<InjectedViaInstance> instance; - + @Inject String foo; @@ -87,6 +95,22 @@ static class FooAlternative extends Foo { static class InjectedViaInstance { } + + @Singleton + static class InjectedViaProvider { + + private boolean isValid; + + @PostConstruct + void init() { + isValid = true; + } + + boolean isValid() { + return isValid; + } + + } @Singleton static class UnusedProducers {
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/DotNames.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/unused/RemoveUnusedBeansTest.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InjectionPointInfo.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceImpl.java']
{'.java': 5}
5
5
0
0
5
3,082,848
607,730
80,471
789
2,136
482
27
4
1,301
113
348
28
0
2
"2019-03-12T07:48: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
3,308
quarkusio/quarkus/1260/1254
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1254
https://github.com/quarkusio/quarkus/pull/1260
https://github.com/quarkusio/quarkus/pull/1260
1
fixes
REST Client doesn't register Interface return types for reflection
Currently the REST Client extension doesn't register the return types of the methods used in a `@RegisterRESTClient` annotated interface for reflection. This will result in those classes being DCE'd for native image builds
1905551d3242e84908ef74273419b026647cf4f6
9335b905edcd946f088986fc143f0619c55e5906
https://github.com/quarkusio/quarkus/compare/1905551d3242e84908ef74273419b026647cf4f6...9335b905edcd946f088986fc143f0619c55e5906
diff --git a/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java b/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java index d3f97478254..0ce7c5be365 100644 --- a/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java +++ b/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java @@ -18,7 +18,9 @@ import java.lang.reflect.Modifier; import java.util.HashMap; +import java.util.HashSet; import java.util.Map; +import java.util.Set; import javax.ws.rs.client.ClientRequestFilter; import javax.ws.rs.client.ClientResponseFilter; @@ -32,6 +34,8 @@ import org.jboss.jandex.AnnotationTarget; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; +import org.jboss.jandex.MethodInfo; +import org.jboss.jandex.Type; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.internal.proxy.ProxyBuilderImpl; import org.jboss.resteasy.client.jaxrs.internal.proxy.ResteasyClientProxy; @@ -52,6 +56,7 @@ import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.SslNativeConfigBuildItem; import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.substrate.ReflectiveHierarchyBuildItem; import io.quarkus.deployment.builditem.substrate.SubstrateProxyDefinitionBuildItem; import io.quarkus.deployment.builditem.substrate.SubstrateResourceBuildItem; import io.quarkus.deployment.util.ServiceUtil; @@ -127,11 +132,13 @@ void processInterfaces(CombinedIndexBuildItem combinedIndexBuildItem, SslNativeConfigBuildItem sslNativeConfig, BuildProducer<SubstrateProxyDefinitionBuildItem> proxyDefinition, BuildProducer<ReflectiveClassBuildItem> reflectiveClass, + BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, BuildProducer<BeanRegistrarBuildItem> beanRegistrars, BuildProducer<ExtensionSslNativeSupportBuildItem> extensionSslNativeSupport) { // According to the spec only rest client interfaces annotated with RegisterRestClient are registered as beans Map<DotName, ClassInfo> interfaces = new HashMap<>(); + Set<Type> returnTypes = new HashSet<>(); for (AnnotationInstance annotation : combinedIndexBuildItem.getIndex().getAnnotations(REGISTER_REST_CLIENT)) { AnnotationTarget target = annotation.target(); @@ -147,6 +154,16 @@ void processInterfaces(CombinedIndexBuildItem combinedIndexBuildItem, continue; } interfaces.put(theInfo.name(), theInfo); + + // Find Return types + for (MethodInfo method : theInfo.methods()) { + Type type = method.returnType(); + if (!type.name().toString().contains("java.lang")) { + if (!returnTypes.contains(type)) { + returnTypes.add(type); + } + } + } } if (interfaces.isEmpty()) { @@ -160,6 +177,11 @@ void processInterfaces(CombinedIndexBuildItem combinedIndexBuildItem, reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, iName)); } + // Register Interface return types for reflection + for (Type returnType : returnTypes) { + reflectiveHierarchy.produce(new ReflectiveHierarchyBuildItem(returnType)); + } + beanRegistrars.produce(new BeanRegistrarBuildItem(new BeanRegistrar() { @Override diff --git a/integration-tests/main/src/main/java/io/quarkus/example/rest/ClientResource.java b/integration-tests/main/src/main/java/io/quarkus/example/rest/ClientResource.java index 9860261e6a5..a45baa50a43 100644 --- a/integration-tests/main/src/main/java/io/quarkus/example/rest/ClientResource.java +++ b/integration-tests/main/src/main/java/io/quarkus/example/rest/ClientResource.java @@ -17,10 +17,12 @@ package io.quarkus.example.rest; import java.net.URL; +import java.util.List; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.Produces; import org.eclipse.microprofile.rest.client.RestClientBuilder; import org.eclipse.microprofile.rest.client.inject.RestClient; @@ -47,4 +49,40 @@ public String cdi() throws Exception { return restInterface.get(); } + @GET + @Path("manual/jackson") + @Produces("application/json") + public TestResource.MyData getDataManual() throws Exception { + RestInterface iface = RestClientBuilder.newBuilder() + .baseUrl(new URL(System.getProperty("test.url"))) + .build(RestInterface.class); + System.out.println(iface.getData()); + return iface.getData(); + } + + @GET + @Path("cdi/jackson") + @Produces("application/json") + public TestResource.MyData getDataCdi() { + return restInterface.getData(); + } + + @GET + @Path("/manual/complex") + @Produces("application/json") + public List<ComponentType> complexManual() throws Exception { + RestInterface iface = RestClientBuilder.newBuilder() + .baseUrl(new URL(System.getProperty("test.url"))) + .build(RestInterface.class); + System.out.println(iface.complex()); + return iface.complex(); + } + + @GET + @Path("/cdi/complex") + @Produces("application/json") + public List<ComponentType> complexCdi() { + return restInterface.complex(); + } + } diff --git a/integration-tests/main/src/main/java/io/quarkus/example/rest/RestInterface.java b/integration-tests/main/src/main/java/io/quarkus/example/rest/RestInterface.java index 5e9c3edfd3a..25a3fae1d89 100644 --- a/integration-tests/main/src/main/java/io/quarkus/example/rest/RestInterface.java +++ b/integration-tests/main/src/main/java/io/quarkus/example/rest/RestInterface.java @@ -16,8 +16,11 @@ package io.quarkus.example.rest; +import java.util.List; + import javax.ws.rs.GET; import javax.ws.rs.Path; +import javax.ws.rs.Produces; import org.eclipse.microprofile.rest.client.inject.RegisterRestClient; @@ -27,4 +30,14 @@ public interface RestInterface { @GET String get(); + + @GET + @Path("/jackson") + @Produces("application/json") + TestResource.MyData getData(); + + @GET + @Path("/complex") + @Produces("application/json") + List<ComponentType> complex(); } diff --git a/integration-tests/main/src/test/java/io/quarkus/example/test/RestClientTestCase.java b/integration-tests/main/src/test/java/io/quarkus/example/test/RestClientTestCase.java index 457cacdfd17..430938d1f8e 100644 --- a/integration-tests/main/src/test/java/io/quarkus/example/test/RestClientTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/example/test/RestClientTestCase.java @@ -19,11 +19,17 @@ import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; +import java.util.List; +import java.util.Map; + +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import io.quarkus.example.rest.ComponentType; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; +import io.restassured.path.json.JsonPath; @QuarkusTest public class RestClientTestCase { @@ -40,6 +46,38 @@ public void testMicroprofileClientCDIIntegration() { .body(is("TEST")); } + @Test + void testMicroprofileClientData() { + JsonPath jsonPath = RestAssured.when().get("/client/manual/jackson").thenReturn().jsonPath(); + Assertions.assertEquals(jsonPath.getString("name"), "Stuart"); + Assertions.assertEquals(jsonPath.getString("value"), "A Value"); + } + + @Test + void testMicroprofileClientDataCdi() { + JsonPath jsonPath = RestAssured.when().get("/client/cdi/jackson").thenReturn().jsonPath(); + Assertions.assertEquals(jsonPath.getString("name"), "Stuart"); + Assertions.assertEquals(jsonPath.getString("value"), "A Value"); + } + + @Test + void testMicroprofileClientComplex() { + JsonPath jsonPath = RestAssured.when().get("/client/manual/complex").thenReturn().jsonPath(); + List<Map<String, String>> components = jsonPath.getList("$"); + Assertions.assertEquals(components.size(), 1); + Map<String, String> map = components.get(0); + Assertions.assertEquals(map.get("value"), "component value"); + } + + @Test + void testMicroprofileClientComplexCdi() { + JsonPath jsonPath = RestAssured.when().get("/client/cdi/complex").thenReturn().jsonPath(); + List<Map<String, String>> components = jsonPath.getList("$"); + Assertions.assertEquals(components.size(), 1); + Map<String, String> map = components.get(0); + Assertions.assertEquals(map.get("value"), "component value"); + } + /** * Disabled by default as it establishes external connections. * <p>
['extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java', 'integration-tests/main/src/main/java/io/quarkus/example/rest/RestInterface.java', 'integration-tests/main/src/main/java/io/quarkus/example/rest/ClientResource.java', 'integration-tests/main/src/test/java/io/quarkus/example/test/RestClientTestCase.java']
{'.java': 4}
4
4
0
0
4
3,080,220
607,330
80,505
787
908
162
22
1
225
33
42
3
0
0
"2019-03-06T10:13:10"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,311
quarkusio/quarkus/1097/721
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/721
https://github.com/quarkusio/quarkus/pull/1097
https://github.com/quarkusio/quarkus/pull/1097
1
fixes
@ApplicationScoped does not work in combination with @ServerEndpoint (quick start using-websockets)
I've tried the quick start "using-websockets" and it looks like a new instance of ChatSocket class is created for every new session even though it has the @ApplicationScoped annotation. The problem is combination of the @ServerEndpoint and @ApplicationScoped annotations. When they are combined a new instance is created because of the @ServerEndpoint even though there is the @ApplicationScoped annotation.
4de61ec0481394d77b470801ab02f0c97cea4596
56cf358f3b4f6f83cd32095fa878a6232aedeee9
https://github.com/quarkusio/quarkus/compare/4de61ec0481394d77b470801ab02f0c97cea4596...56cf358f3b4f6f83cd32095fa878a6232aedeee9
diff --git a/extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/UndertowWebsocketProcessor.java b/extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/UndertowWebsocketProcessor.java index d10d1e7ef95..31c37879fbe 100644 --- a/extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/UndertowWebsocketProcessor.java +++ b/extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/UndertowWebsocketProcessor.java @@ -31,6 +31,7 @@ import org.jboss.jandex.DotName; import org.jboss.jandex.IndexView; +import io.quarkus.arc.deployment.BeanDefiningAnnotationBuildItem; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.annotations.ExecutionTime; @@ -120,4 +121,11 @@ ServiceStartBuildItem setupWorker(UndertowWebsocketTemplate template, UndertowBu template.setupWorker(undertow.getUndertow()); return new ServiceStartBuildItem("Websockets"); } + + @BuildStep + void beanDefiningAnnotations(BuildProducer<BeanDefiningAnnotationBuildItem> annotations) { + annotations.produce(new BeanDefiningAnnotationBuildItem(SERVER_ENDPOINT)); + annotations.produce(new BeanDefiningAnnotationBuildItem(ENDPOINT)); + annotations.produce(new BeanDefiningAnnotationBuildItem(CLIENT_ENDPOINT)); + } }
['extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/UndertowWebsocketProcessor.java']
{'.java': 1}
1
1
0
0
1
3,675,085
728,799
97,535
862
432
85
8
1
413
59
79
4
0
0
"2019-02-28T11:27: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,277
quarkusio/quarkus/2684/2647
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2647
https://github.com/quarkusio/quarkus/pull/2684
https://github.com/quarkusio/quarkus/pull/2684
1
fixes
SmallRye REST client - warnings about duplicate provider registration
When I add the `quarkus-smallrye-rest-client` extension to my app I get a bunch of warnings: ``` 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.IIOImageProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.sse.SseEventOutputProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.sse.SseEventProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DefaultTextPlain is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.client.jaxrs.internal.CompletionStageRxInvokerProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.ReactiveStreamProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.interceptors.CacheControlFeature is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.interceptors.ServerContentEncodingAnnotationFeature is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.FormUrlEncodedProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.CompletionStageProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.interceptors.ClientContentEncodingAnnotationFeature is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DefaultNumberWriter is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.SourceProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.FileProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.context.ContextFeature is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.interceptors.MessageSanitizerContainerResponseFilter is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.MultiValuedParamConverterProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DocumentProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DefaultBooleanWriter is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.ByteArrayProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.StringTextStar is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.StreamingOutputProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.ReaderProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.sse.SseEventSinkInterceptor is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.DataSourceProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,738 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.JaxrsFormProvider is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,739 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.FileRangeWriter is already registered. 2nd registration is being ignored. 2019-05-30 09:02:41,739 WARN [org.jbo.res.res.i18n] (main) RESTEASY002155: Provider class org.jboss.resteasy.plugins.providers.InputStreamProvider is already registered. 2nd registration is being ignored. ```
bd1326f2d931c94a0559de8bb21b0d062b8daa69
f7cd967d257014b7c64fa80edfe01567809dbdaf
https://github.com/quarkusio/quarkus/compare/bd1326f2d931c94a0559de8bb21b0d062b8daa69...f7cd967d257014b7c64fa80edfe01567809dbdaf
diff --git a/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java b/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java index 7eee1cf12d9..f88f7454cbf 100644 --- a/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java +++ b/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java @@ -235,7 +235,7 @@ void registerProviders(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, CombinedIndexBuildItem combinedIndexBuildItem, SmallRyeRestClientTemplate smallRyeRestClientTemplate) { smallRyeRestClientTemplate.initializeResteasyProviderFactory(jaxrsProvidersToRegisterBuildItem.useBuiltIn(), - jaxrsProvidersToRegisterBuildItem.getProviders()); + jaxrsProvidersToRegisterBuildItem.getProviders(), jaxrsProvidersToRegisterBuildItem.getContributedProviders()); // register the providers for reflection for (String providerToRegister : jaxrsProvidersToRegisterBuildItem.getProviders()) { diff --git a/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java b/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java index 0597b2fe58a..422d03fab6d 100644 --- a/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java +++ b/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java @@ -39,7 +39,8 @@ public void setSslEnabled(boolean sslEnabled) { RestClientBuilderImpl.SSL_ENABLED = sslEnabled; } - public void initializeResteasyProviderFactory(boolean useBuiltIn, Set<String> providersToRegister) { + public void initializeResteasyProviderFactory(boolean useBuiltIn, Set<String> providersToRegister, + Set<String> contributedProviders) { ResteasyProviderFactory clientProviderFactory = new ResteasyProviderFactoryImpl(null, true) { @Override public RuntimeType getRuntimeType() { @@ -55,8 +56,15 @@ protected void initializeUtils() { if (useBuiltIn) { RegisterBuiltin.register(clientProviderFactory); + registerProviders(clientProviderFactory, contributedProviders); + } else { + registerProviders(clientProviderFactory, providersToRegister); } + RestClientBuilderImpl.PROVIDER_FACTORY = clientProviderFactory; + } + + private static void registerProviders(ResteasyProviderFactory clientProviderFactory, Set<String> providersToRegister) { for (String providerToRegister : providersToRegister) { try { clientProviderFactory @@ -65,7 +73,5 @@ protected void initializeUtils() { throw new RuntimeException("Unable to find class for provider " + providerToRegister, e); } } - - RestClientBuilderImpl.PROVIDER_FACTORY = clientProviderFactory; } }
['extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java', 'extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java']
{'.java': 2}
2
2
0
0
2
3,996,759
779,659
103,801
1,007
907
162
14
2
6,003
493
1,737
31
0
1
"2019-05-31T15:40:15"
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,312
quarkusio/quarkus/1019/1015
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1015
https://github.com/quarkusio/quarkus/pull/1019
https://github.com/quarkusio/quarkus/pull/1019
1
resolves
Arc container is killed before @Disposes methods are called
Having a class like: ```java @ApplicationScoped public class ResourcesProducer { @Produces ExecutorService managedExecutorService = Executors.newCachedThreadPool(); void destroy(@Disposes ExecutorService ex) { ex.shutdown(); } } ``` I see the following error when stopping (Ctrl+C) the application: ```java java.lang.IllegalStateException: Container not running: ArcContainerImpl [id=f4baf461-5484-4c71-9b3f-e0da6b4f0a72, running=false, beans=83, observers=2, contexts=3] at org.jboss.protean.arc.ArcContainerImpl.requireRunning(ArcContainerImpl.java:506) at org.jboss.protean.arc.ArcContainerImpl.getContext(ArcContainerImpl.java:124) at io.fabric8.launcher.web.producers.ResourcesProducer_ClientProxy.delegate(Unknown Source) at io.fabric8.launcher.web.producers.ResourcesProducer_ClientProxy.getContextualInstance(Unknown Source) at io.fabric8.launcher.web.producers.ResourcesProducer_ProducerField_managedExecutorService_Bean.destroy(Unknown Source) at io.fabric8.launcher.web.producers.ResourcesProducer_ProducerField_managedExecutorService_Bean.destroy(Unknown Source) at org.jboss.protean.arc.InstanceHandleImpl.destroyInternal(InstanceHandleImpl.java:89) at org.jboss.protean.arc.InstanceHandleImpl.destroy(InstanceHandleImpl.java:78) at org.jboss.protean.arc.CreationalContextImpl.release(CreationalContextImpl.java:77) at org.jboss.protean.arc.InjectableBean.destroy(InjectableBean.java:72) at org.jboss.protean.arc.InstanceHandleImpl.destroyInternal(InstanceHandleImpl.java:89) at org.jboss.protean.arc.ComputingCache.forEachExistingValue(ComputingCache.java:82) at org.jboss.protean.arc.AbstractSharedContext.destroy(AbstractSharedContext.java:70) at org.jboss.protean.arc.ArcContainerImpl.shutdown(ArcContainerImpl.java:245) at org.jboss.protean.arc.Arc.shutdown(Arc.java:53) at org.jboss.shamrock.arc.runtime.ArcDeploymentTemplate$1.run(ArcDeploymentTemplate.java:46) at org.jboss.shamrock.runtime.StartupContext.close(StartupContext.java:55) at org.jboss.shamrock.runner.ApplicationImpl1.doStop(Unknown Source) at org.jboss.shamrock.runtime.Application.stop(Application.java:152) at org.jboss.shamrock.runtime.Application.run(Application.java:197) at org.jboss.shamrock.runner.GeneratedMain.main(Unknown Source) ```
dd0d3aa84727019506e6c22d8a0241679eceb31f
2ff724e3e3872c6914c6f50a096ff5ba0824922e
https://github.com/quarkusio/quarkus/compare/dd0d3aa84727019506e6c22d8a0241679eceb31f...2ff724e3e3872c6914c6f50a096ff5ba0824922e
diff --git a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ClientProxyGenerator.java b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ClientProxyGenerator.java index 5e2c2e5b1e1..77af0966822 100644 --- a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ClientProxyGenerator.java +++ b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ClientProxyGenerator.java @@ -204,7 +204,8 @@ Collection<MethodInfo> getDelegatingMethods(BeanInfo bean) { MethodInfo producerMethod = bean.getTarget().get().asMethod(); Map<TypeVariable, Type> resolved = Collections.emptyMap(); ClassInfo returnTypeClass = bean.getDeployment().getIndex().getClassByName(producerMethod.returnType().name()); - if (!returnTypeClass.typeParameters().isEmpty()) { + if (!returnTypeClass.typeParameters().isEmpty() && !Modifier.isInterface(returnTypeClass.flags())) { + // Build the resolved map iff the return type is a parameterized class resolved = Types.buildResolvedMap(producerMethod.returnType().asParameterizedType().arguments(), returnTypeClass.typeParameters(), Collections.emptyMap()); } diff --git a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java index 7f75f453353..1de6cff86f3 100644 --- a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java +++ b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java @@ -18,7 +18,9 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.Iterator; import java.util.List; +import java.util.Set; import javax.enterprise.context.spi.Contextual; import javax.enterprise.context.spi.CreationalContext; @@ -67,7 +69,18 @@ public void destroy(Contextual<?> contextual) { @Override public synchronized void destroy() { - instances.forEachExistingValue(InstanceHandleImpl::destroyInternal); + Set<InstanceHandleImpl<?>> values = instances.getPresentValues(); + // Destroy the producers first + for (Iterator<InstanceHandleImpl<?>> iterator = values.iterator(); iterator.hasNext();) { + InstanceHandleImpl<?> instanceHandle = iterator.next(); + if (instanceHandle.getBean().getDeclaringBean() != null) { + instanceHandle.destroyInternal(); + iterator.remove(); + } + } + for (InstanceHandleImpl<?> instanceHandle : values) { + instanceHandle.destroyInternal(); + } instances.clear(); } diff --git a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ArcContainerImpl.java b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ArcContainerImpl.java index 74a2e56acc6..bccdc0085e4 100644 --- a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ArcContainerImpl.java +++ b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ArcContainerImpl.java @@ -231,28 +231,25 @@ public String toString() { + contexts.size() + "]"; } - void shutdown() { - if (running.compareAndSet(true, false)) { - synchronized (this) { - // Make sure all dependent bean instances obtained via CDI.current() are destroyed correctly - CDI<?> cdi = CDI.current(); - if (cdi instanceof ArcCDI) { - ArcCDI arcCdi = (ArcCDI) cdi; - arcCdi.destroy(); - } - // Destroy contexts - contexts.get(ApplicationScoped.class) - .destroy(); - contexts.get(Singleton.class) - .destroy(); - ((RequestContext) contexts.get(RequestScoped.class)).terminate(); - // Clear caches - contexts.clear(); - beans.clear(); - resolved.clear(); - observers.clear(); - LOGGER.debugf("ArC DI container shut down"); + synchronized void shutdown() { + if (running.get()) { + // Make sure all dependent bean instances obtained via CDI.current() are destroyed correctly + CDI<?> cdi = CDI.current(); + if (cdi instanceof ArcCDI) { + ArcCDI arcCdi = (ArcCDI) cdi; + arcCdi.destroy(); } + // Destroy contexts + contexts.get(ApplicationScoped.class).destroy(); + contexts.get(Singleton.class).destroy(); + ((RequestContext) contexts.get(RequestScoped.class)).terminate(); + // Clear caches + contexts.clear(); + beans.clear(); + resolved.clear(); + observers.clear(); + running.set(false); + LOGGER.debugf("ArC DI container shut down"); } } diff --git a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java index 6fdedbd3a90..b50f3171fc9 100644 --- a/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java +++ b/independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java @@ -18,11 +18,13 @@ import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.function.Function; +import java.util.stream.Collectors; /** * Computing cache backed by a {@link ConcurrentHashMap} which intentionally does not use {@link Map#computeIfAbsent(Object, Function)} and is reentrant. @@ -83,6 +85,10 @@ public void forEachExistingValue(Consumer<? super V> action) { } } } + + public Set<V> getPresentValues() { + return map.values().stream().map(LazyValue::get).collect(Collectors.toSet()); + } public void forEachEntry(BiConsumer<? super K, ? super V> action) { Objects.requireNonNull(action); diff --git a/independent-projects/arc/tests/src/test/java/org/jboss/protean/arc/test/producer/disposer/DisposerTest.java b/independent-projects/arc/tests/src/test/java/org/jboss/protean/arc/test/producer/disposer/DisposerTest.java index ecce9dd12e2..4ee1ac4d680 100644 --- a/independent-projects/arc/tests/src/test/java/org/jboss/protean/arc/test/producer/disposer/DisposerTest.java +++ b/independent-projects/arc/tests/src/test/java/org/jboss/protean/arc/test/producer/disposer/DisposerTest.java @@ -19,13 +19,16 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import java.math.BigDecimal; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import javax.annotation.PreDestroy; +import javax.enterprise.context.ApplicationScoped; import javax.enterprise.context.Dependent; import javax.enterprise.inject.Disposes; import javax.enterprise.inject.Produces; +import javax.enterprise.util.TypeLiteral; import javax.inject.Singleton; import org.jboss.protean.arc.Arc; @@ -34,11 +37,28 @@ import org.jboss.protean.arc.test.MyQualifier; import org.junit.Rule; import org.junit.Test; +import org.junit.rules.RuleChain; +import org.junit.rules.TestRule; +import org.junit.runner.Description; +import org.junit.runners.model.Statement; public class DisposerTest { @Rule - public ArcTestContainer container = new ArcTestContainer(StringProducer.class, LongProducer.class); + public RuleChain chain = RuleChain.outerRule(new TestRule() { + @Override + public Statement apply(final Statement base, Description description) { + return new Statement() { + + @Override + public void evaluate() throws Throwable { + base.evaluate(); + assertNotNull(BigDecimalProducer.DISPOSED.get()); + assertEquals(1, BigDecimalProducer.DESTROYED.get()); + } + }; + } + }).around(new ArcTestContainer(StringProducer.class, LongProducer.class, BigDecimalProducer.class)); @Test public void testDisposers() { @@ -50,6 +70,10 @@ public void testDisposers() { assertNotNull(StringProducer.DISPOSED.get()); // A new instance is created for produce and dispose assertEquals(2, StringProducer.DESTROYED.get()); + // Both producer and produced bean are application scoped + Comparable<BigDecimal> bigDecimal = Arc.container().instance(new TypeLiteral<Comparable<BigDecimal>>() { + }).get(); + assertEquals(0, bigDecimal.compareTo(BigDecimal.ONE)); } @Singleton @@ -92,4 +116,28 @@ void destroy() { } + @ApplicationScoped + static class BigDecimalProducer { + + static final AtomicInteger DESTROYED = new AtomicInteger(); + + static final AtomicReference<Object> DISPOSED = new AtomicReference<>(); + + @ApplicationScoped + @Produces + Comparable<BigDecimal> produce() { + return BigDecimal.ONE; + } + + void dipose(@Disposes Comparable<BigDecimal> value) { + DISPOSED.set(value); + } + + @PreDestroy + void destroy() { + DESTROYED.incrementAndGet(); + } + + } + }
['independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ArcContainerImpl.java', 'independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/ComputingCache.java', 'independent-projects/arc/runtime/src/main/java/org/jboss/protean/arc/AbstractSharedContext.java', 'independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ClientProxyGenerator.java', 'independent-projects/arc/tests/src/test/java/org/jboss/protean/arc/test/producer/disposer/DisposerTest.java']
{'.java': 5}
5
5
0
0
5
3,459,747
686,855
91,052
818
2,935
526
63
4
2,387
94
551
43
0
2
"2019-02-22T16:20:26"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,313
quarkusio/quarkus/946/936
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/936
https://github.com/quarkusio/quarkus/pull/946
https://github.com/quarkusio/quarkus/pull/946
1
fixes
ClassNotFoundException with Arc and generated application class
When working on the Agroal config patch, if I change the generated `DataSourceProducer` class to be a generated **application** class, I get the following error. Stuart is on it. ``` Caused by: java.lang.RuntimeException: Failed to start shamrock at org.jboss.shamrock.runner.ApplicationImpl1.<clinit>(Unknown Source) ... 34 more Caused by: java.lang.NoClassDefFoundError: org/jboss/shamrock/agroal/runtime/DataSourceProducer at org.jboss.shamrock.agroal.runtime.DataSourceProducer_Bean.<init>(Unknown Source) at org.jboss.protean.arc.setup.Default_ComponentsProvider.getComponents(Unknown Source) at org.jboss.protean.arc.ArcContainerImpl.<init>(ArcContainerImpl.java:86) at org.jboss.protean.arc.Arc.initialize(Arc.java:34) at org.jboss.shamrock.arc.runtime.ArcDeploymentTemplate.getContainer(ArcDeploymentTemplate.java:41) at org.jboss.shamrock.deployment.steps.ArcAnnotationProcessor$build6.deploy(Unknown Source) ... 35 more Caused by: java.lang.ClassNotFoundException: org.jboss.shamrock.agroal.runtime.DataSourceProducer at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ```
1e0cfae2a6115f6372ca291e96e53d3c55792a3f
d7821da4268eedaba436795b82cdb2cade6dfe97
https://github.com/quarkusio/quarkus/compare/1e0cfae2a6115f6372ca291e96e53d3c55792a3f...d7821da4268eedaba436795b82cdb2cade6dfe97
diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java index c95722decbb..394eb6e9300 100644 --- a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java @@ -138,7 +138,7 @@ public BeanContainerBuildItem build(ArcDeploymentTemplate arcTemplate, List<Bean for (GeneratedBeanBuildItem beanClass : generatedBeans) { IndexingUtil.indexClass(beanClass.getName(), indexer, beanArchiveIndex.getIndex(), additionalIndex, ArcAnnotationProcessor.class.getClassLoader(), beanClass.getData()); - generatedClassNames.add(DotName.createSimple(beanClass.getName())); + generatedClassNames.add(DotName.createSimple(beanClass.getName().replace('/', '.'))); } CompositeIndex index = CompositeIndex.create(indexer.complete(), beanArchiveIndex.getIndex());
['extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java']
{'.java': 1}
1
1
0
0
1
3,442,286
683,503
90,572
811
179
32
2
1
1,344
78
318
20
0
1
"2019-02-18T22:02: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,314
quarkusio/quarkus/941/940
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/940
https://github.com/quarkusio/quarkus/pull/941
https://github.com/quarkusio/quarkus/pull/941
1
resolves
A CDI Vertx message consumer forces eager init of Vertx and native image generation fails
`org.jboss.shamrock.vertx.VertxProcessor.build()` should be probably annotated with `@Record(ExecutionTime.RUNTIME_INIT)`.
83b751c83d726e3b90f2a4c4e4d46f69302f8e50
b5c43492725d9d7f5799280ceef9db9b0edb74da
https://github.com/quarkusio/quarkus/compare/83b751c83d726e3b90f2a4c4e4d46f69302f8e50...b5c43492725d9d7f5799280ceef9db9b0edb74da
diff --git a/extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java b/extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java index 5b6963a69be..79befd883e0 100644 --- a/extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java +++ b/extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java @@ -115,7 +115,7 @@ AdditionalBeanBuildItem registerBean() { } @BuildStep - @Record(ExecutionTime.STATIC_INIT) + @Record(ExecutionTime.RUNTIME_INIT) void build(VertxTemplate template, BeanContainerBuildItem beanContainer, BuildProducer<FeatureBuildItem> feature, List<EventConsumerBusinessMethodItem> messageConsumerBusinessMethods, BuildProducer<GeneratedClassBuildItem> generatedClass) { feature.produce(new FeatureBuildItem(FeatureBuildItem.VERTX));
['extensions/vertx/deployment/src/main/java/org/jboss/shamrock/vertx/VertxProcessor.java']
{'.java': 1}
1
1
0
0
1
3,438,884
682,818
90,508
811
80
20
2
1
122
7
28
1
0
0
"2019-02-18T13:43: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,315
quarkusio/quarkus/862/855
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/855
https://github.com/quarkusio/quarkus/pull/862
https://github.com/quarkusio/quarkus/pull/862
1
resolves
ArC - stack log messages about usage of private members
Currently, we log an `INFO` message for every private injection field/`@PreDestroy` callback/disposer/producer/etc. we find in the app code. This could be very annoying when porting an existing app. Therefore, we should only log one `INFO` message for the first occurence + `and N more found. Please enable debug logging to see more`.
b0a4760bf701eee4cbeee2f850a295c2995dfe49
4b90dac263a6e6886469f9e83f14d9c283d2505b
https://github.com/quarkusio/quarkus/compare/b0a4760bf701eee4cbeee2f850a295c2995dfe49...4b90dac263a6e6886469f9e83f14d9c283d2505b
diff --git a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java index 8d31098da48..c246d651890 100644 --- a/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java +++ b/extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java @@ -18,9 +18,7 @@ import static org.jboss.shamrock.deployment.annotations.ExecutionTime.STATIC_INIT; -import java.io.ByteArrayInputStream; import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -33,11 +31,9 @@ import javax.inject.Inject; import org.jboss.jandex.AnnotationTarget; -import org.jboss.jandex.ClassInfo; import org.jboss.jandex.CompositeIndex; import org.jboss.jandex.DotName; import org.jboss.jandex.FieldInfo; -import org.jboss.jandex.IndexView; import org.jboss.jandex.Indexer; import org.jboss.jandex.MethodInfo; import org.jboss.logging.Logger; @@ -47,7 +43,6 @@ import org.jboss.protean.arc.processor.BeanDeployment; import org.jboss.protean.arc.processor.BeanProcessor; import org.jboss.protean.arc.processor.BeanProcessor.Builder; -import org.jboss.protean.arc.processor.DotNames; import org.jboss.protean.arc.processor.ReflectionRegistration; import org.jboss.protean.arc.processor.ResourceOutput; import org.jboss.shamrock.deployment.annotations.BuildProducer; diff --git a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanGenerator.java b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanGenerator.java index 70589b640d5..e9162056a00 100644 --- a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanGenerator.java +++ b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanGenerator.java @@ -48,8 +48,6 @@ import org.jboss.jandex.FieldInfo; import org.jboss.jandex.MethodInfo; import org.jboss.jandex.Type; -import org.jboss.logging.Logger; -import org.jboss.logging.Logger.Level; import org.jboss.protean.arc.CreationalContextImpl; import org.jboss.protean.arc.CurrentInjectionPointProvider; import org.jboss.protean.arc.InitializedInterceptor; @@ -59,6 +57,7 @@ import org.jboss.protean.arc.LazyValue; import org.jboss.protean.arc.Subclass; import org.jboss.protean.arc.processor.BeanInfo.InterceptionInfo; +import org.jboss.protean.arc.processor.BeanProcessor.PrivateMembersCollector; import org.jboss.protean.arc.processor.ResourceOutput.Resource; import org.jboss.protean.arc.processor.ResourceOutput.Resource.SpecialType; import org.jboss.protean.gizmo.AssignableResultHandle; @@ -89,22 +88,23 @@ public class BeanGenerator extends AbstractGenerator { static final String SYNTHETIC_SUFFIX = "_Synthetic"; - private static final Logger LOGGER = Logger.getLogger(BeanGenerator.class); - protected static final String FIELD_NAME_DECLARING_PROVIDER = "declaringProvider"; protected static final String FIELD_NAME_BEAN_TYPES = "types"; protected static final String FIELD_NAME_QUALIFIERS = "qualifiers"; protected static final String FIELD_NAME_STEREOTYPES = "stereotypes"; protected static final String FIELD_NAME_PROXY = "proxy"; protected static final String FIELD_NAME_PARAMS = "params"; - + protected final AnnotationLiteralProcessor annotationLiterals; protected final Predicate<DotName> applicationClassPredicate; - public BeanGenerator(AnnotationLiteralProcessor annotationLiterals, Predicate<DotName> applicationClassPredicate) { + protected final PrivateMembersCollector privateMembers; + + public BeanGenerator(AnnotationLiteralProcessor annotationLiterals, Predicate<DotName> applicationClassPredicate, PrivateMembersCollector privateMembers) { this.annotationLiterals = annotationLiterals; this.applicationClassPredicate = applicationClassPredicate; + this.privateMembers = privateMembers; } /** @@ -644,7 +644,7 @@ protected void implementDestroy(BeanInfo bean, ClassCreator beanCreator, String bean.getDeployment().getIndex()); for (MethodInfo callback : preDestroyCallbacks) { if (Modifier.isPrivate(callback.flags())) { - LOGGER.logf(isApplicationClass ? Level.INFO : Level.DEBUG, "PreDestroy callback %s#%s is private - users are encouraged to avoid using private callbacks", callback.declaringClass().name(), callback.name()); + privateMembers.add(isApplicationClass, String.format("@PreDestroy callback %s#%s()", callback.declaringClass().name(), callback.name())); reflectionRegistration.registerMethod(callback); destroy.invokeStaticMethod(MethodDescriptors.REFLECTIONS_INVOKE_METHOD, destroy.loadClass(callback.declaringClass().name().toString()), destroy.load(callback.name()), destroy.newArray(Class.class, destroy.load(0)), destroy.getMethodParam(0), @@ -693,9 +693,8 @@ protected void implementDestroy(BeanInfo bean, ClassCreator beanCreator, String } if (Modifier.isPrivate(disposerMethod.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "Disposer %s#%s is private - users are encouraged to avoid using private disposers", disposerMethod.declaringClass().name(), - disposerMethod.name()); + privateMembers.add(isApplicationClass, String.format("Disposer %s#%s", disposerMethod.declaringClass().name(), + disposerMethod.name())); ResultHandle paramTypesArray = destroy.newArray(Class.class, destroy.load(referenceHandles.length)); ResultHandle argsArray = destroy.newArray(Object.class, destroy.load(referenceHandles.length)); for (int i = 0; i < referenceHandles.length; i++) { @@ -881,9 +880,8 @@ protected void implementCreate(ClassOutput classOutput, ClassCreator beanCreator FieldInfo injectedField = fieldInjection.target.asField(); if (isReflectionFallbackNeeded(injectedField, targetPackage)) { if (Modifier.isPrivate(injectedField.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "@Inject %s#%s is private - users are encouraged to avoid using private injection fields", - fieldInjection.target.asField().declaringClass().name(), fieldInjection.target.asField().name()); + privateMembers.add(isApplicationClass, String.format("@Inject field %s#%s", fieldInjection.target.asField().declaringClass().name(), + fieldInjection.target.asField().name())); } reflectionRegistration.registerField(injectedField); create.invokeStaticMethod(MethodDescriptors.REFLECTIONS_WRITE_FIELD, create.loadClass(injectedField.declaringClass().name().toString()), @@ -908,9 +906,8 @@ protected void implementCreate(ClassOutput classOutput, ClassCreator beanCreator MethodInfo initializerMethod = methodInjection.target.asMethod(); if (isReflectionFallbackNeeded(initializerMethod, targetPackage)) { if (Modifier.isPrivate(initializerMethod.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "@Inject %s#%s() is private - users are encouraged to avoid using private injection initializers", - initializerMethod.declaringClass().name(), initializerMethod.name()); + privateMembers.add(isApplicationClass, + String.format("@Inject initializer %s#%s()", initializerMethod.declaringClass().name(), initializerMethod.name())); } ResultHandle paramTypesArray = create.newArray(Class.class, create.load(referenceHandles.length)); ResultHandle argsArray = create.newArray(Object.class, create.load(referenceHandles.length)); @@ -958,10 +955,8 @@ protected void implementCreate(ClassOutput classOutput, ClassCreator beanCreator bean.getDeployment().getIndex()); for (MethodInfo callback : postConstructCallbacks) { if (Modifier.isPrivate(callback.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "PostConstruct callback %s#%s is private - users are encouraged to avoid using private callbacks", - callback.declaringClass().name(), - callback.name()); + privateMembers.add(isApplicationClass, + String.format("@PostConstruct callback %s#%s()", callback.declaringClass().name(), callback.name())); reflectionRegistration.registerMethod(callback); create.invokeStaticMethod(MethodDescriptors.REFLECTIONS_INVOKE_METHOD, create.loadClass(callback.declaringClass().name().toString()), create.load(callback.name()), create.newArray(Class.class, create.load(0)), instanceHandle, @@ -1001,9 +996,7 @@ protected void implementCreate(ClassOutput classOutput, ClassCreator beanCreator MethodInfo producerMethod = bean.getTarget().get().asMethod(); if (Modifier.isPrivate(producerMethod.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "Producer %s#%s is private - users are encouraged to avoid using private producers", producerMethod.declaringClass().name(), - producerMethod.name()); + privateMembers.add(isApplicationClass, String.format("Producer method %s#%s()", producerMethod.declaringClass().name(), producerMethod.name())); ResultHandle paramTypesArray = create.newArray(Class.class, create.load(referenceHandles.length)); ResultHandle argsArray = create.newArray(Object.class, create.load(referenceHandles.length)); for (int i = 0; i < referenceHandles.length; i++) { @@ -1043,9 +1036,7 @@ protected void implementCreate(ClassOutput classOutput, ClassCreator beanCreator } if (Modifier.isPrivate(producerField.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "Producer %s#%s is private - users are encouraged to avoid using private producers", producerField.declaringClass().name(), - producerField.name()); + privateMembers.add(isApplicationClass, String.format("Producer field %s#%s", producerField.declaringClass().name(), producerField.name())); reflectionRegistration.registerField(producerField); create.assign(instanceHandle, create.invokeStaticMethod(MethodDescriptors.REFLECTIONS_READ_FIELD, create.loadClass(producerField.declaringClass().name().toString()), create.load(producerField.name()), declaringProviderInstanceHandle)); @@ -1134,9 +1125,7 @@ private ResultHandle newInstanceHandle(BeanInfo bean, ClassCreator beanCreator, } else if (constructorInjection.isPresent()) { if (Modifier.isPrivate(constructor.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "Constructor %s is private - users are encouraged to avoid using private constructors", - constructor.declaringClass().name()); + privateMembers.add(isApplicationClass, String.format("Bean constructor %s on %s", constructor, constructor.declaringClass().name())); ResultHandle paramTypesArray = creator.newArray(Class.class, creator.load(providerHandles.size())); ResultHandle argsArray = creator.newArray(Object.class, creator.load(providerHandles.size())); for (int i = 0; i < injectionPoints.size(); i++) { @@ -1158,9 +1147,8 @@ private ResultHandle newInstanceHandle(BeanInfo bean, ClassCreator beanCreator, } else { MethodInfo noArgsConstructor = bean.getTarget().get().asClass().method(Methods.INIT); if (Modifier.isPrivate(noArgsConstructor.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "Constructor %s is private - users are encouraged to avoid using private constructors", - noArgsConstructor.declaringClass().name()); + privateMembers.add(isApplicationClass, + String.format("Bean constructor %s on %s", noArgsConstructor, noArgsConstructor.declaringClass().name())); ResultHandle paramTypesArray = creator.newArray(Class.class, creator.load(0)); ResultHandle argsArray = creator.newArray(Object.class, creator.load(0)); diff --git a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanProcessor.java b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanProcessor.java index 3cd2f4ce340..f64e9f633a6 100644 --- a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanProcessor.java +++ b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanProcessor.java @@ -31,6 +31,7 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Predicate; +import java.util.stream.Collectors; import javax.enterprise.context.control.ActivateRequestContext; import javax.enterprise.inject.Any; @@ -150,20 +151,21 @@ public <V> V put(Key<V> key, V value) { this.beanRegistrars = initAndSort(beanRegistrars, buildContext); this.beanDeploymentValidators = initAndSort(beanDeploymentValidators, buildContext); } - + public BeanDeployment process() throws IOException { BeanDeployment beanDeployment = new BeanDeployment(new IndexWrapper(index), additionalBeanDefiningAnnotations, annotationTransformers, resourceAnnotations, beanRegistrars, buildContext, removeUnusedBeans, unusedExclusions); beanDeployment.init(); beanDeployment.validate(buildContext, beanDeploymentValidators); - + + PrivateMembersCollector privateMembers = new PrivateMembersCollector(); AnnotationLiteralProcessor annotationLiterals = new AnnotationLiteralProcessor(sharedAnnotationLiterals, applicationClassPredicate); - BeanGenerator beanGenerator = new BeanGenerator(annotationLiterals, applicationClassPredicate); + BeanGenerator beanGenerator = new BeanGenerator(annotationLiterals, applicationClassPredicate, privateMembers); ClientProxyGenerator clientProxyGenerator = new ClientProxyGenerator(applicationClassPredicate); - InterceptorGenerator interceptorGenerator = new InterceptorGenerator(annotationLiterals, applicationClassPredicate); + InterceptorGenerator interceptorGenerator = new InterceptorGenerator(annotationLiterals, applicationClassPredicate, privateMembers); SubclassGenerator subclassGenerator = new SubclassGenerator(annotationLiterals, applicationClassPredicate); - ObserverGenerator observerGenerator = new ObserverGenerator(annotationLiterals, applicationClassPredicate); + ObserverGenerator observerGenerator = new ObserverGenerator(annotationLiterals, applicationClassPredicate, privateMembers); AnnotationLiteralGenerator annotationLiteralsGenerator = new AnnotationLiteralGenerator(); Map<BeanInfo, String> beanToGeneratedName = new HashMap<>(); @@ -209,6 +211,8 @@ public BeanDeployment process() throws IOException { } } + privateMembers.log(); + // Generate _ComponentsProvider resources.addAll(new ComponentsProviderGenerator().generate(name, beanDeployment, beanToGeneratedName, observerToGeneratedName)); @@ -561,5 +565,42 @@ <V> V putInternal(String key, V value) { } } + + static class PrivateMembersCollector { + + private final List<String> appDescriptions; + private final List<String> fwkDescriptions; + + public PrivateMembersCollector() { + this.appDescriptions = new ArrayList<>(); + this.fwkDescriptions = LOGGER.isDebugEnabled() ? new ArrayList<>() : null; + } + + void add(boolean isApplicationClass, String description) { + if (isApplicationClass) { + appDescriptions.add(description); + } else if(fwkDescriptions != null) { + fwkDescriptions.add(description); + } + } + + private void log() { + // Log application problems + if (!appDescriptions.isEmpty()) { + int limit = LOGGER.isDebugEnabled() ? Integer.MAX_VALUE : 3; + String info = appDescriptions.stream().limit(limit).map(d -> "\\t- " + d).collect(Collectors.joining(",\\n")); + if (appDescriptions.size() > limit) { + info += "\\n\\t- and " + (appDescriptions.size() - limit) + " more - please enable debug logging to see the full list"; + } + LOGGER.infof("Found unrecommended usage of private members in application beans:\\n%s", info); + } + // Log fwk problems + if (fwkDescriptions != null && !fwkDescriptions.isEmpty()) { + LOGGER.debugf("Found unrecommended usage of private members in framework beans:\\n%s", + fwkDescriptions.stream().map(d -> "\\t- " + d).collect(Collectors.joining(",\\n"))); + } + } + + } } diff --git a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/InterceptorGenerator.java b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/InterceptorGenerator.java index 349b97877bb..5080c3fb5f6 100644 --- a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/InterceptorGenerator.java +++ b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/InterceptorGenerator.java @@ -36,9 +36,8 @@ import org.jboss.jandex.DotName; import org.jboss.jandex.MethodInfo; import org.jboss.jandex.Type; -import org.jboss.logging.Logger; -import org.jboss.logging.Logger.Level; import org.jboss.protean.arc.InjectableInterceptor; +import org.jboss.protean.arc.processor.BeanProcessor.PrivateMembersCollector; import org.jboss.protean.arc.processor.ResourceOutput.Resource; import org.jboss.protean.arc.processor.ResourceOutput.Resource.SpecialType; import org.jboss.protean.gizmo.BranchResult; @@ -57,16 +56,11 @@ */ public class InterceptorGenerator extends BeanGenerator { - private static final Logger LOGGER = Logger.getLogger(InterceptorGenerator.class); - protected static final String FIELD_NAME_BINDINGS = "bindings"; - /** - * - * @param annotationLiterals - */ - public InterceptorGenerator(AnnotationLiteralProcessor annotationLiterals, Predicate<DotName> applicationClassPredicate) { - super(annotationLiterals, applicationClassPredicate); + public InterceptorGenerator(AnnotationLiteralProcessor annotationLiterals, Predicate<DotName> applicationClassPredicate, + PrivateMembersCollector privateMembers) { + super(annotationLiterals, applicationClassPredicate, privateMembers); } /** @@ -216,11 +210,8 @@ private void addIntercept(MethodCreator intercept, MethodInfo interceptorMethod, Class<?> retType = InterceptionType.AROUND_INVOKE.equals(interceptionType) ? Object.class : void.class; ResultHandle ret; if (Modifier.isPrivate(interceptorMethod.flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "Interceptor method %s#%s is private - users are encouraged to avoid using private interceptor methods", - interceptorMethod.declaringClass() - .name(), - interceptorMethod.name()); + privateMembers.add(isApplicationClass, + String.format("Interceptor method %s#%s()", interceptorMethod.declaringClass().name(), interceptorMethod.name())); // Use reflection fallback ResultHandle paramTypesArray = trueBranch.newArray(Class.class, trueBranch.load(1)); trueBranch.writeArrayValue(paramTypesArray, 0, trueBranch.loadClass(InvocationContext.class)); diff --git a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ObserverGenerator.java b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ObserverGenerator.java index 04b013b8f18..bc1c3282339 100644 --- a/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ObserverGenerator.java +++ b/independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ObserverGenerator.java @@ -39,13 +39,12 @@ import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; -import org.jboss.logging.Logger; -import org.jboss.logging.Logger.Level; import org.jboss.protean.arc.CreationalContextImpl; import org.jboss.protean.arc.CurrentInjectionPointProvider; import org.jboss.protean.arc.InjectableBean; import org.jboss.protean.arc.InjectableObserverMethod; import org.jboss.protean.arc.InjectableReferenceProvider; +import org.jboss.protean.arc.processor.BeanProcessor.PrivateMembersCollector; import org.jboss.protean.arc.processor.ResourceOutput.Resource; import org.jboss.protean.arc.processor.ResourceOutput.Resource.SpecialType; import org.jboss.protean.gizmo.ClassCreator; @@ -64,19 +63,17 @@ public class ObserverGenerator extends AbstractGenerator { static final String OBSERVER_SUFFIX = "_Observer"; - private static final Logger LOGGER = Logger.getLogger(ObserverGenerator.class); - private final AnnotationLiteralProcessor annotationLiterals; private final Predicate<DotName> applicationClassPredicate; - /** - * - * @param annotationLiterals - * @param applicationClassPredicate - */ - public ObserverGenerator(AnnotationLiteralProcessor annotationLiterals, Predicate<DotName> applicationClassPredicate) { + + private final PrivateMembersCollector privateMembers; + + public ObserverGenerator(AnnotationLiteralProcessor annotationLiterals, Predicate<DotName> applicationClassPredicate, + PrivateMembersCollector privateMembers) { this.annotationLiterals = annotationLiterals; this.applicationClassPredicate = applicationClassPredicate; + this.privateMembers = privateMembers; } /** @@ -211,9 +208,8 @@ protected void implementNotify(ObserverInfo observer, ClassCreator observerCreat } if (Modifier.isPrivate(observer.getObserverMethod().flags())) { - Level level = isApplicationClass ? Level.INFO : Level.DEBUG; - LOGGER.logf(level, "Observer %s#%s is private - users are encouraged to avoid using private observers", observer.getObserverMethod().declaringClass().name(), - observer.getObserverMethod().name()); + privateMembers.add(isApplicationClass, + String.format("Observer method %s#%s()", observer.getObserverMethod().declaringClass().name(), observer.getObserverMethod().name())); ResultHandle paramTypesArray = notify.newArray(Class.class, notify.load(referenceHandles.length)); ResultHandle argsArray = notify.newArray(Object.class, notify.load(referenceHandles.length)); for (int i = 0; i < referenceHandles.length; i++) { diff --git a/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/BeanGeneratorTest.java b/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/BeanGeneratorTest.java index 4b00ba230bc..50c31b52f07 100644 --- a/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/BeanGeneratorTest.java +++ b/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/BeanGeneratorTest.java @@ -22,7 +22,6 @@ import java.util.AbstractCollection; import java.util.AbstractList; import java.util.Collection; -import java.util.Collections; import java.util.List; import javax.enterprise.context.ApplicationScoped; @@ -30,6 +29,7 @@ import javax.enterprise.inject.Produces; import org.jboss.jandex.Index; +import org.jboss.protean.arc.processor.BeanProcessor.PrivateMembersCollector; import org.jboss.protean.arc.processor.types.Foo; import org.jboss.protean.arc.processor.types.FooQualifier; import org.junit.Test; @@ -43,7 +43,7 @@ public void testGenerator() throws IOException { BeanDeployment deployment = new BeanDeployment(index, null, null); deployment.init(); - BeanGenerator generator = new BeanGenerator(new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE), TruePredicate.INSTANCE); + BeanGenerator generator = new BeanGenerator(new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE), TruePredicate.INSTANCE, new PrivateMembersCollector()); deployment.getBeans().forEach(bean -> generator.generate(bean, ReflectionRegistration.NOOP)); // TODO test generated bytecode @@ -56,7 +56,7 @@ public void testGeneratorForNormalScopedProducer() throws IOException { BeanDeployment deployment = new BeanDeployment(index, null, null); deployment.init(); - BeanGenerator generator = new BeanGenerator(new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE), TruePredicate.INSTANCE); + BeanGenerator generator = new BeanGenerator(new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE), TruePredicate.INSTANCE, new PrivateMembersCollector()); deployment.getBeans().forEach(bean -> generator.generate(bean, ReflectionRegistration.NOOP)); // TODO test generated bytecode diff --git a/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/ClientProxyGeneratorTest.java b/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/ClientProxyGeneratorTest.java index 945d0290130..f4603e87223 100644 --- a/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/ClientProxyGeneratorTest.java +++ b/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/ClientProxyGeneratorTest.java @@ -21,7 +21,6 @@ import java.io.IOException; import java.util.AbstractList; import java.util.Collection; -import java.util.Collections; import java.util.List; import javax.enterprise.context.ApplicationScoped; @@ -29,6 +28,7 @@ import javax.enterprise.inject.Produces; import org.jboss.jandex.Index; +import org.jboss.protean.arc.processor.BeanProcessor.PrivateMembersCollector; import org.jboss.protean.arc.processor.ResourceOutput.Resource; import org.junit.Test; @@ -41,7 +41,7 @@ public void testGenerator() throws IOException { BeanDeployment deployment = new BeanDeployment(index, null, null); deployment.init(); - BeanGenerator beanGenerator = new BeanGenerator( new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE), TruePredicate.INSTANCE); + BeanGenerator beanGenerator = new BeanGenerator( new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE), TruePredicate.INSTANCE, new PrivateMembersCollector()); ClientProxyGenerator proxyGenerator = new ClientProxyGenerator(TruePredicate.INSTANCE); deployment.getBeans().stream().filter(bean -> bean.getScope().isNormal()).forEach(bean -> { diff --git a/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/InterceptorGeneratorTest.java b/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/InterceptorGeneratorTest.java index 47b1780fbdf..eb3d6e62a6c 100644 --- a/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/InterceptorGeneratorTest.java +++ b/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/InterceptorGeneratorTest.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; -import java.util.Collections; import javax.annotation.Priority; import javax.inject.Inject; @@ -34,6 +33,7 @@ import org.jboss.jandex.DotName; import org.jboss.jandex.Index; +import org.jboss.protean.arc.processor.BeanProcessor.PrivateMembersCollector; import org.jboss.protean.arc.processor.types.Baz; import org.junit.Test; @@ -53,7 +53,7 @@ public void testGenerator() throws IOException { assertEquals(1, myInterceptor.getBindings().size()); assertNotNull(myInterceptor.getAroundInvoke()); - InterceptorGenerator generator = new InterceptorGenerator(new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE), TruePredicate.INSTANCE); + InterceptorGenerator generator = new InterceptorGenerator(new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE), TruePredicate.INSTANCE, new PrivateMembersCollector()); deployment.getInterceptors().forEach(interceptor -> generator.generate(interceptor, ReflectionRegistration.NOOP)); // TODO test generated bytecode diff --git a/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/SubclassGeneratorTest.java b/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/SubclassGeneratorTest.java index bac068afaaf..e74c577c880 100644 --- a/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/SubclassGeneratorTest.java +++ b/independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/SubclassGeneratorTest.java @@ -25,7 +25,6 @@ import java.lang.annotation.Documented; import java.lang.annotation.Retention; import java.lang.annotation.Target; -import java.util.Collections; import javax.annotation.Priority; import javax.enterprise.context.Dependent; @@ -37,6 +36,7 @@ import org.jboss.jandex.DotName; import org.jboss.jandex.Index; +import org.jboss.protean.arc.processor.BeanProcessor.PrivateMembersCollector; import org.jboss.protean.arc.processor.ResourceOutput.Resource; import org.jboss.protean.arc.processor.types.Baz; import org.junit.Test; @@ -51,7 +51,7 @@ public void testGenerator() throws IOException { deployment.init(); AnnotationLiteralProcessor annotationLiteralProcessor = new AnnotationLiteralProcessor(true, TruePredicate.INSTANCE); - BeanGenerator beanGenerator = new BeanGenerator(annotationLiteralProcessor, TruePredicate.INSTANCE); + BeanGenerator beanGenerator = new BeanGenerator(annotationLiteralProcessor, TruePredicate.INSTANCE, new PrivateMembersCollector()); SubclassGenerator generator = new SubclassGenerator(annotationLiteralProcessor, TruePredicate.INSTANCE); BeanInfo simpleBean = deployment.getBeans().stream() .filter(b -> b.getTarget().get().asClass().name().equals(DotName.createSimple(SimpleBean.class.getName()))).findAny().get();
['independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanGenerator.java', 'independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/InterceptorGenerator.java', 'independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/SubclassGeneratorTest.java', 'independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/BeanProcessor.java', 'extensions/arc/deployment/src/main/java/org/jboss/shamrock/arc/deployment/ArcAnnotationProcessor.java', 'independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/ClientProxyGeneratorTest.java', 'independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/BeanGeneratorTest.java', 'independent-projects/arc/processor/src/test/java/org/jboss/protean/arc/processor/InterceptorGeneratorTest.java', 'independent-projects/arc/processor/src/main/java/org/jboss/protean/arc/processor/ObserverGenerator.java']
{'.java': 9}
9
9
0
0
9
3,491,221
693,056
92,077
814
10,333
1,823
151
5
334
52
77
1
0
0
"2019-02-12T15:28:54"
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,317
quarkusio/quarkus/644/634
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/634
https://github.com/quarkusio/quarkus/pull/644
https://github.com/quarkusio/quarkus/pull/644
1
fixes
mvn install fails if it has already been run
After the recent changes if you run 'mvn install' twice in a row the shamrock-maven-plugin will fail with Caused by: java.nio.file.FileAlreadyExistsException: META-INF/MANIFEST.MF
664778882965195215759eb15ab97a705634ff63
c615e47f4e155b347bc184df14286bf6d6bbc81a
https://github.com/quarkusio/quarkus/compare/664778882965195215759eb15ab97a705634ff63...c615e47f4e155b347bc184df14286bf6d6bbc81a
diff --git a/core/creator/src/main/java/org/jboss/shamrock/creator/phase/runnerjar/RunnerJarPhase.java b/core/creator/src/main/java/org/jboss/shamrock/creator/phase/runnerjar/RunnerJarPhase.java index 16a2bcb83c7..1715f696024 100644 --- a/core/creator/src/main/java/org/jboss/shamrock/creator/phase/runnerjar/RunnerJarPhase.java +++ b/core/creator/src/main/java/org/jboss/shamrock/creator/phase/runnerjar/RunnerJarPhase.java @@ -171,7 +171,7 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException { } runnerJar = outputDir.resolve(finalName + "-runner.jar"); - + IoUtils.recursiveDelete(runnerJar); try (FileSystem zipFs = ZipUtils.newZip(runnerJar)) { buildRunner(zipFs, appState, ctx.resolveOutcome(AugmentOutcome.class)); } catch (Exception e) {
['core/creator/src/main/java/org/jboss/shamrock/creator/phase/runnerjar/RunnerJarPhase.java']
{'.java': 1}
1
1
0
0
1
3,350,598
675,389
89,343
721
46
11
2
1
179
22
44
1
0
0
"2019-01-28T06:34:16"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,319
quarkusio/quarkus/547/544
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/544
https://github.com/quarkusio/quarkus/pull/547
https://github.com/quarkusio/quarkus/pull/547
1
fix
shamrock:dev allows debug port 0 to be used
As the debug port can now be specified, the 0 value is allowed leading to wrong configuration as the allocated port is not retrieved
70f6780c4edbc5c9075f47c52ab750db6dce7373
3241c0b52065e2b2f4561506149f473c9041b07a
https://github.com/quarkusio/quarkus/compare/70f6780c4edbc5c9075f47c52ab750db6dce7373...3241c0b52065e2b2f4561506149f473c9041b07a
diff --git a/maven/src/main/java/org/jboss/shamrock/maven/DevMojo.java b/maven/src/main/java/org/jboss/shamrock/maven/DevMojo.java index cede5f0c17b..c5acb361086 100644 --- a/maven/src/main/java/org/jboss/shamrock/maven/DevMojo.java +++ b/maven/src/main/java/org/jboss/shamrock/maven/DevMojo.java @@ -136,6 +136,9 @@ public void execute() throws MojoFailureException { } else if (!debug.toLowerCase().equals("false")) { try { int port = Integer.parseInt(debug); + if (port <= 0) { + throw new MojoFailureException("The specified debug port must be greater than 0"); + } args.add("-Xdebug"); args.add("-Xrunjdwp:transport=dt_socket,address=" + port + ",server=y,suspend=y"); } catch (NumberFormatException e) {
['maven/src/main/java/org/jboss/shamrock/maven/DevMojo.java']
{'.java': 1}
1
1
0
0
1
3,125,315
631,596
83,488
665
168
29
3
1
132
24
26
1
0
0
"2019-01-17T08:05:45"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,320
quarkusio/quarkus/218/214
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/214
https://github.com/quarkusio/quarkus/pull/218
https://github.com/quarkusio/quarkus/pull/218
1
resolves
High thread contention in org.jboss.protean.arc.RequestContext
org.jboss.protean.arc.RequestContext.activate()[1] and org.jboss.protean.arc.RequestContext.deactivate()[2] both use coarse grained locking via method synchronization. These methods are on a hot code path, and cause a lot of thread contention under load. For a 1min 39s sample, I have observed a total of 1hr 7min 54s of thread time blocked waiting for the sync lock. I am not sure of the intention of the synchronization as the currentContext is accessed in methods other than activate() and deactivate(), so is not not consistently protected. The property is also a threadLocal, so each thread should have it's own copy of the object. I am not sure that the synchronization is necessary, but if it is required, we need to implement a more lightweight, finer grained, locking implementation. [1] https://github.com/protean-project/shamrock/blob/master/ext/arc/runtime/src/main/java/org/jboss/protean/arc/RequestContext.java#L95 [2] https://github.com/protean-project/shamrock/blob/master/ext/arc/runtime/src/main/java/org/jboss/protean/arc/RequestContext.java#L109
1f7593b68aae42748985e601b9fe57ede1595432
97c344ff2ca0886a808ff1251368ae4d23b6855f
https://github.com/quarkusio/quarkus/compare/1f7593b68aae42748985e601b9fe57ede1595432...97c344ff2ca0886a808ff1251368ae4d23b6855f
diff --git a/ext/arc/runtime/src/main/java/org/jboss/protean/arc/RequestContext.java b/ext/arc/runtime/src/main/java/org/jboss/protean/arc/RequestContext.java index 5ef92500ca6..9ae045c31c0 100644 --- a/ext/arc/runtime/src/main/java/org/jboss/protean/arc/RequestContext.java +++ b/ext/arc/runtime/src/main/java/org/jboss/protean/arc/RequestContext.java @@ -92,7 +92,7 @@ public void destroy(Contextual<?> contextual) { } @Override - public synchronized void activate(Collection<InstanceHandle<?>> initialState) { + public void activate(Collection<InstanceHandle<?>> initialState) { Map<Contextual<?>, InstanceHandle<?>> state = new HashMap<>(); if (initialState != null) { for (InstanceHandle<?> instanceHandle : initialState) { @@ -106,7 +106,7 @@ public synchronized void activate(Collection<InstanceHandle<?>> initialState) { } @Override - public synchronized void deactivate() { + public void deactivate() { currentContext.remove(); }
['ext/arc/runtime/src/main/java/org/jboss/protean/arc/RequestContext.java']
{'.java': 1}
1
1
0
0
1
2,952,851
599,885
80,159
655
233
38
4
1
1,082
125
254
10
2
0
"2018-12-07T00:25: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,300
quarkusio/quarkus/1731/1671
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1671
https://github.com/quarkusio/quarkus/pull/1731
https://github.com/quarkusio/quarkus/pull/1731
1
fixes
ImageIO substitutions should be global
Right now, we have `Target_javax_imageio_ImageIO` in `quarkus-resteasy-common` and this substitution should be made global as we have JAXB dependending on it (and so `camel-core`). ``` Call path from entry point to com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(long, boolean, boolean): at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(JPEGImageReader.java) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:620) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:614) at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1070) at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:1050) at javax.imageio.ImageIO.read(ImageIO.java:1448) at javax.imageio.ImageIO.read(ImageIO.java:1352) at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$10.parse(RuntimeBuiltinLeafInfoImpl.java:404) at com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$10.parse(RuntimeBuiltinLeafInfoImpl.java:390) at com.sun.xml.bind.v2.runtime.ValueListBeanInfoImpl$1.text(ValueListBeanInfoImpl.java:93) at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.text(UnmarshallingContext.java:590) at com.sun.xml.bind.v2.runtime.unmarshaller.MTOMDecorator.startElement(MTOMDecorator.java:107) at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:168) at org.apache.camel.support.builder.xml.StAX2SAXSource.parse(StAX2SAXSource.java:147) at org.apache.camel.support.builder.xml.StAX2SAXSource.parse(StAX2SAXSource.java:343) ```
da58f701cefe857236967939b9f6b422e37d0573
6ff8b9221d8c5fdd305c8ac92037e9b995ebe0bb
https://github.com/quarkusio/quarkus/compare/da58f701cefe857236967939b9f6b422e37d0573...6ff8b9221d8c5fdd305c8ac92037e9b995ebe0bb
diff --git a/extensions/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/graal/ImageIOSubstitutions.java b/core/runtime/src/main/java/io/quarkus/runtime/graal/ImageIOSubstitutions.java similarity index 57% rename from extensions/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/graal/ImageIOSubstitutions.java rename to core/runtime/src/main/java/io/quarkus/runtime/graal/ImageIOSubstitutions.java index 06cc8100856..41a89d8b78f 100644 --- a/extensions/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/graal/ImageIOSubstitutions.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/graal/ImageIOSubstitutions.java @@ -1,4 +1,4 @@ -package io.quarkus.resteasy.common.runtime.graal; +package io.quarkus.runtime.graal; import java.awt.image.BufferedImage; import java.awt.image.RenderedImage; @@ -29,155 +29,139 @@ public static void scanForPlugins() { @Substitute public static ImageInputStream createImageInputStream(Object input) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static ImageOutputStream createImageOutputStream(Object output) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static String[] getReaderFormatNames() { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static String[] getReaderMIMETypes() { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static String[] getReaderFileSuffixes() { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageReader> getImageReaders(Object input) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageReader> getImageReadersByFormatName(String formatName) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageReader> getImageReadersByMIMEType(String MIMEType) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static String[] getWriterFormatNames() { - - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } - /** - * Returns an array of {@code String}s listing all of the - * MIME types understood by the current set of registered - * writers. - * - * @return an array of {@code String}s. - */ @Substitute public static String[] getWriterMIMETypes() { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } - /** - * Returns an array of {@code String}s listing all of the - * file suffixes associated with the formats understood - * by the current set of registered writers. - * - * @return an array of {@code String}s. - * @since 1.6 - */ @Substitute public static String[] getWriterFileSuffixes() { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageWriter> getImageWritersByFormatName(String formatName) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static ImageWriter getImageWriter(ImageReader reader) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static ImageReader getImageReader(ImageWriter writer) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageWriter> getImageWriters(ImageTypeSpecifier type, String formatName) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static Iterator<ImageTranscoder> getImageTranscoders(ImageReader reader, ImageWriter writer) { - throw new RuntimeException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static BufferedImage read(File input) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static BufferedImage read(InputStream input) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static BufferedImage read(URL input) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static BufferedImage read(ImageInputStream stream) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static boolean write(RenderedImage im, String formatName, ImageOutputStream output) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static boolean write(RenderedImage im, String formatName, File output) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static boolean write(RenderedImage im, String formatName, OutputStream output) throws IOException { - throw new IOException("Not Implemented yet on substrate"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } } diff --git a/extensions/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/graal/LCMSSubstitutions.java b/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutions.java similarity index 63% rename from extensions/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/graal/LCMSSubstitutions.java rename to core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutions.java index 93ef2fe91a4..322349e2361 100644 --- a/extensions/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/graal/LCMSSubstitutions.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutions.java @@ -1,4 +1,4 @@ -package io.quarkus.resteasy.common.runtime.graal; +package io.quarkus.runtime.graal; import java.awt.color.ICC_Profile; @@ -10,38 +10,28 @@ final class Target_sun_java2d_cmm_lcms_LCMS { @Substitute private long loadProfileNative(byte[] data, Object ref) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute private int getProfileSizeNative(long ptr) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute private void getProfileDataNative(long ptr, byte[] data) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute static byte[] getTagNative(long profileID, int signature) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } - /** - * Writes supplied data as a tag into the profile. - * Destroys old profile, if new one was successfully - * created. - * <p> - * Returns valid pointer to new profile. - * <p> - * Throws CMMException if operation fails, preserve old profile from - * destruction. - */ @Substitute private void setTagDataNative(long ptr, int tagSignature, byte[] data) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute @@ -50,29 +40,28 @@ private static long createNativeTransform( int inFormatter, boolean isInIntPacked, int outFormatter, boolean isOutIntPacked, Object disposerRef) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static void initLCMS(Class<?> Trans, Class<?> IL, Class<?> Pf) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static synchronized LCMSProfile getProfileID(ICC_Profile profile) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @Substitute public static void colorConvert(LCMSTransform trans, LCMSImageLayout src, LCMSImageLayout dest) { - throw new RuntimeException("Not Implemented"); + throw new UnsupportedOperationException("Not implemented yet for GraalVM native images"); } @TargetClass(className = "sun.java2d.cmm.lcms.LCMSProfile") static final class LCMSProfile { - } @TargetClass(className = "sun.java2d.cmm.lcms.LCMSImageLayout") @@ -81,7 +70,6 @@ static final class LCMSImageLayout { @TargetClass(className = "sun.java2d.cmm.lcms.LCMSTransform") static final class LCMSTransform { - } }
['extensions/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/graal/ImageIOSubstitutions.java', 'extensions/resteasy-common/runtime/src/main/java/io/quarkus/resteasy/common/runtime/graal/LCMSSubstitutions.java']
{'.java': 2}
2
2
0
0
2
3,423,689
670,600
89,368
872
0
0
0
2
1,634
65
409
20
0
1
"2019-03-28T12:37:47"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,299
quarkusio/quarkus/1744/1538
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1538
https://github.com/quarkusio/quarkus/pull/1744
https://github.com/quarkusio/quarkus/pull/1744
1
resolves
MP config injection types
According to [1] Quarkus app should be able to inject config properties like: ```java @Inject @ConfigProperty(name="myprj.some.dynamic.timeout", defaultValue="100") private javax.inject.Provider<Long> timeout; ``` or ```java @Inject @ConfigProperty(name="myPets") private List<String> myListPets; ``` The Provider injection fails with Arc as it cannot resolve injection [2] and second List injection fails because List converter is not used by default which I think it should be according to the spec [3]. It doesn't also work with Set or String[]. [1] https://github.com/eclipse/microprofile-config/blob/master/spec/src/main/asciidoc/configexamples.asciidoc#simple-dependency-injection-example [2] https://github.com/xstefank/reproducers/tree/master/config-provided-prop [3] https://github.com/xstefank/reproducers/tree/master/config-list-inject
fd4c4e130e224063c0eb1f7977a086e2e05f8c0b
31ce4814c1bbbb2b3dede85e78de4ea2e687d68c
https://github.com/quarkusio/quarkus/compare/fd4c4e130e224063c0eb1f7977a086e2e05f8c0b...31ce4814c1bbbb2b3dede85e78de4ea2e687d68c
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java index fc7de49937b..b6e70710950 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java @@ -1437,36 +1437,31 @@ protected void implementGetName(BeanInfo bean, ClassCreator beanCreator) { private ResultHandle wrapCurrentInjectionPoint(ClassOutput classOutput, ClassCreator beanCreator, BeanInfo bean, MethodCreator constructor, InjectionPointInfo injectionPoint, int paramIdx) { - // Collect qualifiers - ResultHandle requiredQualifiersHandle = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); - for (AnnotationInstance qualifierAnnotation : injectionPoint.getRequiredQualifiers()) { - BuiltinQualifier qualifier = BuiltinQualifier.of(qualifierAnnotation); - if (qualifier != null) { - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, requiredQualifiersHandle, - qualifier.getLiteralInstance(constructor)); - } else { - // Create annotation literal if needed - ClassInfo qualifierClass = bean.getDeployment().getQualifier(qualifierAnnotation.name()); - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, requiredQualifiersHandle, - annotationLiterals.process(constructor, - classOutput, qualifierClass, qualifierAnnotation, - Types.getPackageName(beanCreator.getClassName()))); - } - } - // Collect all annotations - ResultHandle annotationsHandle = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); + ResultHandle requiredQualifiersHandle = collectQualifiers(classOutput, beanCreator, bean.getDeployment(), constructor, + injectionPoint, + annotationLiterals); + ResultHandle annotationsHandle = collectAnnotations(classOutput, beanCreator, bean.getDeployment(), constructor, + injectionPoint, annotationLiterals); + ResultHandle javaMemberHandle = getJavaMemberHandle(constructor, injectionPoint); + return constructor.newInstance( + MethodDescriptor.ofConstructor(CurrentInjectionPointProvider.class, InjectableBean.class, + InjectableReferenceProvider.class, java.lang.reflect.Type.class, + Set.class, Set.class, Member.class, int.class), + constructor.getThis(), constructor.getMethodParam(paramIdx), + Types.getTypeHandle(constructor, injectionPoint.getRequiredType()), + requiredQualifiersHandle, annotationsHandle, javaMemberHandle, constructor.load(injectionPoint.getPosition())); + } + + static ResultHandle getJavaMemberHandle(MethodCreator constructor, + InjectionPointInfo injectionPoint) { ResultHandle javaMemberHandle; - Collection<AnnotationInstance> annotations; if (Kind.FIELD.equals(injectionPoint.getTarget().kind())) { FieldInfo field = injectionPoint.getTarget().asField(); - annotations = bean.getDeployment().getAnnotations(field); javaMemberHandle = constructor.invokeStaticMethod(MethodDescriptors.REFLECTIONS_FIND_FIELD, constructor.loadClass(field.declaringClass().name().toString()), constructor.load(field.name())); } else { MethodInfo method = injectionPoint.getTarget().asMethod(); - annotations = InjectionPointInfo.getParameterAnnotations(bean.getDeployment(), - method, injectionPoint.getPosition()); if (method.name().equals(Methods.INIT)) { // Reflections.findConstructor(org.foo.SimpleBean.class,java.lang.String.class) ResultHandle[] paramsHandles = new ResultHandle[2]; @@ -1493,26 +1488,57 @@ private ResultHandle wrapCurrentInjectionPoint(ClassOutput classOutput, ClassCre javaMemberHandle = constructor.invokeStaticMethod(MethodDescriptors.REFLECTIONS_FIND_METHOD, paramsHandles); } } + return javaMemberHandle; + } + + static ResultHandle collectAnnotations(ClassOutput classOutput, ClassCreator beanCreator, BeanDeployment beanDeployment, + MethodCreator constructor, + InjectionPointInfo injectionPoint, AnnotationLiteralProcessor annotationLiterals) { + ResultHandle annotationsHandle = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); + Collection<AnnotationInstance> annotations; + if (Kind.FIELD.equals(injectionPoint.getTarget().kind())) { + FieldInfo field = injectionPoint.getTarget().asField(); + annotations = beanDeployment.getAnnotations(field); + } else { + MethodInfo method = injectionPoint.getTarget().asMethod(); + annotations = InjectionPointInfo.getParameterAnnotations(beanDeployment, + method, injectionPoint.getPosition()); + } for (AnnotationInstance annotation : annotations) { if (DotNames.INJECT.equals(annotation.name())) { constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, annotationsHandle, constructor.readStaticField(FieldDescriptor.of(InjectLiteral.class, "INSTANCE", InjectLiteral.class))); } else { // Create annotation literal if needed - ClassInfo literalClass = bean.getDeployment().getIndex().getClassByName(annotation.name()); + ClassInfo literalClass = beanDeployment.getIndex().getClassByName(annotation.name()); constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, annotationsHandle, annotationLiterals.process(constructor, classOutput, literalClass, annotation, Types.getPackageName(beanCreator.getClassName()))); } } - return constructor.newInstance( - MethodDescriptor.ofConstructor(CurrentInjectionPointProvider.class, InjectableBean.class, - InjectableReferenceProvider.class, java.lang.reflect.Type.class, - Set.class, Set.class, Member.class, int.class), - constructor.getThis(), constructor.getMethodParam(paramIdx), - Types.getTypeHandle(constructor, injectionPoint.getRequiredType()), - requiredQualifiersHandle, annotationsHandle, javaMemberHandle, constructor.load(injectionPoint.getPosition())); + return annotationsHandle; + } + + static ResultHandle collectQualifiers(ClassOutput classOutput, ClassCreator beanCreator, BeanDeployment beanDeployment, + MethodCreator constructor, + InjectionPointInfo injectionPoint, AnnotationLiteralProcessor annotationLiterals) { + ResultHandle requiredQualifiersHandle = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); + for (AnnotationInstance qualifierAnnotation : injectionPoint.getRequiredQualifiers()) { + BuiltinQualifier qualifier = BuiltinQualifier.of(qualifierAnnotation); + if (qualifier != null) { + constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, requiredQualifiersHandle, + qualifier.getLiteralInstance(constructor)); + } else { + // Create annotation literal if needed + ClassInfo qualifierClass = beanDeployment.getQualifier(qualifierAnnotation.name()); + constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, requiredQualifiersHandle, + annotationLiterals.process(constructor, + classOutput, qualifierClass, qualifierAnnotation, + Types.getPackageName(beanCreator.getClassName()))); + } + } + return requiredQualifiersHandle; } } diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java index 6b575c2bbe7..e6b48f29cc3 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java @@ -19,6 +19,7 @@ import io.quarkus.arc.BeanManagerProvider; import io.quarkus.arc.BeanMetadataProvider; import io.quarkus.arc.EventProvider; +import io.quarkus.arc.InjectableBean; import io.quarkus.arc.InjectableReferenceProvider; import io.quarkus.arc.InjectionPointProvider; import io.quarkus.arc.InstanceProvider; @@ -30,6 +31,7 @@ import io.quarkus.gizmo.MethodCreator; import io.quarkus.gizmo.MethodDescriptor; import io.quarkus.gizmo.ResultHandle; +import java.lang.reflect.Member; import java.util.HashSet; import java.util.Set; import java.util.function.Predicate; @@ -49,137 +51,125 @@ void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionP ClassCreator clazzCreator, MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { - ResultHandle qualifiers = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); - if (!injectionPoint.getRequiredQualifiers().isEmpty()) { - // Set<Annotation> instanceProvider1Qualifiers = new HashSet<>() - // instanceProvider1Qualifiers.add(javax.enterprise.inject.Default.Literal.INSTANCE) - - for (AnnotationInstance qualifierAnnotation : injectionPoint.getRequiredQualifiers()) { - BuiltinQualifier qualifier = BuiltinQualifier.of(qualifierAnnotation); - if (qualifier != null) { - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, qualifiers, - qualifier.getLiteralInstance(constructor)); - } else { - // Create annotation literal first - ClassInfo qualifierClass = beanDeployment.getQualifier(qualifierAnnotation.name()); - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, qualifiers, - annotationLiterals.process(constructor, classOutput, - qualifierClass, qualifierAnnotation, - Types.getPackageName(clazzCreator.getClassName()))); - } - } - } + ResultHandle qualifiers = BeanGenerator.collectQualifiers(classOutput, clazzCreator, beanDeployment, constructor, + injectionPoint, + annotationLiterals); ResultHandle parameterizedType = Types.getTypeHandle(constructor, injectionPoint.getRequiredType()); + ResultHandle annotationsHandle = BeanGenerator.collectAnnotations(classOutput, clazzCreator, beanDeployment, + constructor, + injectionPoint, annotationLiterals); + ResultHandle javaMemberHandle = BeanGenerator.getJavaMemberHandle(constructor, injectionPoint); ResultHandle instanceProvider = constructor.newInstance( - MethodDescriptor.ofConstructor(InstanceProvider.class, java.lang.reflect.Type.class, Set.class), - parameterizedType, qualifiers); + MethodDescriptor.ofConstructor(InstanceProvider.class, java.lang.reflect.Type.class, Set.class, + InjectableBean.class, Set.class, Member.class, int.class), + parameterizedType, qualifiers, constructor.getThis(), annotationsHandle, javaMemberHandle, + constructor.load(injectionPoint.getPosition())); constructor.writeInstanceField( FieldDescriptor.of(clazzCreator.getClassName(), providerName, InjectableReferenceProvider.class.getName()), constructor.getThis(), instanceProvider); } - }, ip -> ip.getKind() == InjectionPointKind.CDI && (DotNames.INSTANCE.equals(ip.getRequiredType().name()) - || DotNames.PROVIDER.equals(ip.getRequiredType().name()))), INJECTION_POINT(DotNames.INJECTION_POINT, - new Generator() { - @Override - void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, - ClassCreator clazzCreator, - MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { - // this.injectionPointProvider1 = new InjectionPointProvider(); - constructor.writeInstanceField( - FieldDescriptor.of(clazzCreator.getClassName(), providerName, - InjectableReferenceProvider.class.getName()), - constructor.getThis(), - constructor.newInstance(MethodDescriptor.ofConstructor(InjectionPointProvider.class))); - } - }), BEAN(DotNames.BEAN, new Generator() { - @Override - void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, - ClassCreator clazzCreator, - MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { - // this.beanProvider1 = new BeanMetadataProvider<>(); - constructor.writeInstanceField( - FieldDescriptor.of(clazzCreator.getClassName(), providerName, - InjectableReferenceProvider.class.getName()), - constructor.getThis(), - constructor.newInstance(MethodDescriptor.ofConstructor(BeanMetadataProvider.class))); - } - }), BEAN_MANAGER(DotNames.BEAN_MANAGER, new Generator() { - @Override - void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, - ClassCreator clazzCreator, - MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { - constructor.writeInstanceField( - FieldDescriptor.of(clazzCreator.getClassName(), providerName, - InjectableReferenceProvider.class.getName()), - constructor.getThis(), - constructor.newInstance(MethodDescriptor.ofConstructor(BeanManagerProvider.class))); - } - }), EVENT(DotNames.EVENT, new Generator() { - @Override - void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, - ClassCreator clazzCreator, - MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { - - ResultHandle qualifiers = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); - if (!injectionPoint.getRequiredQualifiers().isEmpty()) { - // Set<Annotation> instanceProvider1Qualifiers = new HashSet<>() - // instanceProvider1Qualifiers.add(javax.enterprise.inject.Default.Literal.INSTANCE) - - for (AnnotationInstance qualifierAnnotation : injectionPoint.getRequiredQualifiers()) { - BuiltinQualifier qualifier = BuiltinQualifier.of(qualifierAnnotation); - if (qualifier != null) { - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, qualifiers, - qualifier.getLiteralInstance(constructor)); - } else { - // Create annotation literal first - ClassInfo qualifierClass = beanDeployment.getQualifier(qualifierAnnotation.name()); - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, qualifiers, - annotationLiterals.process(constructor, classOutput, - qualifierClass, qualifierAnnotation, - Types.getPackageName(clazzCreator.getClassName()))); - } - } + }, BuiltinBean::isInstanceInjectionPoint), INJECTION_POINT(DotNames.INJECTION_POINT, + new Generator() { + @Override + void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, + ClassCreator clazzCreator, + MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { + // this.injectionPointProvider1 = new InjectionPointProvider(); + constructor.writeInstanceField( + FieldDescriptor.of(clazzCreator.getClassName(), providerName, + InjectableReferenceProvider.class.getName()), + constructor.getThis(), + constructor.newInstance(MethodDescriptor.ofConstructor(InjectionPointProvider.class))); + } + }), BEAN(DotNames.BEAN, new Generator() { + @Override + void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, + ClassCreator clazzCreator, + MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { + // this.beanProvider1 = new BeanMetadataProvider<>(); + constructor.writeInstanceField( + FieldDescriptor.of(clazzCreator.getClassName(), providerName, + InjectableReferenceProvider.class.getName()), + constructor.getThis(), + constructor.newInstance(MethodDescriptor.ofConstructor(BeanMetadataProvider.class))); + } + }), BEAN_MANAGER(DotNames.BEAN_MANAGER, new Generator() { + @Override + void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, + ClassCreator clazzCreator, + MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { + constructor.writeInstanceField( + FieldDescriptor.of(clazzCreator.getClassName(), providerName, + InjectableReferenceProvider.class.getName()), + constructor.getThis(), + constructor.newInstance(MethodDescriptor.ofConstructor(BeanManagerProvider.class))); + } + }), EVENT(DotNames.EVENT, new Generator() { + @Override + void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, + ClassCreator clazzCreator, + MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { + + ResultHandle qualifiers = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); + if (!injectionPoint.getRequiredQualifiers().isEmpty()) { + // Set<Annotation> instanceProvider1Qualifiers = new HashSet<>() + // instanceProvider1Qualifiers.add(javax.enterprise.inject.Default.Literal.INSTANCE) + + for (AnnotationInstance qualifierAnnotation : injectionPoint.getRequiredQualifiers()) { + BuiltinQualifier qualifier = BuiltinQualifier.of(qualifierAnnotation); + if (qualifier != null) { + constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, qualifiers, + qualifier.getLiteralInstance(constructor)); + } else { + // Create annotation literal first + ClassInfo qualifierClass = beanDeployment.getQualifier(qualifierAnnotation.name()); + constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, qualifiers, + annotationLiterals.process(constructor, classOutput, + qualifierClass, qualifierAnnotation, + Types.getPackageName(clazzCreator.getClassName()))); } - ResultHandle parameterizedType = Types.getTypeHandle(constructor, injectionPoint.getRequiredType()); - ResultHandle eventProvider = constructor.newInstance( - MethodDescriptor.ofConstructor(EventProvider.class, java.lang.reflect.Type.class, - Set.class), - parameterizedType, qualifiers); - constructor.writeInstanceField( - FieldDescriptor.of(clazzCreator.getClassName(), providerName, - InjectableReferenceProvider.class.getName()), - constructor.getThis(), eventProvider); } - }), RESOURCE(DotNames.OBJECT, new Generator() { - @Override - void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, - ClassCreator clazzCreator, - MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { - - ResultHandle annotations = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); - // For a resource field the required qualifiers contain all annotations declared on the field - if (!injectionPoint.getRequiredQualifiers().isEmpty()) { - for (AnnotationInstance annotation : injectionPoint.getRequiredQualifiers()) { - // Create annotation literal first - ClassInfo annotationClass = beanDeployment.getIndex().getClassByName(annotation.name()); - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, annotations, - annotationLiterals.process(constructor, classOutput, - annotationClass, annotation, - Types.getPackageName(clazzCreator.getClassName()))); - } - } - ResultHandle parameterizedType = Types.getTypeHandle(constructor, injectionPoint.getRequiredType()); - ResultHandle resourceProvider = constructor.newInstance( - MethodDescriptor.ofConstructor(ResourceProvider.class, java.lang.reflect.Type.class, - Set.class), - parameterizedType, annotations); - constructor.writeInstanceField( - FieldDescriptor.of(clazzCreator.getClassName(), providerName, - InjectableReferenceProvider.class.getName()), - constructor.getThis(), resourceProvider); + } + ResultHandle parameterizedType = Types.getTypeHandle(constructor, injectionPoint.getRequiredType()); + ResultHandle eventProvider = constructor.newInstance( + MethodDescriptor.ofConstructor(EventProvider.class, java.lang.reflect.Type.class, + Set.class), + parameterizedType, qualifiers); + constructor.writeInstanceField( + FieldDescriptor.of(clazzCreator.getClassName(), providerName, + InjectableReferenceProvider.class.getName()), + constructor.getThis(), eventProvider); + } + }), RESOURCE(DotNames.OBJECT, new Generator() { + @Override + void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionPointInfo injectionPoint, + ClassCreator clazzCreator, + MethodCreator constructor, String providerName, AnnotationLiteralProcessor annotationLiterals) { + + ResultHandle annotations = constructor.newInstance(MethodDescriptor.ofConstructor(HashSet.class)); + // For a resource field the required qualifiers contain all annotations declared on the field + if (!injectionPoint.getRequiredQualifiers().isEmpty()) { + for (AnnotationInstance annotation : injectionPoint.getRequiredQualifiers()) { + // Create annotation literal first + ClassInfo annotationClass = beanDeployment.getIndex().getClassByName(annotation.name()); + constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, annotations, + annotationLiterals.process(constructor, classOutput, + annotationClass, annotation, + Types.getPackageName(clazzCreator.getClassName()))); } - }, ip -> ip.getKind() == InjectionPointKind.RESOURCE); + } + ResultHandle parameterizedType = Types.getTypeHandle(constructor, injectionPoint.getRequiredType()); + ResultHandle resourceProvider = constructor.newInstance( + MethodDescriptor.ofConstructor(ResourceProvider.class, java.lang.reflect.Type.class, + Set.class), + parameterizedType, annotations); + constructor.writeInstanceField( + FieldDescriptor.of(clazzCreator.getClassName(), providerName, + InjectableReferenceProvider.class.getName()), + constructor.getThis(), resourceProvider); + } + }, ip -> ip.getKind() == InjectionPointKind.RESOURCE); private final DotName rawTypeDotName; @@ -188,8 +178,7 @@ void generate(ClassOutput classOutput, BeanDeployment beanDeployment, InjectionP private final Predicate<InjectionPointInfo> matcher; BuiltinBean(DotName rawTypeDotName, Generator generator) { - this(rawTypeDotName, generator, - ip -> ip.getKind() == InjectionPointKind.CDI && rawTypeDotName.equals(ip.getRequiredType().name())); + this(rawTypeDotName, generator, ip -> isCdiAndRawTypeMatches(ip, rawTypeDotName)); } BuiltinBean(DotName rawTypeDotName, Generator generator, Predicate<InjectionPointInfo> matcher) { @@ -231,4 +220,19 @@ abstract void generate(ClassOutput classOutput, BeanDeployment beanDeployment, I } + private static boolean isCdiAndRawTypeMatches(InjectionPointInfo injectionPoint, DotName rawTypeDotName) { + if (injectionPoint.getKind() != InjectionPointKind.CDI) { + return false; + } + return rawTypeDotName.equals(injectionPoint.getRequiredType().name()); + } + + private static boolean isInstanceInjectionPoint(InjectionPointInfo injectionPoint) { + if (injectionPoint.getKind() != InjectionPointKind.CDI) { + return false; + } + return DotNames.INSTANCE.equals(injectionPoint.getRequiredType().name()) + || DotNames.PROVIDER.equals(injectionPoint.getRequiredType().name()); + } + } diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java index e223e1f3db8..5720628ea47 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java @@ -35,6 +35,7 @@ import io.quarkus.gizmo.MethodCreator; import io.quarkus.gizmo.MethodDescriptor; import io.quarkus.gizmo.ResultHandle; +import java.lang.reflect.Member; import java.lang.reflect.Modifier; import java.lang.reflect.Type; import java.util.ArrayList; @@ -306,29 +307,23 @@ protected void createConstructor(ClassOutput classOutput, ClassCreator observerC .anyMatch(ip -> BuiltinBean.INJECTION_POINT.getRawTypeDotName().equals(ip.getRequiredType().name()))) { // IMPL NOTE: Injection point resolves to a dependent bean that injects InjectionPoint metadata and so we need to wrap the injectable // reference provider - ResultHandle requiredQualifiersHandle = constructor - .newInstance(MethodDescriptor.ofConstructor(HashSet.class)); - for (AnnotationInstance qualifierAnnotation : injectionPoint.getRequiredQualifiers()) { - BuiltinQualifier qualifier = BuiltinQualifier.of(qualifierAnnotation); - if (qualifier != null) { - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, requiredQualifiersHandle, - qualifier.getLiteralInstance(constructor)); - } else { - // Create annotation literal first - ClassInfo qualifierClass = observer.getDeclaringBean().getDeployment() - .getQualifier(qualifierAnnotation.name()); - constructor.invokeInterfaceMethod(MethodDescriptors.SET_ADD, requiredQualifiersHandle, - annotationLiterals.process(constructor, - classOutput, qualifierClass, qualifierAnnotation, - Types.getPackageName(observerCreator.getClassName()))); - } - } + ResultHandle requiredQualifiersHandle = BeanGenerator.collectQualifiers(classOutput, observerCreator, + observer.getDeclaringBean().getDeployment(), constructor, + injectionPoint, + annotationLiterals); + ResultHandle annotationsHandle = BeanGenerator.collectAnnotations(classOutput, observerCreator, + observer.getDeclaringBean().getDeployment(), constructor, + injectionPoint, annotationLiterals); + ResultHandle javaMemberHandle = BeanGenerator.getJavaMemberHandle(constructor, injectionPoint); ResultHandle wrapHandle = constructor.newInstance( - MethodDescriptor.ofConstructor(CurrentInjectionPointProvider.class, + MethodDescriptor.ofConstructor(CurrentInjectionPointProvider.class, InjectableBean.class, InjectableReferenceProvider.class, java.lang.reflect.Type.class, - Set.class), - constructor.getMethodParam(paramIdx++), - Types.getTypeHandle(constructor, injectionPoint.getRequiredType()), requiredQualifiersHandle); + Set.class, Set.class, Member.class, int.class), + constructor.getThis(), constructor.getMethodParam(paramIdx++), + Types.getTypeHandle(constructor, injectionPoint.getRequiredType()), + requiredQualifiersHandle, annotationsHandle, javaMemberHandle, + constructor.load(injectionPoint.getPosition())); + constructor.writeInstanceField(FieldDescriptor.of(observerCreator.getClassName(), injectionPointToProviderField.get(injectionPoint), InjectableReferenceProvider.class.getName()), constructor.getThis(), wrapHandle); diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanManagerImpl.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanManagerImpl.java index 0098db3f8a0..14f0430f42e 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanManagerImpl.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanManagerImpl.java @@ -18,6 +18,7 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Type; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Objects; @@ -48,6 +49,7 @@ import javax.enterprise.inject.spi.Interceptor; import javax.enterprise.inject.spi.ObserverMethod; import javax.enterprise.inject.spi.ProducerFactory; +import javax.enterprise.util.TypeLiteral; import javax.interceptor.InterceptorBinding; /** @@ -55,6 +57,10 @@ */ public class BeanManagerImpl implements BeanManager { + @SuppressWarnings("serial") + static final TypeLiteral<Instance<Object>> INSTANCE_LITERAL = new TypeLiteral<Instance<Object>>() { + }; + static final LazyValue<BeanManagerImpl> INSTANCE = new LazyValue<>(BeanManagerImpl::new); @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -279,7 +285,8 @@ public Event<Object> getEvent() { @Override public Instance<Object> createInstance() { - return new InstanceImpl<>(Object.class, null, new CreationalContextImpl<>()); + return new InstanceImpl<>(null, INSTANCE_LITERAL.getType(), Collections.emptySet(), new CreationalContextImpl<>(), + Collections.emptySet(), null, -1); } } diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/CurrentInjectionPointProvider.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/CurrentInjectionPointProvider.java index 7859d7739e7..d310eb7d4a9 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/CurrentInjectionPointProvider.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/CurrentInjectionPointProvider.java @@ -45,7 +45,8 @@ */ public class CurrentInjectionPointProvider<T> implements InjectableReferenceProvider<T> { - static final InjectionPoint EMPTY = new InjectionPointImpl(Object.class, Collections.emptySet(), null, null, null, -1); + static final InjectionPoint EMPTY = new InjectionPointImpl(Object.class, Object.class, Collections.emptySet(), null, null, + null, -1); private final InjectableReferenceProvider<T> delegate; @@ -54,7 +55,8 @@ public CurrentInjectionPointProvider(InjectableBean<?> bean, InjectableReferenceProvider<T> delegate, Type requiredType, Set<Annotation> qualifiers, Set<Annotation> annotations, Member javaMember, int position) { this.delegate = delegate; - this.injectionPoint = new InjectionPointImpl(requiredType, qualifiers, bean, annotations, javaMember, position); + this.injectionPoint = new InjectionPointImpl(requiredType, requiredType, qualifiers, bean, annotations, javaMember, + position); } @Override @@ -72,7 +74,7 @@ public T get(CreationalContext<T> creationalContext) { } } - private static class InjectionPointImpl implements InjectionPoint { + static class InjectionPointImpl implements InjectionPoint { private final Type requiredType; private final Set<Annotation> qualifiers; @@ -80,15 +82,17 @@ private static class InjectionPointImpl implements InjectionPoint { private final Annotated annotated; private final Member member; - InjectionPointImpl(Type requiredType, Set<Annotation> qualifiers, InjectableBean<?> bean, Set<Annotation> annotations, + InjectionPointImpl(Type injectionPointType, Type requiredType, Set<Annotation> qualifiers, InjectableBean<?> bean, + Set<Annotation> annotations, Member javaMember, int position) { this.requiredType = requiredType; this.qualifiers = qualifiers; this.bean = bean; if (javaMember instanceof Executable) { - this.annotated = new AnnotatedParameterImpl<>(requiredType, annotations, position, (Executable) javaMember); + this.annotated = new AnnotatedParameterImpl<>(injectionPointType, annotations, position, + (Executable) javaMember); } else { - this.annotated = new AnnotatedFieldImpl<>(requiredType, annotations, (Field) javaMember); + this.annotated = new AnnotatedFieldImpl<>(injectionPointType, annotations, (Field) javaMember); } this.member = javaMember; } 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 779fbed4a69..2c51f5fc039 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 @@ -16,7 +16,9 @@ package io.quarkus.arc; +import io.quarkus.arc.CurrentInjectionPointProvider.InjectionPointImpl; import java.lang.annotation.Annotation; +import java.lang.reflect.Member; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.Collection; @@ -27,6 +29,7 @@ import javax.enterprise.inject.AmbiguousResolutionException; import javax.enterprise.inject.Instance; import javax.enterprise.inject.UnsatisfiedResolutionException; +import javax.enterprise.inject.spi.InjectionPoint; import javax.enterprise.util.TypeLiteral; import javax.inject.Provider; @@ -38,34 +41,43 @@ private static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[] {}; - private final Type type; - - private final Set<Annotation> qualifiers; - private final CreationalContextImpl<?> creationalContext; + private final Set<InjectableBean<?>> resolvedBeans; + + private final Type injectionPointType; + private final Type requiredType; + private final Set<Annotation> requiredQualifiers; + private final InjectableBean<?> targetBean; + private final Set<Annotation> annotations; + private final Member javaMember; + private final int position; + + InstanceImpl(InjectableBean<?> targetBean, Type type, Set<Annotation> qualifiers, + CreationalContextImpl<?> creationalContext, Set<Annotation> annotations, Member javaMember, int position) { + this(targetBean, type, getRequiredType(type), qualifiers, creationalContext, annotations, javaMember, position); + } - private final Set<InjectableBean<?>> beans; + InstanceImpl(InstanceImpl<?> parent, Type requiredType, Set<Annotation> requiredQualifiers) { + this(parent.targetBean, parent.injectionPointType, requiredType, requiredQualifiers, parent.creationalContext, + parent.annotations, parent.javaMember, parent.position); + } - InstanceImpl(Type type, Set<Annotation> qualifiers, CreationalContextImpl<?> creationalContext) { - if (type instanceof ParameterizedType) { - ParameterizedType parameterizedType = (ParameterizedType) type; - if (Provider.class.isAssignableFrom(Types.getRawType(parameterizedType.getRawType()))) { - this.type = parameterizedType.getActualTypeArguments()[0]; - } else { - this.type = type; - } - } else { - this.type = type; - } - this.qualifiers = qualifiers != null ? qualifiers : Collections.emptySet(); + InstanceImpl(InjectableBean<?> targetBean, Type injectionPointType, Type requiredType, Set<Annotation> requiredQualifiers, + CreationalContextImpl<?> creationalContext, Set<Annotation> annotations, Member javaMember, int position) { + this.injectionPointType = injectionPointType; + this.requiredType = requiredType; + this.requiredQualifiers = requiredQualifiers != null ? requiredQualifiers : Collections.emptySet(); this.creationalContext = creationalContext; - - if (this.qualifiers.isEmpty() && Object.class.equals(type)) { + if (this.requiredQualifiers.isEmpty() && Object.class.equals(requiredType)) { // Do not prefetch the beans for Instance<Object> with no qualifiers - this.beans = null; + this.resolvedBeans = null; } else { - this.beans = resolve(); + this.resolvedBeans = resolve(); } + this.targetBean = targetBean; + this.annotations = annotations; + this.javaMember = javaMember; + this.position = position; } @Override @@ -87,23 +99,23 @@ public T get() { @Override public Instance<T> select(Annotation... qualifiers) { - Set<Annotation> newQualifiers = new HashSet<>(this.qualifiers); + Set<Annotation> newQualifiers = new HashSet<>(this.requiredQualifiers); Collections.addAll(newQualifiers, qualifiers); - return new InstanceImpl<>(type, newQualifiers, creationalContext); + return new InstanceImpl<>(this, requiredType, newQualifiers); } @Override public <U extends T> Instance<U> select(Class<U> subtype, Annotation... qualifiers) { - Set<Annotation> newQualifiers = new HashSet<>(this.qualifiers); + Set<Annotation> newQualifiers = new HashSet<>(this.requiredQualifiers); Collections.addAll(newQualifiers, qualifiers); - return new InstanceImpl<>(subtype, newQualifiers, creationalContext); + return new InstanceImpl<>(this, subtype, newQualifiers); } @Override public <U extends T> Instance<U> select(TypeLiteral<U> subtype, Annotation... qualifiers) { - Set<Annotation> newQualifiers = new HashSet<>(this.qualifiers); + Set<Annotation> newQualifiers = new HashSet<>(this.requiredQualifiers); Collections.addAll(newQualifiers, qualifiers); - return new InstanceImpl<>(subtype.getType(), newQualifiers, creationalContext); + return new InstanceImpl<>(this, subtype.getType(), newQualifiers); } @Override @@ -131,17 +143,29 @@ void destroy() { private T getBeanInstance(InjectableBean<T> bean) { CreationalContextImpl<T> ctx = creationalContext.child(); - // TODO current injection point? - T instance = bean.get(ctx); + InjectionPoint prev = InjectionPointProvider.CURRENT.get(); + InjectionPointProvider.CURRENT + .set(new InjectionPointImpl(injectionPointType, requiredType, requiredQualifiers, targetBean, annotations, + javaMember, position)); + T instance; + try { + instance = bean.get(ctx); + } finally { + if (prev != null) { + InjectionPointProvider.CURRENT.set(prev); + } else { + InjectionPointProvider.CURRENT.remove(); + } + } return instance; } private Set<InjectableBean<?>> beans() { - return beans != null ? beans : resolve(); + return resolvedBeans != null ? resolvedBeans : resolve(); } private Set<InjectableBean<?>> resolve() { - return ArcContainerImpl.instance().getResolvedBeans(type, qualifiers.toArray(EMPTY_ANNOTATION_ARRAY)); + return ArcContainerImpl.instance().getResolvedBeans(requiredType, requiredQualifiers.toArray(EMPTY_ANNOTATION_ARRAY)); } class InstanceIterator implements Iterator<T> { @@ -170,4 +194,14 @@ public T next() { } + private static Type getRequiredType(Type type) { + if (type instanceof ParameterizedType) { + ParameterizedType parameterizedType = (ParameterizedType) type; + if (Provider.class.isAssignableFrom(Types.getRawType(parameterizedType.getRawType()))) { + return parameterizedType.getActualTypeArguments()[0]; + } + } + throw new IllegalArgumentException("Not a valid type: " + type); + } + } diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceProvider.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceProvider.java index 7a6fe1a8bcd..6605ccaa0bc 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceProvider.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceProvider.java @@ -17,6 +17,7 @@ package io.quarkus.arc; import java.lang.annotation.Annotation; +import java.lang.reflect.Member; import java.lang.reflect.Type; import java.util.Set; import javax.enterprise.context.spi.CreationalContext; @@ -29,17 +30,26 @@ public class InstanceProvider<T> implements InjectableReferenceProvider<Instance<T>> { private final Type requiredType; - private final Set<Annotation> qualifiers; + private final InjectableBean<?> targetBean; + private final Set<Annotation> annotations; + private final Member javaMember; + private final int position; - public InstanceProvider(Type type, Set<Annotation> qualifiers) { + public InstanceProvider(Type type, Set<Annotation> qualifiers, InjectableBean<?> targetBean, Set<Annotation> annotations, + Member javaMember, int position) { this.requiredType = type; this.qualifiers = qualifiers; + this.targetBean = targetBean; + this.annotations = annotations; + this.javaMember = javaMember; + this.position = position; } @Override public Instance<T> get(CreationalContext<Instance<T>> creationalContext) { - return new InstanceImpl<T>(requiredType, qualifiers, CreationalContextImpl.unwrap(creationalContext)); + return new InstanceImpl<T>(targetBean, requiredType, qualifiers, CreationalContextImpl.unwrap(creationalContext), + annotations, javaMember, position); } } diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/metadata/InjectionPointMetadataTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/metadata/InjectionPointMetadataTest.java index c935d56ea7e..ab60da7613e 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/metadata/InjectionPointMetadataTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/metadata/InjectionPointMetadataTest.java @@ -27,12 +27,14 @@ import java.util.Set; import javax.enterprise.context.Dependent; import javax.enterprise.inject.Default; +import javax.enterprise.inject.Instance; import javax.enterprise.inject.spi.AnnotatedConstructor; import javax.enterprise.inject.spi.AnnotatedField; import javax.enterprise.inject.spi.AnnotatedParameter; import javax.enterprise.inject.spi.Bean; import javax.enterprise.inject.spi.BeanManager; import javax.enterprise.inject.spi.InjectionPoint; +import javax.enterprise.util.TypeLiteral; import javax.inject.Inject; import javax.inject.Singleton; import org.junit.Rule; @@ -43,7 +45,7 @@ public class InjectionPointMetadataTest { @Rule public ArcTestContainer container = new ArcTestContainer(Controller.class, Controlled.class); - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes", "serial" }) @Test public void testInjectionPointMetadata() { ArcContainer arc = Arc.container(); @@ -83,7 +85,7 @@ public void testInjectionPointMetadata() { // Constructor InjectionPoint ctorInjectionPoint = controller.controlledCtor.injectionPoint; assertNotNull(ctorInjectionPoint); - assertEquals(Controlled.class, methodInjectionPoint.getType()); + assertEquals(Controlled.class, ctorInjectionPoint.getType()); assertTrue(ctorInjectionPoint.getAnnotated() instanceof AnnotatedParameter); assertEquals(bean, ctorInjectionPoint.getBean()); AnnotatedParameter<Controller> ctorParam = (AnnotatedParameter<Controller>) ctorInjectionPoint.getAnnotated(); @@ -94,6 +96,27 @@ public void testInjectionPointMetadata() { assertEquals(1, ctorParam.getAnnotations().size()); assertTrue(ctorParam.getDeclaringCallable() instanceof AnnotatedConstructor); assertEquals(Controller.class, ctorParam.getDeclaringCallable().getJavaMember().getDeclaringClass()); + + // Instance + InjectionPoint instanceInjectionPoint = controller.instanceControlled.get().injectionPoint; + assertNotNull(instanceInjectionPoint); + assertEquals(Controlled.class, instanceInjectionPoint.getType()); + qualifiers = instanceInjectionPoint.getQualifiers(); + assertEquals(1, qualifiers.size()); + assertEquals(Default.class, qualifiers.iterator().next().annotationType()); + bean = instanceInjectionPoint.getBean(); + assertNotNull(bean); + assertTrue(bean.getTypes().stream().anyMatch(t -> t.equals(Controller.class))); + assertNotNull(instanceInjectionPoint.getAnnotated()); + assertTrue(instanceInjectionPoint.getAnnotated() instanceof AnnotatedField); + annotatedField = (AnnotatedField) instanceInjectionPoint.getAnnotated(); + assertEquals("instanceControlled", annotatedField.getJavaMember().getName()); + assertEquals(new TypeLiteral<Instance<Controlled>>() { + }.getType(), annotatedField.getBaseType()); + assertTrue(annotatedField.isAnnotationPresent(Inject.class)); + assertTrue(annotatedField.getAnnotation(Singleton.class) == null); + assertTrue(annotatedField.getAnnotations(Singleton.class).isEmpty()); + assertEquals(1, annotatedField.getAnnotations().size()); } @Singleton @@ -106,6 +129,9 @@ static class Controller { Controlled controlledCtor; + @Inject + Instance<Controlled> instanceControlled; + @Inject public Controller(BeanManager beanManager, @Singleton Controlled controlled) { this.controlledCtor = controlled;
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ObserverGenerator.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/CurrentInjectionPointProvider.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceProvider.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/metadata/InjectionPointMetadataTest.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/BeanManagerImpl.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InstanceImpl.java']
{'.java': 8}
8
8
0
0
8
3,423,683
670,605
89,368
872
36,124
5,391
510
7
873
79
200
21
3
2
"2019-03-28T18:16:57"
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,298
quarkusio/quarkus/1798/1589
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1589
https://github.com/quarkusio/quarkus/pull/1798
https://github.com/quarkusio/quarkus/pull/1798
1
resolves
vert.x web extension does not support RX routing context
The vert.x web extension does not currently support the reactive version of the RoutingContext. Code such as ; ``` ... import io.vertx.reactivex.ext.web.RoutingContext; ... public class SimpleResource { @Route(path = "/simple", methods = GET) void getSimple(RoutingContext context) { ... } } ``` fails with; ``` [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:build (default) on project vertx-web-quarkus: 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.arc.deployment.ArcAnnotationProcessor#build threw an exception: java.lang.IllegalStateException: Route handler business method must accept exactly one parameter of type RoutingContext/RoutingExchange: [io.vertx.reactivex.ext.web.RoutingContext] [method: void getSimple(io.vertx.reactivex.ext.web.RoutingContext context), bean:CLASS bean [types=[io.quarkus.test.SimpleResource, java.lang.Object], qualifiers=[@Default, @Any], target=io.quarkus.test.SimpleResource] ``` We should either; 1) support both `io.vertx.reactivex.ext.web.RoutingContext` and `io.vertx.ext.web.RoutingContext` or 2) Raise a warning if `io.vertx.reactivex.ext.web.RoutingContext` is passed as a `@Route` method parameter type
55a5c1d85201dbca752a338d0ed9119142be7bcb
cc8425d880c7d3f56343700a0cca2cc5e0f09416
https://github.com/quarkusio/quarkus/compare/55a5c1d85201dbca752a338d0ed9119142be7bcb...cc8425d880c7d3f56343700a0cca2cc5e0f09416
diff --git a/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java b/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java index 5e540cb7dbf..928f3720c50 100644 --- a/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java +++ b/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java @@ -171,13 +171,13 @@ public void validate(ValidationContext validationContext) { if (params.size() > 1 || (params.size() == 1 && !params.get(0).equals(SCHEDULED_EXECUTION_TYPE))) { throw new IllegalStateException(String.format( - "Invalid scheduled business method parameters %s [method: %s, bean:%s", params, + "Invalid scheduled business method parameters %s [method: %s, bean: %s]", params, method, bean)); } if (!method.returnType().kind().equals(Type.Kind.VOID)) { throw new IllegalStateException( - String.format("Scheduled business method must return void [method: %s, bean:%s", - method.returnType(), method, bean)); + String.format("Scheduled business method must return void [method: %s, bean: %s]", + method, bean)); } // Validate cron() and every() expressions for (AnnotationInstance scheduled : schedules) { 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 3a97636f25d..bc078ea639d 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 @@ -64,6 +64,8 @@ class VertxWebProcessor { private static final DotName ROUTE = DotName.createSimple(Route.class.getName()); private static final DotName ROUTES = DotName.createSimple(Route.Routes.class.getName()); private static final DotName ROUTING_CONTEXT = DotName.createSimple(RoutingContext.class.getName()); + private static final DotName RX_ROUTING_CONTEXT = DotName + .createSimple(io.vertx.reactivex.ext.web.RoutingContext.class.getName()); private static final DotName ROUTING_EXCHANGE = DotName.createSimple(RoutingExchange.class.getName()); private static final String HANDLER_SUFFIX = "_RouteHandler"; @@ -93,13 +95,13 @@ public void validate(ValidationContext validationContext) { List<AnnotationInstance> routes = new LinkedList<>(); AnnotationInstance routeAnnotation = annotationStore.getAnnotation(method, ROUTE); if (routeAnnotation != null) { - validateMethodParameters(bean, method); + validateMethod(bean, method); routes.add(routeAnnotation); } if (routes.isEmpty()) { AnnotationInstance routesAnnotation = annotationStore.getAnnotation(method, ROUTES); if (routesAnnotation != null) { - validateMethodParameters(bean, method); + validateMethod(bean, method); Collections.addAll(routes, routesAnnotation.value().asNestedArray()); } } @@ -169,12 +171,23 @@ public void transform(TransformationContext context) { }); } - private void validateMethodParameters(BeanInfo bean, MethodInfo method) { + private void validateMethod(BeanInfo bean, MethodInfo method) { + if (!method.returnType().kind().equals(Type.Kind.VOID)) { + throw new IllegalStateException( + String.format("Route handler business method must return void [method: %s, bean: %s]", method, bean)); + } List<Type> params = method.parameters(); - if (params.size() != 1 - || !(params.get(0).name().equals(ROUTING_CONTEXT) || params.get(0).name().equals(ROUTING_EXCHANGE))) { + boolean hasInvalidParam = true; + if (params.size() == 1) { + DotName paramTypeName = params.get(0).name(); + if (ROUTING_CONTEXT.equals(paramTypeName) || RX_ROUTING_CONTEXT.equals(paramTypeName) + || ROUTING_EXCHANGE.equals(paramTypeName)) { + hasInvalidParam = false; + } + } + if (hasInvalidParam) { throw new IllegalStateException(String.format( - "Route handler business method must accept exactly one parameter of type RoutingContext/RoutingExchange: %s [method: %s, bean:%s", + "Route handler business method must accept exactly one parameter of type RoutingContext/RoutingExchange: %s [method: %s, bean: %s]", params, method, bean)); } } @@ -223,6 +236,12 @@ private String generateHandler(BeanInfo bean, MethodInfo method, ClassOutput cla paramHandle = invoke.getMethodParam(0); methodDescriptor = MethodDescriptor.ofMethod(bean.getImplClazz().name().toString(), method.name(), void.class, RoutingContext.class); + } else if (method.parameters().get(0).name().equals(RX_ROUTING_CONTEXT)) { + paramHandle = invoke.newInstance( + MethodDescriptor.ofConstructor(io.vertx.reactivex.ext.web.RoutingContext.class, RoutingContext.class), + invoke.getMethodParam(0)); + methodDescriptor = MethodDescriptor.ofMethod(bean.getImplClazz().name().toString(), method.name(), void.class, + io.vertx.reactivex.ext.web.RoutingContext.class); } else { paramHandle = invoke.newInstance(MethodDescriptor.ofConstructor(RoutingExchangeImpl.class, RoutingContext.class), invoke.getMethodParam(0)); diff --git a/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/SimpleRouteTest.java b/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/SimpleRouteTest.java index f82b0d83ae6..49e0bcc9c02 100644 --- a/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/SimpleRouteTest.java +++ b/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/SimpleRouteTest.java @@ -33,6 +33,7 @@ public class SimpleRouteTest { @Test public void testSimpleRoute() { RestAssured.when().get("/hello").then().statusCode(200).body(is("Hello world!")); + RestAssured.when().get("/rx-hello").then().statusCode(200).body(is("Hello world!")); RestAssured.when().get("/bzuk").then().statusCode(200).body(is("Hello world!")); RestAssured.when().get("/hello-event-bus?name=ping").then().statusCode(200).body(is("Hello PING!")); RestAssured.when().get("/foo?name=foo").then().statusCode(200).body(is("Hello foo!")); @@ -52,6 +53,12 @@ void hello(RoutingContext context) { context.response().setStatusCode(200).end("Hello " + (name != null ? name : "world") + "!"); } + @Route(path = "/rx-hello") + void rxHello(io.vertx.reactivex.ext.web.RoutingContext context) { + String name = context.request().getParam("name"); + context.response().setStatusCode(200).end("Hello " + (name != null ? name : "world") + "!"); + } + @Route(path = "/bzuk") void bzuk(RoutingExchange exchange) { exchange.ok("Hello " + exchange.getParam("name").orElse("world") + "!"); 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 b3b64fb0d0a..6112fb2665f 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 @@ -14,8 +14,8 @@ /** * Annotation used to configure a {@link io.quarkus.vertx.web.Route} in a declarative way. - * - * The target business method must accept exacly one argument of type {@link RoutingContext}. + * <p> + * The target business method must return {@code void} and accept exacly one argument of type {@link RoutingContext}. */ @Repeatable(Routes.class) @Retention(RetentionPolicy.RUNTIME)
['extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/VertxWebProcessor.java', 'extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/Route.java', 'extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/SimpleRouteTest.java', 'extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java']
{'.java': 4}
4
4
0
0
4
3,489,293
683,232
91,089
892
3,071
563
41
3
1,362
136
315
28
0
2
"2019-04-01T13:58:21"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,297
quarkusio/quarkus/1838/1832
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1832
https://github.com/quarkusio/quarkus/pull/1838
https://github.com/quarkusio/quarkus/pull/1838
1
resolves
NPE from ArcAnnotationProcessor when default value() is used
Hello @mkouba , This is in regards to the issue we discussed today on Zulip. After using `jandex-maven-plugin` to generate `META-INF/jandex.idx` I'm getting errors from all my tests. Maven plugin I used: ```xml <plugin> <groupId>org.jboss.jandex</groupId> <artifactId>jandex-maven-plugin</artifactId> <version>1.0.5</version> <executions> <execution> <id>make-index</id> <goals> <goal>jandex</goal> </goals> </execution> </executions> </plugin> ``` And the stack trace I'm getting is: ```plain Caused by: java.lang.NullPointerException: Value not set for java.lang.Class<? extends akka.actor.Actor> value() at io.quarkus.arc.processor.AnnotationLiteralProcessor.process(AnnotationLiteralProcessor.java:92) at io.quarkus.arc.processor.BeanGenerator.initConstructor(BeanGenerator.java:624) at io.quarkus.arc.processor.BeanGenerator.createConstructor(BeanGenerator.java:513) at io.quarkus.arc.processor.BeanGenerator.generateProducerMethodBean(BeanGenerator.java:371) at io.quarkus.arc.processor.BeanGenerator.generate(BeanGenerator.java:124) at io.quarkus.arc.processor.BeanProcessor.process(BeanProcessor.java:186) at io.quarkus.arc.deployment.ArcAnnotationProcessor.build(ArcAnnotationProcessor.java:259) ``` The source code (at revision with jandex failure): https://github.com/sarxos/abberwoult/tree/00dd5d0a182f8ea85657044a4e4a228a7d828756 The problematic annotation is this buddy here: ```java @Qualifier @Documented @Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME) public @interface ActorByClass { final Class<? extends Actor> NO_CLASS = Actor.class; @Nonbinding Class<? extends Actor> value() default Actor.class; } ``` After you suggested to override jandex dependency in corresponding maven plugin to 2.1.1.Final all tests are again passing, which proves that `jandex-maven-plugin` uses outdated dependency. The workarounds so far: 1) Use empty `META-INF/beans.xml` instead of `jandex-maven-plugin`, or 2) Force newer (2.1.1.Final) jandex dependency in `jandex-maven-plugin`: ```xml <plugin> <groupId>org.jboss.jandex</groupId> <artifactId>jandex-maven-plugin</artifactId> <version>1.0.5</version> <executions> <execution> <id>make-index</id> <goals> <goal>jandex</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>org.jboss</groupId> <artifactId>jandex</artifactId> <version>2.1.1.Final</version> </dependency> </dependencies> </plugin> ```
7bdf82ec267b303e776f71cf2a3722252cd7ade8
9b4520f1a19dbe5c18b5f5e1f97ed671e8c2ed06
https://github.com/quarkusio/quarkus/compare/7bdf82ec267b303e776f71cf2a3722252cd7ade8...9b4520f1a19dbe5c18b5f5e1f97ed671e8c2ed06
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 efbb6c1ffe3..d1ad9fa9aa9 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 @@ -29,7 +29,6 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.Enumeration; import java.util.HashSet; import java.util.List; @@ -64,6 +63,9 @@ public class ApplicationArchiveBuildStep { private static final String JANDEX_INDEX = "META-INF/jandex.idx"; + // At least Jandex 2.1 is needed + private static final int REQUIRED_INDEX_VERSION = 8; + IndexDependencyConfiguration config; @ConfigRoot(phase = ConfigPhase.BUILD_TIME) @@ -162,7 +164,6 @@ private static Collection<? extends Path> getMarkerFilePaths(ClassLoader classLo ret.add(urlToPath(url)); } } - return ret; } @@ -187,11 +188,19 @@ private static Index handleFilePath(Path path) throws IOException { Path existing = path.resolve(JANDEX_INDEX); if (Files.exists(existing)) { try (FileInputStream in = new FileInputStream(existing.toFile())) { - IndexReader r = new IndexReader(in); - return r.read(); + 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 indexFilePath(path); + } else { + return reader.read(); + } } } + return indexFilePath(path); + } + private static Index indexFilePath(Path path) throws IOException { Indexer indexer = new Indexer(); try (Stream<Path> stream = Files.walk(path)) { stream.forEach(path1 -> { @@ -208,23 +217,32 @@ private static Index handleFilePath(Path path) throws IOException { } private static Index handleJarPath(Path path) throws IOException { - Indexer indexer = new Indexer(); try (JarFile file = new JarFile(path.toFile())) { ZipEntry existing = file.getEntry(JANDEX_INDEX); if (existing != null) { try (InputStream in = file.getInputStream(existing)) { - IndexReader r = new IndexReader(in); - return r.read(); + 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); + } + } - Enumeration<JarEntry> e = file.entries(); - while (e.hasMoreElements()) { - JarEntry entry = e.nextElement(); - if (entry.getName().endsWith(".class")) { - try (InputStream inputStream = file.getInputStream(entry)) { - indexer.index(inputStream); - } + private static Index indexJar(JarFile file) throws IOException { + Indexer indexer = new Indexer(); + Enumeration<JarEntry> e = file.entries(); + while (e.hasMoreElements()) { + JarEntry entry = e.nextElement(); + if (entry.getName().endsWith(".class")) { + try (InputStream inputStream = file.getInputStream(entry)) { + indexer.index(inputStream); } } } diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralGenerator.java index b1b8a9b71d9..4c8fd622a36 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralGenerator.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralGenerator.java @@ -46,7 +46,6 @@ import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.jboss.jandex.MethodInfo; -import org.jboss.jandex.PrimitiveType; import org.jboss.jandex.Type; import org.jboss.logging.Logger; @@ -114,14 +113,10 @@ static void createSharedAnnotationLiteral(ClassOutput classOutput, Key key, Lite } static void createAnnotationLiteral(ClassOutput classOutput, ClassInfo annotationClass, - AnnotationInstance annotationInstance, String literalName) { - createAnnotationLiteral(classOutput, annotationClass, annotationInstance.values(), literalName); - } - - static void createAnnotationLiteral(ClassOutput classOutput, ClassInfo annotationClass, List<AnnotationValue> values, + AnnotationInstance annotationInstance, String literalName) { - Map<String, AnnotationValue> annotationValues = values.stream() + Map<String, AnnotationValue> annotationValues = annotationInstance.values().stream() .collect(Collectors.toMap(AnnotationValue::name, Function.identity())); // Ljavax/enterprise/util/AnnotationLiteral<Lcom/foo/MyQualifier;>;Lcom/foo/MyQualifier; @@ -142,45 +137,12 @@ static void createAnnotationLiteral(ClassOutput classOutput, ClassInfo annotatio if (value == null) { value = method.defaultValue(); } - ResultHandle retValue = null; if (value == null) { - switch (method.returnType().kind()) { - case CLASS: - case ARRAY: - retValue = valueMethod.loadNull(); - break; - case PRIMITIVE: - PrimitiveType primitiveType = method.returnType().asPrimitiveType(); - switch (primitiveType.primitive()) { - case BOOLEAN: - retValue = valueMethod.load(false); - break; - case BYTE: - case SHORT: - case INT: - retValue = valueMethod.load(0); - break; - case LONG: - retValue = valueMethod.load(0L); - break; - case FLOAT: - retValue = valueMethod.load(0.0f); - break; - case DOUBLE: - retValue = valueMethod.load(0.0d); - break; - case CHAR: - retValue = valueMethod.load('\\u0000'); - break; - } - break; - default: - break; - } - } else { - retValue = loadValue(valueMethod, value, annotationClass, method); + throw new IllegalStateException(String.format( + "Value is not set for %s.%s(). Most probably an older version of Jandex was used to index an application dependency. Make sure that Jandex 2.1+ is used.", + method.declaringClass().name(), method.name())); } - valueMethod.returnValue(retValue); + valueMethod.returnValue(loadValue(valueMethod, value, annotationClass, method)); } annotationLiteral.close(); LOGGER.debugf("Annotation literal generated: %s", literalName); diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralProcessor.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralProcessor.java index a37559f21f0..8c6d0436b88 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralProcessor.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralProcessor.java @@ -89,7 +89,9 @@ ResultHandle process(BytecodeCreator bytecode, ClassOutput classOutput, ClassInf value = method.defaultValue(); } if (value == null) { - throw new NullPointerException("Value not set for " + method); + throw new IllegalStateException(String.format( + "Value is not set for %s.%s(). Most probably an older version of Jandex was used to index an application dependency. Make sure that Jandex 2.1+ is used.", + method.declaringClass().name(), method.name())); } ResultHandle retValue = AnnotationLiteralGenerator.loadValue(bytecode, value, annotationClass, method); constructorParams[iterator.previousIndex()] = retValue;
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralGenerator.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AnnotationLiteralProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java']
{'.java': 3}
3
3
0
0
3
3,516,773
688,779
91,848
901
5,289
846
100
3
2,639
193
679
87
1
4
"2019-04-03T09:51:53"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,278
quarkusio/quarkus/2669/2626
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2626
https://github.com/quarkusio/quarkus/pull/2669
https://github.com/quarkusio/quarkus/pull/2669
1
resolves
New NullPointerException on generic injection with quarkus-arc
**Describe the bug** Following the #2566 issue correction on master, I tested again generics injection on a real project with a snapshot version of quarkus. The #2566 issue is fixed, but I still have an issue (NPE) with a more complex generics injection case (which works with Weld). **Expected behavior** I expect injections to work with generics. **Actual behavior** ``` 2019-05-29 01:23:23,265 ERROR [io.und.request] (executor-thread-1) UT005023: Exception handling request to /cars: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException 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:85) 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 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.lang.NullPointerException at com.gwenneg.City.add(City.java:11) at com.gwenneg.CarResource.addCar(CarResource.java:17) at com.gwenneg.CarResource_ClientProxy.addCar(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) ... 53 more ``` **To Reproduce** Steps to reproduce the behavior: 1. Clone https://github.com/gwenneg/quarkus-unsatisfied-dependency 2. Run the `./gradlew quarkusDev` or `./mvnw compile quarkus:dev` command 3. Call the endpoint using `http://localhost:8080/cars` **Environment:** Output of java -version: openjdk version "11" 2018-09-25 Quarkus version or git rev: master (4f81b765344571f2f72d2bb68c7faee61f483769)
2d81040002169b05d415b1fa92d7464e414fee97
d71636345d0980353ecc1be6fcd75a62948f9eec
https://github.com/quarkusio/quarkus/compare/2d81040002169b05d415b1fa92d7464e414fee97...d71636345d0980353ecc1be6fcd75a62948f9eec
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 b19ba123cb1..b2c276ddeec 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 @@ -35,7 +35,6 @@ import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Collection; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -46,7 +45,6 @@ import org.jboss.jandex.FieldInfo; import org.jboss.jandex.MethodInfo; import org.jboss.jandex.Type; -import org.jboss.jandex.TypeVariable; /** * @@ -210,29 +208,17 @@ Collection<MethodInfo> getDelegatingMethods(BeanInfo bean) { if (bean.isClassBean()) { Methods.addDelegatingMethods(bean.getDeployment().getIndex(), bean.getTarget().get().asClass(), - Collections.emptyMap(), methods); + methods); } else if (bean.isProducerMethod()) { MethodInfo producerMethod = bean.getTarget().get().asMethod(); - Map<TypeVariable, Type> resolved = Collections.emptyMap(); ClassInfo returnTypeClass = bean.getDeployment().getIndex().getClassByName(producerMethod.returnType().name()); - if (!returnTypeClass.typeParameters().isEmpty() && !Modifier.isInterface(returnTypeClass.flags())) { - // Build the resolved map iff the return type is a parameterized class - resolved = Types.buildResolvedMap(producerMethod.returnType().asParameterizedType().arguments(), - returnTypeClass.typeParameters(), - Collections.emptyMap()); - } - Methods.addDelegatingMethods(bean.getDeployment().getIndex(), returnTypeClass, resolved, methods); + Methods.addDelegatingMethods(bean.getDeployment().getIndex(), returnTypeClass, methods); } else if (bean.isProducerField()) { FieldInfo producerField = bean.getTarget().get().asField(); - Map<TypeVariable, Type> resolved = Collections.emptyMap(); ClassInfo fieldClass = bean.getDeployment().getIndex().getClassByName(producerField.type().name()); - if (!fieldClass.typeParameters().isEmpty()) { - resolved = Types.buildResolvedMap(producerField.type().asParameterizedType().arguments(), - fieldClass.typeParameters(), Collections.emptyMap()); - } - Methods.addDelegatingMethods(bean.getDeployment().getIndex(), fieldClass, resolved, methods); + Methods.addDelegatingMethods(bean.getDeployment().getIndex(), fieldClass, methods); } else if (bean.isSynthetic()) { - Methods.addDelegatingMethods(bean.getDeployment().getIndex(), bean.getImplClazz(), Collections.emptyMap(), methods); + Methods.addDelegatingMethods(bean.getDeployment().getIndex(), bean.getImplClazz(), methods); } return methods.values(); } 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 4a247131663..1e2c7758629 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 @@ -55,8 +55,7 @@ private static List<String> initIgnoredMethods() { private Methods() { } - static void addDelegatingMethods(IndexView index, ClassInfo classInfo, Map<TypeVariable, Type> resolvedTypeParameters, - Map<Methods.MethodKey, MethodInfo> methods) { + static void addDelegatingMethods(IndexView index, ClassInfo classInfo, Map<Methods.MethodKey, MethodInfo> methods) { // TODO support interfaces default methods if (classInfo != null) { for (MethodInfo method : classInfo.methods()) { @@ -68,7 +67,7 @@ static void addDelegatingMethods(IndexView index, ClassInfo classInfo, Map<TypeV Type returnType = key.method.returnType(); Type[] params = new Type[key.method.parameters().size()]; for (int i = 0; i < params.length; i++) { - params[i] = resolveType(key.method.parameters().get(i), resolvedTypeParameters); + params[i] = key.method.parameters().get(i); } List<TypeVariable> typeVariables = key.method.typeParameters(); return MethodInfo.create(classInfo, key.method.name(), params, returnType, key.method.flags(), @@ -81,24 +80,14 @@ static void addDelegatingMethods(IndexView index, ClassInfo classInfo, Map<TypeV ClassInfo interfaceClassInfo = index.getClassByName(interfaceType.name()); if (interfaceClassInfo != null) { Map<TypeVariable, Type> resolved = Collections.emptyMap(); - if (org.jboss.jandex.Type.Kind.PARAMETERIZED_TYPE.equals(interfaceType.kind())) { - resolved = Types.buildResolvedMap(interfaceType.asParameterizedType().arguments(), - interfaceClassInfo.typeParameters(), - resolvedTypeParameters); - } - addDelegatingMethods(index, interfaceClassInfo, resolved, methods); + addDelegatingMethods(index, interfaceClassInfo, methods); } } if (classInfo.superClassType() != null) { ClassInfo superClassInfo = index.getClassByName(classInfo.superName()); if (superClassInfo != null) { Map<TypeVariable, Type> resolved = Collections.emptyMap(); - if (org.jboss.jandex.Type.Kind.PARAMETERIZED_TYPE.equals(classInfo.superClassType().kind())) { - resolved = Types.buildResolvedMap(classInfo.superClassType().asParameterizedType().arguments(), - superClassInfo.typeParameters(), - resolvedTypeParameters); - } - addDelegatingMethods(index, superClassInfo, resolved, methods); + addDelegatingMethods(index, superClassInfo, methods); } } } diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java index 8d90422e782..80286df087b 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java @@ -153,8 +153,8 @@ public T getParam() { return param; } - public String ping(T param) { - return param.ping().toString(); + public String ping(T unusedParam) { + return this.param.ping().toString(); } }
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java']
{'.java': 3}
3
3
0
0
3
3,994,396
779,215
103,729
1,006
3,206
542
41
2
9,695
290
2,128
107
2
1
"2019-05-31T09:18:48"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,279
quarkusio/quarkus/2654/1998
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1998
https://github.com/quarkusio/quarkus/pull/2654
https://github.com/quarkusio/quarkus/pull/2654
1
fixes
Improve error message of quarkus:dev if project is empty
Creates an empty project, without any sources or resources and run: ``` mvn compile quarkus:dev ... [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.13.1:dev (default-cli) on project async-demo: The project has no output yet, run `mvn compile quarkus:dev`. -> [Help 1] ``` Either the error messages must be updated to mention that the project must at least contain 1 file, or it should run and waits until we have content.
8af509afc540c689a361f5c7584f52ad58e05457
219e2e54331edb80d0ba55ec9e8da8eed8b187c3
https://github.com/quarkusio/quarkus/compare/8af509afc540c689a361f5c7584f52ad58e05457...219e2e54331edb80d0ba55ec9e8da8eed8b187c3
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 1ca9e72125c..3924ec3867f 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -186,7 +186,8 @@ public void execute() throws MojoFailureException, MojoExecutionException { } if (!buildDir.isDirectory() || !new File(buildDir, "classes").isDirectory()) { - throw new MojoFailureException("The project has no output yet, run `mvn compile quarkus:dev`."); + throw new MojoFailureException("The project " + project.getName() + + " has no output yet. Make sure it contains at least one source or resource file and then run `mvn compile quarkus:dev`."); } try {
['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java']
{'.java': 1}
1
1
0
0
1
3,996,088
779,378
103,766
1,006
334
73
3
1
448
68
117
9
0
1
"2019-05-30T12:41:51"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,280
quarkusio/quarkus/2619/2618
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2618
https://github.com/quarkusio/quarkus/pull/2619
https://github.com/quarkusio/quarkus/pull/2619
1
fixes
Hot reload with context propagation/quarkus-smallrye-reactive-messaging-kafka fails
**Describe the bug** After a reload, an application that uses quarkus-smallrye-reactive-messaging-kafka fails with https://gist.github.com/michalszynkiewicz/c71dba7a6f3d10b54adc3b2e2406a603 **Expected behavior** The application should be reloaded **Actual behavior** An app that uses smallrye-reactive-messaging-kafka fails to reload when working with mvn quarkus:dev. Instead it throws: https://gist.github.com/michalszynkiewicz/c71dba7a6f3d10b54adc3b2e2406a603 Changing the `SmallRyeContextPropagationTemplate#configureStaticInit` to: https://gist.github.com/michalszynkiewicz/eec489d443a675556ab5c95e0c728071 makes the app restart properly. **To Reproduce** Steps to reproduce the behavior: ``` mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create -DprojectGroupId=com.example -DprojectArtifactId=reproducer -DclassName=com.example.ads.AdResource -Dpath=/ads -Dextensions=quarkus-smallrye-reactive-messaging-kafka,io.quarkus:quarkus-smallrye-reactive-messaging,quarkus-hibernate-orm-panache cd reproducer; mvn clean compile quarkus:dev ``` in another konsole: ``` sed -e '13a ;' -i src/main/java/com/example/ads/AdResource.java # or modify the fline somehow if you don't have sed curl localhost:8080/ads ``` **Environment (please complete the following information):** - Output of `uname -a` or `ver`: Linux t580 5.0.16-200.fc29.x86_64 #1 SMP Tue May 14 18:27:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux - Output of `java -version`: ``` java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) ``` - GraalVM version (if different from Java): not applicable - Quarkus version or git rev: f438459b065eb9a5feed44270d08edd811024abd **Additional context** (Add any other context about the problem here.)
99ccbad39011cdee19aa422a80e48fea3861905f
0d988cda177e14cb517abe810c49afa06df44daa
https://github.com/quarkusio/quarkus/compare/99ccbad39011cdee19aa422a80e48fea3861905f...0d988cda177e14cb517abe810c49afa06df44daa
diff --git a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java index d6d4a48b668..ed25b18ed81 100644 --- a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java +++ b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java @@ -23,10 +23,14 @@ public class SmallRyeContextPropagationTemplate { public void configureStaticInit(List<ThreadContextProvider> discoveredProviders, List<ContextManagerExtension> discoveredExtensions) { // build the manager at static init time - ContextManagerProvider contextManagerProvider = new SmallRyeContextManagerProvider(); - ContextManagerProvider.register(contextManagerProvider); + // in the live-reload mode, the provider instance may be already set in the previous start + if (ContextManagerProvider.INSTANCE.get() == null) { + ContextManagerProvider contextManagerProvider = new SmallRyeContextManagerProvider(); + ContextManagerProvider.register(contextManagerProvider); + } + // do what config we can here, but we need the runtime executor service to finish - builder = (SmallRyeContextManager.Builder) contextManagerProvider + builder = (SmallRyeContextManager.Builder) ContextManagerProvider.instance() .getContextManagerBuilder(); builder.withThreadContextProviders(discoveredProviders.toArray(new ThreadContextProvider[0])); builder.withContextManagerExtensions(discoveredExtensions.toArray(new ContextManagerExtension[0]));
['extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java']
{'.java': 1}
1
1
0
0
1
3,905,234
761,214
101,180
986
665
117
10
1
1,865
175
566
45
3
3
"2019-05-28T10:04:22"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,281
quarkusio/quarkus/2601/2511
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2511
https://github.com/quarkusio/quarkus/pull/2601
https://github.com/quarkusio/quarkus/pull/2601
1
fixes
Swagger-ui webjar not found in gradle setup
Hi there, i'm trying to add swagger ui to my kotlin/gradle quarkus project (yeah, testing your non java/maven support to the bones ;-)). Sadly, when i start the app in dev mode, i get an error. Basic project setup: * build.gradle.kts ** quarkus dirs and 0.15.0 dependencies set up and working ** add api("io.quarkus:quarkus-swagger-ui") What do i see? * "gradle build quarkusDev" reports: ``` Caused by: java.lang.RuntimeException: Could not resolve artifact org.webjars:swagger-ui:null. Please make sure it is present and contains a META-INF/MANIFEST.MF file. Note that artifacts that are part of the same project may not always be resolvable, in this case you should generate a META-INF/jandex.idx file instead using the Jandex Maven plugin. at io.quarkus.deployment.index.ClassPathArtifactResolver.getArtifact(ClassPathArtifactResolver.java:93) at io.quarkus.swaggerui.deployment.SwaggerUiProcessor.getSwaggerUiArtifact(SwaggerUiProcessor.java:118) at io.quarkus.swaggerui.deployment.SwaggerUiProcessor.registerSwaggerUiServletExtension(SwaggerUiProcessor.java:98) ``` What did i try? * switch between implementation and api source sets * adding api("org.webjars:swagger-ui:3.22.1") manually * constraining the swagger-ui version * verify the webjars-jar exists under .gradle/lib (it does!) Nothing seems to help :-( Any idea what might be wrong here?
8cf25bf646a2a89ac05ed1219fc1188bc70b4d0c
4083aff57c5fe775be57c3260098390cb3613af3
https://github.com/quarkusio/quarkus/compare/8cf25bf646a2a89ac05ed1219fc1188bc70b4d0c...4083aff57c5fe775be57c3260098390cb3613af3
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/index/ClassPathArtifactResolver.java b/core/deployment/src/main/java/io/quarkus/deployment/index/ClassPathArtifactResolver.java index 64f2aeafae7..c0404266de3 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/index/ClassPathArtifactResolver.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/index/ClassPathArtifactResolver.java @@ -23,8 +23,10 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Arrays; import java.util.Enumeration; import java.util.List; +import java.util.function.BiFunction; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -58,18 +60,81 @@ public ClassPathArtifactResolver(ClassLoader classLoader) { @Override public ResolvedArtifact getArtifact(String groupId, String artifactId, String classifier) { + Pattern filePatten; if (classifier == null || classifier.isEmpty()) { filePatten = Pattern.compile(artifactId + "-(\\\\d.*)\\\\.jar"); } else { filePatten = Pattern.compile(artifactId + "-" + classifier + "-(\\\\d.*)\\\\.jar"); } + List<BiFunction<StoredUrl, Matcher, ResolvedArtifact>> resolvers = createResolvers(groupId, artifactId, classifier); for (StoredUrl url : pathList) { + Matcher matcher = filePatten.matcher(url.fileName); if (matcher.matches()) { + for (BiFunction<StoredUrl, Matcher, ResolvedArtifact> resolver : resolvers) { + ResolvedArtifact result = resolver.apply(url, matcher); + if (result != null) { + return result; + } + } + } + + } + throw new RuntimeException("Could not resolve artifact " + groupId + ":" + artifactId + ":" + classifier + + ". Please make sure it is present and contains a META-INF/MANIFEST.MF file. Note that artifacts that are part of the same project may not always be resolvable, in this case you should generate a META-INF/jandex.idx file instead using the Jandex Maven plugin."); + } + + private List<BiFunction<StoredUrl, Matcher, ResolvedArtifact>> createResolvers(String groupId, String artifactId, + String classifier) { + return Arrays.asList(createMavenResolver(groupId, artifactId, classifier), + createGradleResolver(groupId, artifactId, classifier)); + } + + private BiFunction<StoredUrl, Matcher, ResolvedArtifact> createGradleResolver(String groupId, String artifactId, + String classifier) { + return new BiFunction<StoredUrl, Matcher, ResolvedArtifact>() { + @Override + public ResolvedArtifact apply(StoredUrl url, Matcher matcher) { + //gradle name format in reverse order is: + //filename + //hash + //version + //artifact-id + //group-id + + if (url.path.getNameCount() < 5) { + return null; + } + String fileArtifact = url.path.getName(url.path.getNameCount() - 4).toString(); + String fileGroup = url.path.getName(url.path.getNameCount() - 5).toString(); + if (fileGroup.equals(groupId) && fileArtifact.equals(artifactId)) { + try { + return new ResolvedArtifact(groupId, artifactId, matcher.group(1), classifier, url.path); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + return null; + } + }; + + } + + public BiFunction<StoredUrl, Matcher, ResolvedArtifact> createMavenResolver(String groupId, String artifactId, + String classifier) { + Pattern filePatten; + if (classifier == null || classifier.isEmpty()) { + filePatten = Pattern.compile(artifactId + "-(\\\\d.*)\\\\.jar"); + } else { + filePatten = Pattern.compile(artifactId + "-" + classifier + "-(\\\\d.*)\\\\.jar"); + } + return new BiFunction<StoredUrl, Matcher, ResolvedArtifact>() { + @Override + public ResolvedArtifact apply(StoredUrl url, Matcher matcher) { String[] groupParts = groupId.split("\\\\."); if (url.path.getNameCount() < groupParts.length + 2) { - continue; + return null; } boolean matches = true; @@ -88,10 +153,10 @@ public ResolvedArtifact getArtifact(String groupId, String artifactId, String cl } } + return null; } - } - throw new RuntimeException("Could not resolve artifact " + groupId + ":" + artifactId + ":" + classifier - + ". Please make sure it is present and contains a META-INF/MANIFEST.MF file. Note that artifacts that are part of the same project may not always be resolvable, in this case you should generate a META-INF/jandex.idx file instead using the Jandex Maven plugin."); + }; + } static class StoredUrl {
['core/deployment/src/main/java/io/quarkus/deployment/index/ClassPathArtifactResolver.java']
{'.java': 1}
1
1
0
0
1
3,885,000
757,339
100,704
981
3,622
688
73
1
1,407
162
349
25
0
1
"2019-05-27T07:39:15"
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,283
quarkusio/quarkus/2595/2592
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2592
https://github.com/quarkusio/quarkus/pull/2595
https://github.com/quarkusio/quarkus/pull/2595
1
fix
building master creates changes on file
**Describe the bug** After Quarkus has been locally build with `mvn clean install -DskipTests=true` and I check `git status` I can see changes on files I haven'ts touched : ``` modified: extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java modified: extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java modified: integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java ``` **Expected behavior** After a build i would expect only changes on the files I changed myself **To Reproduce** Steps to reproduce the behavior: 1. `mvn clean install -DskipTests=true` 2. `git status` **Environment (please complete the following information):** - Output of `uname -a` or `ver`: Linux localhost.localdomain 5.0.13-300.fc30.x86_64 #1 SMP Mon May 6 00:39:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux - Output of `java -version`: openjdk version "1.8.0_212" - GraalVM version (if different from Java): rc16 - Quarkus version or git rev: master
fdba149a77566eed84dd376cb34452bd5fc8926c
f0b405285bf8a5c2d56ad762703c34e293a60b37
https://github.com/quarkusio/quarkus/compare/fdba149a77566eed84dd376cb34452bd5fc8926c...f0b405285bf8a5c2d56ad762703c34e293a60b37
diff --git a/extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java b/extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java index 976fe2d727d..9afb35a6073 100644 --- a/extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java +++ b/extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java @@ -2,16 +2,12 @@ import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; -import javax.transaction.SystemException; import javax.transaction.TransactionManager; import javax.transaction.Transactional; import javax.transaction.Transactional.TxType; -import org.eclipse.microprofile.reactive.streams.operators.ReactiveStreams; import org.junit.jupiter.api.Assertions; -import org.reactivestreams.Publisher; -import io.quarkus.hibernate.orm.panache.Panache; import io.reactivex.Flowable; import io.reactivex.Single; diff --git a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java index b6a7f1e3d57..d6d4a48b668 100644 --- a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java +++ b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.concurrent.ExecutorService; -import org.eclipse.microprofile.context.spi.ContextManager; import org.eclipse.microprofile.context.spi.ContextManagerExtension; import org.eclipse.microprofile.context.spi.ContextManagerProvider; import org.eclipse.microprofile.context.spi.ThreadContextProvider; diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java index 597c97c3d79..8536a6d4f92 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java @@ -18,16 +18,8 @@ import static org.hamcrest.Matchers.is; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.nio.charset.StandardCharsets; - -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured;
['extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java', 'integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java', 'extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java']
{'.java': 3}
3
3
0
0
3
3,873,851
755,075
100,414
977
60
10
1
1
1,150
119
296
27
0
1
"2019-05-25T20:29:14"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,284
quarkusio/quarkus/2594/2582
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2582
https://github.com/quarkusio/quarkus/pull/2594
https://github.com/quarkusio/quarkus/pull/2594
1
fix
Doesn't install on Windows 10
I have installed successfully on my macs, but on a Windows Surface Laptop I get when running the first command: mvn io.quarkus:quarkus-maven-plugin:0.15.0:create \\ >> -DprojectGroupId=org.acme \\ >> -DprojectArtifactId=getting-started \\ >> -DclassName="org.acme.quickstart.GreetingResource" \\ >> -Dpath="/hello" …. [INFO] using-keycloak ..................................... SKIPPED [INFO] quickstart-projects ................................ FAILURE [ 11.386 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 12.364 s [INFO] Finished at: 2019-05-24T10:05:09+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.15.0:create (default-cli) on project quickstart-projects: Execution default-cli of goal io.quarkus:quarkus-maven-plugin:0.15.0:create failed.: NullPointerException -> [Help 1] (Describe the problem clearly and concisely.) **Expected behavior** (Describe the expected behavior clearly and concisely.) **Configuration** Windows 10 Surface Laptop (gen 1) 16GB RAM Windows 10 Pro v1803 java version "1.8.0_211" Java(TM) SE Runtime Environment (build 1.8.0_211-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode) Latest Quarkus (also tried with Java 1.12 same issue)
fdba149a77566eed84dd376cb34452bd5fc8926c
17ab43f7733ff32de9f40c95aa8eef26b1dbbf16
https://github.com/quarkusio/quarkus/compare/fdba149a77566eed84dd376cb34452bd5fc8926c...17ab43f7733ff32de9f40c95aa8eef26b1dbbf16
diff --git a/devtools/common/src/main/java/io/quarkus/cli/commands/CreateProject.java b/devtools/common/src/main/java/io/quarkus/cli/commands/CreateProject.java index d92a7207657..e485fae2c4f 100644 --- a/devtools/common/src/main/java/io/quarkus/cli/commands/CreateProject.java +++ b/devtools/common/src/main/java/io/quarkus/cli/commands/CreateProject.java @@ -192,6 +192,7 @@ private void addNativeProfile(Model model) { private void addMainPluginConfig(Model model) { if (!hasPlugin(model)) { + Build build = createBuildSectionIfRequired(model); Plugin plugin = plugin(getPluginGroupId(), getPluginArtifactId(), QUARKUS_VERSION_PROPERTY); if (isParentPom(model)) { addPluginManagementSection(model, plugin); @@ -201,32 +202,31 @@ private void addMainPluginConfig(Model model) { PluginExecution pluginExec = new PluginExecution(); pluginExec.addGoal("build"); plugin.addExecution(pluginExec); - Build build = createBuildSectionIfRequired(model); build.getPlugins().add(plugin); } } private boolean hasPlugin(final Model model) { List<Plugin> plugins = null; - if (isParentPom(model)) { - final PluginManagement management = model.getBuild().getPluginManagement(); - if (management != null) { - plugins = management.getPlugins(); - } - } else { - final Build build = model.getBuild(); - if (build != null) { + final Build build = model.getBuild(); + if (build != null) { + if (isParentPom(model)) { + final PluginManagement management = build.getPluginManagement(); + if (management != null) { + plugins = management.getPlugins(); + } + } else { plugins = build.getPlugins(); } } - return plugins != null && model.getBuild().getPlugins() + return plugins != null && build.getPlugins() .stream() .anyMatch(p -> p.getGroupId().equalsIgnoreCase(getPluginGroupId()) && p.getArtifactId().equalsIgnoreCase(getPluginArtifactId())); } private void addPluginManagementSection(Model model, Plugin plugin) { - if (model.getBuild().getPluginManagement() != null) { + if (model.getBuild() != null && model.getBuild().getPluginManagement() != null) { if (model.getBuild().getPluginManagement().getPlugins() == null) { model.getBuild().getPluginManagement().setPlugins(new ArrayList<>()); } diff --git a/extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java b/extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java index 976fe2d727d..9afb35a6073 100644 --- a/extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java +++ b/extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java @@ -2,16 +2,12 @@ import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; -import javax.transaction.SystemException; import javax.transaction.TransactionManager; import javax.transaction.Transactional; import javax.transaction.Transactional.TxType; -import org.eclipse.microprofile.reactive.streams.operators.ReactiveStreams; import org.junit.jupiter.api.Assertions; -import org.reactivestreams.Publisher; -import io.quarkus.hibernate.orm.panache.Panache; import io.reactivex.Flowable; import io.reactivex.Single; diff --git a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java index b6a7f1e3d57..d6d4a48b668 100644 --- a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java +++ b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.concurrent.ExecutorService; -import org.eclipse.microprofile.context.spi.ContextManager; import org.eclipse.microprofile.context.spi.ContextManagerExtension; import org.eclipse.microprofile.context.spi.ContextManagerProvider; import org.eclipse.microprofile.context.spi.ThreadContextProvider; diff --git a/integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java b/integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java index 597c97c3d79..8536a6d4f92 100644 --- a/integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java +++ b/integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java @@ -18,16 +18,8 @@ import static org.hamcrest.Matchers.is; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.net.URL; -import java.net.URLConnection; -import java.nio.charset.StandardCharsets; - -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import io.quarkus.test.common.http.TestHTTPResource; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured;
['extensions/smallrye-context-propagation/deployment/src/test/java/io/quarkus/context/test/TransactionalBean.java', 'extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationTemplate.java', 'integration-tests/main/src/test/java/io/quarkus/it/main/ContextPropagationTestCase.java', 'devtools/common/src/main/java/io/quarkus/cli/commands/CreateProject.java']
{'.java': 4}
4
4
0
0
4
3,873,851
755,075
100,414
977
1,131
213
23
2
1,498
139
373
34
0
0
"2019-05-25T20:09:56"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,285
quarkusio/quarkus/2573/2566
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2566
https://github.com/quarkusio/quarkus/pull/2573
https://github.com/quarkusio/quarkus/pull/2573
1
fixes
NullPointerException on generic injection with quarkus-arc
**Describe the bug** Following the https://github.com/quarkusio/quarkus/issues/2456 issue correction on master, I just ran a quick test with a snapshot version of quarkus. My unsatisfied dependency problem is gone (thanks for that!) but I have now an injection issue at runtime. **Expected behavior** I expect injections to work with generics. **Actual behavior** ``` 2019-05-22 23:10:52,098 ERROR [io.und.request] (executor-thread-1) UT005023: Exception handling request to /cars: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException 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:437) 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:96) at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup.handleHotDeploymentRequest(UndertowHotReplacementSetup.java:80) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup$1$1.handleRequest(UndertowHotReplacementSetup.java:51) 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.base/java.lang.Thread.run(Thread.java:834) at org.jboss.threads.JBossThread.run(JBossThread.java:479) Caused by: java.lang.NullPointerException at com.gwenneg.CarResource.inject(CarResource.java:21) at com.gwenneg.CarResource_ClientProxy.inject(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) ... 53 more ``` **To Reproduce** Steps to reproduce the behavior: 1. Clone https://github.com/gwenneg/quarkus-unsatisfied-dependency 2. Run the `./gradlew quarkusDev` or `./mvnw compile quarkus:dev` command 3. Call the endpoint using `http://localhost:8080/cars` **Environment:** - Output of `java -version`: openjdk version "11" 2018-09-25 - Quarkus version or git rev: master (https://github.com/quarkusio/quarkus/commit/903dea163ea37e59135c5a3db11d24137b82a62a)
50597aaec03a3511c27d6510adfbb86d375a2fd8
bd0deaa1f2f2e483dcaa670b832de6861eb10adf
https://github.com/quarkusio/quarkus/compare/50597aaec03a3511c27d6510adfbb86d375a2fd8...bd0deaa1f2f2e483dcaa670b832de6861eb10adf
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java index 2d8929fe336..2f527cecf34 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java @@ -982,9 +982,11 @@ protected void implementCreate(ClassOutput classOutput, ClassCreator beanCreator create.load(injectedField.name()), instanceHandle, referenceHandle); } else { + // We cannot use injectionPoint.getRequiredType() because it might be a resolved parameterize type and we could get NoSuchFieldError + String fieldType = injectionPoint.getTarget().asField().type().name().toString(); create.writeInstanceField( FieldDescriptor.of(providerTypeName, injectedField.name(), - injectionPoint.getRequiredType().name().toString()), + fieldType), instanceHandle, referenceHandle); } } 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 c9564e9bbd8..4a247131663 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 @@ -65,7 +65,7 @@ static void addDelegatingMethods(IndexView index, ClassInfo classInfo, Map<TypeV } methods.computeIfAbsent(new Methods.MethodKey(method), key -> { // If parameterized try to resolve the type variables - Type returnType = resolveType(key.method.returnType(), resolvedTypeParameters); + Type returnType = key.method.returnType(); Type[] params = new Type[key.method.parameters().size()]; for (int i = 0; i < params.length; i++) { params[i] = resolveType(key.method.parameters().get(i), resolvedTypeParameters); diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java index 630b5dff21a..8d90422e782 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java @@ -1,8 +1,11 @@ package io.quarkus.arc.test.injection.assignability.generics; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import io.quarkus.arc.Arc; +import io.quarkus.arc.InstanceHandle; import io.quarkus.arc.test.ArcTestContainer; import java.util.ArrayList; import java.util.HashMap; @@ -21,22 +24,51 @@ public class AssignabilityWithGenericsTest { @Rule public ArcTestContainer container = new ArcTestContainer(Car.class, Engine.class, PetrolEngine.class, Vehicle.class, - StringListConsumer.class, ListConsumer.class, ProducerBean.class, DefinitelyNotBar.class, Bar.class, - GenericInterface.class, AlmostCompleteBean.class, ActualBean.class); + StringListConsumer.class, ListConsumer.class, ProducerBean.class, DefinitelyNotBar.class, + Bar.class, GenericInterface.class, AlmostCompleteBean.class, ActualBean.class, + BetaFace.class, GammaFace.class, GammaImpl.class, AbstractAlpha.class, AlphaImpl.class); @Test public void testSelectingInstanceOfCar() { - assertTrue(Arc.container().instance(Car.class).isAvailable()); + InstanceHandle<Car> instance = Arc.container().instance(Car.class); + assertTrue(instance.isAvailable()); + assertNotNull(instance.get().getEngine()); } @Test public void testParameterizedTypeWithTypeVariable() { - assertTrue(Arc.container().instance(StringListConsumer.class).isAvailable()); + InstanceHandle<StringListConsumer> instance = Arc.container().instance(StringListConsumer.class); + assertTrue(instance.isAvailable()); + assertNotNull(instance.get().getList()); } @Test public void testHierarchyWithInterfacesAndMap() { - assertTrue(Arc.container().instance(ActualBean.class).isAvailable()); + InstanceHandle<ActualBean> instance = Arc.container().instance(ActualBean.class); + assertTrue(instance.isAvailable()); + assertNotNull(instance.get().getInjectedMap()); + } + + @Test + public void testProxiedBeanWithGenericMethodParams() { + InstanceHandle<AlphaImpl> alphaInstance = Arc.container().instance(AlphaImpl.class); + InstanceHandle<GammaImpl> gammaInstance = Arc.container().instance(GammaImpl.class); + assertTrue(alphaInstance.isAvailable()); + assertTrue(gammaInstance.isAvailable()); + AlphaImpl alpha = alphaInstance.get(); + assertEquals(GammaImpl.class.getSimpleName(), alpha.ping(alpha.getParam())); + } + + interface GenericInterface<T, K> { + + } + + interface BetaFace<K> { + K ping(); + } + + interface GammaFace extends BetaFace<String> { + } @Dependent @@ -48,11 +80,18 @@ static class StringListConsumer extends ListConsumer<String> { @Inject List<T> list; + + public List<T> getList() { + return list; + } } @Dependent static class ProducerBean { + @Produces + String foo = "foo"; + @Produces List<String> produceList() { return new ArrayList<>(); @@ -63,13 +102,6 @@ Map<String, Bar> produceMap() { return new HashMap<>(); } - @Produces - String foo = "foo"; - - } - - static interface GenericInterface<T, K> { - } static class DefinitelyNotBar<D> { @@ -92,6 +124,10 @@ public void observeSomething(@Observes String event, T injectedInstance) { public void observeSomethingElse(@ObservesAsync String event, K injectedInstance) { // inject-ability is verified at bootstrap } + + public Map<T, K> getInjectedMap() { + return injectedMap; + } } @ApplicationScoped @@ -99,4 +135,33 @@ static class ActualBean extends AlmostCompleteBean<String, Bar> { } + @ApplicationScoped + static class GammaImpl implements GammaFace { + + @Override + public String ping() { + return GammaImpl.class.getSimpleName(); + } + } + + static abstract class AbstractAlpha<T extends BetaFace> { + + @Inject + T param; + + public T getParam() { + return param; + } + + public String ping(T param) { + return param.ping().toString(); + } + + } + + @ApplicationScoped + static class AlphaImpl extends AbstractAlpha<GammaFace> { + + } + } diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/Vehicle.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/Vehicle.java index 291ff8a272d..cd468d64132 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/Vehicle.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/Vehicle.java @@ -6,4 +6,8 @@ @Inject T eng; + + public T getEngine() { + return eng; + } }
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/AssignabilityWithGenericsTest.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/injection/assignability/generics/Vehicle.java']
{'.java': 4}
4
4
0
0
4
3,845,873
750,235
99,794
972
559
84
6
2
9,690
282
2,126
104
4
1
"2019-05-23T11:08:30"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,286
quarkusio/quarkus/2565/2564
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2564
https://github.com/quarkusio/quarkus/pull/2565
https://github.com/quarkusio/quarkus/pull/2565
1
fixes
[quarkus-keycloak] - CORS related properties should be optional otherwise they are set as an empty string
**Describe the bug** When some of the CORS related properties are not explicitly set in `application.properties` they are parsed as an empty string. **Expected behavior** The CORS properties that map to a `string` are optional and if not defined should resolve to `null`. The behavior differs from what users have when using any other Keycloak adapter. We need to keep the same behavior and user experience. **Actual behavior** The CORS properties that map to a `string` are set with an empty string, thus forcing users to explicitly set their values in order to properly enable CORS to the application. **To Reproduce** Steps to reproduce the behavior: 1. Create an application and install the `quarkus-keycloak` extension 2. Enable CORS in `application.properties` by setting `quarkus.keycloak.enable-cors=true` 3. Try to access the application from another `Origin` by passing a bearer token using the HTTP `Authorization` header. By following the steps above, you should not be able to access the application due to the `Authorization` not being allowed by the extension. By default, if not defined, the extension should allow whatever header was requested during an HTTP `OPTIONS` request. **Configuration** ```properties quarkus.keycloak.auth-server-url=http://localhost:8180/auth quarkus.keycloak.realm=quarkus-quickstart quarkus.keycloak.resource=quarkus-rest-username quarkus.keycloak.bearer-only=true quarkus.keycloak.credentials.secret=secret quarkus.keycloak.enable-cors=true ``` **Screenshots** Not applicable. **Environment (please complete the following information):** - Quarkus 0.15.0 **Additional context** Not applicable.
903dea163ea37e59135c5a3db11d24137b82a62a
9c2b684ac4794ad3ba826986ba628262dc1f33ac
https://github.com/quarkusio/quarkus/compare/903dea163ea37e59135c5a3db11d24137b82a62a...9c2b684ac4794ad3ba826986ba628262dc1f33ac
diff --git a/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakAdapterProcessor.java b/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakAdapterProcessor.java index 633fd509a20..22a918a5bf9 100644 --- a/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakAdapterProcessor.java +++ b/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakAdapterProcessor.java @@ -74,9 +74,9 @@ private AdapterConfig createAdapterConfig(KeycloakConfig keycloakConfig) { config.setUseResourceRoleMappings(keycloakConfig.useResourceRoleMappings); config.setCors(keycloakConfig.cors); config.setCorsMaxAge(keycloakConfig.corsMaxAge); - config.setCorsAllowedHeaders(keycloakConfig.corsAllowedHeaders); - config.setCorsAllowedMethods(keycloakConfig.corsAllowedMethods); - config.setCorsExposedHeaders(keycloakConfig.corsExposedHeaders); + config.setCorsAllowedHeaders(keycloakConfig.corsAllowedHeaders.orElse(null)); + config.setCorsAllowedMethods(keycloakConfig.corsAllowedMethods.orElse(null)); + config.setCorsExposedHeaders(keycloakConfig.corsExposedHeaders.orElse(null)); config.setBearerOnly(keycloakConfig.bearerOnly); config.setAutodetectBearerOnly(keycloakConfig.autodetectBearerOnly); config.setPublicClient(keycloakConfig.publicClient); diff --git a/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakConfig.java b/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakConfig.java index 0dc1c5b78f5..33cbecb30db 100644 --- a/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakConfig.java +++ b/extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakConfig.java @@ -93,21 +93,21 @@ public final class KeycloakConfig { * string */ @ConfigItem(name = "cors-allowed-headers") - String corsAllowedHeaders; + Optional<String> corsAllowedHeaders; /** * If CORS is enabled, this sets the value of the Access-Control-Allow-Methods header. This should be a comma-separated * string */ @ConfigItem(name = "cors-allowed-methods") - String corsAllowedMethods; + Optional<String> corsAllowedMethods; /** * If CORS is enabled, this sets the value of the Access-Control-Expose-Headers header. This should be a comma-separated * string */ @ConfigItem(name = "cors-exposed-headers") - String corsExposedHeaders; + Optional<String> corsExposedHeaders; /** * This should be set to true for services. If enabled the adapter will not attempt to authenticate users,
['extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakAdapterProcessor.java', 'extensions/keycloak/deployment/src/main/java/io/quarkus/keycloak/KeycloakConfig.java']
{'.java': 2}
2
2
0
0
2
3,845,051
750,105
99,777
972
703
135
12
2
1,698
209
368
40
1
1
"2019-05-22T19:47:08"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,287
quarkusio/quarkus/2559/2557
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2557
https://github.com/quarkusio/quarkus/pull/2559
https://github.com/quarkusio/quarkus/pull/2559
1
resolves
BeanManager.resolveInterceptors() does not work correctly
The method or constructor must have all the interceptor bindings of the interceptor and not vice versa. See https://github.com/quarkusio/quarkus/blob/master/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java#L496-L504.
cb58c48922963b7969c69a4bbfdb507a7c286695
e7ccd50898b4af35b4d70161d2777f77916a1725
https://github.com/quarkusio/quarkus/compare/cb58c48922963b7969c69a4bbfdb507a7c286695...e7ccd50898b4af35b4d70161d2777f77916a1725
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java index 7a41180e57b..c5aa15a07e5 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java @@ -494,9 +494,11 @@ List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... in } private boolean hasAllInterceptionBindings(InjectableInterceptor<?> interceptor, Annotation[] interceptorBindings) { - for (Annotation binding : interceptorBindings) { + // The method or constructor has all the interceptor bindings of the interceptor + List<Annotation> bindings = Arrays.asList(interceptorBindings); + for (Annotation binding : interceptor.getInterceptorBindings()) { // The resolution rules are the same for qualifiers - if (!Qualifiers.hasQualifier(interceptor.getInterceptorBindings(), binding)) { + if (!Qualifiers.hasQualifier(bindings, binding)) { return false; } } diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Qualifiers.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Qualifiers.java index b9a7ea50c35..026b7575529 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Qualifiers.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Qualifiers.java @@ -42,30 +42,10 @@ static boolean hasQualifiers(InjectableBean<?> bean, Annotation... requiredQuali } static boolean hasQualifier(InjectableBean<?> bean, Annotation requiredQualifier) { - - Class<? extends Annotation> requiredQualifierClass = requiredQualifier.annotationType(); - Method[] members = requiredQualifierClass.getDeclaredMethods(); - - for (Annotation qualifier : bean.getQualifiers()) { - Class<? extends Annotation> qualifierClass = qualifier.annotationType(); - if (qualifierClass.equals(requiredQualifier.annotationType())) { - boolean matches = true; - for (Method value : members) { - if (!value.isAnnotationPresent(Nonbinding.class) - && !invoke(value, requiredQualifier).equals(invoke(value, qualifier))) { - matches = false; - break; - } - } - if (matches) { - return true; - } - } - } - return false; + return hasQualifier(bean.getQualifiers(), requiredQualifier); } - static boolean hasQualifier(Set<Annotation> qualifiers, Annotation requiredQualifier) { + static boolean hasQualifier(Iterable<Annotation> qualifiers, Annotation requiredQualifier) { Class<? extends Annotation> requiredQualifierClass = requiredQualifier.annotationType(); Method[] members = requiredQualifierClass.getDeclaredMethods(); diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/beanmanager/BeanManagerTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/beanmanager/BeanManagerTest.java index 8b12b42de30..953abe88322 100644 --- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/beanmanager/BeanManagerTest.java +++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/beanmanager/BeanManagerTest.java @@ -157,6 +157,7 @@ public Annotated getAnnotated() { assertNull(injectableReference.injectionPoint.getBean()); } + @SuppressWarnings("serial") @Test public void testResolveInterceptors() { BeanManager beanManager = Arc.container().beanManager(); @@ -165,7 +166,9 @@ public void testResolveInterceptors() { interceptors = beanManager.resolveInterceptors(InterceptionType.AROUND_CONSTRUCT, new DummyBinding.Literal(true, true)); assertTrue(interceptors.isEmpty()); // alpha is @Nonbinding - interceptors = beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, new DummyBinding.Literal(false, true)); + interceptors = beanManager.resolveInterceptors(InterceptionType.AROUND_INVOKE, new DummyBinding.Literal(false, true), + new AnnotationLiteral<UselessBinding>() { + }); assertEquals(2, interceptors.size()); assertEquals(DummyInterceptor.class, interceptors.get(0).getBeanClass()); assertEquals(LowPriorityInterceptor.class, interceptors.get(1).getBeanClass()); @@ -256,6 +259,14 @@ public boolean bravo() { } + @Target({ TYPE, METHOD }) + @Retention(RUNTIME) + @Documented + @InterceptorBinding + public @interface UselessBinding { + + } + @DummyBinding(alpha = true, bravo = true) @Priority(10) @Interceptor
['independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Qualifiers.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/beanmanager/BeanManagerTest.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ArcContainerImpl.java']
{'.java': 3}
3
3
0
0
3
3,781,978
739,649
98,300
965
1,623
265
30
2
251
19
59
1
1
0
"2019-05-22T13:37:26"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,288
quarkusio/quarkus/2552/2544
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2544
https://github.com/quarkusio/quarkus/pull/2552
https://github.com/quarkusio/quarkus/pull/2552
2
fix
quarkus-vertx-web hangs if port is in use
**Describe the bug** When starting a quarkus vertx web app that listens on a port that is in use, the quarkus process hangs and does not respond to SIGTERM. **Expected behavior** It would be acceptable for the application to exit with error message informing that the port is in use. **Actual behavior** The application hangs with no logs and does not respond to SIGTERM. **To Reproduce** Steps to reproduce the behavior: 1. Start an http service listening on port 8080 2. Start a quarkus-vertx-web app listening on port 8080 (default). This was tried in JVM and Native modes. 3. Try to stop the quarkus-vertx-web app via SIGTERM. **Environment (please complete the following information):** - Output of `uname -a` or `ver`: ``` Linux <host-redacted> 5.0.16-200.fc29.x86_64 #1 SMP Tue May 14 18:27:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux ``` - GraalVM version (if different from Java): ``` graalvm-ce-1.0.0-rc16 ``` - Quarkus version or git rev: ``` <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-vertx-web</artifactId> <version>0.15.0</version> </dependency> ```
1d4df37de5064dc55dc7e71c434531f002717588
2efbc0bd3cfa638d39c8dacf4525e4ed076630bc
https://github.com/quarkusio/quarkus/compare/1d4df37de5064dc55dc7e71c434531f002717588...2efbc0bd3cfa638d39c8dacf4525e4ed076630bc
diff --git a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java index f3aa6ac8181..97ac66c3f1f 100644 --- a/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java +++ b/extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java @@ -6,6 +6,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicReference; import javax.enterprise.event.Event; @@ -78,7 +79,7 @@ List<io.vertx.ext.web.Route> initialize(Vertx vertx, VertxHttpConfiguration vert routes.add(addRoute(router, handler, route)); } } - // Make it also possible to register the route handlers programatically + // Make it also possible to register the route handlers programmatically Event<Object> event = Arc.container().beanManager().getEvent(); event.select(Router.class).fire(router); @@ -88,17 +89,27 @@ List<io.vertx.ext.web.Route> initialize(Vertx vertx, VertxHttpConfiguration vert // Http server configuration HttpServerOptions httpServerOptions = createHttpServerOptions(vertxHttpConfiguration, launchMode); event.select(HttpServerOptions.class).fire(httpServerOptions); + AtomicReference<Throwable> failure = new AtomicReference<>(); server = vertx.createHttpServer(httpServerOptions).requestHandler(router) .listen(ar -> { if (ar.succeeded()) { // TODO log proper message Timing.setHttpServer(String.format( "Listening on: http://%s:%s", httpServerOptions.getHost(), httpServerOptions.getPort())); - latch.countDown(); + + } else { + // We can't throw an exception from here as we are on the event loop. + // We store the failure in a reference. + // The reference will be checked in the main thread, and the failure re-thrown. + failure.set(ar.cause()); } + latch.countDown(); }); try { latch.await(); + if (failure.get() != null) { + throw new IllegalStateException("Unable to start the HTTP server", failure.get()); + } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Unable to start the HTTP server", e);
['extensions/vertx-web/runtime/src/main/java/io/quarkus/vertx/web/runtime/VertxWebTemplate.java']
{'.java': 1}
1
1
0
0
1
3,781,211
739,517
98,284
965
918
143
15
1
1,146
160
325
37
0
3
"2019-05-22T07:34: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,289
quarkusio/quarkus/2505/2463
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2463
https://github.com/quarkusio/quarkus/pull/2505
https://github.com/quarkusio/quarkus/pull/2505
1
fix
list-extensions shows badly on small screens
`mvn quarkus:list-extensions` is un usable with the added URL. You guys have tiny eyes and big screens. But for me I can't click on the url as it goes on two lines. I'd recommend we put the URL in a second line. ``` RESTEasy - JSON-B quarkus-resteasy-jsonb https://quarku s.io/guides/rest-json-guide Scheduler quarkus-scheduler https://quarku s.io/guides/scheduled-guide Security quarkus-elytron-security https://quarku s.io/guides/security-guide SmallRye Fault Tolerance quarkus-smallrye-fault-tolerance SmallRye Health quarkus-smallrye-health https://quarku s.io/guides/health-guide SmallRye JWT quarkus-smallrye-jwt https://quarku s.io/guides/jwt-guide SmallRye Metrics quarkus-smallrye-metrics https://quarku s.io/guides/metrics-guide SmallRye OpenAPI quarkus-smallrye-openapi https://quarku s.io/guides/openapi-swaggerui-guide SmallRye OpenTracing quarkus-smallrye-opentracing https://quarku s.io/guides/opentracing-guide SmallRye Reactive Streams Operators quarkus-smallrye-reactive-streams-operators SmallRye Reactive Type Converters quarkus-smallrye-reactive-type-converters SmallRye Reactive Messaging quarkus-smallrye-reactive-messaging https://quarku s.io/guides/async-message-passing SmallRye Reactive Messaging - Kafka Connector quarkus-smallrye-reactive-messaging-kafka https://quarku s.io/guides/kafka-guide SmallRye REST Client quarkus-smallrye-rest-client https://quarku s.io/guides/rest-client-guide Spring DI compatibility layer quarkus-spring-di https://quarku s.io/guides/spring-di-guide Swagger UI quarkus-swagger-ui https://quarku s.io/guides/openapi-swaggerui-guide Undertow quarkus-undertow Undertow WebSockets quarkus-undertow-websockets https://quarku s.io/guides/websocket-guide Eclipse Vert.x quarkus-vertx https://quarku s.io/guides/using-vertx Reactive Postgres Client quarkus-reactive-pg-client ```
f3ee166fbd686446664083bb727cfd4aabfa9e00
58371ffc967b520852311f2913b27f646652aee0
https://github.com/quarkusio/quarkus/compare/f3ee166fbd686446664083bb727cfd4aabfa9e00...58371ffc967b520852311f2913b27f646652aee0
diff --git a/devtools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java b/devtools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java index e4c4b683e8b..d7e7b74c343 100644 --- a/devtools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java +++ b/devtools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java @@ -17,12 +17,11 @@ import org.apache.maven.model.Model; import io.quarkus.dependencies.Extension; -import io.quarkus.maven.utilities.MojoUtils; import io.quarkus.maven.utilities.QuarkusDependencyPredicate; public class ListExtensions { - private static final String FULL_FORMAT = "%-8s %-50s %-50s %-25s %s"; - private static final String SIMPLE_FORMAT = "%-50s %-50s %s"; + private static final String FULL_FORMAT = "%-8s %-50s %-50s %-25s\\n%s"; + private static final String SIMPLE_FORMAT = "%-50s %-50s\\n%s"; private Model model; public ListExtensions(final Model model) { diff --git a/devtools/common/src/test/java/io/quarkus/cli/commands/ListExtensionsTest.java b/devtools/common/src/test/java/io/quarkus/cli/commands/ListExtensionsTest.java index d4de5fc8a67..0d5bd81f5ee 100644 --- a/devtools/common/src/test/java/io/quarkus/cli/commands/ListExtensionsTest.java +++ b/devtools/common/src/test/java/io/quarkus/cli/commands/ListExtensionsTest.java @@ -125,6 +125,7 @@ public void listWithoutBom() throws IOException { boolean resteasy = false; boolean hibernateValidator = false; final String output = baos.toString(); + boolean checkGuideInLineAfter = false; for (String line : output.split("\\r?\\n")) { if (line.contains(" Agroal ")) { assertTrue(line.startsWith("current"), "Agroal should list as current: " + line); @@ -133,12 +134,18 @@ public void listWithoutBom() throws IOException { assertTrue(line.startsWith("update"), "RESTEasy should list as having an update: " + line); assertTrue( line.endsWith( - String.format("%-16s %s", getPluginVersion(), "https://quarkus.io/guides/rest-json-guide")), + String.format("%-16s", getPluginVersion())), "RESTEasy should list as having an update: " + line); resteasy = true; } else if (line.contains(" Hibernate Validator ")) { assertTrue(line.startsWith(" "), "Hibernate Validator should not list as anything: " + line); hibernateValidator = true; + } else if (checkGuideInLineAfter) { + checkGuideInLineAfter = false; + assertTrue( + line.endsWith( + String.format("%s", "https://quarkus.io/guides/rest-json-guide")), + "RESTEasy should list as having an guide: " + line); } } diff --git a/devtools/maven/src/main/java/io/quarkus/maven/ListExtensionsMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/ListExtensionsMojo.java index d8ccf41e5fe..8f8f5e328ee 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/ListExtensionsMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/ListExtensionsMojo.java @@ -31,7 +31,7 @@ public class ListExtensionsMojo extends AbstractMojo { /** * display in simplified format. */ - @Parameter(property = "quarkus.extension.format", alias = "quarkus.extension.format", defaultValue = "full") + @Parameter(property = "quarkus.extension.format", alias = "quarkus.extension.format", defaultValue = "simple") protected String format; @Override
['devtools/maven/src/main/java/io/quarkus/maven/ListExtensionsMojo.java', 'devtools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java', 'devtools/common/src/test/java/io/quarkus/cli/commands/ListExtensionsTest.java']
{'.java': 3}
3
3
0
0
3
3,755,007
734,480
97,680
958
562
148
7
2
3,428
146
607
40
15
1
"2019-05-18T15:01:14"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,290
quarkusio/quarkus/2447/2267
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2267
https://github.com/quarkusio/quarkus/pull/2447
https://github.com/quarkusio/quarkus/pull/2447
1
resolves
Two beans with @Scheduled causes jaeger metrics error
There seems to be an issue with the combination of two (or more) beans using @Scheduled with @Traced at the same time. Quarkus 0.14 Mvn 3.6.1 Java 11 GraalVM not relevant Trigger using code sample in this repository: https://github.com/mejlholm/quarkus-scheduled-error Though it seems to be an issue with @Traced and @Scheduled in two @ApplicationScoped beans at the same time. Triggers this error on startup with: mvn clean compile quarkus:dev 2019-04-29 11:07:17,088 ERROR [org.qua.cor.ErrorLogger] (DefaultQuartzScheduler_Worker-1) Job (io.quarkus.scheduler.Scheduler.1_org.acme.quickstart.Scheduler1_ScheduledInvoker_run_72e66771a77415a7284d3ae42331659c186071de threw an exception.: org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.RuntimeException: No reflection exceptions should be thrown unless there is a fundamental error in your code set up.] at org.quartz.core.JobRunShell.run(JobRunShell.java:213) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) Caused by: java.lang.RuntimeException: No reflection exceptions should be thrown unless there is a fundamental error in your code set up. at io.jaegertracing.internal.metrics.Metrics.createMetrics(Metrics.java:76) at io.jaegertracing.internal.metrics.Metrics.<init>(Metrics.java:32) at io.jaegertracing.internal.metrics.Metrics.<init>(Metrics.java:28) at io.jaegertracing.Configuration.getTracerBuilder(Configuration.java:221) at io.jaegertracing.Configuration.getTracer(Configuration.java:245) at io.quarkus.jaeger.runtime.QuarkusJaegerTracer.lambda$tracer$0(QuarkusJaegerTracer.java:45) at java.base/java.util.concurrent.atomic.AtomicReference.updateAndGet(AtomicReference.java:209) at io.quarkus.jaeger.runtime.QuarkusJaegerTracer.tracer(QuarkusJaegerTracer.java:41) at io.quarkus.jaeger.runtime.QuarkusJaegerTracer.buildSpan(QuarkusJaegerTracer.java:51) at io.opentracing.util.GlobalTracer.buildSpan(GlobalTracer.java:133) at io.opentracing.contrib.interceptors.OpenTracingInterceptor.wrap(OpenTracingInterceptor.java:44) at io.opentracing.contrib.interceptors.OpenTracingInterceptor_Bean.intercept(Unknown Source) at io.quarkus.arc.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:270) at io.quarkus.arc.InvocationContextImpl.invokeNext(InvocationContextImpl.java:149) at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:173) at io.quarkus.arc.ActivateRequestContextInterceptor.aroundInvoke(ActivateRequestContextInterceptor.java:38) at io.quarkus.arc.ActivateRequestContextInterceptor_Bean.intercept(Unknown Source) at io.quarkus.arc.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:270) at io.quarkus.arc.InvocationContextImpl.invokeNext(InvocationContextImpl.java:149) at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:173) at org.acme.quickstart.Scheduler1_Subclass.run(Unknown Source) at org.acme.quickstart.Scheduler1_ClientProxy.run(Unknown Source) at org.acme.quickstart.Scheduler1_ScheduledInvoker_run_72e66771a77415a7284d3ae42331659c186071de.invoke(Unknown Source) at io.quarkus.scheduler.runtime.QuartzScheduler$InvokerJob.execute(QuartzScheduler.java:264) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ... 1 more Caused by: java.lang.IllegalArgumentException: A metric with name jaeger_tracer_reporter_queue_length already exists at io.smallrye.metrics.MetricsRegistryImphttps://github.com/quarkusio/quarkus/issues/new l.register(MetricsRegistryImpl.java:113) at io.quarkus.jaeger.runtime.QuarkusJaegerMetricsFactory.createGauge(QuarkusJaegerMetricsFactory.java:64) at io.jaegertracing.internal.metrics.Metrics.createMetrics(Metrics.java:66) ... 25 more
3c302bc3e6e53f5e39635a94ccbe590c4cd9ffb5
e3ec93387030ae3f8ef543f9a466f4cb2dd6e783
https://github.com/quarkusio/quarkus/compare/3c302bc3e6e53f5e39635a94ccbe590c4cd9ffb5...e3ec93387030ae3f8ef543f9a466f4cb2dd6e783
diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java index 594270e8819..a4842a554a5 100644 --- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java +++ b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java @@ -16,8 +16,6 @@ package io.quarkus.jaeger.runtime; -import java.util.concurrent.atomic.AtomicReference; - import io.jaegertracing.Configuration; import io.opentracing.ScopeManager; import io.opentracing.Span; @@ -27,23 +25,23 @@ public class QuarkusJaegerTracer implements Tracer { - static AtomicReference<Tracer> REF = new AtomicReference<>(); - - public QuarkusJaegerTracer() { - } + private static volatile Tracer tracer; @Override public String toString() { return tracer().toString(); } - Tracer tracer() { - return REF.updateAndGet((orig) -> { - if (orig != null) { - return orig; + private static Tracer tracer() { + if (tracer == null) { + synchronized (QuarkusJaegerTracer.class) { + if (tracer == null) { + tracer = Configuration.fromEnv() + .withMetricsFactory(new QuarkusJaegerMetricsFactory()).getTracer(); + } } - return Configuration.fromEnv().withMetricsFactory(new QuarkusJaegerMetricsFactory()).getTracer(); - }); + } + return tracer; } @Override
['extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java']
{'.java': 1}
1
1
0
0
1
3,742,923
732,049
97,316
957
834
166
22
1
4,043
207
990
51
2
0
"2019-05-15T11:35: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,292
quarkusio/quarkus/2239/2040
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2040
https://github.com/quarkusio/quarkus/pull/2239
https://github.com/quarkusio/quarkus/pull/2239
1
fixes
JAX-RS exceptions in native mode CNFE javax.ws.rs.ext.Providers
Hi I see a lot of exceptions: ``` RESTEASY002120: ClassNotFoundException: Unable to load builtin provider org.jboss.resteasy.plugins.providers.JaxrsFormProvider from resource:META-INF/services/javax.ws.rs.ext.Providers java.lang.ClassNotFoundException: org.jboss.resteasy.plugins.providers.JaxrsFormProvider........... ``` when I build https://github.com/quarkusio/quarkus-quickstarts/tree/master/using-opentracing to native executable. Is it problem with the example or bug? Full log: https://pastebin.com/TN0yfCzN
4f449269ee1bfc2e6b5d75ac3dc251a02220942f
21e6bb2ef525f7894ea266d7d5ee35389a6a2793
https://github.com/quarkusio/quarkus/compare/4f449269ee1bfc2e6b5d75ac3dc251a02220942f...21e6bb2ef525f7894ea266d7d5ee35389a6a2793
diff --git a/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java b/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java index ba85b88b632..7eee1cf12d9 100644 --- a/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java +++ b/extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java @@ -62,13 +62,16 @@ import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; import io.quarkus.deployment.builditem.SslNativeConfigBuildItem; -import io.quarkus.deployment.builditem.substrate.*; +import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem; +import io.quarkus.deployment.builditem.substrate.ReflectiveHierarchyBuildItem; +import io.quarkus.deployment.builditem.substrate.ServiceProviderBuildItem; +import io.quarkus.deployment.builditem.substrate.SubstrateProxyDefinitionBuildItem; +import io.quarkus.deployment.builditem.substrate.SubstrateResourceBuildItem; import io.quarkus.gizmo.MethodDescriptor; import io.quarkus.gizmo.ResultHandle; import io.quarkus.resteasy.common.deployment.JaxrsProvidersToRegisterBuildItem; import io.quarkus.smallrye.restclient.runtime.IncomingHeadersProvider; import io.quarkus.smallrye.restclient.runtime.RestClientBase; -import io.quarkus.smallrye.restclient.runtime.RestClientBuilderImpl; import io.quarkus.smallrye.restclient.runtime.SmallRyeRestClientTemplate; import io.smallrye.restclient.DefaultResponseExceptionMapper; import io.smallrye.restclient.RestClientProxy; @@ -125,6 +128,7 @@ void setup(BuildProducer<FeatureBuildItem> feature, } @BuildStep + @Record(ExecutionTime.STATIC_INIT) void processInterfaces(CombinedIndexBuildItem combinedIndexBuildItem, SslNativeConfigBuildItem sslNativeConfig, BuildProducer<SubstrateProxyDefinitionBuildItem> proxyDefinition, @@ -132,7 +136,8 @@ void processInterfaces(CombinedIndexBuildItem combinedIndexBuildItem, BuildProducer<ReflectiveHierarchyBuildItem> reflectiveHierarchy, BuildProducer<BeanRegistrarBuildItem> beanRegistrars, BuildProducer<ExtensionSslNativeSupportBuildItem> extensionSslNativeSupport, - BuildProducer<ServiceProviderBuildItem> serviceProvider) { + BuildProducer<ServiceProviderBuildItem> serviceProvider, + SmallRyeRestClientTemplate smallRyeRestClientTemplate) { // According to the spec only rest client interfaces annotated with RegisterRestClient are registered as beans Map<DotName, ClassInfo> interfaces = new HashMap<>(); @@ -219,15 +224,18 @@ public void register(RegistrationContext registrationContext) { // Indicates that this extension would like the SSL support to be enabled extensionSslNativeSupport.produce(new ExtensionSslNativeSupportBuildItem(FeatureBuildItem.SMALLRYE_REST_CLIENT)); - RestClientBuilderImpl.SSL_ENABLED = sslNativeConfig.isEnabled(); + + smallRyeRestClientTemplate.setSslEnabled(sslNativeConfig.isEnabled()); } @BuildStep + @Record(ExecutionTime.STATIC_INIT) void registerProviders(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, JaxrsProvidersToRegisterBuildItem jaxrsProvidersToRegisterBuildItem, - CombinedIndexBuildItem combinedIndexBuildItem) { - RestClientBuilderImpl.REGISTER_BUILTIN_PROVIDERS = jaxrsProvidersToRegisterBuildItem.useBuiltIn(); - RestClientBuilderImpl.PROVIDERS_TO_REGISTER = String.join(",", jaxrsProvidersToRegisterBuildItem.getProviders()); + CombinedIndexBuildItem combinedIndexBuildItem, + SmallRyeRestClientTemplate smallRyeRestClientTemplate) { + smallRyeRestClientTemplate.initializeResteasyProviderFactory(jaxrsProvidersToRegisterBuildItem.useBuiltIn(), + jaxrsProvidersToRegisterBuildItem.getProviders()); // register the providers for reflection for (String providerToRegister : jaxrsProvidersToRegisterBuildItem.getProviders()) { diff --git a/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/RestClientBuilderImpl.java b/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/RestClientBuilderImpl.java index 728a1daa815..8155def7b75 100644 --- a/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/RestClientBuilderImpl.java +++ b/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/RestClientBuilderImpl.java @@ -23,7 +23,14 @@ import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.Set; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; @@ -48,16 +55,20 @@ import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine; -import org.jboss.resteasy.plugins.server.servlet.ResteasyContextParameters; +import org.jboss.resteasy.client.jaxrs.internal.LocalResteasyProviderFactory; +import org.jboss.resteasy.spi.ResteasyProviderFactory; import org.jboss.resteasy.spi.ResteasyUriBuilder; -import io.smallrye.restclient.*; +import io.smallrye.restclient.ConfigurationWrapper; +import io.smallrye.restclient.DefaultMediaTypeFilter; +import io.smallrye.restclient.DefaultResponseExceptionMapper; +import io.smallrye.restclient.ExceptionMapping; +import io.smallrye.restclient.MethodInjectionFilter; +import io.smallrye.restclient.RestClientListeners; +import io.smallrye.restclient.RestClientProxy; import io.smallrye.restclient.async.AsyncInvocationInterceptorHandler; import io.smallrye.restclient.header.ClientHeaderProviders; -/** - * Created by hbraun on 15.01.18. - */ public class RestClientBuilderImpl implements RestClientBuilder { private static final String RESTEASY_PROPERTY_PREFIX = "resteasy."; @@ -68,17 +79,21 @@ public class RestClientBuilderImpl implements RestClientBuilder { public static final MethodInjectionFilter METHOD_INJECTION_FILTER = new MethodInjectionFilter(); public static final ClientHeadersRequestFilter HEADERS_REQUEST_FILTER = new ClientHeadersRequestFilter(); - public static boolean SSL_ENABLED = false; - public static boolean REGISTER_BUILTIN_PROVIDERS = true; - public static String PROVIDERS_TO_REGISTER = ""; + static boolean SSL_ENABLED = false; + static ResteasyProviderFactory PROVIDER_FACTORY; RestClientBuilderImpl() { ClientBuilder availableBuilder = ClientBuilder.newBuilder(); if (availableBuilder instanceof ResteasyClientBuilder) { builderDelegate = (ResteasyClientBuilder) availableBuilder; - builderDelegate.property(ResteasyContextParameters.RESTEASY_USE_BUILTIN_PROVIDERS, REGISTER_BUILTIN_PROVIDERS); - builderDelegate.property(ResteasyContextParameters.RESTEASY_PROVIDERS, PROVIDERS_TO_REGISTER); + + ResteasyProviderFactory localProviderFactory = new LocalResteasyProviderFactory(PROVIDER_FACTORY); + if (ResteasyProviderFactory.peekInstance() != null) { + localProviderFactory.initializeClientProviders(ResteasyProviderFactory.getInstance()); + } + builderDelegate.providerFactory(localProviderFactory); + configurationWrapper = new ConfigurationWrapper(builderDelegate.getConfiguration()); config = ConfigProvider.getConfig(); } else { diff --git a/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java b/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java index 3c6478e42aa..0597b2fe58a 100644 --- a/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java +++ b/extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java @@ -16,16 +16,56 @@ package io.quarkus.smallrye.restclient.runtime; +import java.util.Set; + +import javax.ws.rs.RuntimeType; + import org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver; +import org.jboss.resteasy.core.providerfactory.ClientHelper; +import org.jboss.resteasy.core.providerfactory.NOOPServerHelper; +import org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl; +import org.jboss.resteasy.plugins.providers.RegisterBuiltin; +import org.jboss.resteasy.spi.ResteasyProviderFactory; import io.quarkus.runtime.annotations.Template; -/** - * @author <a href="http://kenfinnigan.me">Ken Finnigan</a> - */ @Template public class SmallRyeRestClientTemplate { public void setRestClientBuilderResolver() { RestClientBuilderResolver.setInstance(new BuilderResolver()); } + + public void setSslEnabled(boolean sslEnabled) { + RestClientBuilderImpl.SSL_ENABLED = sslEnabled; + } + + public void initializeResteasyProviderFactory(boolean useBuiltIn, Set<String> providersToRegister) { + ResteasyProviderFactory clientProviderFactory = new ResteasyProviderFactoryImpl(null, true) { + @Override + public RuntimeType getRuntimeType() { + return RuntimeType.CLIENT; + } + + @Override + protected void initializeUtils() { + clientHelper = new ClientHelper(this); + serverHelper = NOOPServerHelper.INSTANCE; + } + }; + + if (useBuiltIn) { + RegisterBuiltin.register(clientProviderFactory); + } + + for (String providerToRegister : providersToRegister) { + try { + clientProviderFactory + .registerProvider(Thread.currentThread().getContextClassLoader().loadClass(providerToRegister.trim())); + } catch (ClassNotFoundException e) { + throw new RuntimeException("Unable to find class for provider " + providerToRegister, e); + } + } + + RestClientBuilderImpl.PROVIDER_FACTORY = clientProviderFactory; + } }
['extensions/smallrye-rest-client/deployment/src/main/java/io/quarkus/smallrye/restclient/deployment/SmallRyeRestClientProcessor.java', 'extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/SmallRyeRestClientTemplate.java', 'extensions/smallrye-rest-client/runtime/src/main/java/io/quarkus/smallrye/restclient/runtime/RestClientBuilderImpl.java']
{'.java': 3}
3
3
0
0
3
3,659,891
716,654
95,446
935
5,080
988
105
3
525
39
124
9
2
1
"2019-04-26T11:44:51"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,293
quarkusio/quarkus/2085/1974
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1974
https://github.com/quarkusio/quarkus/pull/2085
https://github.com/quarkusio/quarkus/pull/2085
1
fixes
OpenAPI OASFilter not working in dev mode
When using a OASFilter this works when normally running, but when ran in dev mode it throws a ClassNotFoundException. I've made a sample based on the using-openapi-swaggerui quickstart: https://github.com/Edubits/quarkus-quickstarts/tree/openapi-filter Exception when running `mvn clean compile quarkus:dev`: ``` 09:42:11,874 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:118) at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:108) at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66) Caused by: java.lang.RuntimeException: Failed to start quarkus at io.quarkus.runner.ApplicationImpl1.<clinit>(Unknown Source) ... 8 more Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.acme.openapi.OpenApiFilter at io.smallrye.openapi.runtime.OpenApiProcessor.getFilter(OpenApiProcessor.java:110) at io.quarkus.smallrye.openapi.runtime.SmallRyeOpenApiTemplate.filter(SmallRyeOpenApiTemplate.java:67) at io.quarkus.smallrye.openapi.runtime.SmallRyeOpenApiTemplate.access$100(SmallRyeOpenApiTemplate.java:37) at io.quarkus.smallrye.openapi.runtime.SmallRyeOpenApiTemplate$1.created(SmallRyeOpenApiTemplate.java:52) at io.quarkus.arc.runtime.ArcDeploymentTemplate.initBeanContainer(ArcDeploymentTemplate.java:108) at io.quarkus.deployment.steps.ArcAnnotationProcessor$build5.deploy(Unknown Source) ... 9 more Caused by: java.lang.ClassNotFoundException: org.acme.openapi.OpenApiFilter at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) at io.smallrye.openapi.runtime.OpenApiProcessor.getFilter(OpenApiProcessor.java:107) ... 14 more ```
f59fe347eb43fc9c8f2041ba216381df844eecfe
c2aca1525516975709a16639bb02c0f4dda8fd70
https://github.com/quarkusio/quarkus/compare/f59fe347eb43fc9c8f2041ba216381df844eecfe...c2aca1525516975709a16639bb02c0f4dda8fd70
diff --git a/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/SmallRyeOpenApiTemplate.java b/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/SmallRyeOpenApiTemplate.java index beb9ebfae5a..eee3e0065ec 100644 --- a/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/SmallRyeOpenApiTemplate.java +++ b/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/SmallRyeOpenApiTemplate.java @@ -43,7 +43,8 @@ public void created(BeanContainer container) { Config config = ConfigProvider.getConfig(); OpenApiConfig openApiConfig = new OpenApiConfigImpl(config); - OpenAPI readerModel = OpenApiProcessor.modelFromReader(openApiConfig, Quarkus.class.getClassLoader()); + OpenAPI readerModel = OpenApiProcessor.modelFromReader(openApiConfig, + Thread.currentThread().getContextClassLoader()); OpenApiDocument document = createDocument(openApiConfig); document.modelFromAnnotations(annotationModel); @@ -64,6 +65,7 @@ private OpenApiDocument createDocument(OpenApiConfig openApiConfig) { } private OASFilter filter(OpenApiConfig openApiConfig) { - return OpenApiProcessor.getFilter(openApiConfig, Quarkus.class.getClassLoader()); + return OpenApiProcessor.getFilter(openApiConfig, + Thread.currentThread().getContextClassLoader()); } }
['extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/SmallRyeOpenApiTemplate.java']
{'.java': 1}
1
1
0
0
1
3,570,149
699,268
93,185
913
495
82
6
1
2,382
112
562
33
1
1
"2019-04-15T15:54: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,294
quarkusio/quarkus/2002/2000
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2000
https://github.com/quarkusio/quarkus/pull/2002
https://github.com/quarkusio/quarkus/pull/2002
1
fixes
NPE with bean validation if the @Produces is not set
``` @POST // @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response payment(@Valid Payment payment) { emitter.send(payment); return Response.accepted().build(); } ``` If you un-comment the `@Produces` then it works, without you get: ``` 2019-04-11 09:45:53,597 ERROR [io.und.request] (XNIO-1 task-1) UT005023: Exception handling request to /payment: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException 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.doFilter(ResteasyFilter.java:45) 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:416) 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:89) at io.undertow.server.handlers.CanonicalPathHandler.handleRequest(CanonicalPathHandler.java:49) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup.handleHotDeploymentRequest(UndertowHotReplacementSetup.java:66) at io.quarkus.undertow.deployment.devmode.UndertowHotReplacementSetup$1$1.handleRequest(UndertowHotReplacementSetup.java:37) 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:1998) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1525) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1416) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:203) at java.util.Arrays$ArrayList.<init>(Arrays.java:3813) at java.util.Arrays.asList(Arrays.java:3800) at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor.getAccept(JaxrsEndPointValidationInterceptor.java:41) at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor.validateMethodInvocation(JaxrsEndPointValidationInterceptor.java:30) at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor_Bean.intercept(Unknown Source) at io.quarkus.arc.InvocationContextImpl$InterceptorInvocation.invoke(InvocationContextImpl.java:270) at io.quarkus.arc.InvocationContextImpl.invokeNext(InvocationContextImpl.java:149) at io.quarkus.arc.InvocationContextImpl.proceed(InvocationContextImpl.java:173) at me.escoffier.quarkus.reactive.PaymentResource_Subclass.payment(Unknown Source) 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 org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:151) at org.jboss.resteasy.core.MethodInjectorImpl.lambda$invoke$3(MethodInjectorImpl.java:122) at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:602) at java.util.concurrent.CompletableFuture.uniApplyStage(CompletableFuture.java:614) at java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:1983) at java.util.concurrent.CompletableFuture.thenApply(CompletableFuture.java:110) 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.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:981) at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2124) at java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:110) at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:341) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:477) ... 44 more ```
3be4d2582b291e9b7d7979ab06479567b597ce33
65f2035f64747aa4b00233c03b589b80e61f4231
https://github.com/quarkusio/quarkus/compare/3be4d2582b291e9b7d7979ab06479567b597ce33...65f2035f64747aa4b00233c03b589b80e61f4231
diff --git a/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/JaxrsEndPointValidationInterceptor.java b/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/JaxrsEndPointValidationInterceptor.java index 6172b1e67ba..ded4aafd530 100644 --- a/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/JaxrsEndPointValidationInterceptor.java +++ b/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/JaxrsEndPointValidationInterceptor.java @@ -2,6 +2,7 @@ import java.lang.reflect.Method; import java.util.Arrays; +import java.util.Collections; import java.util.List; import javax.annotation.Priority; @@ -38,6 +39,12 @@ public void validateConstructorInvocation(InvocationContext ctx) throws Exceptio } private List<MediaType> getAccept(Method method) { - return Arrays.asList(MediaTypeHelper.getProduces(method.getDeclaringClass(), method)); + MediaType[] producedMediaTypes = MediaTypeHelper.getProduces(method.getDeclaringClass(), method); + + if (producedMediaTypes == null) { + return Collections.emptyList(); + } + + return Arrays.asList(producedMediaTypes); } } diff --git a/integration-tests/hibernate-validator/src/main/java/io/quarkus/it/hibernate/validator/HibernateValidatorTestResource.java b/integration-tests/hibernate-validator/src/main/java/io/quarkus/it/hibernate/validator/HibernateValidatorTestResource.java index 1c078a2b18c..945ea52ca61 100644 --- a/integration-tests/hibernate-validator/src/main/java/io/quarkus/it/hibernate/validator/HibernateValidatorTestResource.java +++ b/integration-tests/hibernate-validator/src/main/java/io/quarkus/it/hibernate/validator/HibernateValidatorTestResource.java @@ -20,6 +20,7 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; import org.hibernate.validator.constraints.Length; @@ -101,6 +102,12 @@ public String testRestEndPointValidation(@Digits(integer = 5, fraction = 0) @Pat return id; } + @GET + @Path("/no-produces/{id}/") + public Response noProduces(@Digits(integer = 5, fraction = 0) @PathParam("id") String id) { + return Response.accepted().build(); + } + private String formatViolations(Set<? extends ConstraintViolation<?>> violations) { if (violations.isEmpty()) { return "passed"; diff --git a/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java b/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java index 09d6976c49b..460405213b9 100644 --- a/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java +++ b/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java @@ -68,4 +68,13 @@ public void testRestEndPointValidation() { .then() .body(is("42")); } + + @Test + public void testNoProduces() { + RestAssured.when() + .get("/hibernate-validator/test/no-produces/plop/") + .then() + .statusCode(400) + .body(containsString("numeric value out of bounds")); + } }
['integration-tests/hibernate-validator/src/main/java/io/quarkus/it/hibernate/validator/HibernateValidatorTestResource.java', 'extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/JaxrsEndPointValidationInterceptor.java', 'integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java']
{'.java': 3}
3
3
0
0
3
3,540,892
693,609
92,447
909
387
68
9
1
9,091
214
1,940
101
0
2
"2019-04-11T09:36: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,295
quarkusio/quarkus/1975/1972
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1972
https://github.com/quarkusio/quarkus/pull/1975
https://github.com/quarkusio/quarkus/pull/1975
1
fixes
Colorized logging output is gone in 0.13.0
In 0.12.0, the logging output is colorized and like: ```java ➜ java -jar target/my-app-runner.jar 2019-04-10 03:07:09,774 INFO [io.quarkus] (main) Quarkus 0.12.0 started in 1.373s. Listening on: http://[::]:8080 2019-04-10 03:07:09,777 INFO [io.quarkus] (main) Installed features: [cdi, resteasy, resteasy-jsonb, smallrye-health] 2019-04-10 03:07:12,572 INFO [io.quarkus] (main) Quarkus stopped in 0.009s ``` However in 0.13.0, the output is no longer colorized and changed to: ```java ➜ java -jar target/my-app-runner.jar Apr 10, 2019 3:07:53 AM io.quarkus.runtime.Application run WARN: Installation of signal handlers disabled by the presence of the environment variable: DISABLE_SIGNAL_HANDLERS Apr 10, 2019 3:07:53 AM org.xnio.Xnio <clinit> INFO: XNIO version 3.7.0.Final Apr 10, 2019 3:07:53 AM org.xnio.nio.NioXnio <clinit> INFO: XNIO NIO Implementation Version 3.7.0.Final Apr 10, 2019 3:07:53 AM org.jboss.threads.Version <clinit> INFO: JBoss Threads version 3.0.0.Alpha4 Apr 10, 2019 3:07:53 AM io.quarkus.runtime.Timing printStartupTime INFO: Quarkus 0.13.0 started in 0.594s. Listening on: http://[::]:8080 Apr 10, 2019 3:07:53 AM io.quarkus.runtime.Timing printStartupTime INFO: Installed features: [cdi, resteasy, resteasy-jsonb, smallrye-health] ```
b797fc8032de03698733792a6e49f59206b66658
d0cb45ade657ee7b3d0221cef31ef6bfc1fa08c5
https://github.com/quarkusio/quarkus/compare/b797fc8032de03698733792a6e49f59206b66658...d0cb45ade657ee7b3d0221cef31ef6bfc1fa08c5
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 e2a215d788e..6a19d305a68 100644 --- a/core/runtime/src/main/java/io/quarkus/runtime/Application.java +++ b/core/runtime/src/main/java/io/quarkus/runtime/Application.java @@ -35,7 +35,10 @@ */ @SuppressWarnings("restriction") public abstract class Application { - private static final Logger LOG = Logger.getLogger(Application.class); + + // WARNING: do not inject a logger here, it's too early: the log manager has not been properly set up yet + + private static final String DISABLE_SIGNAL_HANDLERS = "DISABLE_SIGNAL_HANDLERS"; private static final int ST_INITIAL = 0; private static final int ST_STARTING = 1; @@ -65,7 +68,7 @@ protected Application() { * @implNote The command line args are not yet used, but at some point we'll want a facility for overriding config and/or * letting the user hook into it. */ - public final void start(@SuppressWarnings("unused") String[] args) { + public final void start(String[] args) { final Lock stateLock = this.stateLock; stateLock.lock(); try { @@ -180,8 +183,7 @@ public final void stop() { */ public final void run(String[] args) { try { - final String property = "DISABLE_SIGNAL_HANDLERS"; - if (ImageInfo.inImageRuntimeCode() && System.getenv(property) == null) { + if (ImageInfo.inImageRuntimeCode() && System.getenv(DISABLE_SIGNAL_HANDLERS) == null) { final SignalHandler handler = new SignalHandler() { @Override public void handle(final Signal signal) { @@ -197,9 +199,8 @@ public void handle(final Signal signal) { DiagnosticPrinter.printDiagnostics(System.out); } }); - } else { - LOG.warn("Installation of signal handlers disabled by the presence of the environment variable: " + property); } + final ShutdownHookThread shutdownHookThread = new ShutdownHookThread(Thread.currentThread()); Runtime.getRuntime().addShutdownHook(shutdownHookThread); start(args);
['core/runtime/src/main/java/io/quarkus/runtime/Application.java']
{'.java': 1}
1
1
0
0
1
3,539,871
693,409
92,419
909
799
162
13
1
1,300
153
471
27
2
2
"2019-04-10T09:59: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,296
quarkusio/quarkus/1945/1944
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/1944
https://github.com/quarkusio/quarkus/pull/1945
https://github.com/quarkusio/quarkus/pull/1945
1
fixes
Dev mode compilation fails if the .m2 path has special characters
DevModeMain is not handling the encoding correctly after reading it from the the text file
8fa5e409c5d268cda8f5f096e0246a52b33d0174
7f1f4b13eaa56b161df332760ed17067da9b0b8e
https://github.com/quarkusio/quarkus/compare/8fa5e409c5d268cda8f5f096e0246a52b33d0174...7f1f4b13eaa56b161df332760ed17067da9b0b8e
diff --git a/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java b/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java index c34b0f8642e..1160aeada2b 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java +++ b/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java @@ -26,6 +26,7 @@ import java.net.URISyntaxException; import java.net.URL; import java.net.URLClassLoader; +import java.net.URLDecoder; import java.nio.charset.StandardCharsets; import java.util.ArrayDeque; import java.util.ArrayList; @@ -77,7 +78,7 @@ public ClassLoaderCompiler(ClassLoader classLoader, File outputDirectory, List<C Set<String> parsedFiles = new HashSet<>(); Deque<String> toParse = new ArrayDeque<>(); for (URL url : urls) { - toParse.add(new File(url.getPath()).getAbsolutePath()); + toParse.add(new File(URLDecoder.decode(url.getPath(), StandardCharsets.UTF_8.name())).getAbsolutePath()); } Set<File> classPathElements = new HashSet<>(); classPathElements.add(outputDirectory);
['core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java']
{'.java': 1}
1
1
0
0
1
3,531,614
691,779
92,217
907
216
40
3
1
90
15
17
1
0
0
"2019-04-09T11:07: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,229
quarkusio/quarkus/3738/3663
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3663
https://github.com/quarkusio/quarkus/pull/3738
https://github.com/quarkusio/quarkus/pull/3738
1
fixes
vertx event look thread blocked Warning messages
**Describe the bug** Pretty much every time I build projects from quickstart, or running some runner jars throws WARNING messages that vertx event loop is blocked as below ``` 2019-08-23 11:22:21,441 WARNING [io.ver.cor.imp.BlockedThreadChecker] (vertx-blocked-thread-checker) Thread Thread[vert.x-eventloop-thread-4,5,main]=Thread[vert.x-eventloop-thread-4,5,main] has been blocked for 3916 ms, time limit is 2000 ms: io.vertx.core.VertxException: Thread blocked at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method) at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:929) at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1324) at java.net.InetAddress.getLocalHost(InetAddress.java:1501) at sun.management.VMManagementImpl.getVmId(VMManagementImpl.java:140) at sun.management.RuntimeImpl.getName(RuntimeImpl.java:59) 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.netty.channel.DefaultChannelId.defaultProcessId(DefaultChannelId.java:120) at io.netty.channel.DefaultChannelId.<clinit>(DefaultChannelId.java:77) at io.netty.channel.AbstractChannel.newId(AbstractChannel.java:112) at io.netty.channel.AbstractChannel.<init>(AbstractChannel.java:84) at io.netty.channel.nio.AbstractNioChannel.<init>(AbstractNioChannel.java:84) at io.netty.channel.nio.AbstractNioMessageChannel.<init>(AbstractNioMessageChannel.java:42) at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:88) at io.netty.channel.socket.nio.NioServerSocketChannel.<init>(NioServerSocketChannel.java:74) at io.vertx.core.net.impl.transport.Transport$$Lambda$235/888928066.newChannel(Unknown Source) at io.netty.bootstrap.AbstractBootstrap.initAndRegister(AbstractBootstrap.java:320) at io.netty.bootstrap.AbstractBootstrap.doBind(AbstractBootstrap.java:282) at io.netty.bootstrap.AbstractBootstrap.bind(AbstractBootstrap.java:278) at io.vertx.core.net.impl.AsyncResolveConnectHelper.lambda$doBind$3(AsyncResolveConnectHelper.java:86) at io.vertx.core.net.impl.AsyncResolveConnectHelper$$Lambda$236/986266054.handle(Unknown Source) at io.vertx.core.impl.AddressResolver.lambda$null$0(AddressResolver.java:88) at io.vertx.core.impl.AddressResolver$$Lambda$238/922142897.handle(Unknown Source) at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:369) at io.vertx.core.impl.EventLoopContext.lambda$executeAsync$0(EventLoopContext.java:38) at io.vertx.core.impl.EventLoopContext$$Lambda$228/259319861.run(Unknown Source) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:495) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.lang.Thread.run(Thread.java:748) 2019-08-23 11:22:22,589 INFO [io.quarkus] (main) Quarkus 999-SNAPSHOT started in 16.301s. Listening on: http://0.0.0.0:8080 ``` **Expected behavior** No warning **Actual behavior** Warning message about event loop blocked **To Reproduce** I build integration test of dynamodb module (see PR #3172) 1. Just build `mvn clean install` the `integration-tests/amazon-dynamodb` 2. Run the runner `java -jar target/quarkus-integration-test-amazon-dynamodb-999-SNAPSHOT-runner.jar` I'm experiencing the same issue when running any integration tests. **Configuration** N/A **Screenshots** (If applicable, add screenshots to help explain your problem.) **Environment (please complete the following information):** - Output of `uname -a` or `ver`: `Darwin PL-MAC.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jun 20 18:42:21 PDT 2019; root:xnu-4903.270.47~4/RELEASE_X86_64 x86_64` - Output of `java -version`: ``` java version "1.8.0_192" Java(TM) SE Runtime Environment (build 1.8.0_192-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode) ``` - GraalVM version (if different from Java): ``` openjdk version "1.8.0_222" OpenJDK Runtime Environment (build 1.8.0_222-20190711112007.graal.jdk8u-src-tar-gz-b08) OpenJDK 64-Bit GraalVM CE 19.1.1 (build 25.222-b08-jvmci-19.1-b01, mixed mode) ``` - Quarkus version or git rev: `SNAPSHOT`, e.g. #3172 **Additional context** (Add any other context about the problem here.)
4703d0e23c1367298f715626fa1189082af59e82
61e145f0ef64174e789ae59e013dcadd9daa5eba
https://github.com/quarkusio/quarkus/compare/4703d0e23c1367298f715626fa1189082af59e82...61e145f0ef64174e789ae59e013dcadd9daa5eba
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 33946a8b60c..99bcdc4d5e4 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 @@ -96,6 +96,15 @@ SubstrateConfigBuildItem build(BuildProducer<JniBuildItem> jni) { .build(); } + @BuildStep + @Record(ExecutionTime.RUNTIME_INIT) + public void eagerlyInitClass(NettyRecorder recorder) { + //see https://github.com/quarkusio/quarkus/issues/3663 + //this class is slow to initialize, we make sure that we do it eagerly + //before it blocks the IO thread and causes a warning + recorder.eagerlyInitChannelId(); + } + @BuildStep @Record(ExecutionTime.STATIC_INIT) void createExecutors(BuildProducer<RuntimeBeanBuildItem> runtimeBeanBuildItemBuildProducer, diff --git a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/NettyRecorder.java b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/NettyRecorder.java index e9bb23f3f44..f75f2de6b1b 100644 --- a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/NettyRecorder.java +++ b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/NettyRecorder.java @@ -2,6 +2,9 @@ import java.util.function.Supplier; +import org.jboss.logging.Logger; + +import io.netty.channel.DefaultChannelId; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.quarkus.runtime.annotations.Recorder; @@ -9,6 +12,25 @@ @Recorder public class NettyRecorder { + private static final Logger log = Logger.getLogger(NettyRecorder.class); + + public void eagerlyInitChannelId() { + //this class is slow to init and can block the IO thread and cause a warning + //we init it from a throway thread to stop this + //we do it from another thread so as not to affect start time + new Thread(new Runnable() { + @Override + public void run() { + long start = System.currentTimeMillis(); + DefaultChannelId.newInstance(); + if (System.currentTimeMillis() - start > 1000) { + log.warn( + "Localhost lookup took more than one second, you need to add a /etc/hosts entry to improve Quarkus startup time. See https://thoeni.io/post/macos-sierra-java/ for details."); + } + } + }).start(); + } + public Supplier<Object> createEventLoop(int nThreads) { return new Supplier<Object>() {
['extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java', 'extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/NettyRecorder.java']
{'.java': 2}
2
2
0
0
2
4,413,153
854,103
114,119
1,156
1,353
281
31
2
4,994
299
1,244
81
1
3
"2019-08-27T13:08: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,228
quarkusio/quarkus/3765/2936
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/2936
https://github.com/quarkusio/quarkus/pull/3765
https://github.com/quarkusio/quarkus/pull/3765
1
fixes
Entities extending PanacheEntityBase are not enhanced in dev mode when located in a dependency
**Describe the bug** Getters and setters are not generated for an entity extending `PanacheEntityBase` and located in a dependency of a Quarkus project. This dependency contains an empty `beans.xml`. **Expected behavior** The Quarkus documentation says entities getter/setter generation should work for entities from dependencies as long as there's an empty beans.xml in the dependencies: > Hibernate ORM in Quarkus relies on compile-time bytecode enhancements to your entities. If you define your entities in the same project where you build your Quarkus application, everything will work fine. If the entities come from external projects or jars, you can make sure that your jar is treated like a Quarkus application library by adding an empty META-INF/beans.xml file. This will allow Quarkus to index and enhance your entities as if they were inside the current project. **Actual behavior** ``` org.jboss.resteasy.spi.UnhandledException: java.lang.NoSuchMethodError: com.gwenneg.EntityWithoutGetterSetter.setName(Ljava/lang/String;)V 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 org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:61) at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) 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.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$8$1$1.call(UndertowDeploymentTemplate.java:482) 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:90) 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:1429) 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.lang.NoSuchMethodError: com.gwenneg.EntityWithoutGetterSetter.setName(Ljava/lang/String;)V at com.gwenneg.todo.application.ReproducerResource.test(ReproducerResource.java:16) at com.gwenneg.todo.application.ReproducerResource_ClientProxy.test(ReproducerResource_ClientProxy.zig:159) 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) ... 50 more ``` **To Reproduce** Steps to reproduce the behavior: 1. Clone https://github.com/gwenneg/quarkus-panache-getter-setter-generation 2. Run `cd entity-dependency` 3. Run `./mvnw clean install` 4. Run `cd ../jaxrs-resource` 5. Run `./mvnw clean compile quarkus:dev` 6. Call http://localhost:8080/reproducer/test from browser **Environment:** - Output of `java -version`: `openjdk version "11" 2018-09-25` - Quarkus version or git rev: `0.17.0`
221d1ade0c0162301aa0be1f9772ae357529c3e0
df8a13d85cd36f43f94b86c9fb7211201645400a
https://github.com/quarkusio/quarkus/compare/221d1ade0c0162301aa0be1f9772ae357529c3e0...df8a13d85cd36f43f94b86c9fb7211201645400a
diff --git a/core/deployment/src/main/java/io/quarkus/runner/RuntimeClassLoader.java b/core/deployment/src/main/java/io/quarkus/runner/RuntimeClassLoader.java index 22ec24c77c4..912622810e1 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/RuntimeClassLoader.java +++ b/core/deployment/src/main/java/io/quarkus/runner/RuntimeClassLoader.java @@ -26,6 +26,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Future; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiFunction; import java.util.function.Consumer; @@ -80,7 +81,9 @@ public void accept(Path path) { }); } } + this.applicationClasses = applicationClasses; + } catch (IOException e) { throw new RuntimeException(e); } @@ -201,17 +204,11 @@ protected Class<?> findClass(String name) throws ClassNotFoundException { } } try { - byte[] buf = new byte[1024]; - int r; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try (FileInputStream in = new FileInputStream(classLoc.toFile())) { - while ((r = in.read(buf)) > 0) { - out.write(buf, 0, r); - } + try { + bytes = Files.readAllBytes(classLoc); } catch (IOException e) { throw new ClassNotFoundException("Failed to load class", e); } - bytes = out.toByteArray(); bytes = handleTransform(name, bytes); definePackage(name); Class<?> clazz = defineClass(name, bytes, 0, bytes.length); @@ -273,6 +270,38 @@ public void setTransformers(Map<String, List<BiFunction<String, ClassVisitor, Cl this.bytecodeTransformers = functions; } + public void setApplicationArchives(List<Path> archives) { + //we also need to be able to transform application archives + //this is not great but I can't really see a better solution + if (bytecodeTransformers == null) { + return; + } + try { + for (Path root : archives) { + Map<String, Path> classes = new HashMap<>(); + AtomicBoolean transform = new AtomicBoolean(); + Files.walk(root).forEach(new Consumer<Path>() { + @Override + public void accept(Path path) { + if (path.toString().endsWith(".class")) { + String key = root.relativize(path).toString().replace('\\\\', '/'); + classes.put(key, path); + if (bytecodeTransformers + .containsKey(key.substring(0, key.length() - ".class".length()).replace("/", "."))) { + transform.set(true); + } + } + } + }); + if (transform.get()) { + applicationClasses.putAll(classes); + } + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + @Override public void writeResource(String name, byte[] data) throws IOException { resources.put(name, data); 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 943c803aefd..be9b0d74d32 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java +++ b/core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java @@ -17,13 +17,16 @@ import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.logging.Handler; +import java.util.stream.Collectors; import org.objectweb.asm.ClassVisitor; import io.quarkus.builder.BuildChainBuilder; import io.quarkus.builder.BuildResult; +import io.quarkus.deployment.ApplicationArchive; import io.quarkus.deployment.ClassOutput; import io.quarkus.deployment.QuarkusAugmentor; +import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem; import io.quarkus.deployment.builditem.ApplicationClassNameBuildItem; import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem; import io.quarkus.deployment.builditem.LiveReloadBuildItem; @@ -115,6 +118,11 @@ public void run() { transformerTarget.setTransformers(functions); } + if (loader instanceof RuntimeClassLoader) { + ApplicationArchivesBuildItem archives = result.consume(ApplicationArchivesBuildItem.class); + ((RuntimeClassLoader) loader).setApplicationArchives(archives.getApplicationArchives().stream() + .map(ApplicationArchive::getArchiveRoot).collect(Collectors.toList())); + } final Application application; Class<? extends Application> appClass = loader
['core/deployment/src/main/java/io/quarkus/runner/RuntimeRunner.java', 'core/deployment/src/main/java/io/quarkus/runner/RuntimeClassLoader.java']
{'.java': 2}
2
2
0
0
2
4,594,039
886,532
117,957
1,179
2,469
413
53
2
9,500
357
2,076
105
2
1
"2019-08-29T03:52:51"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,227
quarkusio/quarkus/3849/3844
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/3844
https://github.com/quarkusio/quarkus/pull/3849
https://github.com/quarkusio/quarkus/pull/3849
1
fixes
Dev mode: several Vert.x worker threads detecting the change
Still with a very simple getting-started application. I start in dev mode. I don't load anything. I go to the `src/main/java/org/acme/quickstart/GreetingResource.java` resource and remove a semi-colon to have a compilation error. When I load the `http://localhost:8080/hello` page, I end up with several Vert.x worker threads signaling the change: ``` 2019-09-04 11:13:58,811 INFO [io.qua.dev] (vert.x-worker-thread-0) Changed source files detected, recompiling [/tmp/getting-started/src/main/java/org/acme/quickstart/GreetingResource.java] 2019-09-04 11:13:58,818 INFO [io.qua.dev] (vert.x-worker-thread-1) Changed source files detected, recompiling [/tmp/getting-started/src/main/java/org/acme/quickstart/GreetingResource.java] 2019-09-04 11:14:04,274 INFO [io.qua.dev] (vert.x-worker-thread-2) Changed source files detected, recompiling [/tmp/getting-started/src/main/java/org/acme/quickstart/GreetingResource.java] 2019-09-04 11:14:25,273 INFO [io.qua.dev] (vert.x-worker-thread-3) Changed source files detected, recompiling [/tmp/getting-started/src/main/java/org/acme/quickstart/GreetingResource.java] ``` It's variable, sometimes I have 1, sometimes 2, and sometimes like in this case 4.
ddfce9ef10b99060e571a255931f5f14444eda51
87638416ed2fb7c98f250f9313e400687d908c2b
https://github.com/quarkusio/quarkus/compare/ddfce9ef10b99060e571a255931f5f14444eda51...87638416ed2fb7c98f250f9313e400687d908c2b
diff --git a/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/devmode/VertxHotReplacementSetup.java b/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/devmode/VertxHotReplacementSetup.java index 9f49c32b810..416f5cd166a 100644 --- a/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/devmode/VertxHotReplacementSetup.java +++ b/extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/devmode/VertxHotReplacementSetup.java @@ -47,13 +47,13 @@ public void handle(Promise<Boolean> event) { boolean restart = false; synchronized (this) { if (nextUpdate < System.currentTimeMillis() || hotReplacementContext.isTest()) { + nextUpdate = System.currentTimeMillis() + HOT_REPLACEMENT_INTERVAL; try { restart = hotReplacementContext.doScan(true); } catch (Exception e) { event.fail(new IllegalStateException("Unable to perform hot replacement scanning", e)); return; } - nextUpdate = System.currentTimeMillis() + HOT_REPLACEMENT_INTERVAL; } } if (hotReplacementContext.getDeploymentProblem() != null) {
['extensions/vertx-web/deployment/src/main/java/io/quarkus/vertx/web/deployment/devmode/VertxHotReplacementSetup.java']
{'.java': 1}
1
1
0
0
1
4,707,875
908,090
120,795
1,209
185
28
2
1
1,213
109
342
13
1
1
"2019-09-04T11:54:42"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,168
quarkusio/quarkus/6023/6017
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6017
https://github.com/quarkusio/quarkus/pull/6023
https://github.com/quarkusio/quarkus/pull/6023
1
fixes
quarkus-integration-test-kogito build fails in native mode with JDK 11
**Describe the bug** ``` [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 19.3.0 CE [INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /Library/Java/JavaVirtualMachines/graalvm-ce-java11-19.3.0/Contents/Home/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -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 -H:+TraceClassInitialization --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar quarkus-integration-test-kogito-999-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+AddAllCharsets -H:EnableURLProtocols=http -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace quarkus-integration-test-kogito-999-SNAPSHOT-runner [quarkus-integration-test-kogito-999-SNAPSHOT-runner:51213] classlist: 41,192.02 ms [quarkus-integration-test-kogito-999-SNAPSHOT-runner:51213] (cap): 6,009.80 ms [quarkus-integration-test-kogito-999-SNAPSHOT-runner:51213] setup: 10,921.17 ms 11:42:03,092 INFO [org.jbo.threads] JBoss Threads version 3.0.0.Final [quarkus-integration-test-kogito-999-SNAPSHOT-runner:51213] (typeflow): 99,864.10 ms [quarkus-integration-test-kogito-999-SNAPSHOT-runner:51213] (objects): 71,636.80 ms [quarkus-integration-test-kogito-999-SNAPSHOT-runner:51213] (features): 3,055.08 ms [quarkus-integration-test-kogito-999-SNAPSHOT-runner:51213] analysis: 182,299.87 ms Error: No instances of java.io.FilePermission are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked. Detailed message: Trace: object java.util.concurrent.ConcurrentHashMap$Node object java.util.concurrent.ConcurrentHashMap$Node[] object java.util.concurrent.ConcurrentHashMap object java.io.FilePermissionCollection object java.util.concurrent.ConcurrentHashMap$Node object java.util.concurrent.ConcurrentHashMap$Node[] object java.util.concurrent.ConcurrentHashMap object java.security.Permissions object java.security.ProtectionDomain method org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(Class, String, ClassFieldAccessorCache$CacheEntry) Call path from entry point to org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(Class, String, ClassFieldAccessorCache$CacheEntry): at org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(ClassFieldAccessorFactory.java:164) at org.drools.core.base.ClassFieldAccessorCache$CacheEntry.getWriteAccessor(ClassFieldAccessorCache.java:204) at org.drools.core.base.ClassFieldAccessorCache.getWriteAcessor(ClassFieldAccessorCache.java:115) at org.drools.core.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:298) at org.drools.core.base.ClassFieldAccessorStore.merge(ClassFieldAccessorStore.java:240) at org.drools.core.impl.KnowledgeBaseImpl.internalAddPackages(KnowledgeBaseImpl.java:902) at org.drools.core.impl.KnowledgeBaseImpl.lambda$addPackages$2(KnowledgeBaseImpl.java:729) at org.drools.core.impl.KnowledgeBaseImpl$$Lambda$1363/0x00000008423e6040.run(Unknown Source) at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144) at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89) at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:143) at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186) at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0) com.oracle.svm.core.util.UserError$UserException: No instances of java.io.FilePermission are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked. Detailed message: Trace: object java.util.concurrent.ConcurrentHashMap$Node object java.util.concurrent.ConcurrentHashMap$Node[] object java.util.concurrent.ConcurrentHashMap object java.io.FilePermissionCollection object java.util.concurrent.ConcurrentHashMap$Node object java.util.concurrent.ConcurrentHashMap$Node[] object java.util.concurrent.ConcurrentHashMap object java.security.Permissions object java.security.ProtectionDomain method org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(Class, String, ClassFieldAccessorCache$CacheEntry) Call path from entry point to org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(Class, String, ClassFieldAccessorCache$CacheEntry): at org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(ClassFieldAccessorFactory.java:164) at org.drools.core.base.ClassFieldAccessorCache$CacheEntry.getWriteAccessor(ClassFieldAccessorCache.java:204) at org.drools.core.base.ClassFieldAccessorCache.getWriteAcessor(ClassFieldAccessorCache.java:115) at org.drools.core.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:298) at org.drools.core.base.ClassFieldAccessorStore.merge(ClassFieldAccessorStore.java:240) at org.drools.core.impl.KnowledgeBaseImpl.internalAddPackages(KnowledgeBaseImpl.java:902) at org.drools.core.impl.KnowledgeBaseImpl.lambda$addPackages$2(KnowledgeBaseImpl.java:729) at org.drools.core.impl.KnowledgeBaseImpl$$Lambda$1363/0x00000008423e6040.run(Unknown Source) at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144) at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89) at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:143) at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186) at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0) at com.oracle.svm.core.util.UserError.abort(UserError.java:75) at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:221) at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:736) at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530) at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445) at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177) Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: No instances of java.io.FilePermission are allowed in the image heap as this class should be initialized at image runtime. Object has been initialized without the native-image initialization instrumentation and the stack trace can't be tracked. Detailed message: Trace: object java.util.concurrent.ConcurrentHashMap$Node object java.util.concurrent.ConcurrentHashMap$Node[] object java.util.concurrent.ConcurrentHashMap object java.io.FilePermissionCollection object java.util.concurrent.ConcurrentHashMap$Node object java.util.concurrent.ConcurrentHashMap$Node[] object java.util.concurrent.ConcurrentHashMap object java.security.Permissions object java.security.ProtectionDomain method org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(Class, String, ClassFieldAccessorCache$CacheEntry) Call path from entry point to org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(Class, String, ClassFieldAccessorCache$CacheEntry): at org.drools.core.base.ClassFieldAccessorFactory.getClassFieldWriter(ClassFieldAccessorFactory.java:164) at org.drools.core.base.ClassFieldAccessorCache$CacheEntry.getWriteAccessor(ClassFieldAccessorCache.java:204) at org.drools.core.base.ClassFieldAccessorCache.getWriteAcessor(ClassFieldAccessorCache.java:115) at org.drools.core.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:298) at org.drools.core.base.ClassFieldAccessorStore.merge(ClassFieldAccessorStore.java:240) at org.drools.core.impl.KnowledgeBaseImpl.internalAddPackages(KnowledgeBaseImpl.java:902) at org.drools.core.impl.KnowledgeBaseImpl.lambda$addPackages$2(KnowledgeBaseImpl.java:729) at org.drools.core.impl.KnowledgeBaseImpl$$Lambda$1363/0x00000008423e6040.run(Unknown Source) at com.oracle.svm.core.jdk.RuntimeSupport.executeHooks(RuntimeSupport.java:144) at com.oracle.svm.core.jdk.RuntimeSupport.executeStartupHooks(RuntimeSupport.java:89) at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:143) at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186) at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0) at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126) at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:733) ... 8 more ``` **To Reproduce** Steps to reproduce the behavior from the `master` branch: 1. (Optional) Set the `JAVA_HOME` environment variable to a JDK 11 installation directory (OpenJDK 11 or GraalVM 19.3.0 JDK 11 edition). Add the JDK 11 `bin` directory to the path. 2. (Optional) Run `./mvnw clean install -Dmaven.test.skip=true` to build all the Quarkus sources with the JDK 11. 3. Run `./mvnw clean install --projects :quarkus-integration-test-kogito -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:19.3.0-java11`.
b76f837726c88c46bdfadf7738b538d284a294a4
7cbf09cd731ac9de28efb3cd73e6cb47b539e26f
https://github.com/quarkusio/quarkus/compare/b76f837726c88c46bdfadf7738b538d284a294a4...7cbf09cd731ac9de28efb3cd73e6cb47b539e26f
diff --git a/extensions/kogito/deployment/src/main/java/io/quarkus/kogito/deployment/KogitoAssetsProcessor.java b/extensions/kogito/deployment/src/main/java/io/quarkus/kogito/deployment/KogitoAssetsProcessor.java index 7e031553e4c..e040ceaba9d 100644 --- a/extensions/kogito/deployment/src/main/java/io/quarkus/kogito/deployment/KogitoAssetsProcessor.java +++ b/extensions/kogito/deployment/src/main/java/io/quarkus/kogito/deployment/KogitoAssetsProcessor.java @@ -20,6 +20,7 @@ import org.drools.compiler.commons.jci.compilers.JavaCompilerSettings; import org.drools.compiler.compiler.io.memory.MemoryFileSystem; import org.drools.compiler.kproject.models.KieModuleModelImpl; +import org.drools.core.base.ClassFieldAccessorFactory; import org.drools.modelcompiler.builder.GeneratedFile; import org.drools.modelcompiler.builder.JavaParserCompiler; import org.jboss.jandex.ClassInfo; @@ -53,6 +54,7 @@ import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyIgnoreWarningBuildItem; +import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem; import io.quarkus.deployment.index.IndexingUtil; import io.quarkus.runtime.LaunchMode; @@ -134,6 +136,11 @@ public List<ReflectiveHierarchyIgnoreWarningBuildItem> reflectiveDMNREST() { return result; } + @BuildStep + public RuntimeInitializedClassBuildItem init() { + return new RuntimeInitializedClassBuildItem(ClassFieldAccessorFactory.class.getName()); + } + @BuildStep(loadsApplicationClasses = true) public void generateModel(ArchiveRootBuildItem root, BuildProducer<GeneratedBeanBuildItem> generatedBeans,
['extensions/kogito/deployment/src/main/java/io/quarkus/kogito/deployment/KogitoAssetsProcessor.java']
{'.java': 1}
1
1
0
0
1
6,496,025
1,255,866
168,246
1,765
317
61
7
1
10,211
463
2,467
114
0
1
"2019-12-08T20:47: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,160
quarkusio/quarkus/6343/6342
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6342
https://github.com/quarkusio/quarkus/pull/6343
https://github.com/quarkusio/quarkus/pull/6343
1
fixes
spring-di: @Named should be a bean defining annotation
**Describe the bug** While migrating a spring war application based on JSR-303 to Quarkus, beans annotated with `@javax.inject.Named` and without an explicit scope are not seen by Arc. Indeed CDI, `@javax.inject.Named` is not a bean defining annotation by itself. But in Spring DI it is an equivalent to `@org.springframework.stereotype.Component` (with the difference that it is not a composable annotation) - cf https://github.com/spring-projects/spring-framework/blob/76645644b1cb99cbee155dfea2852ee13914b3e3/src/docs/asciidoc/core/core-beans.adoc#named-and-managedbean-standard-equivalents-to-the-component-annotation Here is a working spring test: ```java @ExtendWith(SpringExtension.class) @ContextConfiguration(classes = { SpringNamedTest.MyBean.class }) public class SpringNamedTest { @Inject MyBean myBean; @Test public void testInjection() { assertNotNull(myBean); } @Named public static class MyBean { } } ``` **Expected behavior** Dependency injection of MyBean works. **Actual behavior** No qualifying bean found by Arc. **Environment (please complete the following information):** - Output of `java -version`: java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) - Quarkus version or git rev: 1.1.0.Final **Additional context** I'll open a PR with proposed reproducer on integration-tests/spring-di and a fix.
b181352b9c88492c5058f2a1f3ba934c70019e05
c35a01632e1e7ae7fc1f16b54cfa17c393cba7a5
https://github.com/quarkusio/quarkus/compare/b181352b9c88492c5058f2a1f3ba934c70019e05...c35a01632e1e7ae7fc1f16b54cfa17c393cba7a5
diff --git a/extensions/spring-di/deployment/src/main/java/io/quarkus/spring/di/deployment/SpringDIProcessor.java b/extensions/spring-di/deployment/src/main/java/io/quarkus/spring/di/deployment/SpringDIProcessor.java index 7fd9463ccce..3ceef513391 100644 --- a/extensions/spring-di/deployment/src/main/java/io/quarkus/spring/di/deployment/SpringDIProcessor.java +++ b/extensions/spring-di/deployment/src/main/java/io/quarkus/spring/di/deployment/SpringDIProcessor.java @@ -313,7 +313,11 @@ Set<AnnotationInstance> getAnnotationsToAdd( } } } - final DotName declaredScope = getScope(classInfo); + DotName declaredScope = getScope(classInfo); + // @Named is a bean-defining annotation in Spring, but not in Arc. + if (declaredScope == null && classInfo.classAnnotation(CDI_NAMED_ANNOTATION) != null) { + declaredScope = CDI_SINGLETON_ANNOTATION; // implicit default scope in spring + } final boolean isAnnotation = isAnnotation(classInfo.flags()); if (declaredScope != null) { annotationsToAdd.add(create( diff --git a/integration-tests/spring-di/src/main/java/io/quarkus/it/spring/AppConfiguration.java b/integration-tests/spring-di/src/main/java/io/quarkus/it/spring/AppConfiguration.java index 5fef2202c95..c2c0d08be8b 100644 --- a/integration-tests/spring-di/src/main/java/io/quarkus/it/spring/AppConfiguration.java +++ b/integration-tests/spring-di/src/main/java/io/quarkus/it/spring/AppConfiguration.java @@ -1,5 +1,6 @@ package io.quarkus.it.spring; +import javax.inject.Named; import javax.inject.Singleton; import org.springframework.beans.factory.annotation.Qualifier; @@ -50,4 +51,9 @@ private static class AnotherRequestBean { public static class CustomPrototypeBean { } + + @Named + public static class NamedBean { + + } } diff --git a/integration-tests/spring-di/src/main/java/io/quarkus/it/spring/InjectedSpringBeansResource.java b/integration-tests/spring-di/src/main/java/io/quarkus/it/spring/InjectedSpringBeansResource.java index f0ceb748968..3dd0a8ffd28 100644 --- a/integration-tests/spring-di/src/main/java/io/quarkus/it/spring/InjectedSpringBeansResource.java +++ b/integration-tests/spring-di/src/main/java/io/quarkus/it/spring/InjectedSpringBeansResource.java @@ -1,7 +1,5 @@ package io.quarkus.it.spring; -import static io.quarkus.it.spring.AppConfiguration.CustomPrototypeBean; - import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.GET; @@ -11,6 +9,9 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; +import io.quarkus.it.spring.AppConfiguration.CustomPrototypeBean; +import io.quarkus.it.spring.AppConfiguration.NamedBean; + @Path("/") public class InjectedSpringBeansResource { @@ -22,6 +23,8 @@ public class InjectedSpringBeansResource { SessionBean sessionBean; @Inject CustomPrototypeBean anotherRequestBean; + @Inject + NamedBean namedBean; @GET @Produces(MediaType.TEXT_PLAIN)
['extensions/spring-di/deployment/src/main/java/io/quarkus/spring/di/deployment/SpringDIProcessor.java', 'integration-tests/spring-di/src/main/java/io/quarkus/it/spring/AppConfiguration.java', 'integration-tests/spring-di/src/main/java/io/quarkus/it/spring/InjectedSpringBeansResource.java']
{'.java': 3}
3
3
0
0
3
6,603,921
1,276,423
171,207
1,805
412
87
6
1
1,494
163
372
45
1
1
"2019-12-26T13:08:07"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,163
quarkusio/quarkus/6278/6275
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6275
https://github.com/quarkusio/quarkus/pull/6278
https://github.com/quarkusio/quarkus/pull/6278
1
fixes
UnsupportedOperationException when trying to run dev mode on a multi-module project.
**Describe the bug** When trying to run quarkus:dev on a multi-module project this issue happens: ``` Listening for transport dt_socket at address: 5005 Exception in thread "main" java.lang.RuntimeException: java.lang.UnsupportedOperationException at io.quarkus.dev.DevModeMain.main(DevModeMain.java:70) Caused by: java.lang.UnsupportedOperationException at java.base/java.util.AbstractCollection.add(AbstractCollection.java:267) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.Collections$2.tryAdvance(Collections.java:4747) at java.base/java.util.Collections$2.forEachRemaining(Collections.java:4755) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497) at io.quarkus.dev.DevModeContext$ModuleInfo.addSourcePaths(DevModeContext.java:165) at io.quarkus.dev.DevModeMain.lambda$setupRuntimeCompilation$0(DevModeMain.java:232) at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) at io.quarkus.dev.DevModeMain.setupRuntimeCompilation(DevModeMain.java:232) at io.quarkus.dev.DevModeMain.start(DevModeMain.java:88) at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66) ``` **To Reproduce** Steps to reproduce the behavior: 1. create a multi module project 2. navitage to the "runnable" module 3. run mvn clean compile quarkus:dev **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`: > openjdk version "11.0.5" 2019-10-15 > OpenJDK Runtime Environment 18.9 (build 11.0.5+10) > OpenJDK 64-Bit Server VM 18.9 (build 11.0.5+10, mixed mode, sharing) - GraalVM version (if different from Java): Not used in this case - Quarkus version or git rev: tested with 1.0.1.Final and 1.1.0.Final **Additional context** (Add any other context about the problem here.)
44e5e2e3a642d1fa7af9ddea44b6ff8d37e862b8
e9176e6f11b7c07f5a1f0bf8b5c1ed94d335a55d
https://github.com/quarkusio/quarkus/compare/44e5e2e3a642d1fa7af9ddea44b6ff8d37e862b8...e9176e6f11b7c07f5a1f0bf8b5c1ed94d335a55d
diff --git a/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java b/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java index ba3f3d19da6..6d4a0e0d2cc 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java +++ b/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java @@ -5,7 +5,9 @@ import java.net.URL; 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.Set; @@ -163,7 +165,7 @@ public ModuleInfo( String resourcePath) { this.name = name; this.projectDirectory = projectDirectory; - this.sourcePaths = sourcePaths; + this.sourcePaths = sourcePaths == null ? new HashSet<>() : new HashSet<>(sourcePaths); this.classesPath = classesPath; this.resourcePath = resourcePath; } @@ -177,7 +179,7 @@ public String getProjectDirectory() { } public Set<String> getSourcePaths() { - return sourcePaths; + return Collections.unmodifiableSet(sourcePaths); } public void addSourcePaths(Collection<String> additionalPaths) {
['core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java']
{'.java': 1}
1
1
0
0
1
6,591,805
1,274,094
170,908
1,799
297
53
6
1
2,745
188
655
61
0
2
"2019-12-20T05:10: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,164
quarkusio/quarkus/6216/6214
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6214
https://github.com/quarkusio/quarkus/pull/6216
https://github.com/quarkusio/quarkus/pull/6216
1
fixes
Spring Data JPA custom query with countQuery breaks in dev mode
**Describe the bug** There is a classloader issue when using the spring-data-jpa integration test in dev mode. **Expected behavior** Dev-mode should behave the same as regular mode. **Actual behavior** java.lang.LinkageError: io/quarkus/hibernate/orm/panache/PanacheQuery at io.quarkus.it.spring.data.jpa.MovieRepository_4263b43a08c2ca0cc9a7dd59c4e59bb4f9386bbdImpl.customFind(MovieRepository_4263b43a08c2ca0cc9a7dd59c4e59bb4f9386bbdImpl.zig:381) at io.quarkus.it.spring.data.jpa.MovieRepository_4263b43a08c2ca0cc9a7dd59c4e59bb4f9386bbdImpl_ClientProxy.customFind(MovieRepository_4263b43a08c2ca0cc9a7dd59c4e59bb4f9386bbdImpl_ClientProxy.zig:430) **To Reproduce** Steps to reproduce the behavior: 1. cd `integration-tests/spring-data-jpa` in Quarkus repo 2. `mvn clean quarkus:dev` 3. hit `http://localhost:8080/movie/customFind/page/1/0` This only appears after the change in #5823 was made.
cb132a732aeae9e396c151f3c1328a465cf90cea
e886a58f2898b9958feb0f5f7f53047ae783d135
https://github.com/quarkusio/quarkus/compare/cb132a732aeae9e396c151f3c1328a465cf90cea...e886a58f2898b9958feb0f5f7f53047ae783d135
diff --git a/extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/AdditionalJpaOperations.java b/extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/AdditionalJpaOperations.java similarity index 90% rename from extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/AdditionalJpaOperations.java rename to extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/AdditionalJpaOperations.java index 4ab7fe9800a..cc267002b26 100644 --- a/extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/AdditionalJpaOperations.java +++ b/extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/AdditionalJpaOperations.java @@ -9,6 +9,8 @@ import io.quarkus.panache.common.Parameters; import io.quarkus.panache.common.Sort; +//TODO this class is only needed by the Spring Data JPA module and would be placed there it it weren't for a dev-mode classloader issue +// see https://github.com/quarkusio/quarkus/issues/6214 public class AdditionalJpaOperations { @SuppressWarnings("rawtypes") @@ -19,7 +21,6 @@ public static PanacheQuery<?> find(Class<?> entityClass, String query, String co Query jpaQuery = em.createQuery(sort != null ? findQuery + JpaOperations.toOrderBy(sort) : findQuery); JpaOperations.bindParameters(jpaQuery, params); return new CustomCountPanacheQuery(em, jpaQuery, findQuery, countQuery, params); - // return new PanacheQueryImpl(em, jpaQuery, findQuery, params); } @SuppressWarnings("rawtypes") @@ -35,6 +36,5 @@ public static PanacheQuery<?> find(Class<?> entityClass, String query, String co Query jpaQuery = em.createQuery(sort != null ? findQuery + JpaOperations.toOrderBy(sort) : findQuery); JpaOperations.bindParameters(jpaQuery, params); return new CustomCountPanacheQuery(em, jpaQuery, findQuery, countQuery, params); - // return new PanacheQueryImpl(em, jpaQuery, findQuery, params); } } diff --git a/extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/CustomCountPanacheQuery.java b/extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/CustomCountPanacheQuery.java similarity index 75% rename from extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/CustomCountPanacheQuery.java rename to extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/CustomCountPanacheQuery.java index 0694fef6e40..dbe86a37471 100644 --- a/extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/CustomCountPanacheQuery.java +++ b/extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/CustomCountPanacheQuery.java @@ -3,6 +3,8 @@ import javax.persistence.EntityManager; import javax.persistence.Query; +//TODO this class is only needed by the Spring Data JPA module and would be placed there it it weren't for a dev-mode classloader issue +// see https://github.com/quarkusio/quarkus/issues/6214 public class CustomCountPanacheQuery<Entity> extends PanacheQueryImpl<Entity> { private final String customCountQuery;
['extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/CustomCountPanacheQuery.java', 'extensions/spring-data-jpa/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/AdditionalJpaOperations.java']
{'.java': 2}
2
2
0
0
2
6,563,566
1,268,579
170,026
1,792
0
0
0
2
916
65
302
19
1
0
"2019-12-16T21:12:18"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,165
quarkusio/quarkus/6186/6183
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6183
https://github.com/quarkusio/quarkus/pull/6186
https://github.com/quarkusio/quarkus/pull/6186
1
fixes
New "Launching JVM" log line appearing in quarkus:dev
Just launched a project with `quarkus:dev` and got that one: ``` [INFO] Launching JVM with command line: /data/opt/jdk1.8.0_221/jre/bin/java -XX:TieredStopAtLevel=1 -Xverify:none -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n -Djava.util.logging.manager=org.jboss.logmanager.LogManager -jar /tmp/jpa-example/target/jpa-example-dev.jar ``` I don't think it's something we want at the info level. @gastaldi is this the one you tweaked the other day? Do you know when it was introduced and why?
baeee85f8bbf33d275008b6780a290a229da36b9
366cf8f388415d800feb8a68ff825cfd519ac94f
https://github.com/quarkusio/quarkus/compare/baeee85f8bbf33d275008b6780a290a229da36b9...366cf8f388415d800feb8a68ff825cfd519ac94f
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 2c58b65a06a..c4314b90dcd 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 @@ -351,7 +351,9 @@ public void startDev() { .redirectErrorStream(true) .redirectInput(ProcessBuilder.Redirect.INHERIT) .directory(getWorkingDir()); - System.out.printf("Launching JVM with command line: %s%n", pb.command().stream().collect(joining(" "))); + if (getLogger().isDebugEnabled()) { + getLogger().debug("Launching JVM with command line: {}", pb.command().stream().collect(joining(" "))); + } Process p = pb.start(); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override 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 f40b1b722d2..4243d6c1e73 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -691,7 +691,9 @@ public Set<Path> getPomFiles() { public void run() throws Exception { // Display the launch command line in dev mode - getLog().info("Launching JVM with command line: " + args.stream().collect(joining(" "))); + if (getLog().isDebugEnabled()) { + getLog().debug("Launching JVM with command line: " + args.stream().collect(joining(" "))); + } process = new ProcessBuilder(args) .inheritIO() .directory(workingDir)
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java', 'devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java']
{'.java': 2}
2
2
0
0
2
6,559,277
1,267,783
169,954
1,792
572
119
8
2
523
56
148
8
0
1
"2019-12-15T23:59:09"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,167
quarkusio/quarkus/6104/6070
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6070
https://github.com/quarkusio/quarkus/pull/6104
https://github.com/quarkusio/quarkus/pull/6104
1
fixes
JAXB extension cannot handle empty lines in jaxb.index
**Describe the bug** I'm tweaking a Camel extension so that it makes use of the JAXB extension capability to discover classes from `jaxb.index`. Here's the content of `jaxb.index` that is causing problems: ``` # # Copyright 2005-2019 Dozer Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # AllowedExceptionsDefinition ClassDefinition ConfigurationDefinition ConverterTypeDefinition CopyByReferencesDefinition ``` The whitespace after the license header results in: ``` Build step io.quarkus.jaxb.deployment.JaxbProcessor#process threw an exception: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.github.dozermapper.core.builder.model.jaxb. at io.quarkus.jaxb.deployment.JaxbProcessor.handleJaxbFile(JaxbProcessor.java:232) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1553) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) at io.quarkus.jaxb.deployment.JaxbProcessor.process(JaxbProcessor.java:207) ``` **Expected behavior** The JAXB extension ignores empty lines in `jaxb.index` and continues to process the file. **Actual behavior** See CNFE stack trace above. **To Reproduce** Steps to reproduce the behavior: 1. Create a project with a `jaxb.index` file like the one above 2. Include the `quarkus-jaxb` dependency in the project 3. Observe aforementioned CNFE **Environment (please complete the following information):** - Quarkus version: 1.0.1.Final
74deb14109cb528042d854c35293d8047db92835
e90c79973e8f8a147c8e6ef8aeabd1d40d5a5588
https://github.com/quarkusio/quarkus/compare/74deb14109cb528042d854c35293d8047db92835...e90c79973e8f8a147c8e6ef8aeabd1d40d5a5588
diff --git a/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java b/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java index 722aeb05b54..d8f62b43e8b 100644 --- a/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java +++ b/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java @@ -218,8 +218,9 @@ private void handleJaxbFile(Path p) { addResource(path); for (String line : Files.readAllLines(p)) { - if (!line.startsWith("#")) { - String clazz = pkg + line.trim(); + line = line.trim(); + if (!line.isEmpty() && !line.startsWith("#")) { + String clazz = pkg + line; Class<?> cl = Class.forName(clazz); while (cl != Object.class) {
['extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java']
{'.java': 1}
1
1
0
0
1
6,539,710
1,264,439
169,272
1,780
250
44
5
1
3,659
269
815
76
1
2
"2019-12-11T13:11:26"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,169
quarkusio/quarkus/6013/6011
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6011
https://github.com/quarkusio/quarkus/pull/6013
https://github.com/quarkusio/quarkus/pull/6013
1
fixes
quarkus-credential FORM auth cookie does not get renewed in the expected way
There are three generally accepted behaviors for timeout and renewal for credential session cookies. 1. [absolute-timeout](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#absolute-timeout) 1. [idle-timeout]( https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#idle-timeout) 1. [renewal-timeout](https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#renewal-timeout) Quarkus implements 2. as **timeout** (```quarkus.http.auth.form.timeout```) and 3. as **newCookieInterval** (```quarkus.http.auth.form.new-cookie-interval```). The implementation of 3. does not renew the cookie as expected. Let me follow up with a PR containing a comprehensive test and a fix to the behavior.
c13dad146aa3b77b7a5172fe7c4405f8cefd7f98
08e0b81524689f5cf3f0131c2b5c621b12c66a88
https://github.com/quarkusio/quarkus/compare/c13dad146aa3b77b7a5172fe7c4405f8cefd7f98...08e0b81524689f5cf3f0131c2b5c621b12c66a88
diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/FormAuthCookiesTestCase.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/FormAuthCookiesTestCase.java index 6623d50a180..bab97de48d6 100644 --- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/FormAuthCookiesTestCase.java +++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/FormAuthCookiesTestCase.java @@ -1,9 +1,34 @@ package io.quarkus.vertx.http.security; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.notNullValue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; import java.util.function.Supplier; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.Consts; +import org.apache.http.NameValuePair; +import org.apache.http.client.CookieStore; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.cookie.Cookie; +import org.apache.http.impl.client.BasicCookieStore; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; @@ -12,6 +37,7 @@ import org.junit.jupiter.api.extension.RegisterExtension; import io.quarkus.test.QuarkusUnitTest; +import io.quarkus.test.common.http.TestHTTPResource; import io.restassured.RestAssured; import io.restassured.filter.cookie.CookieFilter; @@ -25,8 +51,8 @@ public class FormAuthCookiesTestCase { "quarkus.http.auth.policy.r1.roles-allowed=admin\\n" + "quarkus.http.auth.permission.roles1.paths=/admin%E2%9D%A4\\n" + "quarkus.http.auth.permission.roles1.policy=r1\\n" + - "quarkus.http.auth.form.timeout=PT6S\\n" + - "quarkus.http.auth.form.new-cookie-interval=PT2S\\n" + + "quarkus.http.auth.form.timeout=PT2S\\n" + + "quarkus.http.auth.form.new-cookie-interval=PT1S\\n" + "quarkus.http.auth.form.cookie-name=laitnederc-sukrauq\\n" + "quarkus.http.auth.session.encryption-key=CHANGEIT-CHANGEIT-CHANGEIT-CHANGEIT-CHANGEIT\\n"; @@ -89,4 +115,129 @@ public void testFormBasedAuthSuccess() { .body(equalTo("admin:/admin%E2%9D%A4")); } + + private String getCredentialCookie(CookieStore cookieStore) { + for (Cookie cookie : cookieStore.getCookies()) { + if ("laitnederc-sukrauq".equals(cookie.getName())) { + return cookie.getValue(); + } + } + return null; + } + + private void doRegularGet(CloseableHttpClient httpClient, CookieStore cookieStore, String credentialCookieValue) + throws IOException { + HttpGet httpGet = new HttpGet(url.toString() + "/admin%E2%9D%A4"); + try (CloseableHttpResponse adminResponse = httpClient.execute(httpGet)) { + String credentialInCookieStore = getCredentialCookie(cookieStore); + assertEquals(credentialCookieValue, credentialInCookieStore, + "Session cookie WAS NOT eligible for renewal and should have remained the same."); + assertEquals(200, adminResponse.getStatusLine().getStatusCode(), "HTTP 200 expected."); + assertEquals("admin:/admin%E2%9D%A4", EntityUtils.toString(adminResponse.getEntity(), "UTF-8"), + "Unexpected web page content."); + } + } + + private void waitForPointInTime(long pointInFuture) throws InterruptedException { + long wait = pointInFuture - System.currentTimeMillis(); + assertTrue(wait > 0, "Having to wait for " + wait + + " ms for another request is unexpected. The previous one took too long."); + Thread.sleep(wait); + } + + @TestHTTPResource + URL url; + + @Test + public void testCredentialCookieRotation() throws IOException, InterruptedException { + + final CookieStore cookieStore = new BasicCookieStore(); + + try (CloseableHttpClient httpClient = HttpClientBuilder.create() + .setDefaultCookieStore(cookieStore) + .setDefaultRequestConfig(RequestConfig.custom() + .setCookieSpec(CookieSpecs.STANDARD).build()) + .build()) { + + final List<NameValuePair> authForm = new ArrayList<>(); + authForm.add(new BasicNameValuePair("j_username", "admin")); + authForm.add(new BasicNameValuePair("j_password", "admin")); + final UrlEncodedFormEntity entity = new UrlEncodedFormEntity(authForm, Consts.UTF_8); + + // Login + HttpPost httpPost = new HttpPost(url.toString() + "/j_security_check"); + httpPost.setEntity(entity); + String credentialCookieValue = null; + try (CloseableHttpResponse loginResponse = httpClient.execute(httpPost)) { + assertEquals(302, loginResponse.getStatusLine().getStatusCode(), + "Login should have been successful and return HTTP 302 redirect."); + credentialCookieValue = getCredentialCookie(cookieStore); + assertTrue(StringUtils.isNotBlank(credentialCookieValue), "Credential cookie value must not be blank."); + } + + long t0 = System.currentTimeMillis(); + + waitForPointInTime(t0 + 400); + + doRegularGet(httpClient, cookieStore, credentialCookieValue); + + waitForPointInTime(t0 + 700); + + doRegularGet(httpClient, cookieStore, credentialCookieValue); + + waitForPointInTime(t0 + 1300); + + HttpGet httpGet = new HttpGet(url.toString() + "/admin%E2%9D%A4"); + try (CloseableHttpResponse adminResponse = httpClient.execute(httpGet)) { + String credentialInCookieStore = getCredentialCookie(cookieStore); + assertNotEquals(credentialCookieValue, credentialInCookieStore, + "Session cookie WAS eligible for renewal and should have been updated."); + assertEquals(200, adminResponse.getStatusLine().getStatusCode(), "HTTP 200 expected."); + assertEquals("admin:/admin%E2%9D%A4", EntityUtils.toString(adminResponse.getEntity(), "UTF-8"), + "Unexpected web page content."); + + credentialCookieValue = credentialInCookieStore; + + } + + t0 = System.currentTimeMillis(); + + waitForPointInTime(t0 + 400); + + doRegularGet(httpClient, cookieStore, credentialCookieValue); + + waitForPointInTime(t0 + 700); + + doRegularGet(httpClient, cookieStore, credentialCookieValue); + + waitForPointInTime(t0 + 3600); + + httpGet = new HttpGet(url.toString() + "/admin%E2%9D%A4"); + try (CloseableHttpResponse adminResponse = httpClient.execute(httpGet)) { + assertEquals(200, adminResponse.getStatusLine().getStatusCode(), "HTTP 200 from login page expected."); + assertEquals(":/login", EntityUtils.toString(adminResponse.getEntity(), "UTF-8"), + "Login web page was expected. Quarkus should have enforced a new login."); + String redirectLocation = null; + for (Cookie cookie : cookieStore.getCookies()) { + if ("quarkus-redirect-location".equals(cookie.getName())) { + redirectLocation = cookie.getValue(); + break; + } + } + assertTrue(StringUtils.isNotBlank(redirectLocation) && redirectLocation.contains("admin%E2%9D%A4"), + "quarkus-redirect-location should have been set."); + } + + httpPost = new HttpPost(url.toString() + "/j_security_check"); + httpPost.setEntity(entity); + try (CloseableHttpResponse loginResponse = httpClient.execute(httpPost)) { + assertEquals(302, loginResponse.getStatusLine().getStatusCode(), + "Login should have been successful and return HTTP 302 redirect."); + String newCredentialCookieValue = getCredentialCookie(cookieStore); + assertTrue(StringUtils.isNotBlank(newCredentialCookieValue), "Credential cookie value must not be blank."); + assertNotEquals(newCredentialCookieValue, credentialCookieValue, + "New credential cookie must not be the same as the previous one."); + } + } + } } diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java index 7b1699e8e11..3f0a1803e02 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java @@ -42,21 +42,27 @@ public class FormAuthConfig { public boolean redirectAfterLogin; /** - * The inactivity timeout + * The inactivity (idle) timeout + * + * When inactivity timeout is reached, cookie is not renewed and a new login is enforced. */ @ConfigItem(defaultValue = "PT30M") public Duration timeout; /** - * How old a cookie can get before it will be replaced with a new cookie with an updated timeout. + * How old a cookie can get before it will be replaced with a new cookie with an updated timeout, also + * referred to as "renewal-timeout". * - * Not that smaller values will result in slightly more server load (as new encrypted cookies will be + * Note that smaller values will result in slightly more server load (as new encrypted cookies will be * generated more often), however larger values affect the inactivity timeout as the timeout is set * when a cookie is generated. * * For example if this is set to 10 minutes, and the inactivity timeout is 30m, if a users last request * is when the cookie is 9m old then the actual timeout will happen 21m after the last request, as the timeout * is only refreshed when a new cookie is generated. + * + * In other words no timeout is tracked on the server side; the timestamp is encoded and encrypted in the cookie itself + * and it is decrypted and parsed with each request. */ @ConfigItem(defaultValue = "PT1M") public Duration newCookieInterval; 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 7b2d5e934f9..098171c3c01 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 @@ -564,6 +564,8 @@ private static class WebDeploymentVerticle extends AbstractVerticle { private final HttpServerOptions httpOptions; private final HttpServerOptions httpsOptions; private final LaunchMode launchMode; + private volatile boolean clearHttpProperty = false; + private volatile boolean clearHttpsProperty = false; public WebDeploymentVerticle(int port, int httpsPort, String host, HttpServerOptions httpOptions, HttpServerOptions httpsOptions, LaunchMode launchMode) { @@ -588,6 +590,7 @@ public void start(Future<Void> startFuture) { int actualPort = event.result().actualPort(); if (actualPort != port) { // Override quarkus.http.(test-)?port + clearHttpProperty = true; System.setProperty(launchMode == LaunchMode.TEST ? "quarkus.http.test-port" : "quarkus.http.port", String.valueOf(actualPort)); // Set in HttpOptions to output the port in the Timing class @@ -608,6 +611,7 @@ public void start(Future<Void> startFuture) { int actualPort = event.result().actualPort(); if (actualPort != httpsPort) { // Override quarkus.https.(test-)?port + clearHttpsProperty = true; System.setProperty(launchMode == LaunchMode.TEST ? "quarkus.https.test-port" : "quarkus.https.port", String.valueOf(actualPort)); // Set in HttpOptions to output the port in the Timing class @@ -623,6 +627,12 @@ public void start(Future<Void> startFuture) { @Override public void stop(Future<Void> stopFuture) { + if (clearHttpProperty) { + System.clearProperty(launchMode == LaunchMode.TEST ? "quarkus.http.test-port" : "quarkus.http.port"); + } + if (clearHttpsProperty) { + System.clearProperty(launchMode == LaunchMode.TEST ? "quarkus.https.test-port" : "quarkus.https.port"); + } httpServer.close(new Handler<AsyncResult<Void>>() { @Override public void handle(AsyncResult<Void> event) { diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PersistentLoginManager.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PersistentLoginManager.java index 2416d80de25..f6da62631fb 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PersistentLoginManager.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PersistentLoginManager.java @@ -5,6 +5,7 @@ import java.security.MessageDigest; import java.security.SecureRandom; import java.util.Base64; +import java.util.Date; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; @@ -20,9 +21,7 @@ /** * A class that manages persistent logins. - * * This is done by encoding an expiry time, and the current username into an encrypted cookie - * * TODO: make this pluggable */ public class PersistentLoginManager { @@ -35,31 +34,32 @@ public class PersistentLoginManager { private final String cookieName; private final long timeoutMillis; private final SecureRandom secureRandom = new SecureRandom(); - private final long newCookieMillis; + private final long newCookieIntervalMillis; - public PersistentLoginManager(String encryptionKey, String cookieName, long timeoutMillis, long newCookieMillis) { + public PersistentLoginManager(String encryptionKey, String cookieName, long timeoutMillis, long newCookieIntervalMillis) { try { this.cookieName = cookieName; - this.newCookieMillis = newCookieMillis; + this.newCookieIntervalMillis = newCookieIntervalMillis; this.timeoutMillis = timeoutMillis; if (encryptionKey == null) { - secretKey = KeyGenerator.getInstance("AES").generateKey(); + this.secretKey = KeyGenerator.getInstance("AES").generateKey(); } else if (encryptionKey.length() < 16) { throw new RuntimeException("Shared keys for persistent logins must be more than 16 characters long"); } else { MessageDigest sha256 = MessageDigest.getInstance("SHA-256"); sha256.update(encryptionKey.getBytes(StandardCharsets.UTF_8)); - secretKey = new SecretKeySpec(sha256.digest(), "AES"); + this.secretKey = new SecretKeySpec(sha256.digest(), "AES"); } } catch (Exception t) { throw new RuntimeException(t); } - } public RestoreResult restore(RoutingContext context) { Cookie existing = context.getCookie(cookieName); + // If there is no credential cookie, we have nothing to restore. if (existing == null) { + // Enforce new login. return null; } String val = existing.getValue(); @@ -74,14 +74,25 @@ public RestoreResult restore(RoutingContext context) { cipher.init(Cipher.DECRYPT_MODE, secretKey, new GCMParameterSpec(ENC_TAG_LENGTH, iv)); String result = new String(cipher.doFinal(encrypted), StandardCharsets.UTF_8); int sep = result.indexOf(":"); + // If parsing fails, something is wrong and we need to enforce a new login. if (sep == -1) { + // Enforce new login. + log.debugf("%s cookie parsing failed. Is encryption-key set for all instances?", cookieName); return null; } - long expire = Long.parseLong(result.substring(0, sep)); - if (System.currentTimeMillis() > expire) { + long expireIdle = Long.parseLong(result.substring(0, sep)); + long now = System.currentTimeMillis(); + log.debugf("Current time: %s, Expire idle timeout: %s, expireIdle - now is: %d - %d = %d", + new Date(now).toString(), new Date(expireIdle).toString(), expireIdle, now, expireIdle - now); + // We don't attempt renewal, idle timeout already expired. + if (now > expireIdle) { + // Enforce new login. return null; } - return new RestoreResult(result.substring(sep + 1), (System.currentTimeMillis() - expire) > newCookieMillis); + boolean newCookieNeeded = (timeoutMillis - (expireIdle - now)) > newCookieIntervalMillis; + log.debugf("Is new cookie needed? ( %d - ( %d - %d)) > %d : %b", timeoutMillis, expireIdle, now, + newCookieIntervalMillis, newCookieNeeded); + return new RestoreResult(result.substring(sep + 1), newCookieNeeded); } catch (Exception e) { log.debug("Failed to restore persistent user session", e); return null; @@ -101,6 +112,7 @@ public void save(SecurityIdentity identity, RoutingContext context, RestoreResul cipher.init(Cipher.ENCRYPT_MODE, secretKey, new GCMParameterSpec(ENC_TAG_LENGTH, iv)); StringBuilder contents = new StringBuilder(); long timeout = System.currentTimeMillis() + timeoutMillis; + log.debugf("The new cookie will expire at %s", new Date(timeout).toString()); contents.append(timeout); contents.append(":"); contents.append(identity.getPrincipal().getName()); 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 1273fe18b7e..1f9ce585ca2 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 @@ -445,6 +445,7 @@ public void afterAll(ExtensionContext extensionContext) throws Exception { } curatedApplication.close(); } finally { + System.clearProperty("test.url"); Thread.currentThread().setContextClassLoader(originalClassLoader); timeoutTask.cancel(); timeoutTask = null;
['test-framework/junit5-internal/src/main/java/io/quarkus/test/QuarkusUnitTest.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java', 'extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/FormAuthCookiesTestCase.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PersistentLoginManager.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/FormAuthConfig.java']
{'.java': 5}
5
5
0
0
5
7,522,534
1,459,156
194,101
2,001
3,745
772
56
3
784
60
203
11
3
2
"2019-12-08T01:06:16"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,180
quarkusio/quarkus/5598/5589
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5589
https://github.com/quarkusio/quarkus/pull/5598
https://github.com/quarkusio/quarkus/pull/5598
1
fixes
PanacheQueryImpl.firstResult() retrieves more than one item from the database
**Describe the bug** Reading the code of `PanacheQueryImpl.firstResult() ` it seems to retrieves more than one item from the database. ``` @Override public <T extends Entity> T firstResult() { List<T> list = list(); jpaQuery.setMaxResults(1); return list.isEmpty() ? null : list.get(0); } ``` As the `setMaxQueryResult` is called after listing the results, it is useless and the query will be sent to the database with the previously set max result (Integer.MAX_VALUE by default) **Expected behavior** `firstResult()` retrieve one or zero item from the database. **Environment (please complete the following information):** - Quarkus version or git rev: 1.0.0.CR1 and current master **Additional context** If the bug is aknowledge, I can propose a PR to fix it.
9c837f2e12e8f2d7b5e4b1c46c1970e629a478f1
78963c85eba340ba80573435bbc31690916ed67b
https://github.com/quarkusio/quarkus/compare/9c837f2e12e8f2d7b5e4b1c46c1970e629a478f1...78963c85eba340ba80573435bbc31690916ed67b
diff --git a/extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/PanacheQueryImpl.java b/extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/PanacheQueryImpl.java index 8b8cd9ce9ac..404514c3fc6 100644 --- a/extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/PanacheQueryImpl.java +++ b/extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/PanacheQueryImpl.java @@ -127,8 +127,8 @@ public <T extends Entity> Stream<T> stream() { @Override public <T extends Entity> T firstResult() { - List<T> list = list(); jpaQuery.setMaxResults(1); + List<T> list = jpaQuery.getResultList(); return list.isEmpty() ? null : list.get(0); }
['extensions/panache/hibernate-orm-panache/runtime/src/main/java/io/quarkus/hibernate/orm/panache/runtime/PanacheQueryImpl.java']
{'.java': 1}
1
1
0
0
1
5,972,153
1,157,573
154,078
1,598
81
20
2
1
826
114
188
25
0
1
"2019-11-19T16:29:08"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,170
quarkusio/quarkus/5929/5921
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5921
https://github.com/quarkusio/quarkus/pull/5929
https://github.com/quarkusio/quarkus/pull/5929
1
fixes
Database connections are leaked in AWS Lambda
**Describe the bug** While testing JPA with Lambda I've encountered situation when Lambda runs JPA query, which connects to database, but doesn't close connection. **Expected behavior** If running in Lambda it's reasonable (if possible) to close connection on lambda exit. If there is some way to use connection pool, it would be ideal. **Actual behavior** If I keep using Lambda, it looks like, it's reusing the same connection (same IP / connection), however, if Lambda gets "cold" AWS spawns a new one on different IP address and it get a new connection. As a result, I am observing growing number of connections on database, which will eventually lead to an issue. **To Reproduce** Steps to reproduce the behavior: 1. Created AWS Lambda using Maven Archetype 2. Added Entity and CrudRepository classes 3. Created class with injected repository object and `@Transactional` method 4. Used repository object to access database **Environment (please complete the following information):** - Output of `java -version`: 1.8 - Quarkus version or git rev: 1.0.1
dc83d5506dbd742a54be9b3696b60f29af863236
95725dee6985e75a37d2cf822afb5092ec307c5d
https://github.com/quarkusio/quarkus/compare/dc83d5506dbd742a54be9b3696b60f29af863236...95725dee6985e75a37d2cf822afb5092ec307c5d
diff --git a/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/QuarkusStreamHandler.java b/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/QuarkusStreamHandler.java index d9fe96653c0..1edbb680e66 100644 --- a/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/QuarkusStreamHandler.java +++ b/extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/QuarkusStreamHandler.java @@ -30,7 +30,7 @@ public class QuarkusStreamHandler implements RequestStreamHandler { Class appClass = Class.forName("io.quarkus.runner.ApplicationImpl"); String[] args = {}; Application app = (Application) appClass.newInstance(); - app.start(args); + app.run(args); errorWriter.println("Quarkus bootstrapped successfully."); started = true; } catch (Exception ex) {
['extensions/amazon-lambda/runtime/src/main/java/io/quarkus/amazon/lambda/runtime/QuarkusStreamHandler.java']
{'.java': 1}
1
1
0
0
1
6,436,539
1,244,793
166,766
1,742
65
10
2
1
1,085
167
237
21
0
0
"2019-12-04T04:18: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,171
quarkusio/quarkus/5852/5818
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5818
https://github.com/quarkusio/quarkus/pull/5852
https://github.com/quarkusio/quarkus/pull/5852
1
fixes
with quarkus.http.root-path set to abc the swagger-ui is not available
**Describe the bug** with quarkus.http.root-path set to abc the swagger-ui is not available **Expected behavior** showing the sawgger-ui by http://localhost:8080/abc/swagger-ui **Actual behavior** failing with JavaScript asset not loaded exception in the browser. **To Reproduce** Steps to reproduce the behavior: 1. in application.propertes - set quarkus.http.root-path to abc 2. go by http://localhost:8080/abc/swagger-ui in the browser 3. see the exception in the browser console
741579864f57bccaf198a6652e72d7d566f48955
2209df34bbb0d3faba89ace9d9ef03052c47fd90
https://github.com/quarkusio/quarkus/compare/741579864f57bccaf198a6652e72d7d566f48955...2209df34bbb0d3faba89ace9d9ef03052c47fd90
diff --git a/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java b/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java index 405ad1a3f46..a0669206085 100644 --- a/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java +++ b/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java @@ -118,7 +118,8 @@ public void registerSwaggerUiServletExtension(SwaggerUiRecorder recorder, throw new RuntimeException(e); } } - Handler<RoutingContext> handler = recorder.handler(cached.cachedDirectory, swaggerUiConfig.path); + Handler<RoutingContext> handler = recorder.handler(cached.cachedDirectory, + httpRootPathBuildItem.adjustPath(swaggerUiConfig.path)); routes.produce(new RouteBuildItem(swaggerUiConfig.path, handler)); routes.produce(new RouteBuildItem(swaggerUiConfig.path + "/*", handler)); displayableEndpoints.produce(new NotFoundPageDisplayableEndpointBuildItem(swaggerUiConfig.path + "/"));
['extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiProcessor.java']
{'.java': 1}
1
1
0
0
1
6,042,614
1,170,414
156,040
1,626
276
51
3
1
508
62
120
18
2
0
"2019-11-28T21:40:28"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,173
quarkusio/quarkus/5808/5359
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5359
https://github.com/quarkusio/quarkus/pull/5808
https://github.com/quarkusio/quarkus/pull/5808
1
fixes
Simplest generated project fails with quarkus:dev with JDK 13 on Windows 10
**Describe the bug** Generated project doesn't run with `quarkus:dev` on Windows 10. The same project run seamlessly on macOS Catalina. **Expected behavior** Runs without any error. **Actual behavior** Fails at run with error message: ``` [INFO] --- quarkus-maven-plugin:1.0.0.CR1:dev (default-cli) @ code-with-quarkus --- Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release. Listening for transport dt_socket at address: 5005 Error: Could not find or load main class io.quarkus.dev.DevModeMain Caused by: java.lang.ClassNotFoundException: io.quarkus.dev.DevModeMain ``` **To Reproduce** Steps to reproduce the behavior: 1. Generate the simplest app on code.quarkus.io (whithout extensions) 2. Run `mvn compile quarkus:dev` **Environment:** - OS: Windows 10 (KO) and macOS Catalina (OK) - JDK: tested with Oracle JDK 13 **Additional context** I found a similar issue: https://github.com/apache/camel-quarkus/issues/263 but this one seems related to camel and I am not using it.
24846a9206901985c75e18059b8e0b837a47c1af
0be50b296510fa44fc687fa19945ba751d97429f
https://github.com/quarkusio/quarkus/compare/24846a9206901985c75e18059b8e0b837a47c1af...0be50b296510fa44fc687fa19945ba751d97429f
diff --git a/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java b/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java index 4a42569d1cd..47812a78b58 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java +++ b/core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java @@ -122,12 +122,19 @@ public ClassLoaderCompiler(ClassLoader classLoader, } Object classPath = mf.getMainAttributes().get(Attributes.Name.CLASS_PATH); if (classPath != null) { - for (String i : WHITESPACE_PATTERN.split(classPath.toString())) { + for (String classPathEntry : WHITESPACE_PATTERN.split(classPath.toString())) { + final URI cpEntryURI = new URI(classPathEntry); File f; - try { - f = Paths.get(new URI("file", null, "/", null).resolve(new URI(i))).toFile(); - } catch (URISyntaxException e) { - f = new File(file.getParentFile(), i); + // if it's a "file" scheme URI, then use the path as a file system path + // without the need to resolve it + if (cpEntryURI.isAbsolute() && cpEntryURI.getScheme().equals("file")) { + f = new File(cpEntryURI.getPath()); + } else { + try { + f = Paths.get(new URI("file", null, "/", null).resolve(cpEntryURI)).toFile(); + } catch (URISyntaxException e) { + f = new File(file.getParentFile(), classPathEntry); + } } if (f.exists()) { toParse.add(f.getAbsolutePath()); 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 afafff887fe..9c211c7b0ee 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -55,7 +55,6 @@ import io.quarkus.bootstrap.resolver.BootstrapAppModelResolver; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject; -import io.quarkus.bootstrap.util.PropertyUtils; import io.quarkus.dev.DevModeContext; import io.quarkus.dev.DevModeMain; import io.quarkus.maven.components.MavenVersionEnforcer; @@ -381,23 +380,13 @@ private void addProject(DevModeContext devModeContext, LocalProject localProject } private void addToClassPaths(StringBuilder classPathManifest, DevModeContext classPath, File file) { - URI uri = file.toPath().toAbsolutePath().toUri(); + final URI uri = file.toPath().toAbsolutePath().toUri(); try { classPath.getClassPath().add(uri.toURL()); } catch (MalformedURLException e) { throw new RuntimeException(e); } - String path = uri.getRawPath(); - if (PropertyUtils.isWindows()) { - if (path.length() > 2 && Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') { - path = "/" + path; - } - } - classPathManifest.append(path); - if (file.isDirectory() && path.charAt(path.length() - 1) != '/') { - classPathManifest.append("/"); - } - classPathManifest.append(" "); + classPathManifest.append(uri).append(" "); } class DevModeRunner {
['core/devmode/src/main/java/io/quarkus/dev/ClassLoaderCompiler.java', 'devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java']
{'.java': 2}
2
2
0
0
2
6,039,042
1,169,810
155,972
1,626
2,085
356
32
2
1,114
146
288
30
1
1
"2019-11-27T14:55: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,174
quarkusio/quarkus/5768/5731
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5731
https://github.com/quarkusio/quarkus/pull/5768
https://github.com/quarkusio/quarkus/pull/5768
1
fixes
How to set correctly ssl certificate oauth2
Hi folks, I'm trying to use oauth2 following this guide : https://quarkus.io/guides/security-oauth2 and also https://quarkus.io/guides/native-and-ssl In application.properties, i use for the `quarkus.oauth2.introspection-url` an **https** adress ([auth0](https://auth0.com/)). When i execute these commands separatly : ``` ./mvnw compile quarkus:dev ./mvnw clean install -Pnative ``` I getting this error : > Caused by: java.lang.IllegalArgumentException: Parameter 'sslContext' may not be null The complete stacktrace : [error-log.txt](https://github.com/quarkusio/quarkus/files/3884061/error-log.txt) I use graalVM, the `GRAALVM_HOME` is set and the certificate of auth0 is added to the truststore of graalVM, follwing these commands : ``` echo | openssl s_client -servername NAME -connect HOST:PORT |\\ sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > certificate.crt /home/xerxes/graalvm-ce-19.2.1/bin/keytool -import -alias auth0 -storepass 'changeit' -keystore /home/xerxes/graalvm-ce-19.2.1/jre/lib/security/cacerts -file certificate.crt ``` I check with this command `keytool -list -v -keystore /home/xerxes/graalvm-ce-19.2.1/jre/lib/security/cacerts`, i have my certificate in there. Could you explain me what i missed in my steps ? I saw this option `quarkus.oauth2.ca-cert-file` but i don't know very well how to use it. Thank you so much guys for your help !
f526e8c47392445b64899b3c6ff9352323e29b02
2a2d0d0fe651fbfab1e9f457e7f4e24f745a1ade
https://github.com/quarkusio/quarkus/compare/f526e8c47392445b64899b3c6ff9352323e29b02...2a2d0d0fe651fbfab1e9f457e7f4e24f745a1ade
diff --git a/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/OAuth2Recorder.java b/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/OAuth2Recorder.java index 6e4101c0053..023f96b3f2b 100644 --- a/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/OAuth2Recorder.java +++ b/extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/OAuth2Recorder.java @@ -39,6 +39,8 @@ public RuntimeValue<SecurityRealm> createRealm(OAuth2Config config) if (config.caCertFile.isPresent()) { validatorBuilder.useSslContext(createSSLContext(config)); + } else { + validatorBuilder.useSslContext(SSLContext.getDefault()); } OAuth2IntrospectValidator validator = validatorBuilder.build();
['extensions/elytron-security-oauth2/runtime/src/main/java/io/quarkus/elytron/security/oauth2/runtime/OAuth2Recorder.java']
{'.java': 1}
1
1
0
0
1
6,466,775
1,250,001
167,364
1,745
87
16
2
1
1,424
164
401
33
4
2
"2019-11-26T13:49:04"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,175
quarkusio/quarkus/5724/5647
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5647
https://github.com/quarkusio/quarkus/pull/5724
https://github.com/quarkusio/quarkus/pull/5724
1
fixes
Error message on start (/etc/hosts permissions)
**Describe the bug** At start of stock quarkus without any extensions I get the following message: 2019-11-21 07:25:46,065 WARN [io.net.res.HostsFileParser] (main) Failed to load and parse hosts file at /etc/hosts: java.io.FileNotFoundException: /etc/hosts (Permission denied) The application is still working **Expected behavior** No superfluous error message. **Actual behavior** WARN [io.net.res.HostsFileParser] (main) Failed to load and parse hosts file at /etc/hosts: java.io.FileNotFoundException: /etc/hosts (Permission denied) at java.io.FileInputStream.open0(Native Method) at java.io.FileInputStream.open(FileInputStream.java:195) at java.io.FileInputStream.<init>(FileInputStream.java:138) at io.netty.resolver.HostsFileParser.parse(HostsFileParser.java:132) at io.netty.resolver.HostsFileParser.parseSilently(HostsFileParser.java:89) at io.netty.resolver.HostsFileParser.parseSilently(HostsFileParser.java:76) at io.vertx.core.impl.resolver.DnsResolverProvider.<init>(DnsResolverProvider.java:123) at io.vertx.core.spi.resolver.ResolverProvider.factory(ResolverProvider.java:39) at io.vertx.core.impl.AddressResolver.<init>(AddressResolver.java:75) at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:167) at io.vertx.core.impl.VertxImpl.vertx(VertxImpl.java:92) at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:40) at io.vertx.core.impl.VertxFactoryImpl.vertx(VertxFactoryImpl.java:32) at io.vertx.core.Vertx.vertx(Vertx.java:85) **To Reproduce** Steps to reproduce the behavior: 1. mvn io.quarkus:quarkus-maven-plugin:1.0.0.CR2:create (the same behaviour on CR1) 2. mvn compile quarkus:dev **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 19.0.0 Darwin Kernel Version 19.0.0, Mac OS Catalina - Output of `java -version`: java version "1.8.0_201" Java(TM) SE Runtime Environment (build 1.8.0_201-b09) Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) - GraalVM version (if different from Java): - Quarkus version or git rev: CR2 **Additional context** `sudo chmod a+r /etc/hosts`fixes the problem
9e66cdb8e7da82854062cca609e722e04eec83a7
8a8a4d85e4dca163b5a1512815e20d8827676401
https://github.com/quarkusio/quarkus/compare/9e66cdb8e7da82854062cca609e722e04eec83a7...8a8a4d85e4dca163b5a1512815e20d8827676401
diff --git a/extensions/vertx-core/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java b/extensions/vertx-core/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java index 6de2d0c8819..65a5e2ef78c 100644 --- a/extensions/vertx-core/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java +++ b/extensions/vertx-core/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java @@ -13,6 +13,7 @@ import io.quarkus.deployment.builditem.ShutdownContextBuildItem; import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; +import io.quarkus.deployment.logging.LogCleanupFilterBuildItem; import io.quarkus.netty.deployment.EventLoopSupplierBuildItem; import io.quarkus.runtime.RuntimeValue; import io.quarkus.vertx.core.runtime.VertxCoreProducer; @@ -79,4 +80,9 @@ InternalWebVertxBuildItem buildWeb(VertxCoreRecorder recorder, VertxConfiguratio RuntimeValue<Vertx> vertx = recorder.initializeWeb(config, context, launchModeBuildItem.getLaunchMode()); return new InternalWebVertxBuildItem(vertx); } + + @BuildStep + LogCleanupFilterBuildItem filterNettyHostsFileParsingWarn() { + return new LogCleanupFilterBuildItem("io.netty.resolver.HostsFileParser", "Failed to load and parse hosts file"); + } }
['extensions/vertx-core/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java']
{'.java': 1}
1
1
0
0
1
6,014,690
1,164,675
155,258
1,617
279
64
6
1
2,368
198
616
60
0
1
"2019-11-24T06:28:26"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,176
quarkusio/quarkus/5717/5636
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5636
https://github.com/quarkusio/quarkus/pull/5717
https://github.com/quarkusio/quarkus/pull/5717
1
fixes
Vault Extension Serialization Error in Native Mode at Runtime
**Description** Following the implementation of the Vault guide (https://quarkus.io/guides/vault) generates serialization error in native mode at runtime, [stacktrace attached](https://github.com/quarkusio/quarkus/files/3870212/stacktrace.txt). As a workaround, I added the following `reflection-config.json`: ```json [ { "name" : "io.quarkus.vault.runtime.client.dto.VaultAppRoleAuthBody", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true }, { "name" : "io.quarkus.vault.runtime.client.dto.VaultAppRoleAuthAuthMetadata", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true } ] ``` **Steps to reproduce the behavior** 1. Follow the guide: https://quarkus.io/guides/vault 2. `mvn package -Pnative` 3. Run the native runner **Configuration** ```properties quarkus.vault.url=https://my-vault.onkubernetes.intranet quarkus.vault.tls.skip-verify=true quarkus.vault.authentication.app-role.role-id=****** quarkus.vault.authentication.app-role.secret-id=****** quarkus.vault.kv-secret-engine-version=2 quarkus.vault.secret-config-kv-path=apps/sample/config ``` **Environment** - OS Linux xxxxxx 5.3.0-23-generic #25-Ubuntu SMP Tue Nov 12 09:22:33 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux - Java 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 openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-20191008104205.buildslave.jdk8u-src-tar--b07) OpenJDK 64-Bit GraalVM CE 19.2.1 (build 25.232-b07-jvmci-19.2-b03, mixed mode) - Quarkus version 1.0.0.CR2
bc066bcfc8c95833845bbb70ad75d61cba9ddafd
da9357f07b13a2364883a2f38bbdead900cb15c3
https://github.com/quarkusio/quarkus/compare/bc066bcfc8c95833845bbb70ad75d61cba9ddafd...da9357f07b13a2364883a2f38bbdead900cb15c3
diff --git a/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthAuthMetadata.java b/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthAuthMetadata.java index 0912d1392fa..0be24062130 100644 --- a/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthAuthMetadata.java +++ b/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthAuthMetadata.java @@ -1,4 +1,4 @@ package io.quarkus.vault.runtime.client.dto; -public class VaultAppRoleAuthAuthMetadata { +public class VaultAppRoleAuthAuthMetadata implements VaultModel { } diff --git a/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthBody.java b/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthBody.java index 8e9b9ccc56c..3a7be226b75 100644 --- a/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthBody.java +++ b/extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthBody.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; -public class VaultAppRoleAuthBody { +public class VaultAppRoleAuthBody implements VaultModel { @JsonProperty("role_id") public String roleId;
['extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthAuthMetadata.java', 'extensions/vault/runtime/src/main/java/io/quarkus/vault/runtime/client/dto/VaultAppRoleAuthBody.java']
{'.java': 2}
2
2
0
0
2
6,007,937
1,163,465
155,097
1,616
206
40
4
2
1,963
164
600
57
4
2
"2019-11-23T07:58:45"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,177
quarkusio/quarkus/5684/5680
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5680
https://github.com/quarkusio/quarkus/pull/5684
https://github.com/quarkusio/quarkus/pull/5684
1
fixes
Exception when directory doesn't exist with quarkus-maven-plugin
**Describe the bug** The `quarkus-maven-plugin` fails with an exception if it's configured with a `finalName` using a directory that doesn't exist. I think this was working in previous versions, so looks like a regression. **To Reproduce** In your pom.xml ``` ... <plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>1.0.0.CR2</version> <executions> <execution> <goals> <goal>build</goal> </goals> </execution> </executions> <configuration> <finalName>${project.build.directory}/non-existing-dir/${project.build.finalName}</finalName> </configuration> </plugin> ... ``` Then `mvn clean package` will fail with an exception like this one: ``` [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.0.0.CR2:build (default) on project server-quarkus: Failed to build a runnable JAR: Failed to augment application classes: Build failure: Build failed due to errors [ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.JarResultBuildStep#buildRunnerJar threw an exception: java.lang.IllegalStateException: java.io.IOException: Failed to create a new filesystem for jar:file:/tmp/test/target/non-existing-dir/server-quarkus-1.0-SNAPSHOT-runner.jar [ERROR] at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:950) [ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:415) [ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35) [ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535) [ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426) [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.io.IOException: Failed to create a new filesystem for jar:file:/tmp/test/target/non-existing-dir/server-quarkus-1.0-SNAPSHOT-runner.jar [ERROR] at io.quarkus.bootstrap.util.ZipUtils.newFileSystem(ZipUtils.java:150) [ERROR] at io.quarkus.bootstrap.util.ZipUtils.newZip(ZipUtils.java:102) [ERROR] at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildThinJar(JarResultBuildStep.java:295) [ERROR] at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildRunnerJar(JarResultBuildStep.java:141) [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$1.execute(ExtensionLoader.java:941) [ERROR] ... 7 more [ERROR] Caused by: java.nio.file.NoSuchFileException: /tmp/test/target/non-existing-dir/server-quarkus-1.0-SNAPSHOT-runner.jar [ERROR] at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92) [ERROR] at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111) [ERROR] at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116) [ERROR] at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219) [ERROR] at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:478) [ERROR] at java.base/java.nio.file.Files.newOutputStream(Files.java:219) [ERROR] at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:112) [ERROR] at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:109) [ERROR] at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:337) [ERROR] at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:286) [ERROR] at io.quarkus.bootstrap.util.ZipUtils.newFileSystem(ZipUtils.java:143) [ERROR] ... 15 more [ERROR] -> [Help 1] [ERROR] ```
4562f454d12ee7635220930d5ce175f15a744b92
18f2396774ee099398759b554a865efb3b6d2c2a
https://github.com/quarkusio/quarkus/compare/4562f454d12ee7635220930d5ce175f15a744b92...18f2396774ee099398759b554a865efb3b6d2c2a
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/ZipUtils.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/ZipUtils.java index 541e179aa65..d98313f6462 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/ZipUtils.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/ZipUtils.java @@ -99,7 +99,19 @@ public static void zip(Path src, Path zipFile) throws IOException { } public static FileSystem newZip(Path zipFile) throws IOException { - return newFileSystem(toZipUri(zipFile), Files.exists(zipFile) ? Collections.emptyMap() : CREATE_ENV); + final Map<String, ?> env; + if (Files.exists(zipFile)) { + env = Collections.emptyMap(); + } else { + env = CREATE_ENV; + // explicitly create any parent dirs, since the ZipFileSystem only creates a new file + // with "create" = "true", but doesn't create any parent dirs. + + // It's OK to not check the existence of the parent dir(s) first, since the API, + // as per its contract doesn't throw any exception if the parent dir(s) already exist + Files.createDirectories(zipFile.getParent()); + } + return newFileSystem(toZipUri(zipFile), env); } private static void copyToZip(Path srcRoot, Path srcPath, FileSystem zipfs) throws IOException { diff --git a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/util/ZipUtilsTest.java b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/util/ZipUtilsTest.java index 4dcb7d0878f..66440560fc8 100644 --- a/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/util/ZipUtilsTest.java +++ b/independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/util/ZipUtilsTest.java @@ -5,10 +5,15 @@ import java.io.IOException; import java.net.URI; +import java.nio.charset.StandardCharsets; +import java.nio.file.FileSystem; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.Collections; +import static org.junit.jupiter.api.Assertions.assertEquals; + /** * Tests {@link ZipUtils} */ @@ -49,4 +54,59 @@ public void testCorruptZipException() throws Exception { Files.delete(tmpFile); } } + + /** + * Test that the {@link ZipUtils#newZip(Path)} works as expected + * + * @throws Exception + */ + @Test + public void testNewZip() throws Exception { + final Path tmpDir = Paths.get(System.getProperty("java.io.tmpdir")); + final Path zipPath = Paths.get(tmpDir.toString(), "ziputilstest-" + System.currentTimeMillis() + ".jar"); + try { + try (final FileSystem fs = ZipUtils.newZip(zipPath)) { + final Path someFileInZip = fs.getPath("hello.txt"); + Files.write(someFileInZip, "hello".getBytes(StandardCharsets.UTF_8)); + } + // now just verify that the content was actually written out + try (final FileSystem fs = ZipUtils.newFileSystem(zipPath)) { + assertFileExistsWithContent(fs.getPath("hello.txt"), "hello"); + } + } finally { + Files.deleteIfExists(zipPath); + } + } + + /** + * Tests that the {@link ZipUtils#newZip(Path)} works correctly, and creates the zip file, + * when the parent directories of the {@link Path} passed to it are not present. + * + * @throws Exception + * @see <a href="https://github.com/quarkusio/quarkus/issues/5680"/> + */ + @Test + public void testNewZipForNonExistentParentDir() throws Exception { + final Path tmpDir = Files.createTempDirectory(null); + final Path nonExistentLevel1Dir = tmpDir.resolve("non-existent-level1"); + final Path nonExistentLevel2Dir = nonExistentLevel1Dir.resolve("non-existent-level2"); + final Path zipPath = Paths.get(nonExistentLevel2Dir.toString(), "ziputilstest-nonexistentdirs.jar"); + try { + try (final FileSystem fs = ZipUtils.newZip(zipPath)) { + final Path someFileInZip = fs.getPath("hello.txt"); + Files.write(someFileInZip, "hello".getBytes(StandardCharsets.UTF_8)); + } + // now just verify that the content was actually written out + try (final FileSystem fs = ZipUtils.newFileSystem(zipPath)) { + assertFileExistsWithContent(fs.getPath("hello.txt"), "hello"); + } + } finally { + Files.deleteIfExists(zipPath); + } + } + + private static void assertFileExistsWithContent(final Path path, final String content) throws IOException { + final String readContent = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); + assertEquals(content, readContent, "Unexpected content in " + path); + } }
['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/util/ZipUtils.java', 'independent-projects/bootstrap/core/src/test/java/io/quarkus/bootstrap/util/ZipUtilsTest.java']
{'.java': 2}
2
2
0
0
2
6,006,020
1,164,573
154,924
1,611
770
158
14
1
4,313
233
1,103
67
0
2
"2019-11-22T11:44:41"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,178
quarkusio/quarkus/5623/5614
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/5614
https://github.com/quarkusio/quarkus/pull/5623
https://github.com/quarkusio/quarkus/pull/5623
1
fixes
Vert.x also provides a JSON implementation so no warning should be emitted
Since https://github.com/quarkusio/quarkus/pull/4165 , we emit a warning if our REST services produce JSON and we don't have any of the RESTEasy JSON extensions: > [WARNING] [io.quarkus.resteasy.common.deployment.ResteasyCommonProcessor] Quarkus detected the need of REST JSON support but you have not provided the necessary JSON extension for this. You can visit https://quarkus.io/guides/rest-json for more information on how to set one. Problem is: Vert.x also has the ability to serialize JSON via the Vert.x JSON types. I think we should drop the warning also when we have the full Vert.x extension around. See the Reactive MySQL client IT for an example of this issue.
dd86525328a9d11fd03ae2853234b832f8a2a88c
ab682b2fdbf5c3db7ffb7ec19759eefdc26766bc
https://github.com/quarkusio/quarkus/compare/dd86525328a9d11fd03ae2853234b832f8a2a88c...ab682b2fdbf5c3db7ffb7ec19759eefdc26766bc
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 70693f29b20..da8826b1c28 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 @@ -25,6 +25,7 @@ import io.quarkus.arc.processor.AnnotationsTransformer; import io.quarkus.arc.processor.BeanInfo; import io.quarkus.arc.processor.BuildExtension; +import io.quarkus.deployment.Capabilities; import io.quarkus.deployment.GizmoAdaptor; import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; @@ -51,6 +52,11 @@ class VertxProcessor { @Inject BuildProducer<ReflectiveClassBuildItem> reflectiveClass; + @BuildStep(providesCapabilities = Capabilities.RESTEASY_JSON_EXTENSION) + FeatureBuildItem feature() { + return new FeatureBuildItem(FeatureBuildItem.VERTX); + } + @BuildStep AdditionalBeanBuildItem registerBean() { return AdditionalBeanBuildItem.unremovableOf(VertxProducer.class); @@ -59,13 +65,11 @@ AdditionalBeanBuildItem registerBean() { @BuildStep @Record(ExecutionTime.RUNTIME_INIT) VertxBuildItem build(CoreVertxBuildItem internalVertx, VertxRecorder recorder, BeanContainerBuildItem beanContainer, - BuildProducer<FeatureBuildItem> feature, List<EventConsumerBusinessMethodItem> messageConsumerBusinessMethods, BuildProducer<GeneratedClassBuildItem> generatedClass, AnnotationProxyBuildItem annotationProxy, LaunchModeBuildItem launchMode, ShutdownContextBuildItem shutdown, BuildProducer<ServiceStartBuildItem> serviceStart, List<MessageCodecBuildItem> codecs, RecorderContext recorderContext) { - feature.produce(new FeatureBuildItem(FeatureBuildItem.VERTX)); Map<String, ConsumeEvent> messageConsumerConfigurations = new HashMap<>(); ClassOutput classOutput = new GizmoAdaptor(generatedClass, true); for (EventConsumerBusinessMethodItem businessMethod : messageConsumerBusinessMethods) {
['extensions/vertx/deployment/src/main/java/io/quarkus/vertx/deployment/VertxProcessor.java']
{'.java': 1}
1
1
0
0
1
5,974,927
1,158,182
154,145
1,598
351
75
8
1
686
100
157
9
2
0
"2019-11-20T12:10: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,158
quarkusio/quarkus/6407/6399
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6399
https://github.com/quarkusio/quarkus/pull/6407
https://github.com/quarkusio/quarkus/pull/6407
1
fixes
Mime mappings in web.xml are ignored by undertow extension
I need to serve my wasm file with 'Content-Type' header `application/wasm` instead of `application/octet-stream`. I explicitly use the quarkus-undertow extension. I tried to add a web.xml under src/main/resources/META-INF with a mime mapping for wasm files like this: ``` <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <mime-mapping> <extension>wasm</extension> <mime-type>application/wasm</mime-type> </mime-mapping> </web-app> ``` The web.xml mime mapping seems to be ignored by the undertow extension. **Expected behavior** The Content-Type header for wasm files should be `application/wasm`. **Actual behavior** The Content-Type header for wasm files is still the original `application/octet-stream`. **To Reproduce** Steps to reproduce the behavior: 1. Add the quarkus-undertow extension 2. Add the web.xml from above under `src/main/resources/META-INF` 3. Add an empty file 'test.wasm' to `src/main/resources/META-INF/resources` 4. HTTP GET request to url `<quarkus-root>/test.wasm` --> Content-Type header of response should be `application/wasm` like defined in the web.xml instead of `application/octet-stream` **Environment (please complete the following information):** - Output of `uname -a` or `ver`: `Linux 5.3.16-300.fc31.x86_64 #1 SMP Fri Dec 13 17:59:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux` - Output of `java -version`: ``` openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-b09) OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode) ``` - GraalVM version (if different from Java): CE 19.2.1 - Quarkus version or git rev: 1.1.0.Final **Additional context** My original SO post: https://stackoverflow.com/q/59520915/3952202
01cb09123ac6710ac5d55b81425a6bb795c5e4ef
7402ed58413476191187cdfabebd4767041176ac
https://github.com/quarkusio/quarkus/compare/01cb09123ac6710ac5d55b81425a6bb795c5e4ef...7402ed58413476191187cdfabebd4767041176ac
diff --git a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java index 015f199cf40..e16605c3b0b 100644 --- a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java +++ b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java @@ -66,6 +66,7 @@ import org.jboss.metadata.web.spec.FiltersMetaData; import org.jboss.metadata.web.spec.HttpMethodConstraintMetaData; import org.jboss.metadata.web.spec.ListenerMetaData; +import org.jboss.metadata.web.spec.MimeMappingMetaData; import org.jboss.metadata.web.spec.MultipartConfigMetaData; import org.jboss.metadata.web.spec.SecurityConstraintMetaData; import org.jboss.metadata.web.spec.ServletMappingMetaData; @@ -463,6 +464,13 @@ public ServletDeploymentManagerBuildItem build(List<ServletBuildItem> servlets, } } + // MIME mappings + if (webMetaData.getMimeMappings() != null) { + for (MimeMappingMetaData mimeMapping : webMetaData.getMimeMappings()) { + recorder.addMimeMapping(deployment, mimeMapping.getExtension(), mimeMapping.getMimeType()); + } + } + for (ServletBuildItem servlet : servlets) { String servletClass = servlet.getServletClass(); if (servlet.getLoadOnStartup() == 0) { diff --git a/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ServletWebXmlTestCase.java b/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ServletWebXmlTestCase.java index 66824b42d28..a960bf964f3 100644 --- a/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ServletWebXmlTestCase.java +++ b/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ServletWebXmlTestCase.java @@ -3,6 +3,7 @@ import static org.hamcrest.Matchers.is; import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Test; @@ -29,14 +30,20 @@ public class ServletWebXmlTestCase { " <servlet-mapping>\\n" + " <servlet-name>mapped</servlet-name>\\n" + " <url-pattern>/mapped</url-pattern>\\n" + - " </servlet-mapping>" + + " </servlet-mapping>\\n" + + "\\n" + + " <mime-mapping>\\n" + + " <extension>wasm</extension>\\n" + + " <mime-type>application/wasm</mime-type>\\n" + + " </mime-mapping>" + "</web-app>"; @RegisterExtension static QuarkusUnitTest runner = new QuarkusUnitTest() .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) .addClasses(WebXmlServlet.class) - .addAsManifestResource(new StringAsset(WEB_XML), "web.xml")); + .addAsManifestResource(new StringAsset(WEB_XML), "web.xml") + .addAsManifestResource(EmptyAsset.INSTANCE, "resources/test.wasm")); @Test public void testWebXmlServlet() { @@ -45,4 +52,10 @@ public void testWebXmlServlet() { .body(is("web xml servlet")); } + @Test + public void testMimeMapping() { + RestAssured.when().get("/test.wasm").then() + .statusCode(200) + .contentType(is("application/wasm")); + } } diff --git a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java index d66f8d71f3e..a1fdf23dd37 100644 --- a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java +++ b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java @@ -65,6 +65,7 @@ import io.undertow.servlet.api.InstanceHandle; import io.undertow.servlet.api.ListenerInfo; import io.undertow.servlet.api.LoginConfig; +import io.undertow.servlet.api.MimeMapping; import io.undertow.servlet.api.SecurityConstraint; import io.undertow.servlet.api.SecurityInfo; import io.undertow.servlet.api.ServletContainer; @@ -310,6 +311,11 @@ public void registerListener(RuntimeValue<DeploymentInfo> info, Class<?> listene factory.instanceFactory(listenerClass)))); } + public void addMimeMapping(RuntimeValue<DeploymentInfo> info, String extension, + String mimeType) throws Exception { + info.getValue().addMimeMapping(new MimeMapping(extension, mimeType)); + } + public void addServletInitParameter(RuntimeValue<DeploymentInfo> info, String name, String value) { info.getValue().addInitParameter(name, value); }
['extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java', 'extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java', 'extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ServletWebXmlTestCase.java']
{'.java': 3}
3
3
0
0
3
6,610,604
1,277,735
171,411
1,807
624
123
14
2
2,011
214
553
46
5
2
"2020-01-05T15:36:43"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,157
quarkusio/quarkus/6430/6428
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6428
https://github.com/quarkusio/quarkus/pull/6430
https://github.com/quarkusio/quarkus/pull/6430
1
fixes
NPE launching in dev mode with Kotlin and version 1.1.0.Final
**Describe the bug** I have upgraded the project from 1.0.1.Final to 1.1.0.Final and executing Quarkus in DEV mode I get this maven error (-X): ``` [INFO] --- quarkus-maven-plugin:1.1.0.Final:dev (default-cli) @ quake-service --- [DEBUG] Configuring mojo io.quarkus:quarkus-maven-plugin:1.1.0.Final:dev from plugin realm ClassRealm[plugin>io.quarkus:quarkus-maven-plugin:1.1.0.Final, parent: java.net.URLClassLoader@6cc4c815] [DEBUG] Configuring mojo 'io.quarkus:quarkus-maven-plugin:1.1.0.Final:dev' with basic configurator --> [DEBUG] (f) buildDir = /Users/francesco.bellentani/Dev/quake/quake-service/target [DEBUG] (f) deleteDevJar = true [DEBUG] (f) outputDirectory = /Users/francesco.bellentani/Dev/quake/quake-service/target/classes [DEBUG] (f) project = MavenProject: it.quix.quake:quake-service:1.0.0-SNAPSHOT @ /Users/francesco.bellentani/Dev/quake/quake-service/pom.xml [DEBUG] (f) repoSession = org.eclipse.aether.DefaultRepositorySystemSession@7df28f1 [DEBUG] (f) repos = [central (http://maven.quix.it/nexus/content/repositories/central, default, releases)] [DEBUG] (f) session = org.apache.maven.execution.MavenSession@4087c7fc [DEBUG] (f) source = 1.8 [DEBUG] (f) sourceDir = /Users/francesco.bellentani/Dev/quake/quake-service/src/main/java [DEBUG] (f) target = 1.8 [DEBUG] (f) workingDir = /Users/francesco.bellentani/Dev/quake/quake-service/target [DEBUG] -- end configuration -- [DEBUG] Detected Maven Version: 3.6.1 [DEBUG] Detected Maven Version (3.6.1) is allowed in [3.5.3,). [DEBUG] Using javaTool: /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home/bin/java [DEBUG] Kotlin Maven plugin detected [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary for quake 1.0.0-SNAPSHOT: [INFO] [INFO] quake .............................................. SUCCESS [ 2.710 s] [INFO] quake-api .......................................... SUCCESS [ 1.535 s] [INFO] quake-service ...................................... FAILURE [ 1.446 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 6.698 s [INFO] Finished at: 2020-01-06T20:59:24+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.1.0.Final:dev (default-cli) on project quake-service: Failed to run: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:1.1.0.Final:dev (default-cli) on project quake-service: Failed to run 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:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) 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) 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.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) Caused by: org.apache.maven.plugin.MojoFailureException: Failed to run at io.quarkus.maven.DevMojo.execute (DevMojo.java:360) 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:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) 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) 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.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) Caused by: java.lang.NullPointerException at io.quarkus.maven.DevMojo$DevModeRunner.setKotlinSpecificFlags (DevMojo.java:686) at io.quarkus.maven.DevMojo$DevModeRunner.prepare (DevMojo.java:521) at io.quarkus.maven.DevMojo.execute (DevMojo.java:321) 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:956) at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288) at org.apache.maven.cli.MavenCli.main (MavenCli.java:192) 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) 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.apache.maven.wrapper.BootstrapMainStarter.start (BootstrapMainStarter.java:39) at org.apache.maven.wrapper.WrapperExecutor.execute (WrapperExecutor.java:122) at org.apache.maven.wrapper.MavenWrapperMain.main (MavenWrapperMain.java:61) [ERROR] [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/MojoFailureException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :quake-service ``` **Expected behavior** Run in dev mode **Actual behavior** NPE on Maven Plugin **To Reproduce** Steps to reproduce the behavior: 1. take a project with Kotlin plugin configured without the pluginOptions 2. upgrade to 1.1.0.Final 3. run ./mvnw compile quarkus:dev **Environment (please complete the following information):** - Output of `uname -a` or `ver`: `Darwin PC153-2 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64` - Output of `java -version`: ``` openjdk version "11.0.5" 2019-10-15 LTS OpenJDK Runtime Environment Corretto-11.0.5.10.1 (build 11.0.5+10-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.5.10.1 (build 11.0.5+10-LTS, mixed mode) ``` - GraalVM version (if different from Java): - Quarkus version or git rev: 1.1.0.Final **Additional context** I fixed the problem adding an empty **pluginOptions** section to the Kotlin Maven Plugin: ``` <plugin> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-maven-plugin</artifactId> <version>${kotlin.version}</version> <executions> <execution> <id>compile</id> <phase>compile</phase> <goals> <goal>compile</goal> </goals> </execution> <execution> <id>test-compile</id> <phase>test-compile</phase> <goals> <goal>test-compile</goal> </goals> </execution> </executions> <configuration> <pluginOptions> </pluginOptions> <jvmTarget>1.8</jvmTarget> </configuration> </plugin> ``` The Quarkus:DEV checks if there is a Kotlin Maven Plugin configuration to copy these settings, in my case I have a Kotlin configuration but that section was not present
81805b4f74d885f7bcaf91d6513c9b34ec901444
f9be4d5172093e5ab94c5619ff3b212415a74350
https://github.com/quarkusio/quarkus/compare/81805b4f74d885f7bcaf91d6513c9b34ec901444...f9be4d5172093e5ab94c5619ff3b212415a74350
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 f0ee42197df..7b41179947a 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -684,8 +684,10 @@ private void setKotlinSpecificFlags(DevModeContext devModeContext) { Xpp3Dom compilerPluginConfiguration = (Xpp3Dom) kotlinMavenPlugin.getConfiguration(); if (compilerPluginConfiguration != null) { Xpp3Dom compilerPluginArgsConfiguration = compilerPluginConfiguration.getChild("pluginOptions"); - for (Xpp3Dom argConfiguration : compilerPluginArgsConfiguration.getChildren()) { - options.add(argConfiguration.getValue()); + if (compilerPluginArgsConfiguration != null) { + for (Xpp3Dom argConfiguration : compilerPluginArgsConfiguration.getChildren()) { + options.add(argConfiguration.getValue()); + } } } devModeContext.setCompilerPluginsOptions(options);
['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java']
{'.java': 1}
1
1
0
0
1
6,611,231
1,277,841
171,428
1,807
416
61
6
1
13,123
724
3,202
194
2
3
"2020-01-06T20:46:57"
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,156
quarkusio/quarkus/6445/6412
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6412
https://github.com/quarkusio/quarkus/pull/6445
https://github.com/quarkusio/quarkus/pull/6445
1
resolves
Lots of logging if class is not in index
When using the reproducer for https://github.com/quarkusio/quarkus/issues/5354 I noticed that there is a lot of logging about the same class not being in the index: IMHO this should be logged once at most, and probably we should automatically index (and cache the result, as we don't want to do it multiple times). ``` 2020-01-06 16:36:53,100 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-2) Class for name: com.github.brunoabdon.quarkus.SomeSuperclass was not found in Jandex index. Please ensure the class is part of the index. 2020-01-06 16:36:53,109 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-2) Class for name: com.github.brunoabdon.quarkus.SomeSuperclass was not found in Jandex index. Please ensure the class is part of the index. 2020-01-06 16:36:53,110 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-2) Class for name: com.github.brunoabdon.quarkus.SomeSuperclass was not found in Jandex index. Please ensure the class is part of the index. 2020-01-06 16:36:53,139 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-2) Class for name: com.github.brunoabdon.quarkus.SomeSuperclass was not found in Jandex index. Please ensure the class is part of the index. 2020-01-06 16:36:53,139 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-2) Class for name: com.github.brunoabdon.quarkus.SomeSuperclass was not found in Jandex index. Please ensure the class is part of the index. 2020-01-06 16:36:53,139 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-2) Class for name: com.github.brunoabdon.quarkus.SomeSuperclass was not found in Jandex index. Please ensure the class is part of the index. 2020-01-06 16:36:53,185 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-3) Class for name: com.github.brunoabdon.quarkus.SomeSuperclass was not found in Jandex index. Please ensure the class is part of the index. 2020-01-06 16:36:53,185 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-3) Class for name: com.github.brunoabdon.quarkus.SomeSuperclass was not found in Jandex index. Please ensure the class is part of the index. ```
f9fe22d69f59ab3b51189c7228b3dafa82e85ed0
0bee2a9726829e0a26a76b64d451ffcc40c75244
https://github.com/quarkusio/quarkus/compare/f9fe22d69f59ab3b51189c7228b3dafa82e85ed0...0bee2a9726829e0a26a76b64d451ffcc40c75244
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java index 161e4fddb2c..b05604d0386 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java @@ -1,5 +1,7 @@ package io.quarkus.arc.processor; +import java.util.HashSet; +import java.util.Set; import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.jboss.jandex.IndexView; @@ -9,6 +11,9 @@ final class IndexClassLookupUtils { private static final Logger LOGGER = Logger.getLogger(IndexClassLookupUtils.class); + // set of already encountered and logged DotNames that are missing in the index + private static Set<DotName> alreadyKnown = new HashSet<>(); + private IndexClassLookupUtils() { } @@ -31,10 +36,11 @@ private static ClassInfo lookupClassInIndex(IndexView index, DotName dotName, bo throw new IllegalArgumentException("Cannot lookup class, provided Jandex Index was null."); } ClassInfo info = index.getClassByName(dotName); - if (info == null && withLogging) { - // class not in index, log warning as this may cause the application to blow up or behave weirdly + if (info == null && withLogging && !alreadyKnown.contains(dotName)) { + // class not in index, log info as this may cause the application to blow up or behave weirdly LOGGER.info("Class for name: " + dotName + " was not found in Jandex index. Please ensure the class " + "is part of the index."); + alreadyKnown.add(dotName); } return info; }
['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java']
{'.java': 1}
1
1
0
0
1
6,611,869
1,277,956
171,440
1,807
583
124
10
1
2,077
245
614
15
1
1
"2020-01-07T15:15:30"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,155
quarkusio/quarkus/6455/6442
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6442
https://github.com/quarkusio/quarkus/pull/6455
https://github.com/quarkusio/quarkus/pull/6455
1
fixes
quarkusDev doesn't work in multi module gradle project
**Describe the bug** If using a multi module gradle project quarkusDev will fail complaining that beans are defined multiple times. This is due to both common/buld/classes and common/buld/lib/common.jar being on the classpath inside of dev-mode-context.dat Project Structure ``` project-root ... common ... app ``` App depends on common via ``` compile project(":commons") ``` The error that happens is ``` Suppressed: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type commons.CommonsConfig and qualifiers [@Default] - java member: commons.cache.impl.CacheServiceImpl#config - declared on CLASS bean [types=[commons.cache.CacheService, commons.cache.impl.CacheServiceImpl, java.lang.Object], qualifiers=[@Default, @Any], target=commons.cache.impl.CacheServiceImpl] - available beans: - CLASS bean [types=[commons.CommonsConfig, java.lang.Object], qualifiers=[@Default, @Any], target=commons.CommonsConfig] - CLASS bean [types=[commons.CommonsConfig, java.lang.Object], qualifiers=[@Default, @Any], target=commons.CommonsConfig] ``` Inside META-INF/dev-mode-context.dat ``` commons/build/classes/java/main commons/build/libs/commons-v383-1-gf5b4d8a.dirty.jar ``` **Expected behavior** QuarkusDev should start without issues **Actual behavior** QuarkusDev fails due to AmbiguousResolutionException **Environment (please complete the following information):** - Output of `uname -a` or `ver`: Darwin Kernel Version 19.0.0 - Output of `java -version`: OpenJDK 64-Bit GraalVM CE 19.2.1 (build 25.232-b07-jvmci-19.2-b03, mixed mode) - GraalVM version (if different from Java): - Quarkus version or git rev: 1.1.0.FINAL
b33f36d5b9b94b7f10f0610052dae7aed881553d
b27ebf41a7fd12162035c6dffda5b1bf3296a19f
https://github.com/quarkusio/quarkus/compare/b33f36d5b9b94b7f10f0610052dae7aed881553d...b27ebf41a7fd12162035c6dffda5b1bf3296a19f
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 d5984ab07fc..ab99d14206f 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java @@ -52,6 +52,7 @@ import org.gradle.api.tasks.options.Option; import io.quarkus.bootstrap.model.AppArtifact; +import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.model.AppDependency; import io.quarkus.bootstrap.model.AppModel; import io.quarkus.bootstrap.resolver.AppModelResolver; @@ -241,22 +242,13 @@ public void startDev() { throw new GradleException("Failed to resolve application model " + extension.getAppArtifact() + " dependencies", e); } - for (AppDependency appDep : appModel.getAllDependencies()) { - addToClassPaths(classPathManifest, context, appDep.getArtifact().getPath().toFile()); - } args.add("-Djava.util.logging.manager=org.jboss.logmanager.LogManager"); File wiringClassesDirectory = new File(getBuildDir(), "wiring-classes"); wiringClassesDirectory.mkdirs(); addToClassPaths(classPathManifest, context, wiringClassesDirectory); - //we also want to add the maven plugin jar to the class path - //this allows us to just directly use classes, without messing around copying them - //to the runner jar - addGradlePluginDeps(classPathManifest, context); - //now we need to build a temporary jar to actually run - File tempFile = new File(getBuildDir(), extension.finalName() + "-dev.jar"); tempFile.delete(); tempFile.deleteOnExit(); @@ -271,6 +263,7 @@ public void startDev() { res = file.getAbsolutePath(); } + final Set<AppArtifactKey> projectDependencies = new HashSet<>(); final Configuration compileCp = project.getConfigurations() .getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME); final DependencySet compileCpDependencies = compileCp.getAllDependencies(); @@ -280,6 +273,11 @@ public void startDev() { continue; } + // Create the key via AppArtifact to make sure we use same defaults for type and classifier + AppArtifactKey key = new AppArtifact(dependency.getGroup(), dependency.getName(), dependency.getVersion()) + .getKey(); + projectDependencies.add(key); + Project dependencyProject = ((ProjectDependency) dependency).getDependencyProject(); Convention convention = dependencyProject.getConvention(); JavaPluginConvention javaConvention = convention.findPlugin(JavaPluginConvention.class); @@ -308,6 +306,17 @@ public void startDev() { context.getModules().add(wsModuleInfo); } + for (AppDependency appDependency : appModel.getAllDependencies()) { + if (!projectDependencies.contains(appDependency.getArtifact().getKey())) { + addToClassPaths(classPathManifest, context, appDependency.getArtifact().getPath().toFile()); + } + } + + //we also want to add the maven plugin jar to the class path + //this allows us to just directly use classes, without messing around copying them + //to the runner jar + addGradlePluginDeps(classPathManifest, context); + DevModeContext.ModuleInfo moduleInfo = new DevModeContext.ModuleInfo( project.getName(), project.getProjectDir().getAbsolutePath(),
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java']
{'.java': 1}
1
1
0
0
1
6,624,623
1,280,496
171,789
1,811
1,497
271
27
1
1,775
169
417
46
0
4
"2020-01-08T07:12:27"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,136
quarkusio/quarkus/7380/7371
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/7371
https://github.com/quarkusio/quarkus/pull/7380
https://github.com/quarkusio/quarkus/pull/7380
1
fixes
quarkus.security.jdbc.principal-query.sql is required even if quarkus.security.jdbc.enabled is set to false
`quarkus.security.jdbc.principal-query.sql` is required even if `quarkus.security.jdbc.enabled=false` Expected behavior is to not require `quarkus.security.jdbc.principal-query.sql` when `quarkus.security.jdbc.enabled=false` is set. ``` [INFO] Running io.quarkus.qe.MyResourceTest [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.306 s <<< FAILURE! - in io.quarkus.qe.MyResourceTest [ERROR] testHelloEndpoint Time elapsed: 0.011 s <<< ERROR! java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.util.NoSuchElementException: Property quarkus.security.jdbc.principal-query.sql not found Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.util.NoSuchElementException: Property quarkus.security.jdbc.principal-query.sql not found Caused by: java.lang.RuntimeException: java.util.NoSuchElementException: Property quarkus.security.jdbc.principal-query.sql not found Caused by: java.util.NoSuchElementException: Property quarkus.security.jdbc.principal-query.sql not found ``` Reproducer: ``` rm -rf fooBar mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create \\ -DprojectGroupId=io.quarkus.qe \\ -DprojectArtifactId=fooBar \\ -DprojectVersion=1.0.0-SNAPSHOT \\ -DplatformArtifactId=quarkus-bom \\ -DclassName="io.quarkus.qe.MyResource" \\ -Dextensions="quarkus-elytron-security-jdbc" echo "quarkus.security.jdbc.enabled=false" > fooBar/src/main/resources/application.properties mvn -f fooBar/pom.xml clean verify ```
552284e9cab154c95adc8c09ae770d4c73a443e5
11c8be8b86113e9104a33cb78e7feaf773ef6938
https://github.com/quarkusio/quarkus/compare/552284e9cab154c95adc8c09ae770d4c73a443e5...11c8be8b86113e9104a33cb78e7feaf773ef6938
diff --git a/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java b/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java index 1949f766148..53faf6a116e 100644 --- a/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java +++ b/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java @@ -43,11 +43,10 @@ public Provider[] get() { } private void registerPrincipalQuery(PrincipalQueryConfig principalQuery, JdbcSecurityRealmBuilder builder) { - DataSource dataSource = (DataSource) principalQuery.datasource - .map(name -> Arc.container().instance(name).get()) - .orElse(Arc.container().instance(DataSource.class).get()); - QueryBuilder queryBuilder = builder.principalQuery(principalQuery.sql).from(dataSource); + QueryBuilder queryBuilder = builder.principalQuery(principalQuery.sql.orElseThrow( + () -> new IllegalStateException("quarkus.security.jdbc.principal-query.sql property must be set"))) + .from(getDataSource(principalQuery)); AttributeMapper[] mappers = principalQuery.attributeMappings.entrySet() .stream() @@ -62,4 +61,10 @@ private void registerPrincipalQuery(PrincipalQueryConfig principalQuery, JdbcSec queryBuilder.withMapper(principalQuery.bcryptPasswordKeyMapperConfig.toPasswordKeyMapper()); } } + + private DataSource getDataSource(PrincipalQueryConfig principalQuery) { + return (DataSource) principalQuery.datasource + .map(name -> Arc.container().instance(name).get()) + .orElse(Arc.container().instance(DataSource.class).get()); + } } diff --git a/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/PrincipalQueryConfig.java b/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/PrincipalQueryConfig.java index 93e2179f70b..85433878212 100644 --- a/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/PrincipalQueryConfig.java +++ b/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/PrincipalQueryConfig.java @@ -16,7 +16,7 @@ public class PrincipalQueryConfig { * The sql query to find the password */ @ConfigItem - public String sql; + public Optional<String> sql; /** * The data source to use
['extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/PrincipalQueryConfig.java', 'extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java']
{'.java': 2}
2
2
0
0
2
7,673,014
1,490,216
198,647
2,065
919
168
15
2
1,547
110
400
28
0
2
"2020-02-24T10:54: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,137
quarkusio/quarkus/7305/7161
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/7161
https://github.com/quarkusio/quarkus/pull/7305
https://github.com/quarkusio/quarkus/pull/7305
1
fixes
Running a shutdown task failed: Provider io.smallrye.faulttolerance.propagation.ContextPropagationExecutorFactory not a subtype
I circled back to the https://github.com/quarkus-qe/beefy-scenarios to try it with current Quarkus master and I noticed stacktrace in the console, tests do not fail though. Stacktrace is around faulttolerance, so @Ladicek / @michalszynkiewicz could you please take a look ? Steps to reproduce: ``` git clone https://github.com/quarkus-qe/beefy-scenarios.git cd beefy-scenarios mvn clean verify -fae -pl 101-javaee-like-getting-started/ ``` Details ``` [INFO] Running io.quarkus.qe.core.JavaEELikeQuarkusBundleTest 2020-02-12 13:31:02,611 WARN [io.qua.agr.dep.AgroalProcessor] (build-36) Agroal dependency is present but no driver has been defined for the default datasource 2020-02-12 13:31:05,133 INFO [io.quarkus] (main) Quarkus 999-SNAPSHOT started in 3.685s. Listening on: http://0.0.0.0:8081 2020-02-12 13:31:05,134 INFO [io.quarkus] (main) Profile test activated. 2020-02-12 13:31:05,134 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, hibernate-validator, jaeger, narayana-jta, resteasy, resteasy-jsonb, scheduler, security, servlet, smallrye-context-propagation, smallrye-fault-tolerance, smallrye-health, smallrye-metrics, smallrye-openapi, smallrye-opentracing, swagger-ui, undertow-websockets] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.82 s - in io.quarkus.qe.core.JavaEELikeQuarkusBundleTest [INFO] Running io.quarkus.qe.core.JavaEELikeHealthCheckTest [INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.556 s - in io.quarkus.qe.core.JavaEELikeHealthCheckTest 2020-02-12 13:31:07,593 ERROR [io.qua.run.StartupContext] (main) Running a shutdown task failed: java.util.ServiceConfigurationError: io.smallrye.faulttolerance.ExecutorFactory: Provider io.smallrye.faulttolerance.propagation.ContextPropagationExecutorFactory not a subtype at java.util.ServiceLoader.fail(ServiceLoader.java:239) at java.util.ServiceLoader.access$300(ServiceLoader.java:185) at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404) at java.util.ServiceLoader$1.next(ServiceLoader.java:480) at io.smallrye.faulttolerance.ExecutorProvider.executorProvider(ExecutorProvider.java:83) at io.smallrye.faulttolerance.ExecutorProvider.setUp(ExecutorProvider.java:48) at io.smallrye.faulttolerance.ExecutorProvider_Bean.create(ExecutorProvider_Bean.zig:398) at io.smallrye.faulttolerance.ExecutorProvider_Bean.create(ExecutorProvider_Bean.zig:414) at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:80) 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 io.smallrye.faulttolerance.ExecutorProvider_Bean.get(ExecutorProvider_Bean.zig:472) at io.smallrye.faulttolerance.ExecutorProvider_Bean.get(ExecutorProvider_Bean.zig:65) at io.smallrye.faulttolerance.ExecutorProvider_Observer_tearDown_5b12a3f0c93ede4d9438df3ab2b4167b7b4850fa.notify(ExecutorProvider_Observer_tearDown_5b12a3f0c93ede4d9438df3ab2b4167b7b4850fa.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$Notifier.notify(EventImpl.java:217) at io.quarkus.arc.impl.ArcContainerImpl.shutdown(ArcContainerImpl.java:302) at io.quarkus.arc.Arc.shutdown(Arc.java:49) at io.quarkus.arc.runtime.ArcRecorder$1.run(ArcRecorder.java:39) at io.quarkus.runtime.StartupContext.runAllInReverseOrder(StartupContext.java:69) at io.quarkus.runtime.StartupContext.close(StartupContext.java:58) at io.quarkus.runner.ApplicationImpl.doStop(ApplicationImpl.zig:527) at io.quarkus.runtime.Application.stop(Application.java:170) at io.quarkus.runtime.Application.close(Application.java:113) at io.quarkus.runner.bootstrap.StartupActionImpl$1.close(StartupActionImpl.java:102) at io.quarkus.runner.bootstrap.RunningQuarkusApplicationImpl.close(RunningQuarkusApplicationImpl.java:29) at io.quarkus.test.junit.QuarkusTestExtension$1.close(QuarkusTestExtension.java:100) at io.quarkus.test.junit.QuarkusTestExtension$ExtensionState.close(QuarkusTestExtension.java:369) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.jupiter.engine.execution.ExtensionValuesStore.closeAllStoredCloseableValues(ExtensionValuesStore.java:61) at org.junit.jupiter.engine.descriptor.AbstractExtensionContext.close(AbstractExtensionContext.java:73) at org.junit.jupiter.engine.execution.JupiterEngineExecutionContext.close(JupiterEngineExecutionContext.java:53) at org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.cleanUp(JupiterEngineDescriptor.java:67) at org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.cleanUp(JupiterEngineDescriptor.java:29) at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$cleanUp$9(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73) at org.junit.platform.engine.support.hierarchical.NodeTestTask.cleanUp(NodeTestTask.java:151) at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:83) at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32) at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57) at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154) at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:142) at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344) at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417) 2020-02-12 13:31:07,594 INFO [io.quarkus] (main) Quarkus stopped in 0.040s ```
d2242d0e40fd9b18c44f62ecfa49d0e7e1b499f5
3390f3a56f9f17ef1d8a3d7e0c297e9d873c251c
https://github.com/quarkusio/quarkus/compare/d2242d0e40fd9b18c44f62ecfa49d0e7e1b499f5...3390f3a56f9f17ef1d8a3d7e0c297e9d873c251c
diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java index 4a249293d66..aa58bd9fa17 100644 --- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java +++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java @@ -98,9 +98,14 @@ public RunningQuarkusApplication run(String... args) throws Exception { @Override public void close() throws IOException { try { + ClassLoader original = Thread.currentThread().getContextClassLoader(); try { + // some actions during close can still require the runtime classloader + // (e.g. ServiceLoader calls) + Thread.currentThread().setContextClassLoader(runtimeClassLoader); closeTask.close(); } finally { + Thread.currentThread().setContextClassLoader(original); runtimeClassLoader.close(); } } finally {
['core/deployment/src/main/java/io/quarkus/runner/bootstrap/StartupActionImpl.java']
{'.java': 1}
1
1
0
0
1
7,358,334
1,424,423
190,017
1,992
434
54
5
1
6,844
299
1,793
79
3
2
"2020-02-20T09:55:39"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,138
quarkusio/quarkus/7287/7195
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/7195
https://github.com/quarkusio/quarkus/pull/7287
https://github.com/quarkusio/quarkus/pull/7287
2
fixes
Multi-project @QuarkusTest in IDE to use compiled source
**Describe the bug** Running @QuarkusTests in Eclipse IDE for a multi-project Maven setup, the tests are picking up the jar dependencies not the compiled source. **Environment (please complete the following information):** - Quarkus version or git rev: 1.3.0.Alpha1 **Additional context** https://groups.google.com/d/msg/quarkus-dev/ovaJ1GUang8/9jUbs9m7AQAJ
8a0ffb7f74c6257a00427d50d005155cc07c1f6a
192005548a958a076c7f98bec60be3f5dc8f7f54
https://github.com/quarkusio/quarkus/compare/8a0ffb7f74c6257a00427d50d005155cc07c1f6a...192005548a958a076c7f98bec60be3f5dc8f7f54
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 6724abacb84..063737b695d 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 @@ -80,25 +80,20 @@ private static LocalProject load(LocalWorkspace workspace, LocalProject parent, private static Model loadRootModel(Path currentProjectDir) throws BootstrapException { Path pomXml = currentProjectDir.resolve(POM_XML); - Model model = readModel(pomXml); - Parent parent = model.getParent(); - while (parent != null) { - if (parent.getRelativePath() != null && !parent.getRelativePath().isEmpty()) { + Model model = null; + while (Files.exists(pomXml)) { + model = readModel(pomXml); + final Parent parent = model.getParent(); + if (parent != null + && parent.getRelativePath() != null + && !parent.getRelativePath().isEmpty()) { pomXml = pomXml.getParent().resolve(parent.getRelativePath()).normalize(); - if (!Files.exists(pomXml)) { - return model; - } if (Files.isDirectory(pomXml)) { pomXml = pomXml.resolve(POM_XML); } } else { pomXml = pomXml.getParent().getParent().resolve(POM_XML); - if (!Files.exists(pomXml)) { - return model; - } } - model = readModel(pomXml); - parent = model.getParent(); } 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 227181ed6ab..e0965f63ece 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 @@ -107,10 +107,10 @@ public void loadIndependentProjectInTheWorkspaceTree() throws Exception { assertEquals("independent", project.getArtifactId()); assertEquals(MvnProjectBuilder.DEFAULT_VERSION, project.getVersion()); final Map<AppArtifactKey, LocalProject> projects = project.getWorkspace().getProjects(); - assertEquals(1, projects.size()); + assertEquals(6, projects.size()); assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "independent"))); - assertLocalDeps(project); + assertLocalDeps(project, "root-module-not-direct-child", "root-no-parent-module", "root-module-with-parent"); } @Test @@ -135,9 +135,9 @@ public void loadWorkspaceForModuleWithoutParent() throws Exception { assertEquals(MvnProjectBuilder.DEFAULT_VERSION, project.getVersion()); assertNotNull(project.getWorkspace()); final Map<AppArtifactKey, LocalProject> projects = project.getWorkspace().getProjects(); - assertEquals(1, projects.size()); + assertEquals(5, projects.size()); assertTrue(projects.containsKey(new AppArtifactKey(MvnProjectBuilder.DEFAULT_GROUP_ID, "root-no-parent-module"))); - assertLocalDeps(project); + assertLocalDeps(project, "root-module-not-direct-child"); } @Test
['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
7,365,913
1,425,695
190,037
1,992
807
153
19
1
369
41
95
9
1
0
"2020-02-19T17:49:12"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,139
quarkusio/quarkus/7277/7144
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/7144
https://github.com/quarkusio/quarkus/pull/7277
https://github.com/quarkusio/quarkus/pull/7277
1
resolves
Qute Template Extension with multiple parameters: Resulting in endless wait without error
**Describe the bug** I'm trying to create a Qute template extension with multiple parameters as described here: https://quarkus.io/guides/qute-reference#method-parameters When using a method with a single parameter all is working well, when I add a second parameter in the template extension method, it results in an endless loop in the browser. I tried setting the default logger to DEBUG, but nothing gets logged (see log under "actual behavior"). I also tried to set a breakpoint in the method that gets called, but the error seems to be happening before the breakpoint is reached. **Expected behavior** The template extension method is called, the result computed and displayed in my HTML template. **Actual behavior** Website loads endlesly in browser. Logfile shows this: ``` 2020-02-11 17:00:18,069 INFO [io.quarkus] (main) Quarkus 1.2.0.Final started in 2.818s. Listening on: http://0.0.0.0:8080 2020-02-11 17:00:18,070 INFO [io.quarkus] (main) Profile dev activated. Live Coding activated. 2020-02-11 17:00:18,070 INFO [io.quarkus] (main) Installed features: [cdi, qute, resteasy, resteasy-jackson, resteasy-qute, spring-di, spring-web] 2020-02-11 17:00:30,242 DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-1) -Dio.netty.recycler.maxCapacityPerThread: {} 2020-02-11 17:00:30,243 DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-1) -Dio.netty.recycler.maxSharedCapacityFactor: {} 2020-02-11 17:00:30,243 DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-1) -Dio.netty.recycler.linkCapacity: {} 2020-02-11 17:00:30,243 DEBUG [io.net.uti.Recycler] (vert.x-eventloop-thread-1) -Dio.netty.recycler.ratio: {} 2020-02-11 17:00:30,334 DEBUG [io.net.han.cod.com.ZlibCodecFactory] (vert.x-eventloop-thread-1) -Dio.netty.noJdkZlibDecoder: {} 2020-02-11 17:00:30,334 DEBUG [io.net.han.cod.com.ZlibCodecFactory] (vert.x-eventloop-thread-1) -Dio.netty.noJdkZlibEncoder: {} 2020-02-11 17:00:30,459 DEBUG [org.jbo.res.res.i18n] (executor-thread-1) RESTEASY002315: PathInfo: / 2020-02-11 17:00:31,172 DEBUG [io.qua.qut.run.EngineProducer] (executor-thread-1) Locate template for templates/feed 2020-02-11 17:00:31,175 DEBUG [io.qua.qut.run.EngineProducer] (executor-thread-1) Locate template for templates/feed.qute.html 2020-02-11 17:00:31,176 DEBUG [io.qua.qut.run.EngineProducer] (executor-thread-1) Locate template for templates/feed.qute.txt <HERE WE HAVE AN ENDLESS WAIT, THEN IT SEEMS TO RESTART THE TASK?> > Task :quarkusDev <THEN RELOADING WEBSITE IN BROWSER> 2020-02-11 17:04:48,855 DEBUG [io.qua.resteasy] (vert.x-eventloop-thread-10) IO Exception : io.vertx.core.VertxException: Connection was closed 2020-02-11 17:04:48,892 DEBUG [org.jbo.res.res.i18n] (executor-thread-1) RESTEASY002315: PathInfo: / 2020-02-11 17:04:49,219 DEBUG [io.qua.qut.run.EngineProducer] (executor-thread-1) Locate template for templates/feed 2020-02-11 17:04:49,222 DEBUG [io.qua.qut.run.EngineProducer] (executor-thread-1) Locate template for templates/feed.qute.html 2020-02-11 17:04:49,224 DEBUG [io.qua.qut.run.EngineProducer] (executor-thread-1) Locate template for templates/feed.qute.txt <AND ENDLESS WAIT AGAIN> ``` **Not working code example** ``` // My @RestController method, where "downloadFolder" would be a simple String, and "feed" would be a @Component with several methods @GetMapping(value = "/", produces = MediaType.TEXT_HTML) public TemplateInstance showFeed() { return feed.data("feed", feedReader.readFeed()) .data("downloadFolder", downloadFolder); } ``` ``` @TemplateExtension public class DownloadExistsUtil { public static boolean isAlreadyDownloaded(FeedItem feedItem, String downloadUrl, String downloadFolder) { return false; } } ``` ``` <table class="datagrid"> {#for item in feed} <tr> <td> {#for url in item.urls} {#if item.isAlreadyDownloaded(url,downloadFolder) == false} <p> Bla </p> {#else} <p> Blub </p> {/if} {/for} </td> </tr> {/for} </table> ``` **Working example with just 1 parameter** ``` // No change from "not working example" // My @RestController method, where "downloadFolder" would be a simple String, and "feed" would be a @Component with several methods @GetMapping(value = "/", produces = MediaType.TEXT_HTML) public TemplateInstance showFeed() { return feed.data("feed", feedReader.readFeed()) .data("downloadFolder", downloadFolder); } ``` ``` @TemplateExtension public class DownloadExistsUtil { public static boolean isAlreadyDownloaded(FeedItem feedItem, String downloadUrl) { return false; } } ``` ``` <table class="datagrid"> {#for item in feed} <tr> <td> {#for url in item.urls} {#if item.isAlreadyDownloaded(url) == false} <p> Bla </p> {#else} <p> Blub </p> {/if} {/for} </td> </tr> {/for} </table> ``` **Configuration** - Nothing **Environment (please complete the following information):** - Output of `uname -a` or `ver`: Microsoft Windows [Version 10.0.18363.592] - Output of `java -version`: ``` openjdk 11.0.6 2020-01-14 OpenJDK Runtime Environment GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07) OpenJDK 64-Bit Server VM GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07, mixed mode, sharing) ``` - GraalVM version (if different from Java): same as java - Quarkus version or git rev: 1.2.0.Final
6a635856fa686c5f2693a0090e168dc5138ea962
dad8321888c60096baae69c3e8b3693ca8d306f3
https://github.com/quarkusio/quarkus/compare/6a635856fa686c5f2693a0090e168dc5138ea962...dad8321888c60096baae69c3e8b3693ca8d306f3
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 c00d6e837a0..6edb2f6f129 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 @@ -69,7 +69,7 @@ private CompletionStage<Object> resolveReference(boolean tryParent, Object ref, return resolve(new EvalContextImpl(tryParent, ref, parts.next(), resolutionContext), resolvers.iterator()) .thenCompose(r -> { if (parts.hasNext()) { - return resolveReference(false, r, parts, resolutionContext); + return resolveReference(tryParent, r, parts, resolutionContext); } else { return CompletableFuture.completedFuture(r); } @@ -82,7 +82,7 @@ private CompletionStage<Object> resolve(EvalContextImpl evalContext, Iterator<Va if (evalContext.tryParent && parent != null) { // Continue with parent context return resolve( - new EvalContextImpl(false, parent.getData(), evalContext.name, parent), + new EvalContextImpl(true, parent.getData(), evalContext.name, parent), this.resolvers.iterator()); } LOGGER.tracef("Unable to resolve %s", evalContext); 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 8e7d061aea6..de7e5f08ca8 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 @@ -47,7 +47,9 @@ public CompletionStage<ResultNode> resolve(SectionResolutionContext context) { } else if (it instanceof Integer) { iterator = IntStream.rangeClosed(1, (Integer) it).iterator(); } else { - throw new IllegalStateException("Cannot iterate over: " + it); + throw new IllegalStateException( + String.format("Cannot iterate over [%s] resolved for [%s] in template %s on line %s", it, + iterable.toOriginalString(), iterable.origin.getTemplateId(), iterable.origin.getLine())); } int idx = 0; while (iterator.hasNext()) { 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 186959ec04c..a55a87a06d0 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 @@ -68,8 +68,8 @@ public void testStream() { @Test public void testNestedLoops() { - List<String> data = new ArrayList<>(); - data.add("alpha"); + List<String> list = new ArrayList<>(); + list.add("alpha"); Engine engine = Engine.builder() .addSectionHelper(new LoopSectionHelper.Factory()) @@ -92,14 +92,14 @@ public CompletionStage<Object> resolve(EvalContext context) { }) .build(); - String template = "{#for name in this}" + String template = "{#for name in list}" + "{count}.{name}: {#for char in name.chars}" - + "{name} - char at {index} = {char}{#if hasNext},{/}" + + "{name} {global} char at {index} = {char}{#if hasNext},{/}" + "{/}{/}"; assertEquals( "1.alpha: alpha - char at 0 = a,alpha - char at 1 = l,alpha - char at 2 = p,alpha - char at 3 = h,alpha - char at 4 = a", - engine.parse(template).render(data)); + engine.parse(template).data("global", "-").data("list", list).render()); } @Test diff --git a/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java b/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java index 9948a4ce424..c77b16aebef 100644 --- a/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java +++ b/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java @@ -8,12 +8,14 @@ import io.quarkus.gizmo.AssignableResultHandle; import io.quarkus.gizmo.BranchResult; import io.quarkus.gizmo.BytecodeCreator; +import io.quarkus.gizmo.CatchBlockCreator; import io.quarkus.gizmo.ClassCreator; import io.quarkus.gizmo.ClassOutput; import io.quarkus.gizmo.FunctionCreator; import io.quarkus.gizmo.MethodCreator; import io.quarkus.gizmo.MethodDescriptor; import io.quarkus.gizmo.ResultHandle; +import io.quarkus.gizmo.TryBlock; import io.quarkus.qute.EvalContext; import io.quarkus.qute.TemplateExtension; import io.quarkus.qute.ValueResolver; @@ -196,12 +198,20 @@ private void implementResolve(ClassCreator valueResolver, ClassInfo declaringCla args[i + shift] = success.invokeVirtualMethod(Descriptors.COMPLETABLE_FUTURE_GET, paramResult); } - ResultHandle invokeRet = success + // try + TryBlock tryCatch = success.tryBlock(); + // catch (Throwable e) + CatchBlockCreator exception = tryCatch.addCatch(Throwable.class); + // CompletableFuture.completeExceptionally(Throwable) + exception.invokeVirtualMethod(Descriptors.COMPLETABLE_FUTURE_COMPLETE_EXCEPTIONALLY, whenRet, + exception.getCaughtException()); + + ResultHandle invokeRet = tryCatch .invokeStaticMethod(MethodDescriptor.ofMethod(declaringClass.name().toString(), method.name(), method.returnType().name().toString(), method.parameters().stream().map(p -> p.name().toString()).collect(Collectors.toList()).toArray()), args); - success.invokeVirtualMethod(Descriptors.COMPLETABLE_FUTURE_COMPLETE, whenRet, invokeRet); + tryCatch.invokeVirtualMethod(Descriptors.COMPLETABLE_FUTURE_COMPLETE, whenRet, invokeRet); BytecodeCreator failure = throwableIsNull.falseBranch(); failure.invokeVirtualMethod(Descriptors.COMPLETABLE_FUTURE_COMPLETE_EXCEPTIONALLY, whenRet, diff --git a/independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/MyService.java b/independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/MyService.java index 1b9dd37da83..90747afb7c7 100644 --- a/independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/MyService.java +++ b/independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/MyService.java @@ -1,6 +1,7 @@ package io.quarkus.qute.generator; import io.quarkus.qute.TemplateData; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; @@ -50,4 +51,8 @@ public CompletionStage<String> getAnotherTestName(String param) { return CompletableFuture.completedFuture(param); } + public static List<String> getDummy(MyService service, int limit, String dummy) { + return Collections.emptyList(); + } + } diff --git a/independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/SimpleGeneratorTest.java b/independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/SimpleGeneratorTest.java index 995687b0044..427a736ab12 100644 --- a/independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/SimpleGeneratorTest.java +++ b/independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/SimpleGeneratorTest.java @@ -4,6 +4,7 @@ import static org.junit.jupiter.api.Assertions.fail; import io.quarkus.qute.Engine; +import io.quarkus.qute.EngineBuilder; import io.quarkus.qute.EvalContext; import io.quarkus.qute.Expression; import io.quarkus.qute.ImmutableList; @@ -11,19 +12,29 @@ import java.io.IOException; import java.io.InputStream; import java.util.Collections; +import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionStage; +import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.function.Function; +import org.jboss.jandex.ClassInfo; import org.jboss.jandex.DotName; import org.jboss.jandex.Index; import org.jboss.jandex.Indexer; +import org.jboss.jandex.MethodInfo; +import org.jboss.jandex.PrimitiveType; +import org.jboss.jandex.Type; +import org.jboss.jandex.Type.Kind; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; public class SimpleGeneratorTest { + static Set<String> generatedTypes = new HashSet<>(); + @BeforeAll public static void init() throws IOException { TestClassOutput classOutput = new TestClassOutput(); @@ -31,11 +42,20 @@ public static void init() throws IOException { CompletionStage.class, List.class); ValueResolverGenerator generator = new ValueResolverGenerator(index, classOutput, Collections.emptyMap()); - generator.generate(index.getClassByName(DotName.createSimple(MyService.class.getName()))); + ClassInfo myServiceClazz = index.getClassByName(DotName.createSimple(MyService.class.getName())); + generator.generate(myServiceClazz); generator.generate(index.getClassByName(DotName.createSimple(PublicMyService.class.getName()))); generator.generate(index.getClassByName(DotName.createSimple(MyItem.class.getName()))); generator.generate(index.getClassByName(DotName.createSimple(String.class.getName()))); generator.generate(index.getClassByName(DotName.createSimple(List.class.getName()))); + generatedTypes.addAll(generator.getGeneratedTypes()); + + ExtensionMethodGenerator extensionMethodGenerator = new ExtensionMethodGenerator(classOutput); + MethodInfo extensionMethod = index.getClassByName(DotName.createSimple(MyService.class.getName())).method( + "getDummy", Type.create(myServiceClazz.name(), Kind.CLASS), PrimitiveType.INT, + Type.create(DotName.createSimple(String.class.getName()), Kind.CLASS)); + extensionMethodGenerator.generate(extensionMethod, null); + generatedTypes.addAll(extensionMethodGenerator.getGeneratedTypes()); } @Test @@ -71,18 +91,38 @@ public void testWithEngine() throws Exception { } catch (ClassNotFoundException | InstantiationException | IllegalAccessException expected) { } - Engine engine = Engine.builder().addDefaults() - .addValueResolver(newResolver("io.quarkus.qute.generator.MyService_ValueResolver")) - .addValueResolver(newResolver("io.quarkus.qute.generator.PublicMyService_ValueResolver")) - .addValueResolver(newResolver("io.quarkus.qute.generator.MyItem_ValueResolver")) - .addValueResolver(newResolver("io.quarkus.qute.String_ValueResolver")) - .addValueResolver(newResolver("io.quarkus.qute.List_ValueResolver")) - .build(); + EngineBuilder builder = Engine.builder().addDefaults(); + for (String generatedType : generatedTypes) { + builder.addValueResolver(newResolver(generatedType)); + } + Engine engine = builder.build(); assertEquals(" FOO ", engine.parse("{#if isActive} {name.toUpperCase} {/if}").render(new MyService())); assertEquals("OK", engine.parse("{#if this.getList(5).size == 5}OK{/if}").render(new MyService())); assertEquals("Martin NOT_FOUND OK NOT_FOUND", engine.parse("{name} {surname} {isStatic ?: 'OK'} {base}").render(new PublicMyService())); assertEquals("foo NOT_FOUND", engine.parse("{id} {bar}").render(new MyItem())); + try { + engine.parse("{this.getList(5,5)}").render(new MyService()); + fail(); + } catch (IllegalStateException e) { + assertClassCastException(e); + } + try { + engine.parse("{service.getDummy(5,resultNotFound)}").data("service", new MyService()).render(); + fail(); + } catch (IllegalStateException e) { + assertClassCastException(e); + } + } + + private void assertClassCastException(Exception e) { + if (e.getCause() instanceof ExecutionException) { + ExecutionException ex = (ExecutionException) e.getCause(); + if (ex.getCause() instanceof ClassCastException) { + return; + } + } + fail("Unexpected exception thrown: ", e); } private ValueResolver newResolver(String className)
['independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/ExtensionMethodGenerator.java', 'independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/MyService.java', 'independent-projects/qute/generator/src/test/java/io/quarkus/qute/generator/SimpleGeneratorTest.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/LoopSectionHelper.java', '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': 6}
6
6
0
0
6
7,365,231
1,425,556
190,024
1,992
1,532
271
22
3
5,914
570
1,649
144
2
8
"2020-02-19T10:33:11"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,140
quarkusio/quarkus/7244/7167
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/7167
https://github.com/quarkusio/quarkus/pull/7244
https://github.com/quarkusio/quarkus/pull/7244
1
fixes
POST with HTTP/2 fails with: java.lang.IllegalStateException: Request has already been read
**Describe the bug** A POST request over HTTP/2 fails with _java.lang.IllegalStateException: Request has already been read_. The request is not processed by the appropriate JAX-RS resource at all and instead a _400 Bad Request_ that contains the error message in its body. The same request over HTTP/1 executes correctly. **Expected behavior** The requests should be executed in the same way regardless of the transport protocol. **Actual behavior** As described above. **To Reproduce** Steps to reproduce the behavior: 1. Make a simple Hello World application, the most basic one made by [the generator](https://code.quarkus.io/) with RESTEasy (included by default) is the good starting point. 2. Add the method for handling a POST request. It can be as simple as this: ```java @POST @Consumes(MediaType.TEXT_PLAIN) @Produces(MediaType.TEXT_PLAIN) public String post(String body) { System.out.println(body); return ""; } ``` 3. Build and run. 4. Send a POST request over HTTP/2, e.g.: ``` curl --http2-prior-knowledge -v -X POST -d Hello -H "Content-Type: text/plain" http://localhost:8080/hello ``` It does not matter if `--http2` or `--http2-prior-knowledge` is used. The result differs just in the protocol switching. Without `--http2` or `--http2-prior-knowledge` the command succeeds: ``` $ curl --http2-prior-knowledge -v -X POST -d Hello -H "Content-Type: text/plain" http://localhost:8080/hello Note: Unnecessary use of -X or --request, POST is already inferred. * Uses proxy env variable no_proxy == '192.168.99.100' * Trying ::1:8080... * TCP_NODELAY set * Connected to localhost (::1) port 8080 (#0) * Using HTTP2, server supports multi-use * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * Using Stream ID: 1 (easy handle 0x172c50) > POST /hello HTTP/2 > Host: localhost:8080 > user-agent: curl/7.68.0 > accept: */* > content-type: text/plain > content-length: 5 > * We are completely uploaded and fine * Connection state changed (MAX_CONCURRENT_STREAMS == 100)! < HTTP/2 400 < content-length: 62 < content-type: text/html;charset=UTF-8 < java.lang.IllegalStateException: Request has already been read* Connection #0 to host localhost left intact $ curl -v -X POST -d Hello -H "Content-Type: text/plain" http://localhost:8080/hello Note: Unnecessary use of -X or --request, POST is already inferred. * Uses proxy env variable no_proxy == '192.168.99.100' * Trying ::1:8080... * TCP_NODELAY set * Connected to localhost (::1) port 8080 (#0) > POST /hello HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.68.0 > Accept: */* > Content-Type: text/plain > Content-Length: 5 > * upload completely sent off: 5 out of 5 bytes * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Content-Length: 0 < Content-Type: text/plain;charset=UTF-8 < * Connection #0 to host localhost left intact ``` Moreover it is interesting that a GET request executes successfully with both HTTP/1 and HTTP/2: ``` $ curl -v http://localhost:8080/hello * Uses proxy env variable no_proxy == '192.168.99.100' * Trying ::1:8080... * TCP_NODELAY set * Connected to localhost (::1) port 8080 (#0) > GET /hello HTTP/1.1 > Host: localhost:8080 > User-Agent: curl/7.68.0 > Accept: */* > * Mark bundle as not supporting multiuse < HTTP/1.1 200 OK < Content-Length: 5 < Content-Type: text/plain;charset=UTF-8 < hello* Connection #0 to host localhost left intact $ curl -v --http2-prior-knowledge http://localhost:8080/hello * Uses proxy env variable no_proxy == '192.168.99.100' * Trying ::1:8080... * TCP_NODELAY set * Connected to localhost (::1) port 8080 (#0) * Using HTTP2, server supports multi-use * Connection state changed (HTTP/2 confirmed) * Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0 * Using Stream ID: 1 (easy handle 0xa22a50) > GET /hello HTTP/2 > Host: localhost:8080 > user-agent: curl/7.68.0 > accept: */* > * Connection state changed (MAX_CONCURRENT_STREAMS == 100)! < HTTP/2 200 < content-length: 5 < content-type: text/plain;charset=UTF-8 < hello* Connection #0 to host localhost left intact ``` **Configuration** Using defaults. **Environment (please complete the following information):** - Output of `uname -a` or `ver`: Microsoft Windows [Version 6.1.7601] - Output of `java -version`: java 11.0.5 2019-10-15 LTS - Quarkus version or git rev: 1.2.0.Final
d1aeb430578a546fc273e37cf54b4198e40425ac
23aa49289510a6b245cef060cd751be5f9f1086a
https://github.com/quarkusio/quarkus/compare/d1aeb430578a546fc273e37cf54b4198e40425ac...23aa49289510a6b245cef060cd751be5f9f1086a
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxInputStream.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxInputStream.java index 232a3aa9964..92f1bceb565 100644 --- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxInputStream.java +++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxInputStream.java @@ -200,7 +200,7 @@ protected ByteBuf readBlocking() throws IOException { if (input1 == null) { request.fetch(1); } - } else { + } else if (!eof) { request.fetch(1); }
['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxInputStream.java']
{'.java': 1}
1
1
0
0
1
7,308,614
1,413,887
188,613
1,970
61
12
2
1
4,535
637
1,262
128
6
4
"2020-02-18T02:31:29"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,141
quarkusio/quarkus/7176/7174
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/7174
https://github.com/quarkusio/quarkus/pull/7176
https://github.com/quarkusio/quarkus/pull/7176
1
fixes
SchedulerProcessor method collectScheduledMethods recursion check
**Describe the bug** ``` DotName superClassName = beanClass.superName(); if (superClassName != null) { ClassInfo superClass = index.getClassByName(superClassName); if (superClassName != null) { collectScheduledMethods(config, index, annotationStore, bean, superClass, scheduledBusinessMethods, validationContext); } } ``` https://github.com/quarkusio/quarkus/blob/801dcb28295721fd65f9d30d1f0ad340dd6b5dd7/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java#L191 **Expected behavior** ``` ClassInfo superClass = index.getClassByName(superClassName); if (superClass != null) { collectScheduledMethods(config, index, annotationStore, bean, superClass, scheduledBusinessMethods, validationContext); } ``` **Actual behavior** NPE
801dcb28295721fd65f9d30d1f0ad340dd6b5dd7
02e224e81e18f9c17f5139da2888981680f2efe9
https://github.com/quarkusio/quarkus/compare/801dcb28295721fd65f9d30d1f0ad340dd6b5dd7...02e224e81e18f9c17f5139da2888981680f2efe9
diff --git a/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java b/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java index b0bbb7efc4c..6b8c3fd30d6 100644 --- a/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java +++ b/extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java @@ -188,7 +188,7 @@ private void collectScheduledMethods(SchedulerConfig config, IndexView index, An DotName superClassName = beanClass.superName(); if (superClassName != null) { ClassInfo superClass = index.getClassByName(superClassName); - if (superClassName != null) { + if (superClass != null) { collectScheduledMethods(config, index, annotationStore, bean, superClass, scheduledBusinessMethods, validationContext); }
['extensions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/SchedulerProcessor.java']
{'.java': 1}
1
1
0
0
1
7,179,410
1,386,503
185,528
1,960
81
18
2
1
983
57
198
28
1
2
"2020-02-12T22:04: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
3,142
quarkusio/quarkus/7112/7081
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/7081
https://github.com/quarkusio/quarkus/pull/7112
https://github.com/quarkusio/quarkus/pull/7112
1
fixes
Hibernate ORM logging ServiceConfigurationError errors with full stacktraces
**Describe the bug** When Hibernate ORM's is scanning for services such as Integrator, when running on JDK11 (and not on JDK8) the strategy it uses to search for services is generating background noise in the form of verbose stacktraces being logged since Quarkus changed the classloader strategy. These errors are harmless as it's still able to load the correct class definition as it goes on trying different classloaders; however I want to fix this as it's both noisy and inefficient. One can only notice such errors when actually having an Integrator among the dependencies on classpath, such as Hibernate Search or Envers: ``` 2020-02-07 16:46:27,330 WARN [org.hib.boo.reg.cla.int.AggregatedServiceLoader] (main) HHH000505: Ignoring ServiceConfigurationError caught while trying to instantiate service 'interface org.hibernate.boot.registry.selector.StrategyRegistrationProvider'.: java.util.ServiceConfigurationError: org.hibernate.boot.registry.selector.StrategyRegistrationProvider: org.hibernate.envers.boot.internal.ModifiedColumnNamingStrategyRegistrationProvider 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$ProviderSpliterator.tryAdvance(ServiceLoader.java:1483) at java.base/java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) at org.hibernate.boot.registry.classloading.internal.AggregatedServiceLoader$ClassPathAndModulePathAggregatedServiceLoader.hasNextIgnoringServiceConfigurationError(AggregatedServiceLoader.java:241) at org.hibernate.boot.registry.classloading.internal.AggregatedServiceLoader$ClassPathAndModulePathAggregatedServiceLoader.loadAll(AggregatedServiceLoader.java:219) at org.hibernate.boot.registry.classloading.internal.AggregatedServiceLoader$ClassPathAndModulePathAggregatedServiceLoader.getAll(AggregatedServiceLoader.java:187) at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:251) at org.hibernate.boot.registry.selector.internal.StrategySelectorBuilder.buildSelector(StrategySelectorBuilder.java:173) at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:232) at org.hibernate.boot.registry.StandardServiceRegistryBuilder.<init>(StandardServiceRegistryBuilder.java:87) at io.quarkus.hibernate.orm.runtime.recording.RecordableBootstrap.<init>(RecordableBootstrap.java:73) ``` **Additional context** The fix is simple but will need an upgrade to Hibernate ORM 5.4.11
72e8580cffa8b73bb408f7c1fdfc14d394e70418
e4560b5b672f38024eb3fa11e583407b0f31aa0f
https://github.com/quarkusio/quarkus/compare/72e8580cffa8b73bb408f7c1fdfc14d394e70418...e4560b5b672f38024eb3fa11e583407b0f31aa0f
diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/RecordableBootstrap.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/RecordableBootstrap.java index f6313afd48b..cda00cc21ff 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/RecordableBootstrap.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/RecordableBootstrap.java @@ -67,12 +67,19 @@ public final class RecordableBootstrap extends StandardServiceRegistryBuilder { private final LoadedConfig aggregatedCfgXml; public RecordableBootstrap(BootstrapServiceRegistry bootstrapServiceRegistry) { - this(bootstrapServiceRegistry, LoadedConfig.baseline()); + this(bootstrapServiceRegistry, initialProperties(), LoadedConfig.baseline()); } - public RecordableBootstrap(BootstrapServiceRegistry bootstrapServiceRegistry, LoadedConfig loadedConfigBaseline) { - this.settings = new HashMap(); - this.settings.putAll(QuarkusEnvironment.getInitialProperties()); + private static Map initialProperties() { + HashMap map = new HashMap(); + map.putAll(QuarkusEnvironment.getInitialProperties()); + return map; + } + + private RecordableBootstrap(BootstrapServiceRegistry bootstrapServiceRegistry, Map properties, + LoadedConfig loadedConfigBaseline) { + super(bootstrapServiceRegistry, properties, loadedConfigBaseline); + this.settings = properties; this.bootstrapServiceRegistry = bootstrapServiceRegistry; this.configLoader = new ConfigLoader(bootstrapServiceRegistry); this.aggregatedCfgXml = loadedConfigBaseline;
['extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/RecordableBootstrap.java']
{'.java': 1}
1
1
0
0
1
7,095,327
1,370,609
183,589
1,932
827
145
15
1
2,837
169
571
29
0
1
"2020-02-10T09:16:57"
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,143
quarkusio/quarkus/7078/7077
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/7077
https://github.com/quarkusio/quarkus/pull/7078
https://github.com/quarkusio/quarkus/pull/7078
1
fixes
Gradle buildNative is broken
**Describe the bug** In a Gradle project, when you run `./gradle buildNative --stacktrace` the following error appears: ``` Caused by: java.lang.RuntimeException: Failed to resolve initial application dependencies at io.quarkus.bootstrap.BootstrapAppModelFactory.createAppModelForJar(BootstrapAppModelFactory.java:429) at io.quarkus.bootstrap.BootstrapAppModelFactory.resolveAppModel(BootstrapAppModelFactory.java:240) at io.quarkus.bootstrap.app.QuarkusBootstrap.bootstrap(QuarkusBootstrap.java:134) at io.quarkus.gradle.tasks.QuarkusNative.buildNative(QuarkusNative.java:384) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:721) at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:688) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:539) 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:524) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:507) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:109) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:258) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:247) 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:63) at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:35) at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49) at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34) at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43) 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:34) at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44) at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54) at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38) at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:153) at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:67) at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:41) at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49) at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44) at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33) 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:92) at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85) at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55) at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39) at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76) 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:94) at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49) at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79) at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53) at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78) at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34) at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39) at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40) at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28) at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:174) ... 125 more Caused by: java.io.IOException: Failed to located META-INF/maven/<groupId>/<artifactId>/pom.properties in /tmp/my-gradle/build/libs/my-gradle-1.0-SNAPSHOT.jar at io.quarkus.bootstrap.resolver.maven.workspace.ModelUtils.resolveAppArtifact(ModelUtils.java:114) at io.quarkus.bootstrap.BootstrapAppModelFactory.createAppModelForJar(BootstrapAppModelFactory.java:362) ... 190 more ``` **Expected behavior** No error **Actual behavior** Errors **To Reproduce** Steps to reproduce the behavior: 1. ``` mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create \\ -DprojectGroupId=org.acme \\ -DprojectArtifactId=my-gradle \\ -DclassName="org.acme.quickstart.GreetingResource" \\ -Dpath="/hello" -DplatformVersion=999-SNAPSHOT -DbuildTool=gradle ``` 2. `./gradlew buildNative --stacktrace` **Environment (please complete the following information):** - Output of `uname -a` or `ver`: Fedora 31 - Output of `java -version`: Java 8 - GraalVM version (if different from Java): 19.3.1 - Quarkus version or git rev: 1.3.0.Alpha1
44a9e2334a7570b082434781d577f7dec3103f15
b4e5483c481ef5f777240264e58a922301652ced
https://github.com/quarkusio/quarkus/compare/44a9e2334a7570b082434781d577f7dec3103f15...b4e5483c481ef5f777240264e58a922301652ced
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java index a64b05eed21..58bbd3c6c28 100644 --- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java +++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java @@ -212,6 +212,7 @@ public boolean isEnableJni() { } /** + * @param enableJni true to enable JNI * @deprecated JNI is always enabled starting from GraalVM 19.3.1. */ @Option(description = "Enable jni (deprecated)", option = "enable-jni") @@ -379,8 +380,7 @@ public void buildNative() { .setLocalProjectDiscovery(false) .setBuildSystemProperties(realProperties) .setIsolateDeployment(true) - //.setConfigDir(extension().outputConfigDirectory().toPath()) - //.setTargetDirectory(extension().outputDirectory().toPath()) + .setAppArtifact(appArtifact) .build().bootstrap()) { appCreationContext.createAugmentor().createProductionApplication();
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java']
{'.java': 1}
1
1
0
0
1
7,092,245
1,369,963
183,493
1,929
247
47
4
1
8,681
249
1,774
103
0
2
"2020-02-07T15:23:12"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,144
quarkusio/quarkus/7001/6934
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6934
https://github.com/quarkusio/quarkus/pull/7001
https://github.com/quarkusio/quarkus/pull/7001
1
fixes
Jandex WARNING using standard JAX-RS classes
**Describe the bug** This is not a real bug but an annoying WARNING if you use classes like javax.ws.rs.core.StreamingOutput: ``` @GET @Path("other") @Produces(MediaType.TEXT_HTML) public StreamingOutput renderGWTHostingPage() { return output -> output.write("hello".getBytes(Charset.defaultCharset())); } ``` **Expected behavior** No WARNING **Actual behavior** This is printed on the console at startup: ``` [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: - javax.ws.rs.core.StreamingOutput 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** Steps to reproduce the behavior: 1. mvnw compile quarkus:dev **Environment (please complete the following information):** - Darwin WMICTLM1P.local 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64 - openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-20191009173705.graal.jdk8u-src-tar-gz-b07) OpenJDK 64-Bit GraalVM CE 19.3.0 (build 25.232-b07-jvmci-19.3-b05, mixed mode) - <quarkus.platform.version>1.2.0.Final</quarkus.platform.version> [quarkus-120-issues.zip](https://github.com/quarkusio/quarkus/files/4142463/quarkus-120-issues.zip) **Additional context** Please use the reproducer project.
c4342f25a6ace267f602d2384920147c8dc3b370
bf9e42c34a6ae231349ae751d410181b0ddaaa6e
https://github.com/quarkusio/quarkus/compare/c4342f25a6ace267f602d2384920147c8dc3b370...bf9e42c34a6ae231349ae751d410181b0ddaaa6e
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 6f491912bce..c4f1a454b00 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 @@ -74,6 +74,7 @@ private boolean isInIgnoredPackage(String name) { // JAX-RS DotName.createSimple("javax.ws.rs.core.Response"), DotName.createSimple("javax.ws.rs.container.AsyncResponse"), + DotName.createSimple("javax.ws.rs.core.StreamingOutput"), // 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,044,421
1,361,147
182,415
1,928
70
14
1
1
1,596
159
438
42
1
2
"2020-02-05T09:46: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,145
quarkusio/quarkus/6981/6738
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6738
https://github.com/quarkusio/quarkus/pull/6981
https://github.com/quarkusio/quarkus/pull/6981
1
fixes
Improve reporting in case JSON cannot be handled due to missing JSONB
I have a JAX-RS method like this: ``` @POST @Consumes(MediaType.APPLICATION_JSON) public Response newMeasurement(Measurement measurement) { return Response.ok().build(); } ``` `Measurement` should be unmarshalled from the incoming JSON payload. I had forgotten to add the `quarkus-resteasy-jsonb` dependency, though. This resulted in the following, IMO rather confusing response: ``` HTTP/1.1 415 Unsupported Media Type Content-Length: 0 ``` I'd expect a more meaningful error, perhaps even exception and HTTP status 500 stating, that the request cannot be handled due to lacking unmarshalling capabilities.
85b47c52b20f09b3a2a25490efca8314cebef8bd
a561cd5f254f17728d9c8b6ac1e60e6db3a967d4
https://github.com/quarkusio/quarkus/compare/85b47c52b20f09b3a2a25490efca8314cebef8bd...a561cd5f254f17728d9c8b6ac1e60e6db3a967d4
diff --git a/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java b/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java index b10d7608c23..b052c151d0c 100644 --- a/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java +++ b/extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java @@ -22,11 +22,11 @@ import org.jboss.jandex.AnnotationInstance; import org.jboss.jandex.AnnotationTarget; import org.jboss.jandex.AnnotationValue; +import org.jboss.jandex.AnnotationValue.Kind; import org.jboss.jandex.DotName; import org.jboss.jandex.IndexView; import org.jboss.jandex.MethodInfo; import org.jboss.logging.Logger; -import org.jboss.resteasy.annotations.SseElementType; import org.jboss.resteasy.core.MediaTypeMap; import org.jboss.resteasy.plugins.interceptors.AcceptEncodingGZIPFilter; import org.jboss.resteasy.plugins.interceptors.GZIPDecodingInterceptor; @@ -56,8 +56,6 @@ public class ResteasyCommonProcessor { private static final Logger LOGGER = Logger.getLogger(ResteasyCommonProcessor.class.getName()); - private static final DotName SSE_ELEMENT_TYPE = DotName.createSimple(SseElementType.class.getName()); - private static final ProviderDiscoverer[] PROVIDER_DISCOVERERS = { new ProviderDiscoverer(ResteasyDotNames.GET, false, true), new ProviderDiscoverer(ResteasyDotNames.HEAD, false, false), @@ -152,7 +150,8 @@ JaxrsProvidersToRegisterBuildItem setupProviders(BuildProducer<ReflectiveClassBu if (!capabilities.isCapabilityPresent(Capabilities.RESTEASY_JSON_EXTENSION)) { boolean needJsonSupport = restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.CONSUMES) - || restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.PRODUCES); + || restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.PRODUCES) + || restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.RESTEASY_SSE_ELEMENT_TYPE); if (needJsonSupport) { LOGGER.warn( "Quarkus detected the need of REST JSON support but you have not provided the necessary JSON " + @@ -195,7 +194,12 @@ private boolean restJsonSupportNeeded(CombinedIndexBuildItem indexBuildItem, Dot continue; } - final List<String> mediaTypes = Arrays.asList(annotationValue.asStringArray()); + List<String> mediaTypes = Collections.emptyList(); + if (annotationValue.kind() == Kind.ARRAY) { + mediaTypes = Arrays.asList(annotationValue.asStringArray()); + } else if (annotationValue.kind() == Kind.STRING) { + mediaTypes = Collections.singletonList(annotationValue.asString()); + } return mediaTypes.contains(MediaType.APPLICATION_JSON) || mediaTypes.contains(MediaType.APPLICATION_JSON_PATCH_JSON); } @@ -344,7 +348,8 @@ private static Collection<String> collectInferredProviders(final MediaType media if (matches(MediaType.SERVER_SENT_EVENTS_TYPE, mediaType)) { final Set<String> additionalProvidersToRegister = new HashSet<>(); // first check for @SseElementType - final AnnotationInstance sseElementTypeAnnInst = targetMethod.annotation(SSE_ELEMENT_TYPE); + final AnnotationInstance sseElementTypeAnnInst = targetMethod + .annotation(ResteasyDotNames.RESTEASY_SSE_ELEMENT_TYPE); String elementType = null; if (sseElementTypeAnnInst != null) { elementType = sseElementTypeAnnInst.value().asString(); 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 6f491912bce..021cb3cce0d 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 @@ -44,6 +44,8 @@ public final class ResteasyDotNames { .createSimple(org.jboss.resteasy.annotations.jaxrs.HeaderParam.class.getName()); public static final DotName RESTEASY_MATRIX_PARAM = DotName .createSimple(org.jboss.resteasy.annotations.jaxrs.MatrixParam.class.getName()); + public static final DotName RESTEASY_SSE_ELEMENT_TYPE = DotName + .createSimple(org.jboss.resteasy.annotations.SseElementType.class.getName()); public static final IgnoreForReflectionPredicate IGNORE_FOR_REFLECTION_PREDICATE = new IgnoreForReflectionPredicate();
['extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java', 'extensions/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyDotNames.java']
{'.java': 2}
2
2
0
0
2
7,038,604
1,359,999
182,243
1,928
1,370
259
19
2
635
80
139
20
0
2
"2020-02-03T23:44:17"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,146
quarkusio/quarkus/6929/6725
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6725
https://github.com/quarkusio/quarkus/pull/6929
https://github.com/quarkusio/quarkus/pull/6929
1
fixes
SecDispatcherException: java.io.FileNotFoundException: $HOME/.m2/settings-security.xml
**Describe the bug** when running test for camel-quarkus on on GitHub actions I see some messages like: org.sonatype.plexus.components.sec.dispatcher.SecDispatcherException: java.io.FileNotFoundException: /home/runner/.m2/settings-security.xml (No such file or directory) Which seems to have not effect but does not look very nice in a build output. **Expected behavior** If the exception is harmless, it should be silenced **Actual behavior** The exception is appears in the build log **Full build log** https://gist.githubusercontent.com/lburgazzoli/f58b0fced2f9caec1b97dcf4f9401c33/raw/57f127cdbb0aeac2fd92b585ab92e28dd999099a/action.txt
734c54680af996a46fd8481084b1d77a245284db
606de18b110460aedd803cb186e40092cc766a5f
https://github.com/quarkusio/quarkus/compare/734c54680af996a46fd8481084b1d77a245284db...606de18b110460aedd803cb186e40092cc766a5f
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java index 99acb4e5158..61c1aee63de 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java @@ -201,9 +201,10 @@ public static DefaultRepositorySystemSession newSession(RepositorySystem system, decrypt.setProxies(settings.getProxies()); decrypt.setServers(settings.getServers()); final SettingsDecryptionResult decrypted = new SettingsDecrypterImpl().decrypt(decrypt); - if(decrypted.getProblems().isEmpty()) { + if(!decrypted.getProblems().isEmpty() && log.isDebugEnabled()) { + // this is how maven handles these for(SettingsProblem p : decrypted.getProblems()) { - log.warn("Problem decrypting maven settings: " + p); + log.debug(p.getMessage(), p.getException()); } } diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java index 19de65d780b..2d4270ff152 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java @@ -3,7 +3,6 @@ import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; - import org.sonatype.plexus.components.cipher.DefaultPlexusCipher; import org.sonatype.plexus.components.cipher.PlexusCipher; import org.sonatype.plexus.components.cipher.PlexusCipherException; @@ -106,7 +105,6 @@ public String decrypt( String str ) } catch ( Exception e ) { - e.printStackTrace(); throw new SecDispatcherException(e); } }
['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/SecDispatcherImpl.java']
{'.java': 2}
2
2
0
0
2
7,007,332
1,354,055
181,432
1,921
337
67
7
2
672
66
169
19
1
0
"2020-01-31T22:30:53"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,147
quarkusio/quarkus/6894/6881
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6881
https://github.com/quarkusio/quarkus/pull/6894
https://github.com/quarkusio/quarkus/pull/6894
1
fixes
Compilation error on first run in dev mode
**Describe the bug** After updating to Quarkus 1.2.0.Final sometimes me and my teammate get a compilation error when we run `mvn quarkus:dev` > [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /some/path/SomeService.java:[107,34] multi-catch statements are not supported in -source 6 (use -source 7 or higher to enable multi-catch statements) When we repeat the same command it compiles and starts successfully. Never occurred before on version 1.1.1.Final **Expected behavior** Shouldn't get the compile error on executing `mvn quarkus:dev` **Environment:** - Output of `uname -a`: `Linux denis 5.3.0-29-generic #31-Ubuntu SMP Fri Jan 17 17:27:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux` - Output of `java -version`: ``` openjdk version "11.0.5" 2019-10-15 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode) ``` - Output of `mvn -version`: ``` Apache Maven 3.6.1 Maven home: /usr/share/maven Java version: 11.0.5, vendor: AdoptOpenJDK, runtime: /home/denis/.sdkman/candidates/java/11.0.5.hs-adpt Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.3.0-29-generic", arch: "amd64", family: "unix" ``` - Quarkus version or git rev: `1.2.0.Final` pom.xml: ``` <?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>dummy.group</groupId> <artifactId>some-service</artifactId> <version>1.0.0-SNAPSHOT</version> <properties> <compiler-plugin.version>3.8.1</compiler-plugin.version> <maven.compiler.parameters>true</maven.compiler.parameters> <java.version>11</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <quarkus-plugin.version>1.2.0.Final</quarkus-plugin.version> <quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id> <quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id> <quarkus.platform.version>1.2.0.Final</quarkus.platform.version> <surefire-plugin.version>2.22.1</surefire-plugin.version> <lombok.version>1.18.10</lombok.version> <maxmind.geoip2.version>2.13.0</maxmind.geoip2.version> <amazon.sdk.version>2.10.48</amazon.sdk.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>${quarkus.platform.group-id}</groupId> <artifactId>${quarkus.platform.artifact-id}</artifactId> <version>${quarkus.platform.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-resteasy-jackson</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-health</artifactId> </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-smallrye-metrics</artifactId> </dependency> <dependency> <groupId>com.maxmind.geoip2</groupId> <artifactId>geoip2</artifactId> <version>${maxmind.geoip2.version}</version> </dependency> <dependency> <groupId>software.amazon.awssdk</groupId> <artifactId>s3</artifactId> <version>${amazon.sdk.version}</version> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <scope>provided</scope> </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>org.mockito</groupId> <artifactId>mockito-core</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>io.quarkus</groupId> <artifactId>quarkus-maven-plugin</artifactId> <version>${quarkus-plugin.version}</version> <executions> <execution> <goals> <goal>build</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>${compiler-plugin.version}</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceEncoding}</encoding> </configuration> </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> <artifactId>maven-failsafe-plugin</artifactId> <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> <properties> <quarkus.package.type>native</quarkus.package.type> </properties> </profile> </profiles> </project> ```
0755dfe4f06bbba51d5838308dae16877b3d1b13
3d11cbd00e448472417e1e22be5b3a9c002dd35d
https://github.com/quarkusio/quarkus/compare/0755dfe4f06bbba51d5838308dae16877b3d1b13...3d11cbd00e448472417e1e22be5b3a9c002dd35d
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 543f922cc06..ceef1c3df02 100644 --- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java +++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java @@ -266,13 +266,17 @@ public void execute() throws MojoFailureException, MojoExecutionException { if (plugin == null) { throw new MojoExecutionException("Failed to locate " + key + " among the project plugins"); } + Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); + if (configuration == null) { + configuration = MojoExecutor.configuration(); + } MojoExecutor.executeMojo( MojoExecutor.plugin( MojoExecutor.groupId(ORG_APACHE_MAVEN_PLUGINS), MojoExecutor.artifactId(MAVEN_COMPILER_PLUGIN), MojoExecutor.version(plugin.getVersion())), MojoExecutor.goal("compile"), - MojoExecutor.configuration(), + configuration, MojoExecutor.executionEnvironment( project, session,
['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java']
{'.java': 1}
1
1
0
0
1
6,970,882
1,347,238
180,542
1,922
280
42
6
1
6,163
324
1,854
192
4
3
"2020-01-30T16:14:30"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,148
quarkusio/quarkus/6815/6501
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6501
https://github.com/quarkusio/quarkus/pull/6815
https://github.com/quarkusio/quarkus/pull/6815
1
fix
Data source Connection Issue After Updating Quarkus (0.25.0 to 1.1.1.Final)
**Describe the bug** After updating Quarkus to 1.1.1.Final the bootstrap process fail with java.sql.SQLException saing Access denied. But it works without any issue with Quarkus 0.25.0 without any configuration change. Apparently quarkus doesn't detect the environment variables. **Expected behavior** It should create the data-source connection successfully. **Actual behavior** I am using the quarkus native image in a docker container which connects to a mariadb database. But when initializing it fails with ` java.sql.SQLException: Access denied for user 'root'@'172.17.42.1' (using password: NO) ` in Mariadb log I can see an authentication error `2020-01-10 13:17:28 69 [Warning] Access denied for user 'root'@'172.17.42.1' (using password: NO)` Stacktrace ``` 2020-01-10 18:47:27,158 host NativeImageGeneratorRunner[6486] INFO [io.quarkus] (main) myapp stopped in 0.014s 2020-01-10 18:47:28,548 host NativeImageGeneratorRunner[32069] INFO [org.fly.cor.int.lic.VersionPrinter] (main) Flyway Community Edition 6.1.0 by Redgate 2020-01-10 18:47:28,549 host NativeImageGeneratorRunner[32069] WARN [io.agr.pool] (Agroal_16893719241) Datasource '<default>': Could not connect to address=(host=service1)(port=13306)(type=master) : Access denied for user 'root'@'172.17.42.1' (using password: NO) 2020-01-10 18:47:28,550 host NativeImageGeneratorRunner[32069] WARN [io.agr.pool] (Agroal_16893719241) Datasource '<default>': Could not connect to address=(host=service1)(port=13306)(type=master) : Access denied for user 'root'@'172.17.42.1' (using password: NO) 2020-01-10 18:47:28,550 host NativeImageGeneratorRunner[32069] ERROR [io.qua.application] (main) Failed to start application: org.flywaydb.core.internal.exception.FlywaySqlException: Unable to obtain connection from database: Could not connect to address=(host=service1)(port=13306)(type=master) : Access denied for user 'root'@'172.17.42.1' (using password: NO) ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- SQL State : 28000 Error Code : 1045 Message : Could not connect to address=(host=service1)(port=13306)(type=master) : Access denied for user 'root'@'172.17.42.1' (using password: NO) at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:60) at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:80) at org.flywaydb.core.Flyway.execute(Flyway.java:437) at org.flywaydb.core.Flyway.migrate(Flyway.java:147) at io.quarkus.flyway.runtime.FlywayRecorder.migrate(FlywayRecorder.java:54) at io.quarkus.flyway.runtime.FlywayRecorder.doStartActions(FlywayRecorder.java:35) at io.quarkus.deployment.steps.FlywayProcessor$configureRuntimeProperties61.deploy_0(FlywayProcessor$configureRuntimeProperties61.zig:79) at io.quarkus.deployment.steps.FlywayProcessor$configureRuntimeProperties61.deploy(FlywayProcessor$configureRuntimeProperties61.zig:98) at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:234) at io.quarkus.runtime.Application.start(Application.java:87) at io.quarkus.runtime.Application.run(Application.java:210) at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:41) Caused by: java.sql.SQLInvalidAuthorizationSpecException: Could not connect to address=(host=service1)(port=13306)(type=master) : Access denied for user 'root'@'172.17.42.1' (using password: NO) at org.mariadb.jdbc.internal.util.exceptions.ExceptionMapper.get(ExceptionMapper.java:239) at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1241) at org.mariadb.jdbc.internal.util.Utils.retrieveProxy(Utils.java:610) at org.mariadb.jdbc.MariaDbConnection.newConnection(MariaDbConnection.java:142) at org.mariadb.jdbc.Driver.connect(Driver.java:86) at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:200) at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:390) at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:372) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:65) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:460) at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193) Caused by: java.sql.SQLException: Access denied for user 'root'@'172.17.42.1' (using password: NO) at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.authenticationHandler(AbstractConnectProtocol.java:729) at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.createConnection(AbstractConnectProtocol.java:507) at org.mariadb.jdbc.internal.protocol.AbstractConnectProtocol.connectWithoutProxy(AbstractConnectProtocol.java:1236) ... 13 more ``` This only happens with Quarkys 1.1.1.Final. I have configured Mariadb to allow remote connect. **To Reproduce** Steps to reproduce the behavior: 1. Create a Quarkus application which uses a datasource. 2. Provide the given environment variables when creating the docker container from the generated native image. **Configuration** ```properties quarkus.datasource.url = jdbc:mariadb://service1:13306 quarkus.datasource.driver = org.mariadb.jdbc.Driver quarkus.datasource.username = root quarkus.datasource.password = mypass quarkus.hibernate-orm.database.default-schema=timepickle ``` ```Bash #!/bin/bash docker run --name container1 \\ --add-host=service1:172.17.42.1 \\ -e QUARKUS_PROFILE=prod \\ -e QUARKUS_DATASOURCE_PASSWORD='mypass' \\ -e QUARKUS_DATASOURCE_URL='jdbc:mariadb://service1:13306' -itd -p 18080:8080 myapp:1.1 ``` **Environment (please complete the following information):** - Output of `uname -a` or `ver`: 4.15.0-1065-oem - Output of `java -version`: java version "1.8.0_191" Java(TM) SE Runtime Environment (build 1.8.0_191-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode) - GraalVM version (if different from Java): openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-20191008104205.buildslave.jdk8u-src-tar--b07) OpenJDK 64-Bit GraalVM CE 19.2.1 (build 25.232-b07-jvmci-19.2-b03, mixed mode) - Quarkus version or git rev: 1.1.1.Final
d0029637ffbcf186456d47b90e95fe93259c099c
613533e633501bd4fc66fda2dfffd11a81abaa93
https://github.com/quarkusio/quarkus/compare/d0029637ffbcf186456d47b90e95fe93259c099c...613533e633501bd4fc66fda2dfffd11a81abaa93
diff --git a/extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/MariaDBJDBCReflections.java b/extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/MariaDBJDBCReflections.java index 2b2dd778035..4e9d5fdea07 100644 --- a/extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/MariaDBJDBCReflections.java +++ b/extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/MariaDBJDBCReflections.java @@ -16,7 +16,7 @@ void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) { reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, driverName)); //MariaDB's connection process requires reflective read to all fields of Options: - reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, "org.mariadb.jdbc.internal.util.Options")); + reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, "org.mariadb.jdbc.util.Options")); } @BuildStep
['extensions/jdbc/jdbc-mariadb/deployment/src/main/java/io/quarkus/jdbc/mariadb/deployment/MariaDBJDBCReflections.java']
{'.java': 1}
1
1
0
0
1
6,925,370
1,338,698
179,563
1,920
226
49
2
1
6,692
476
1,764
103
0
3
"2020-01-27T22:20:58"
12,047
Java
{'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109}
Apache License 2.0
3,149
quarkusio/quarkus/6734/6561
quarkusio
quarkus
https://github.com/quarkusio/quarkus/issues/6561
https://github.com/quarkusio/quarkus/pull/6734
https://github.com/quarkusio/quarkus/pull/6734
1
fixes
QuarkusDev does not start with Kotlin subprojects
To see the full disucssion on this subject, please refer to this chat: https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Quarkus.20Dev.20not.20working.20with.20Kotlin.20and.20Subprojects **Describe the bug** I have a Quarkus gradle project with two modules `project-a` and `project-a-models`. `project-a` is a quarkus project having a dependency on the plain Kotlin `project-a-models` module. I can compile this configuration (see sample project linked below). However, when I run `gradlew quarkusDev`, it fails searching a Java path. This is error fixed with the PR #6551. However, when I now run `gradlew quarkusDev`, the server never starts up but hangs after starting the debugger port. I ran jstack on gradlew: https://gist.github.com/andreas-eberle/28c3d1438292ab636f6c374988f95f22 And jstack on the built and executed project-a-1.0.0-SNAPSHOT-dev.jar: https://gist.github.com/andreas-eberle/7393cf44da1952d622c0d6383ea09a65 The last part of the output of `gradlew quarkusDev --stacktrace --debug` is here: https://gist.github.com/andreas-eberle/6c074e8f10c2a7514b323430b9f504ed **Expected behavior** Server starts up without an exception. **Actual behavior** Dev server hangs with PR #6551 or crashes with quarkus 1.1.1-Final **To Reproduce** Steps to reproduce the behavior: 1. Download the reproducer project [quarkus-experiments.zip](https://github.com/quarkusio/quarkus/files/4064951/quarkus-experiments.zip) 2. Install quarkus locally from PR https://github.com/quarkusio/quarkus/pull/6551/files 2. run `./gradlew :project-a:quarkusDev --stacktrace --info` 3. the server won't start up **Platform** - Windows 10 x64 - Oracle JDK 64bit Version 1.8.0_231
91784b105eb7476494d562450d45353e702f7ce6
b289d2655ec555f9239cb215a58e04ce77193aba
https://github.com/quarkusio/quarkus/compare/91784b105eb7476494d562450d45353e702f7ce6...b289d2655ec555f9239cb215a58e04ce77193aba
diff --git a/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java b/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java index 6d2b7199949..e491947f887 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java +++ b/core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java @@ -12,8 +12,6 @@ import java.util.Map; import java.util.Set; -import io.quarkus.bootstrap.model.AppModel; - /** * Object that is used to pass context data from the plugin doing the invocation * into the dev mode process using java serialization. @@ -45,8 +43,6 @@ public class DevModeContext implements Serializable { private List<String> compilerPluginArtifacts; private List<String> compilerPluginsOptions; - private AppModel appModel; - public boolean isLocalProjectDiscovery() { return localProjectDiscovery; } @@ -173,15 +169,6 @@ public DevModeContext setProjectDir(File projectDir) { return this; } - public AppModel getAppModel() { - return appModel; - } - - public DevModeContext setAppModel(AppModel appModel) { - this.appModel = appModel; - return this; - } - public static class ModuleInfo implements Serializable { private final String name; diff --git a/core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java b/core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java index 756bbf9ca52..56e0351d19f 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java +++ b/core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java @@ -154,11 +154,16 @@ public void stop() { } } QuarkusConfigFactory.setConfig(null); - final ConfigProviderResolver cpr = ConfigProviderResolver.instance(); + + ClassLoader old = Thread.currentThread().getContextClassLoader(); + Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { + final ConfigProviderResolver cpr = ConfigProviderResolver.instance(); cpr.releaseConfig(cpr.getConfig()); } catch (Throwable ignored) { // just means no config was installed, which is fine + } finally { + Thread.currentThread().setContextClassLoader(old); } runner = null; } @@ -242,7 +247,7 @@ public void run() { synchronized (DevModeMain.class) { if (runner != null) { try { - runner.close(); + stop(); } catch (Exception e) { e.printStackTrace(); } diff --git a/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java b/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java index 5e4e5672e86..fa77d6a2c38 100644 --- a/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java +++ b/core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java @@ -171,7 +171,11 @@ boolean checkForChangedClasses() throws IOException { for (String sourcePath : module.getSourcePaths()) { final Set<File> changedSourceFiles; - try (final Stream<Path> sourcesStream = Files.walk(Paths.get(sourcePath))) { + Path start = Paths.get(sourcePath); + if (!Files.exists(start)) { + continue; + } + try (final Stream<Path> sourcesStream = Files.walk(start)) { changedSourceFiles = sourcesStream .parallel() .filter(p -> matchingHandledExtension(p).isPresent() @@ -218,6 +222,9 @@ private boolean checkForClassFilesChangesInModule(DevModeContext.ModuleInfo modu try { for (String folder : module.getClassesPath().split(File.pathSeparator)) { final Path moduleClassesPath = Paths.get(folder); + if (!Files.exists(moduleClassesPath)) { + continue; + } try (final Stream<Path> classesStream = Files.walk(moduleClassesPath)) { final Set<Path> classFilePaths = classesStream .parallel() 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 ed1c105125a..162cfe2ce88 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 @@ -17,6 +17,8 @@ import java.net.URI; import java.net.URL; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -28,6 +30,7 @@ import java.util.concurrent.Executors; import java.util.jar.Attributes; import java.util.jar.Manifest; +import java.util.stream.Stream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; @@ -39,6 +42,7 @@ import org.gradle.api.artifacts.DependencySet; import org.gradle.api.artifacts.ProjectDependency; import org.gradle.api.artifacts.ResolvedDependency; +import org.gradle.api.file.FileCollection; import org.gradle.api.plugins.Convention; import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPluginConvention; @@ -51,6 +55,7 @@ import org.gradle.api.tasks.compile.JavaCompile; import org.gradle.api.tasks.options.Option; +import io.quarkus.bootstrap.BootstrapConstants; import io.quarkus.bootstrap.model.AppArtifact; import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.model.AppDependency; @@ -293,8 +298,45 @@ public void startDev() { sourcePaths.add(sourceDir.getAbsolutePath()); } - String classesPaths = mainSourceSet.getOutput().getClassesDirs().getAsPath(); - String resourcePaths = mainSourceSet.getResources().getSourceDirectories().getAsPath(); + FileCollection classesDirs = mainSourceSet.getOutput().getClassesDirs(); + final String classesPaths; + Set<File> classDirFiles = classesDirs.getFiles(); + if (classDirFiles.size() == 1) { + classesPaths = classesDirs.getAsPath(); + } else { + //there does not seem to be any sane way of dealing with multiple output dirs, as there does not seem + //to be a way to map them. We will need to address this at some point, but for now we just stick them + //all in a temp dir + + Path path = getTemporaryDir().toPath(); + classesPaths = path.toAbsolutePath().toString(); + for (File c : classDirFiles) { + Path cd = c.toPath(); + if (!Files.exists(cd)) { + continue; + } + try (Stream<Path> stream = Files.walk(cd)) { + stream.forEach(s -> { + try { + if (Files.isDirectory(s)) { + return; + } + final Path file = cd.relativize(path); + final Path targetPath = path.resolve(file.toString()); + Files.createDirectories(targetPath.getParent()); + byte[] data = Files.readAllBytes(s); + Files.write(targetPath, data); + } catch (IOException e) { + throw new RuntimeException(e); + } + + }); + } + } + + } + + String resourcePaths = mainSourceSet.getResources().getSourceDirectories().getSingleFile().getAbsolutePath(); //TODO: multiple resource directories DevModeContext.ModuleInfo wsModuleInfo = new DevModeContext.ModuleInfo( dependencyProject.getName(), @@ -351,6 +393,13 @@ public void startDev() { obj.writeObject(context); obj.close(); out.write(bytes.toByteArray()); + + out.putNextEntry(new ZipEntry(BootstrapConstants.SERIALIZED_APP_MODEL)); + bytes = new ByteArrayOutputStream(); + obj = new ObjectOutputStream(new DataOutputStream(bytes)); + obj.writeObject(appModel); + obj.close(); + out.write(bytes.toByteArray()); } extension.outputDirectory().mkdirs(); diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java index 121f7e88393..f415ced24da 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java @@ -213,10 +213,10 @@ public AppModelResolver getAppModelResolver() { } public CurationResult resolveAppModel() throws BootstrapException { - if (test) { - //gradle tests encode the result on the class path + if (test || devMode) { + //gradle tests and dev encode the result on the class path - try (InputStream existing = getClass().getResourceAsStream(BootstrapConstants.SERIALIZED_APP_MODEL)){ + try (InputStream existing = getClass().getClassLoader().getResourceAsStream(BootstrapConstants.SERIALIZED_APP_MODEL)){ if(existing != null ) { AppModel appModel = (AppModel) new ObjectInputStream(existing).readObject(); return new CurationResult(appModel); diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java index c135e67c660..14ad9834b79 100644 --- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java +++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java @@ -26,7 +26,6 @@ import io.quarkus.bootstrap.model.AppArtifactKey; import io.quarkus.bootstrap.model.AppDependency; import io.quarkus.bootstrap.model.AppModel; -import io.quarkus.bootstrap.resolver.AppModelResolver; /** * The result of the curate step that is done by QuarkusBootstrap.
['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java', 'core/devmode/src/main/java/io/quarkus/dev/IsolatedDevModeMain.java', 'core/devmode/src/main/java/io/quarkus/dev/RuntimeUpdatesProcessor.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java', 'core/devmode/src/main/java/io/quarkus/dev/DevModeContext.java']
{'.java': 6}
6
6
0
0
6
6,911,998
1,336,402
179,277
1,919
4,535
725
91
6
1,720
185
507
30
6
0
"2020-01-23T04:16:54"
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