id
int64 0
10.2k
| text_id
stringlengths 17
67
| repo_owner
stringclasses 232
values | repo_name
stringclasses 295
values | issue_url
stringlengths 39
89
| pull_url
stringlengths 37
87
| comment_url
stringlengths 37
94
| links_count
int64 1
2
| link_keyword
stringclasses 12
values | issue_title
stringlengths 7
197
| issue_body
stringlengths 45
21.3k
| base_sha
stringlengths 40
40
| head_sha
stringlengths 40
40
| diff_url
stringlengths 120
170
| diff
stringlengths 478
132k
| changed_files
stringlengths 47
2.6k
| changed_files_exts
stringclasses 22
values | changed_files_count
int64 1
22
| java_changed_files_count
int64 1
22
| kt_changed_files_count
int64 0
0
| py_changed_files_count
int64 0
0
| code_changed_files_count
int64 1
22
| repo_symbols_count
int64 32.6k
242M
| repo_tokens_count
int64 6.59k
49.2M
| repo_lines_count
int64 992
6.2M
| repo_files_without_tests_count
int64 12
28.1k
| changed_symbols_count
int64 0
36.1k
| changed_tokens_count
int64 0
6.5k
| changed_lines_count
int64 0
561
| changed_files_without_tests_count
int64 1
17
| issue_symbols_count
int64 45
21.3k
| issue_words_count
int64 2
1.39k
| issue_tokens_count
int64 13
4.47k
| issue_lines_count
int64 1
325
| issue_links_count
int64 0
19
| issue_code_blocks_count
int64 0
31
| pull_create_at
timestamp[s] | stars
int64 10
44.3k
| language
stringclasses 8
values | languages
stringclasses 296
values | license
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
3,150 | quarkusio/quarkus/6675/6519 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6519 | https://github.com/quarkusio/quarkus/pull/6675 | https://github.com/quarkusio/quarkus/pull/6675 | 1 | resolves | Qute - fix default template extensions for java.util.Map | `Map.get()` and `Map.containsKey()` are not handled correctly. A workaround exists:
```java
@TemplateExtension
static Object get(Map<?, ?> map, Object key) {
return map.get(key);
}
@TemplateExtension
static boolean containsKey(Map<?, ?> map, Object key) {
return map.containsKey(key);
}
``` | 3398d3663dbd2e88322e5ae488505ec436e9e4a8 | 40e102084eacb3b63ff582148c4da8a0533a5675 | https://github.com/quarkusio/quarkus/compare/3398d3663dbd2e88322e5ae488505ec436e9e4a8...40e102084eacb3b63ff582148c4da8a0533a5675 | diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
index 3ee57fc28ec..8179de01cf6 100644
--- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
+++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java
@@ -82,7 +82,7 @@
import io.quarkus.qute.deployment.TemplatesAnalysisBuildItem.TemplateAnalysis;
import io.quarkus.qute.generator.ExtensionMethodGenerator;
import io.quarkus.qute.generator.ValueResolverGenerator;
-import io.quarkus.qute.runtime.DefaultTemplateExtensions;
+import io.quarkus.qute.runtime.BuiltinTemplateExtensions;
import io.quarkus.qute.runtime.EngineProducer;
import io.quarkus.qute.runtime.QuteConfig;
import io.quarkus.qute.runtime.QuteRecorder;
@@ -145,7 +145,7 @@ AdditionalBeanBuildItem additionalBeans() {
return AdditionalBeanBuildItem.builder()
.setUnremovable()
.addBeanClasses(EngineProducer.class, TemplateProducer.class, VariantTemplateProducer.class, ResourcePath.class,
- Template.class, TemplateInstance.class, DefaultTemplateExtensions.class)
+ Template.class, TemplateInstance.class, BuiltinTemplateExtensions.class)
.build();
}
diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/TemplateExtensionMethodsTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/TemplateExtensionMethodsTest.java
index 55e99c70c52..9b3a16dcca4 100644
--- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/TemplateExtensionMethodsTest.java
+++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/TemplateExtensionMethodsTest.java
@@ -5,6 +5,8 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
+import java.util.HashMap;
+import java.util.Map;
import javax.inject.Inject;
@@ -57,6 +59,19 @@ public void testMatchAnyWithParameter() {
engine.getTemplate("any.txt").data("anyInt", 10).render());
}
+ @Test
+ public void testBuiltinExtensions() {
+ Map<String, String> map = new HashMap<String, String>();
+ map.put("alpha", "1");
+ map.put("bravo", "2");
+ map.put("charlie", "3");
+ assertEquals("3:1:NOT_FOUND:1:false:true",
+ engine.parse(
+ "{myMap.size}:{myMap.alpha}:{myMap.missing}:{myMap.get(key)}:{myMap.empty}:{myMap.containsKey('charlie')}")
+ .data("myMap", map).data("key", "alpha").render());
+
+ }
+
@TemplateExtension
public static class Extensions {
diff --git a/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/DefaultTemplateExtensions.java b/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/BuiltinTemplateExtensions.java
similarity index 62%
rename from extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/DefaultTemplateExtensions.java
rename to extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/BuiltinTemplateExtensions.java
index 068b6962ad1..5db9fb017a7 100644
--- a/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/DefaultTemplateExtensions.java
+++ b/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/BuiltinTemplateExtensions.java
@@ -7,11 +7,12 @@
import io.quarkus.qute.Results.Result;
import io.quarkus.qute.TemplateExtension;
-public class DefaultTemplateExtensions {
+@TemplateExtension
+public class BuiltinTemplateExtensions {
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings({ "rawtypes", "unchecked" })
@TemplateExtension(matchName = ANY)
- public static Object map(Map map, String name) {
+ static Object map(Map map, String name) {
Object val = map.get(name);
if (val != null) {
return val;
@@ -27,13 +28,17 @@ public static Object map(Map map, String name) {
case "empty":
case "isEmpty":
return map.isEmpty();
- case "get":
- return map.get(name);
- case "containsKey":
- return map.containsKey(name);
default:
- return Result.NOT_FOUND;
+ return map.getOrDefault(name, Result.NOT_FOUND);
}
}
+ static Object get(Map<?, ?> map, Object key) {
+ return map.get(key);
+ }
+
+ static boolean containsKey(Map<?, ?> map, Object key) {
+ return map.containsKey(key);
+ }
+
}
diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/ValueResolvers.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/ValueResolvers.java
index a4b30207dc4..874d06faee5 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/ValueResolvers.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/ValueResolvers.java
@@ -193,9 +193,6 @@ private static Object entryResolve(Entry<?, ?> entry, String name) {
@SuppressWarnings("rawtypes")
private static CompletionStage<Object> mapResolveAsync(EvalContext context) {
Map map = (Map) context.getBase();
- if (map.containsKey(context.getName())) {
- return CompletableFuture.completedFuture(map.get(context.getName()));
- }
switch (context.getName()) {
case "keys":
case "keySet":
@@ -220,7 +217,8 @@ private static CompletionStage<Object> mapResolveAsync(EvalContext context) {
});
}
default:
- return Results.NOT_FOUND;
+ return map.containsKey(context.getName()) ? CompletableFuture.completedFuture(map.get(context.getName()))
+ : Results.NOT_FOUND;
}
}
| ['extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/DefaultTemplateExtensions.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/ValueResolvers.java', 'extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/TemplateExtensionMethodsTest.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 6,858,325 | 1,326,877 | 177,926 | 1,907 | 669 | 101 | 10 | 3 | 313 | 36 | 69 | 12 | 0 | 1 | 2020-01-21T08:33: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,151 | quarkusio/quarkus/6643/6641 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6641 | https://github.com/quarkusio/quarkus/pull/6643 | https://github.com/quarkusio/quarkus/pull/6643 | 2 | fixes | Panache entites are not marked as dirty after deserialization with Jackson | **Describe the bug**
Using Jackson for JSON-Deserializiation Panache entities (w/out explicit setters) is problematic because generated getters & setters are marked "synthetic" by Quarkus and Jackson skips synthetic methods, i.e. it uses just the public fields. But that means that Hibernate's dirty tracking is bypassed and the (changed) entities are not persisted.
**Expected behavior**
Panache entity is persistable (aka. dirty) after deserialization with Jackson.
**Actual behavior**
Panache entity is not marked as dirty after deserialization with Jackson.
**To Reproduce**
Steps to reproduce the behavior:
1. Use Jackson for JSON handling
2. Deserialize a Panache entity w/out explicit getters & setters
3. Try to persist this entity
**Solution**
As discussed with @FroMage on the chat, the synthetic flag should be removed to make this work as it is not relevant for any (known) use case right now (see getter & setter generation in PanacheEntityEnhancer).
| bcd95553beb5e40ff824bb232f271eae815565d7 | 6ee371b5c336b5171d8443855085ee8ca321c92e | https://github.com/quarkusio/quarkus/compare/bcd95553beb5e40ff824bb232f271eae815565d7...6ee371b5c336b5171d8443855085ee8ca321c92e | diff --git a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheEntityEnhancer.java b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheEntityEnhancer.java
index c26c31e49c7..59583cedb0c 100644
--- a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheEntityEnhancer.java
+++ b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheEntityEnhancer.java
@@ -185,7 +185,7 @@ private void generateAccessors() {
String getterName = field.getGetterName();
String getterDescriptor = "()" + field.descriptor;
if (!methods.contains(getterName + "/" + getterDescriptor)) {
- MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC,
+ MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC,
getterName, getterDescriptor, field.signature == null ? null : "()" + field.signature, null);
mv.visitCode();
mv.visitIntInsn(Opcodes.ALOAD, 0);
@@ -204,7 +204,7 @@ private void generateAccessors() {
String setterName = field.getSetterName();
String setterDescriptor = "(" + field.descriptor + ")V";
if (!methods.contains(setterName + "/" + setterDescriptor)) {
- MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC,
+ MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC,
setterName, setterDescriptor, field.signature == null ? null : "(" + field.signature + ")V", null);
mv.visitCode();
mv.visitIntInsn(Opcodes.ALOAD, 0); | ['extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/PanacheEntityEnhancer.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 6,826,114 | 1,320,930 | 177,282 | 1,887 | 359 | 70 | 4 | 1 | 985 | 143 | 208 | 18 | 0 | 0 | 2020-01-20T12:54: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,152 | quarkusio/quarkus/6602/6600 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6600 | https://github.com/quarkusio/quarkus/pull/6602 | https://github.com/quarkusio/quarkus/pull/6602 | 1 | resolves | Simple scheduler CRON triggers do not work correctly with JDK9+ | It seems that since JDK9 the `ZonedDateTime.now()` method works with microsecond precision. This breaks our scheduling logic which expects milliseconds precision (JDK8 behavior). We need to make the extension logic more robust.
NOTE: This bug does not apply to quartz extension which is using a different mechanism to evaluate triggers. | 3ab105c87613119f492c297d34a51bf31ee4a5b0 | fa93c3b58ab26f1159b8988d10592228abf9e52b | https://github.com/quarkusio/quarkus/compare/3ab105c87613119f492c297d34a51bf31ee4a5b0...fa93c3b58ab26f1159b8988d10592228abf9e52b | diff --git a/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java b/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java
index 28c0d73c088..ae723f248b0 100644
--- a/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java
+++ b/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java
@@ -42,6 +42,7 @@ public class SimpleScheduler implements Scheduler {
private static final Logger LOGGER = Logger.getLogger(SimpleScheduler.class);
+ // milliseconds
private static final long CHECK_PERIOD = 1000L;
private final ScheduledExecutorService scheduledExecutor;
@@ -111,19 +112,23 @@ void checkTriggers() {
ZonedDateTime now = ZonedDateTime.now();
for (ScheduledTask task : scheduledTasks) {
- LOGGER.tracef("Evaluate trigger %s", task.trigger.id);
+ LOGGER.tracef("Evaluate trigger %s", task.trigger);
ZonedDateTime scheduledFireTime = task.trigger.evaluate(now);
if (scheduledFireTime != null) {
try {
executor.execute(new Runnable() {
@Override
public void run() {
- task.invoker.invoke(new SimpleScheduledExecution(now, scheduledFireTime, task.trigger));
+ try {
+ task.invoker.invoke(new SimpleScheduledExecution(now, scheduledFireTime, task.trigger));
+ } catch (Throwable t) {
+ LOGGER.errorf(t, "Error occured while executing task for trigger %s", task.trigger);
+ }
}
});
- LOGGER.debugf("Executing scheduled task for trigger %s", task.trigger.id);
+ LOGGER.debugf("Executing scheduled task for trigger %s", task.trigger);
} catch (RejectedExecutionException e) {
- LOGGER.warnf("Rejected execution of a scheduled task for trigger %s", task.trigger.id);
+ LOGGER.warnf("Rejected execution of a scheduled task for trigger %s", task.trigger);
}
}
}
@@ -231,12 +236,12 @@ ZonedDateTime evaluate(ZonedDateTime now) {
}
if (lastFireTime == null) {
// First execution
- lastFireTime = now;
+ lastFireTime = now.truncatedTo(ChronoUnit.SECONDS);
return now;
}
if (ChronoUnit.MILLIS.between(lastFireTime, now) >= interval) {
ZonedDateTime scheduledFireTime = lastFireTime.plus(Duration.ofMillis(interval));
- lastFireTime = now;
+ lastFireTime = now.truncatedTo(ChronoUnit.SECONDS);
return scheduledFireTime;
}
return null;
@@ -252,14 +257,26 @@ public Instant getPreviousFireTime() {
return lastFireTime.toInstant();
}
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("IntervalTrigger [id=").append(getId()).append(", interval=").append(interval).append("]");
+ return builder.toString();
+ }
+
}
static class CronTrigger extends SimpleTrigger {
+ // microseconds
+ private static final long DIFF_THRESHOLD = CHECK_PERIOD * 1000;
+
+ private final Cron cron;
private final ExecutionTime executionTime;
public CronTrigger(String id, ZonedDateTime start, Cron cron) {
super(id, start);
+ this.cron = cron;
this.executionTime = ExecutionTime.forCron(cron);
}
@@ -285,14 +302,23 @@ ZonedDateTime evaluate(ZonedDateTime now) {
if (now.isBefore(trunc)) {
return null;
}
- long diff = ChronoUnit.MILLIS.between(trunc, now);
- if (diff <= CHECK_PERIOD) {
+ // Use microseconds precision to workaround incompatibility between jdk8 and jdk9+
+ long diff = ChronoUnit.MICROS.between(trunc, now);
+ if (diff <= DIFF_THRESHOLD) {
+ LOGGER.debugf("%s fired, diff=%s μs", this, diff);
return trunc;
}
}
return null;
}
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder();
+ builder.append("CronTrigger [id=").append(getId()).append(", cron=").append(cron.asString()).append("]");
+ return builder.toString();
+ }
+
}
static class SimpleScheduledExecution implements ScheduledExecution { | ['extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 6,701,766 | 1,294,979 | 173,721 | 1,830 | 2,382 | 435 | 42 | 1 | 339 | 50 | 64 | 3 | 0 | 0 | 2020-01-17T10:13: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,153 | quarkusio/quarkus/6583/6566 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6566 | https://github.com/quarkusio/quarkus/pull/6583 | https://github.com/quarkusio/quarkus/pull/6583 | 1 | fixes | PanacheMongoRepository does not deal well with instants | When using the PanacheMongoRepository to query the database using Instants the Inventory does not find any results unless the query is written in mongo syntax.
`fun getByCreationInstantBefore(time: Instant) = list("endAt < ?1", time)`
Should return the Commands present in the database with endAt < time but returns an empty list.
Steps to reproduce the behavior:
1. Create a Database populated with entries with time
2. Try to query by time like above
`fun getByCreationInstantBefore(time: Instant) = list("{endAt : { \\$lte : ISODate(?1) }}", time)` works well | 64067b91deb0311c6833d93f49ec41fa91d06121 | 4c49673ece0d0d366a6e0c6530a9fba1b8be6bcc | https://github.com/quarkusio/quarkus/compare/64067b91deb0311c6833d93f49ec41fa91d06121...4c49673ece0d0d366a6e0c6530a9fba1b8be6bcc | diff --git a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/runtime/CommonQueryBinder.java b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/runtime/CommonQueryBinder.java
index 8ab9230ad6d..f63874a48b4 100644
--- a/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/runtime/CommonQueryBinder.java
+++ b/extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/runtime/CommonQueryBinder.java
@@ -1,8 +1,10 @@
package io.quarkus.mongodb.panache.runtime;
import java.text.SimpleDateFormat;
+import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
+import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.Date;
@@ -34,6 +36,10 @@ static String escape(Object value) {
LocalDateTime dateValue = (LocalDateTime) value;
return "ISODate('" + DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(dateValue) + "')";
}
+ if (value instanceof Instant) {
+ Instant dateValue = (Instant) value;
+ return "ISODate('" + DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(dateValue.atZone(ZoneOffset.UTC)) + "')";
+ }
return "'" + value.toString().replace("\\\\", "\\\\\\\\").replace("'", "\\\\'") + "'";
}
}
diff --git a/extensions/panache/mongodb-panache/runtime/src/test/java/io/quarkus/mongodb/panache/runtime/MongoOperationsTest.java b/extensions/panache/mongodb-panache/runtime/src/test/java/io/quarkus/mongodb/panache/runtime/MongoOperationsTest.java
index f8dc5d55b1d..b7bab77eba3 100644
--- a/extensions/panache/mongodb-panache/runtime/src/test/java/io/quarkus/mongodb/panache/runtime/MongoOperationsTest.java
+++ b/extensions/panache/mongodb-panache/runtime/src/test/java/io/quarkus/mongodb/panache/runtime/MongoOperationsTest.java
@@ -5,6 +5,7 @@
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
+import java.time.ZoneOffset;
import java.util.Date;
import org.bson.codecs.pojo.annotations.BsonProperty;
@@ -35,6 +36,10 @@ public void testBindShorthandQuery() {
query = MongoOperations.bindQuery(Object.class, "field", new Object[] { LocalDateTime.of(2019, 3, 4, 1, 1, 1) });
assertEquals("{'field':ISODate('2019-03-04T01:01:01')}", query);
+ query = MongoOperations.bindQuery(Object.class, "field",
+ new Object[] { LocalDateTime.of(2019, 3, 4, 1, 1, 1).toInstant(ZoneOffset.UTC) });
+ assertEquals("{'field':ISODate('2019-03-04T01:01:01')}", query);
+
query = MongoOperations.bindQuery(Object.class, "field",
new Object[] { toDate(LocalDateTime.of(2019, 3, 4, 1, 1, 1)) });
assertEquals("{'field':ISODate('2019-03-04T01:01:01.000')}", query);
@@ -68,6 +73,10 @@ public void testBindNativeQueryByIndex() {
new Object[] { LocalDateTime.of(2019, 3, 4, 1, 1, 1) });
assertEquals("{'field': ISODate('2019-03-04T01:01:01')}", query);
+ query = MongoOperations.bindQuery(Object.class, "{'field': ?1}",
+ new Object[] { LocalDateTime.of(2019, 3, 4, 1, 1, 1).toInstant(ZoneOffset.UTC) });
+ assertEquals("{'field': ISODate('2019-03-04T01:01:01')}", query);
+
query = MongoOperations.bindQuery(Object.class, "{'field': ?1}",
new Object[] { toDate(LocalDateTime.of(2019, 3, 4, 1, 1, 1)) });
assertEquals("{'field': ISODate('2019-03-04T01:01:01.000')}", query);
@@ -99,6 +108,10 @@ public void testBindNativeQueryByName() {
Parameters.with("field", LocalDateTime.of(2019, 3, 4, 1, 1, 1)).map());
assertEquals("{'field': ISODate('2019-03-04T01:01:01')}", query);
+ query = MongoOperations.bindQuery(Object.class, "{'field': :field}",
+ Parameters.with("field", LocalDateTime.of(2019, 3, 4, 1, 1, 1).toInstant(ZoneOffset.UTC)).map());
+ assertEquals("{'field': ISODate('2019-03-04T01:01:01')}", query);
+
query = MongoOperations.bindQuery(Object.class, "{'field': :field}",
Parameters.with("field", toDate(LocalDateTime.of(2019, 3, 4, 1, 1, 1))).map());
assertEquals("{'field': ISODate('2019-03-04T01:01:01.000')}", query);
@@ -127,6 +140,10 @@ public void testBindEnhancedQueryByIndex() {
query = MongoOperations.bindQuery(Object.class, "field = ?1", new Object[] { LocalDateTime.of(2019, 3, 4, 1, 1, 1) });
assertEquals("{'field':ISODate('2019-03-04T01:01:01')}", query);
+ query = MongoOperations.bindQuery(Object.class, "field = ?1",
+ new Object[] { LocalDateTime.of(2019, 3, 4, 1, 1, 1).toInstant(ZoneOffset.UTC) });
+ assertEquals("{'field':ISODate('2019-03-04T01:01:01')}", query);
+
query = MongoOperations.bindQuery(Object.class, "field = ?1",
new Object[] { toDate(LocalDateTime.of(2019, 3, 4, 1, 1, 1)) });
assertEquals("{'field':ISODate('2019-03-04T01:01:01.000')}", query);
@@ -180,6 +197,10 @@ public void testBindEnhancedQueryByName() {
Parameters.with("field", LocalDateTime.of(2019, 3, 4, 1, 1, 1)).map());
assertEquals("{'field':ISODate('2019-03-04T01:01:01')}", query);
+ query = MongoOperations.bindQuery(Object.class, "field = :field",
+ Parameters.with("field", LocalDateTime.of(2019, 3, 4, 1, 1, 1).toInstant(ZoneOffset.UTC)).map());
+ assertEquals("{'field':ISODate('2019-03-04T01:01:01')}", query);
+
query = MongoOperations.bindQuery(Object.class, "field = :field",
Parameters.with("field", toDate(LocalDateTime.of(2019, 3, 4, 1, 1, 1))).map());
assertEquals("{'field':ISODate('2019-03-04T01:01:01.000')}", query); | ['extensions/panache/mongodb-panache/runtime/src/test/java/io/quarkus/mongodb/panache/runtime/MongoOperationsTest.java', 'extensions/panache/mongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/runtime/CommonQueryBinder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 6,705,750 | 1,295,800 | 173,834 | 1,832 | 279 | 60 | 6 | 1 | 577 | 86 | 131 | 11 | 0 | 0 | 2020-01-16T12:43: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,154 | quarkusio/quarkus/6504/6485 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6485 | https://github.com/quarkusio/quarkus/pull/6504 | https://github.com/quarkusio/quarkus/pull/6504 | 1 | fixes | Adding Groovy plugin to Gradle project fails quarkusDev | When adding the Groovy plugin like:
```
plugins {
id "java"
id "groovy"
id "io.quarkus"
}
```
then `quarkusDev` fails with:
```
❯ ./gradlew clean quarkusDev
> Task :compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :quarkusDev FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':quarkusDev' (type 'QuarkusDev').
> Directory '/Users/marceloverdijk/workspace/demo-backend-quarkus/build/classes/groovy/main' specified for property 'workingDir' does not exist.
> Directory '/Users/marceloverdijk/workspace/demo-backend-quarkus/src/main/groovy' specified for property 'sourceDir' does not exist.
```
It seems the `src/main/groovy` folder is expected.
I'm only adding Groovy to run Spock tests from `/src/test/groovy`.
When creating an empty `src/main/groovy` folder it keeps complaining about `build/classes/groovy/main`.
| 8c8670d1c0124575a160f7a7b1aec06cddf84609 | e5e6e1e7d6d4392d55fd12b7c24920eda165aad6 | https://github.com/quarkusio/quarkus/compare/8c8670d1c0124575a160f7a7b1aec06cddf84609...e5e6e1e7d6d4392d55fd12b7c24920eda165aad6 | diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java
index 3e3a0c27bfe..d48acd6ec7d 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java
@@ -108,7 +108,9 @@ public AppModelResolver resolveAppModel() {
private File getLastFile(FileCollection fileCollection) {
File result = null;
for (File f : fileCollection) {
- result = f;
+ if (result == null || f.exists()) {
+ result = f;
+ }
}
return result;
} | ['devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPluginExtension.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 6,637,370 | 1,282,892 | 172,089 | 1,811 | 117 | 23 | 4 | 1 | 1,025 | 119 | 262 | 35 | 0 | 2 | 2020-01-10T22:14: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,179 | quarkusio/quarkus/5607/3721 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3721 | https://github.com/quarkusio/quarkus/pull/5607 | https://github.com/quarkusio/quarkus/pull/5607 | 1 | fixes | Unable to Run tests with non-standard maven settings | **Describe the bug**
When using non-standard maven settings, typically the user maven repository is no configured at `$HOME/.m2`, the test fails with exception unable to find the project artifact at $HOME/.m2/repository
**Expected behavior**
Test should run successfully
**Actual behavior**
Test fails with the following exception
```
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.quarkus.sample.HelloResourceTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.499 s <<< FAILURE! - in org.acme.quarkus.sample.HelloResourceTest
[ERROR] testHelloEndpoint Time elapsed: 0.009 s <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: TestInstanceFactory [io.quarkus.test.junit.QuarkusTestExtension] failed to instantiate test class [org.acme.quarkus.sample.HelloResourceTest]: 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.acme.quarkus.sample:my-quarkus-project::jar:1.0-SNAPSHOT
Caused by: io.quarkus.bootstrap.resolver.AppModelResolverException: Failed to read descriptor of org.acme.quarkus.sample:my-quarkus-project:jar:1.0-SNAPSHOT
Caused by: org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.acme.quarkus.sample:my-quarkus-project:jar:1.0-SNAPSHOT
Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact io.quarkus:quarkus-bom:pom:0.21.1 from/to central (https://repo.maven.apache.org/maven2): /.m2/repository/io/quarkus/quarkus-bom/0.21.1/quarkus-bom-0.21.1.pom.part.lock (No such file or directory)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact io.quarkus:quarkus-bom:pom:0.21.1 from/to central (https://repo.maven.apache.org/maven2): /.m2/repository/io/quarkus/quarkus-bom/0.21.1/quarkus-bom-0.21.1.pom.part.lock (No such file or directory)
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact io.quarkus:quarkus-bom:pom:0.21.1 from/to central (https://repo.maven.apache.org/maven2): /.m2/repository/io/quarkus/quarkus-bom/0.21.1/quarkus-bom-0.21.1.pom.part.lock (No such file or directory)
Caused by: java.io.FileNotFoundException: /.m2/repository/io/quarkus/quarkus-bom/0.21.1/quarkus-bom-0.21.1.pom.part.lock (No such file or directory)
```
**To Reproduce**
Steps to reproduce the behavior:
1. Delete the maven settings at ~/.m2/settings.xml
2. Configure global maven settings $MAVEN_HOME/settings.xml to have `localRepository` configured at anyother place than $HOME/.m2/repository
3. Create or take any Quarkus quickstart projects and run the `mvn clean test`
**Configuration**
Maven configuration as mentioned above
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: all supported OS
- Output of `java -version`: 1.8(openjdk)
- GraalVM version (if different from Java): 19.1.1
- Quarkus version or git rev: 0.21.1
| 1cfe29a8ea5030dbfbb078ad171ae4173e9d8f6e | 6f4d610ea504fcbcfa253bc79a71e90859357ce8 | https://github.com/quarkusio/quarkus/compare/1cfe29a8ea5030dbfbb078ad171ae4173e9d8f6e...6f4d610ea504fcbcfa253bc79a71e90859357ce8 | 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 c88d79b6a6c..f002c3d65f8 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
@@ -77,13 +77,13 @@ public class MavenRepoInitializer {
private static final String BASEDIR = "basedir";
private static final String MAVEN_CMD_LINE_ARGS = "MAVEN_CMD_LINE_ARGS";
private static final String DOT_M2 = ".m2";
- private static final String MAVEN_HOME = "maven.home";
- private static final String M2_HOME = "M2_HOME";
+ private static final String MAVEN_DOT_HOME = "maven.home";
+ private static final String MAVEN_HOME = "MAVEN_HOME";
private static final String SETTINGS_XML = "settings.xml";
private static final String userHome = PropertyUtils.getUserHome();
private static final File userMavenConfigurationHome = new File(userHome, DOT_M2);
- private static final String envM2Home = System.getenv(M2_HOME);
+ private static final String envM2Home = System.getenv(MAVEN_HOME);
private static final File USER_SETTINGS_FILE;
private static final File GLOBAL_SETTINGS_FILE;
@@ -109,7 +109,7 @@ public class MavenRepoInitializer {
File f = userSettings != null ? resolveUserSettings(userSettings) : new File(userMavenConfigurationHome, SETTINGS_XML);
USER_SETTINGS_FILE = f != null && f.exists() ? f : null;
- f = globalSettings != null ? resolveUserSettings(globalSettings) : new File(PropertyUtils.getProperty(MAVEN_HOME, envM2Home != null ? envM2Home : ""), "conf/settings.xml");
+ f = globalSettings != null ? resolveUserSettings(globalSettings) : new File(PropertyUtils.getProperty(MAVEN_DOT_HOME, envM2Home != null ? envM2Home : ""), "conf/settings.xml");
GLOBAL_SETTINGS_FILE = f != null && f.exists() ? f : null;
}
| ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,972,153 | 1,157,573 | 154,078 | 1,598 | 746 | 177 | 8 | 1 | 3,272 | 289 | 871 | 44 | 3 | 1 | 2019-11-19T20:56: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,181 | quarkusio/quarkus/5573/5569 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5569 | https://github.com/quarkusio/quarkus/pull/5573 | https://github.com/quarkusio/quarkus/pull/5573 | 1 | fixes | MicroProfile TCK OpenTracing failures | I just stumbled upon this test failure in the TCK run on CI:
```
[ERROR] Failures:
[ERROR] OpenTracingClassMethodNameClientTests>Arquillian.run:138->OpenTracingClientBaseTests.testNestedSpans:414->OpenTracingBaseTests.testNestedSpans:385->OpenTracingBaseTests.assertEqualTrees:227 expected [[
{
span: "{ operationName: GET:org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices.nested, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=1&nestBreadth=2&async=false&data=201&failNest=false, span.kind=server], logEntries: []}",
children: [
{
span: "{ operationName: GET, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=0&nestBreadth=1&async=false&data=201&failNest=false, span.kind=client], logEntries: []}",
children: [
{
span: "{ operationName: GET:org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices.nested, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=0&nestBreadth=1&async=false&data=201&failNest=false, span.kind=server], logEntries: []}"
}
]
},
{
span: "{ operationName: GET, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=0&nestBreadth=1&async=false&data=201&failNest=false, span.kind=client], logEntries: []}",
children: [
{
span: "{ operationName: GET:org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices.nested, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=0&nestBreadth=1&async=false&data=201&failNest=false, span.kind=server], logEntries: []}"
}
]
}
]
}
]
] but found [[
{
span: "{ operationName: GET, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=0&nestBreadth=1&async=false&data=201&failNest=false, span.kind=client], logEntries: []}",
children: [
{
span: "{ operationName: GET:org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices.nested, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=0&nestBreadth=1&async=false&data=201&failNest=false, span.kind=server], logEntries: []}"
}
]
},
{
span: "{ operationName: GET, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=0&nestBreadth=1&async=false&data=201&failNest=false, span.kind=client], logEntries: []}",
children: [
{
span: "{ operationName: GET:org.eclipse.microprofile.opentracing.tck.application.TestServerWebServices.nested, tags: [component=jaxrs, http.method=GET, http.status_code=200, http.url=http://localhost:8081/rest/testServices/nested?nestDepth=0&nestBreadth=1&async=false&data=201&failNest=false, span.kind=server], logEntries: []}"
}
]
}
]
]
```
@stuartwdouglas I wonder if it could be related to your changes or not? | 1eb0423ee4ece41e025b3e74cb1028f00cca0c7a | 6a4c53d1a5d63b19912ca036d53fc23f20844b16 | https://github.com/quarkusio/quarkus/compare/1eb0423ee4ece41e025b3e74cb1028f00cca0c7a...6a4c53d1a5d63b19912ca036d53fc23f20844b16 | diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java
index 1560a717b0b..a54586a1cfe 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java
@@ -8,6 +8,7 @@
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
import javax.ws.rs.ServiceUnavailableException;
import javax.ws.rs.container.AsyncResponse;
@@ -262,11 +263,7 @@ public boolean resume(Object entity) {
return false;
done = true;
requestContext.activate(requestContextState);
- try {
- return internalResume(entity, t -> vertxFlush());
- } finally {
- requestContext.terminate();
- }
+ return internalResume(entity, new FlushTask());
}
}
@@ -279,11 +276,7 @@ public boolean resume(Throwable ex) {
return false;
done = true;
requestContext.activate(requestContextState);
- try {
- return internalResume(ex, t -> vertxFlush());
- } finally {
- requestContext.terminate();
- }
+ return internalResume(ex, new FlushTask());
}
}
@@ -299,11 +292,7 @@ public boolean cancel() {
done = true;
cancelled = true;
requestContext.activate(requestContextState);
- try {
- return internalResume(Response.status(Response.Status.SERVICE_UNAVAILABLE).build(), t -> vertxFlush());
- } finally {
- requestContext.terminate();
- }
+ return internalResume(Response.status(Response.Status.SERVICE_UNAVAILABLE).build(), new FlushTask());
}
}
@@ -317,14 +306,10 @@ public boolean cancel(int retryAfter) {
done = true;
cancelled = true;
requestContext.activate(requestContextState);
- try {
- return internalResume(
- Response.status(Response.Status.SERVICE_UNAVAILABLE).header(HttpHeaders.RETRY_AFTER, retryAfter)
- .build(),
- t -> vertxFlush());
- } finally {
- requestContext.terminate();
- }
+ return internalResume(
+ Response.status(Response.Status.SERVICE_UNAVAILABLE).header(HttpHeaders.RETRY_AFTER, retryAfter)
+ .build(),
+ new FlushTask());
}
}
@@ -393,6 +378,17 @@ protected void handleTimeout() {
return;
resume(new ServiceUnavailableException());
}
+
+ private class FlushTask implements Consumer<Throwable> {
+ @Override
+ public void accept(Throwable t) {
+ try {
+ requestContext.terminate();
+ } finally {
+ VertxHttpAsyncResponse.this.vertxFlush();
+ }
+ }
+ }
}
}
}
diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
index d57c8a4563e..d676b8ab814 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
@@ -117,20 +117,17 @@ private void dispatch(RoutingContext routingContext, InputStream is, VertxOutput
boolean suspended = vertxRequest.getAsyncContext().isSuspended();
boolean requestContextActive = requestContext.isActive();
- if (requestContextActive) {
- //it is possible that there was an async response, that then finished in the same thread
- //the async response will have terminated the request context in this case
- currentVertxRequest.initialInvocationComplete(suspended);
- }
if (!suspended) {
try {
- vertxResponse.finish();
- } catch (IOException e) {
- log.error("Unexpected failure", e);
- } finally {
if (requestContextActive) {
requestContext.terminate();
}
+ } finally {
+ try {
+ vertxResponse.finish();
+ } catch (IOException e) {
+ log.debug("IOException writing JAX-RS response", e);
+ }
}
} else {
//we need the request context to stick around
diff --git a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TracingTest.java b/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TracingTest.java
index 1fb5563107f..9ab1d26d7b9 100644
--- a/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TracingTest.java
+++ b/extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TracingTest.java
@@ -1,9 +1,7 @@
package io.quarkus.smallrye.opentracing.deployment;
import java.util.List;
-import java.util.Set;
import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
import org.awaitility.Awaitility;
import org.jboss.shrinkwrap.api.ShrinkWrap;
@@ -48,15 +46,13 @@ public static void afterAll() {
}
@Test
- public void testSingleServerRequest() throws InterruptedException {
+ public void testSingleServerRequest() {
try {
RestAssured.defaultParser = Parser.TEXT;
RestAssured.when().get("/hello")
.then()
.statusCode(200);
- //inherently racy, tracer is completed after response is sent back to the client
- Awaitility.await().atMost(5, TimeUnit.SECONDS)
- .until(() -> mockTracer.finishedSpans().size() == 1);
+ Assertions.assertEquals(1, mockTracer.finishedSpans().size());
Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.hello",
mockTracer.finishedSpans().get(0).operationName());
} finally {
@@ -65,15 +61,12 @@ public void testSingleServerRequest() throws InterruptedException {
}
@Test
- public void testCDI() throws InterruptedException {
+ public void testCDI() {
try {
RestAssured.defaultParser = Parser.TEXT;
RestAssured.when().get("/cdi")
.then()
.statusCode(200);
- //inherently racy, tracer is completed after response is sent back to the client
- Awaitility.await().atMost(5, TimeUnit.SECONDS)
- .until(() -> mockTracer.finishedSpans().size() == 2);
Assertions.assertEquals(2, mockTracer.finishedSpans().size());
Assertions.assertEquals("io.quarkus.smallrye.opentracing.deployment.Service.foo",
mockTracer.finishedSpans().get(0).operationName());
@@ -85,24 +78,18 @@ public void testCDI() throws InterruptedException {
}
@Test
- public void testMPRestClient() throws InterruptedException {
+ public void testMPRestClient() {
try {
RestAssured.defaultParser = Parser.TEXT;
RestAssured.when().get("/restClient")
.then()
.statusCode(200);
- //inherently racy, tracer is completed after response is sent back to the client
- Awaitility.await().atMost(5, TimeUnit.SECONDS)
- .until(() -> mockTracer.finishedSpans().size() == 3);
Assertions.assertEquals(3, mockTracer.finishedSpans().size());
- //these can come in any order, as the 'hello' span is finished after the request is sent back.
- //this means the client might have already dealt with the response before the hello span is finished
- //in practice this means that the spans might be in any order, as they are ordered by the time
- //they are completed rather than the time they are started
- Set<String> results = mockTracer.finishedSpans().stream().map(MockSpan::operationName).collect(Collectors.toSet());
- Assertions.assertTrue(results.contains("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.hello"));
- Assertions.assertTrue(results.contains("GET"));
- Assertions.assertTrue(results.contains("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.restClient"));
+ Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.hello",
+ mockTracer.finishedSpans().get(0).operationName());
+ Assertions.assertEquals("GET", mockTracer.finishedSpans().get(1).operationName());
+ Assertions.assertEquals("GET:io.quarkus.smallrye.opentracing.deployment.TestResource.restClient",
+ mockTracer.finishedSpans().get(2).operationName());
} finally {
RestAssured.reset();
}
diff --git a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.java b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.java
index 2ce0f0b01aa..36c586228f5 100644
--- a/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.java
+++ b/extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.java
@@ -16,6 +16,7 @@
import io.opentracing.contrib.jaxrs2.internal.SpanWrapper;
import io.opentracing.tag.Tags;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
+import io.vertx.core.Handler;
import io.vertx.ext.web.RoutingContext;
@Provider
@@ -39,31 +40,21 @@ CurrentVertxRequest request() {
@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
- request().addRequestDoneListener(new CurrentVertxRequest.Listener() {
+ RoutingContext routingContext = request().getCurrent();
+ routingContext.addHeadersEndHandler(new Handler<Void>() {
@Override
- public void initialInvocationComplete(RoutingContext routingContext, boolean goingAsync) {
+ public void handle(Void event) {
SpanWrapper wrapper = routingContext.get(SpanWrapper.PROPERTY_NAME);
if (wrapper != null) {
wrapper.getScope().close();
+ Tags.HTTP_STATUS.set(wrapper.get(), routingContext.response().getStatusCode());
+ if (routingContext.failure() != null) {
+ addExceptionLogs(wrapper.get(), routingContext.failure());
+ }
+ wrapper.finish();
}
}
-
- @Override
- public void responseComplete(RoutingContext routingContext) {
- SpanWrapper wrapper = routingContext.get(SpanWrapper.PROPERTY_NAME);
- if (wrapper == null) {
- return;
- }
-
- Tags.HTTP_STATUS.set(wrapper.get(), routingContext.response().getStatusCode());
- if (routingContext.failure() != null) {
- addExceptionLogs(wrapper.get(), routingContext.failure());
- }
- wrapper.finish();
-
- }
});
-
}
private static void addExceptionLogs(Span span, Throwable throwable) {
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 1537a5b69ea..f9e7394440a 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
@@ -460,7 +460,6 @@ public T call(HttpServerExchange exchange, C context) throws Exception {
if (exchange == null) {
return action.call(exchange, context);
}
- boolean vertxFirst = false;
ManagedContext requestContext = beanContainer.requestContext();
if (requestContext.isActive()) {
return action.call(exchange, context);
@@ -469,7 +468,6 @@ public T call(HttpServerExchange exchange, C context) throws Exception {
.getAttachment(REQUEST_CONTEXT);
try {
requestContext.activate(existingRequestContext);
- vertxFirst = existingRequestContext == null;
VertxHttpExchange delegate = (VertxHttpExchange) exchange.getDelegate();
RoutingContext rc = (RoutingContext) delegate.getContext();
@@ -479,9 +477,6 @@ public T call(HttpServerExchange exchange, C context) throws Exception {
ServletRequestContext src = exchange
.getAttachment(ServletRequestContext.ATTACHMENT_KEY);
HttpServletRequestImpl req = src.getOriginalRequest();
- if (vertxFirst) {
- currentVertxRequest.initialInvocationComplete(req.isAsyncStarted());
- }
if (req.isAsyncStarted()) {
exchange.putAttachment(REQUEST_CONTEXT, requestContext.getState());
requestContext.deactivate();
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CurrentVertxRequest.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CurrentVertxRequest.java
index e7dd3617c32..2588f1a1348 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CurrentVertxRequest.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CurrentVertxRequest.java
@@ -1,23 +1,14 @@
package io.quarkus.vertx.http.runtime;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.PreDestroy;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
-import org.jboss.logging.Logger;
-
import io.vertx.ext.web.RoutingContext;
@RequestScoped
public class CurrentVertxRequest {
- private final Logger log = Logger.getLogger(CurrentVertxRequest.class);
-
public RoutingContext current;
- private List<Listener> doneListeners;
@Produces
@RequestScoped
@@ -30,51 +21,4 @@ public CurrentVertxRequest setCurrent(RoutingContext current) {
return this;
}
- public void addRequestDoneListener(Listener doneListener) {
- if (doneListeners == null) {
- doneListeners = new ArrayList<>();
- }
- doneListeners.add(doneListener);
- }
-
- public void initialInvocationComplete(boolean goingAsync) {
-
- if (current == null) {
- return;
- }
- if (doneListeners != null) {
- for (Listener i : doneListeners) {
- try {
- i.initialInvocationComplete(current, goingAsync);
- } catch (Throwable t) {
- log.errorf(t, "Failed to process invocation listener %s", i);
- }
- }
- }
- }
-
- @PreDestroy
- void done() {
- if (current == null) {
- return;
- }
- if (doneListeners != null) {
- for (Listener i : doneListeners) {
- try {
- i.responseComplete(current);
- } catch (Throwable t) {
- log.errorf(t, "Failed to process done listener %s", i);
- }
- }
- }
- }
-
- public interface Listener {
-
- void initialInvocationComplete(RoutingContext routingContext, boolean goingAsync);
-
- void responseComplete(RoutingContext routingContext);
-
- }
-
} | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/CurrentVertxRequest.java', 'extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxHttpRequest.java', 'extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java', 'extensions/smallrye-opentracing/runtime/src/main/java/io/quarkus/smallrye/opentracing/runtime/QuarkusSmallRyeTracingStandaloneVertxDynamicFeature.java', 'extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/UndertowDeploymentRecorder.java', 'extensions/smallrye-opentracing/deployment/src/test/java/io/quarkus/smallrye/opentracing/deployment/TracingTest.java'] | {'.java': 6} | 6 | 6 | 0 | 0 | 6 | 5,974,655 | 1,157,984 | 154,162 | 1,598 | 6,117 | 918 | 145 | 5 | 3,410 | 182 | 953 | 48 | 9 | 1 | 2019-11-18T23:34:20 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,226 | quarkusio/quarkus/3869/3790 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3790 | https://github.com/quarkusio/quarkus/pull/3869 | https://github.com/quarkusio/quarkus/pull/3869 | 1 | fixes | NPE in ArcTestRequestScopeProvider.setup() in native mode with dependency on deployment test jar | while working on the quarkus vault extension, I encountered a NPE in ArcTestRequestScopeProvider in native mode, after adding a test jar (which contains helper classes to start and configure vault for integration testing) as a test dependency of integration test jpa-postgresql.
may be the issue is in the way I developed the vault extension, and specifically the test jar.
or may be there is a lack of robustness in the quarkus test framework (ie: protecting from NPE), or there is a situation that is not handled when testing native, and an improvement could be done in the test framework.
**To Reproduce**
go to branch:
https://github.com/vsevel/quarkus/tree/issue_NPE_ArcTestRequestScopeProvider
and execute:
```
docker run -d --rm --publish 5432:5432 --name build-postgres -e POSTGRES_USER=hibernate_orm_test -e POSTGRES_PASSWORD=hibernate_orm_test -e POSTGRES_DB=hibernate_orm_test -d postgres:10.5
./mvnw -am clean install \\
--settings azure-mvn-settings.xml \\
-Dnative-image.docker-build -Dtest-postgresql -Dtest-elasticsearch -Dtest-dynamodb -Ddynamodb-local.port=8000 -Dnative-image.xmx=6g -Dnative -Dno-format \\
-pl integration-tests/jpa-postgresql
```
**Expected behavior**
the build should pass
**Actual behavior**
the build fails with:
```
[INFO] Running io.quarkus.it.jpa.postgresql.JPAFunctionalityInGraalITCase
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.001 s <<< FAILURE! - in io.quarkus.it.jpa.postgresql.JPAFunctionalityInGraalITCase
[ERROR] testJPAFunctionalityFromServlet Time elapsed: 0 s <<< ERROR!
java.lang.NullPointerException
at io.quarkus.arc.deployment.ArcTestRequestScopeProvider.setup(ArcTestRequestScopeProvider.java:12)
at io.quarkus.test.common.TestScopeManager.tearDown(TestScopeManager.java:27)
at io.quarkus.test.junit.QuarkusTestExtension.beforeEach(QuarkusTestExtension.java:308)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeEachCallbacks$1(TestMethodTestDescriptor.java:151)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeBeforeMethodsOrCallbacksUntilExceptionOccurs$5(TestMethodTestDescriptor.java:187)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeMethodsOrCallbacksUntilExceptionOccurs(TestMethodTestDescriptor.java:187)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeBeforeEachCallbacks(TestMethodTestDescriptor.java:150)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:129)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
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)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
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)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
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)
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)
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Linux quarkus-fedora 4.15.0-1040-gcp #42~16.04.1-Ubuntu SMP Wed Aug 7 16:42:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`: openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~16.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
- GraalVM version (if different from Java): /home/vvsevel/graalvm-ce-19.1.1/bin/java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-20190711120915.buildslave.jdk8u-src-tar--b08)
OpenJDK 64-Bit GraalVM CE 19.1.1 (build 25.222-b08-jvmci-19.1-b01, mixed mode)
- Quarkus version or git rev:
**Additional context**
In the meantime, to workaround the issue in the vault extension, I changed the code to:
https://github.com/vsevel/quarkus/blob/master/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcTestRequestScopeProvider.java#L13-L31
| 383767c14ae7705ba21aa81b1256914106e38f6a | ef82c09bfe08cde8f1942d141c459cacccf5cad7 | https://github.com/quarkusio/quarkus/compare/383767c14ae7705ba21aa81b1256914106e38f6a...ef82c09bfe08cde8f1942d141c459cacccf5cad7 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/test/TestScopeSetup.java b/core/deployment/src/main/java/io/quarkus/deployment/test/TestScopeSetup.java
index 3663d099a3e..29388b6b8ba 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/test/TestScopeSetup.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/test/TestScopeSetup.java
@@ -2,7 +2,7 @@
public interface TestScopeSetup {
- void setup();
+ void setup(boolean isSubstrateTest);
- void tearDown();
+ void tearDown(boolean isSubstrateTest);
}
diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcTestRequestScopeProvider.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcTestRequestScopeProvider.java
index 08e68fb13cd..692967f5685 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcTestRequestScopeProvider.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcTestRequestScopeProvider.java
@@ -1,21 +1,39 @@
package io.quarkus.arc.deployment;
+import org.jboss.logging.Logger;
+
import io.quarkus.arc.Arc;
import io.quarkus.arc.ArcContainer;
import io.quarkus.deployment.test.TestScopeSetup;
public class ArcTestRequestScopeProvider implements TestScopeSetup {
+ private static final Logger LOGGER = Logger.getLogger(ArcTestRequestScopeProvider.class);
+
@Override
- public void setup() {
+ public void setup(boolean isSubstrateTest) {
+ if (isSubstrateTest) {
+ return;
+ }
ArcContainer container = Arc.container();
- container.requestContext().activate();
+ if (container == null) {
+ LOGGER.warn("Container not available, ignoring setup");
+ } else {
+ container.requestContext().activate();
+ }
}
@Override
- public void tearDown() {
+ public void tearDown(boolean isSubstrateTest) {
+ if (isSubstrateTest) {
+ return;
+ }
ArcContainer container = Arc.container();
- container.requestContext().terminate();
+ if (container == null) {
+ LOGGER.warn("Container not available, ignoring tearDown");
+ } else {
+ container.requestContext().terminate();
+ }
}
}
diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/TestScopeManager.java b/test-framework/common/src/main/java/io/quarkus/test/common/TestScopeManager.java
index 6cd26b25aec..f0851e42d8a 100644
--- a/test-framework/common/src/main/java/io/quarkus/test/common/TestScopeManager.java
+++ b/test-framework/common/src/main/java/io/quarkus/test/common/TestScopeManager.java
@@ -8,23 +8,23 @@
public class TestScopeManager {
- private static final List<TestScopeSetup> scopeManagers = new ArrayList<>();
+ private static final List<TestScopeSetup> SCOPE_MANAGERS = new ArrayList<>();
static {
for (TestScopeSetup i : ServiceLoader.load(TestScopeSetup.class)) {
- scopeManagers.add(i);
+ SCOPE_MANAGERS.add(i);
}
}
- public static void setup() {
- for (TestScopeSetup i : scopeManagers) {
- i.setup();
+ public static void setup(boolean isSubstrateTest) {
+ for (TestScopeSetup i : SCOPE_MANAGERS) {
+ i.setup(isSubstrateTest);
}
}
- public static void tearDown() {
- for (TestScopeSetup i : scopeManagers) {
- i.tearDown();
+ public static void tearDown(boolean isSubstrateTest) {
+ for (TestScopeSetup i : SCOPE_MANAGERS) {
+ i.tearDown(isSubstrateTest);
}
}
}
diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
index b063cd5bd67..275c41b6c46 100644
--- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
+++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
@@ -298,14 +298,16 @@ private URLClassLoader createQuarkusBuildClassLoader(Path appClassLocation) {
@Override
public void afterEach(ExtensionContext context) throws Exception {
+ boolean substrateTest = context.getRequiredTestClass().isAnnotationPresent(SubstrateTest.class);
restAssuredURLManager.clearURL();
- TestScopeManager.tearDown();
+ TestScopeManager.tearDown(substrateTest);
}
@Override
public void beforeEach(ExtensionContext context) throws Exception {
+ boolean substrateTest = context.getRequiredTestClass().isAnnotationPresent(SubstrateTest.class);
restAssuredURLManager.setURL();
- TestScopeManager.setup();
+ TestScopeManager.setup(substrateTest);
}
@Override | ['test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java', 'core/deployment/src/main/java/io/quarkus/deployment/test/TestScopeSetup.java', 'extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ArcTestRequestScopeProvider.java', 'test-framework/common/src/main/java/io/quarkus/test/common/TestScopeManager.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 4,716,828 | 909,904 | 121,006 | 1,211 | 889 | 163 | 26 | 1 | 8,348 | 389 | 1,904 | 96 | 2 | 2 | 2019-09-05T09:43: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,215 | quarkusio/quarkus/4274/4248 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4248 | https://github.com/quarkusio/quarkus/pull/4274 | https://github.com/quarkusio/quarkus/pull/4274 | 1 | fix | Native image - ClassNotFoundException: org.conscrypt.BufferAllocator | **Describe the bug**
When upgrading from Quarkus 0.19.0 to 0.23.1 (GraalVM 19.0.2 to 19.2.0.1) I'm getting this error at native-image compilation:
```
[2019-09-26T17:55:00.105Z] [INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] Running Quarkus native-image plugin on OpenJDK 64-Bit GraalVM CE 19.2.0.1
[2019-09-26T17:55:00.105Z] [INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] /opt/graalvm/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dio.netty.noUnsafe=true -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dio.netty.leakDetection.level=DISABLED -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dcom.sun.xml.bind.v2.bytecode.ClassTailor.noOptimize=true -J-Dvertx.disableDnsResolver=true --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar ojf-quarkus-packaging-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportUnsupportedElementsAtRuntime -H:+ReportExceptionStackTraces -H:+PrintAnalysisCallTree -H:-AddAllCharsets -H:EnableURLProtocols=http -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
[2019-09-26T17:55:26.895Z] [quarkus-packaging-runner:1115] classlist: 23,885.64 ms
[2019-09-26T17:55:26.895Z] [quarkus-packaging-runner:1115] setup: 520.25 ms
[2019-09-26T17:55:26.895Z] Fatal error: java.lang.NoClassDefFoundError
[2019-09-26T17:55:26.895Z] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[2019-09-26T17:55:26.895Z] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[2019-09-26T17:55:26.895Z] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[2019-09-26T17:55:26.895Z] at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
[2019-09-26T17:55:26.896Z] at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:598)
[2019-09-26T17:55:26.896Z] at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:461)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:310)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:448)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:113)
[2019-09-26T17:55:26.896Z] Caused by: java.lang.NoClassDefFoundError: org/conscrypt/BufferAllocator
[2019-09-26T17:55:26.896Z] at java.lang.Class.getDeclaredMethods0(Native Method)
[2019-09-26T17:55:26.896Z] at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
[2019-09-26T17:55:26.896Z] at java.lang.Class.getDeclaredMethods(Class.java:1975)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleDeletedClass(AnnotationSubstitutionProcessor.java:437)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:270)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:230)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:875)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:824)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:524)
[2019-09-26T17:55:26.896Z] at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:444)
[2019-09-26T17:55:26.896Z] at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
[2019-09-26T17:55:26.896Z] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
[2019-09-26T17:55:26.896Z] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
[2019-09-26T17:55:26.896Z] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
[2019-09-26T17:55:26.896Z] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
[2019-09-26T17:55:26.896Z] Caused by: java.lang.ClassNotFoundException: org.conscrypt.BufferAllocator
[2019-09-26T17:55:26.896Z] at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
[2019-09-26T17:55:26.896Z] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[2019-09-26T17:55:26.896Z] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[2019-09-26T17:55:26.896Z] ... 15 more
[2019-09-26T17:55:26.896Z] Error: Image build request failed with exit status 1
```
I tried to zgrep for conscrypt or org.conscrypt.BufferAllocator in target/lib, but didn't find any references in any jar.
**Expected behavior**
Should compile (was fine on Quarkus 0.19.0 + GraalVM 19.0.2).
**To Reproduce**
I don't have a reproducer I can share, but:
- I'm using the docker image quay.io/quarkus/centos-quarkus-maven:19.2.0.1 to build.
- My application uses the following extensions: quarkus-undertow, quarkus-spring-di, quarkus-resteasy, and a custom one with a servlet and some Arc beans.
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Linux 8e5961cd5b12 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 13 10:46:25 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux`
- Output of `java -version`: `openjdk version "1.8.0_222"`
`OpenJDK Runtime Environment (build 1.8.0_222-20190711120915.buildslave.jdk8u-src-tar--b08)
OpenJDK 64-Bit GraalVM CE 19.2.0.1 (build 25.222-b08-jvmci-19.2-b02, mixed mode)`
- GraalVM version (if different from Java): `GraalVM CE 19.2.0.1`
- Quarkus version or git rev: 0.23.1
**Additional context**
I've only seen the same error mentioned in https://github.com/apache/camel-quarkus/issues/132 | 00f961719a1bdabd286bd900b263a77c79d0a903 | 5958a040c9fea55b6751a65eae656a549a0b0df3 | https://github.com/quarkusio/quarkus/compare/00f961719a1bdabd286bd900b263a77c79d0a903...5958a040c9fea55b6751a65eae656a549a0b0df3 | diff --git a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
index ab2bb428f41..da0521e7f6e 100644
--- a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
+++ b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
@@ -12,11 +12,11 @@
import javax.net.ssl.TrustManagerFactory;
import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
import com.oracle.svm.core.jdk.JDK11OrLater;
+import com.oracle.svm.core.jdk.JDK8OrEarlier;
import io.netty.bootstrap.AbstractBootstrapConfig;
import io.netty.bootstrap.ChannelFactory;
@@ -92,11 +92,6 @@ final class Target_io_netty_handler_ssl_SslHandler$SslEngineType {
}
}
-@Delete
-@TargetClass(className = "io.netty.handler.ssl.ConscryptAlpnSslEngine")
-final class Target_io_netty_handler_ssl_ConscryptAlpnSslEngine {
-}
-
@TargetClass(className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$AlpnWrapper", onlyWith = JDK11OrLater.class)
final class Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator_AlpnWrapper {
@Substitute
@@ -107,6 +102,43 @@ public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc,
}
+@TargetClass(className = "io.netty.handler.ssl.JdkAlpnApplicationProtocolNegotiator$AlpnWrapper", onlyWith = JDK8OrEarlier.class)
+final class Target_io_netty_handler_ssl_JdkAlpnApplicationProtocolNegotiator_AlpnWrapperJava8 {
+ @Substitute
+ public SSLEngine wrapSslEngine(SSLEngine engine, ByteBufAllocator alloc,
+ JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) {
+ if (Target_io_netty_handler_ssl_JettyAlpnSslEngine.isAvailable()) {
+ return isServer
+ ? (SSLEngine) (Object) Target_io_netty_handler_ssl_JettyAlpnSslEngine.newServerEngine(engine,
+ applicationNegotiator)
+ : (SSLEngine) (Object) Target_io_netty_handler_ssl_JettyAlpnSslEngine.newClientEngine(engine,
+ applicationNegotiator);
+ }
+ throw new RuntimeException("Unable to wrap SSLEngine of type " + engine.getClass().getName());
+ }
+
+}
+
+@TargetClass(className = "io.netty.handler.ssl.JettyAlpnSslEngine", onlyWith = JDK8OrEarlier.class)
+final class Target_io_netty_handler_ssl_JettyAlpnSslEngine {
+ @Alias
+ static boolean isAvailable() {
+ return false;
+ }
+
+ @Alias
+ static Target_io_netty_handler_ssl_JettyAlpnSslEngine newClientEngine(SSLEngine engine,
+ JdkApplicationProtocolNegotiator applicationNegotiator) {
+ return null;
+ }
+
+ @Alias
+ static Target_io_netty_handler_ssl_JettyAlpnSslEngine newServerEngine(SSLEngine engine,
+ JdkApplicationProtocolNegotiator applicationNegotiator) {
+ return null;
+ }
+}
+
@TargetClass(className = "io.netty.handler.ssl.Java9SslEngine", onlyWith = JDK11OrLater.class)
final class Target_io_netty_handler_ssl_Java9SslEngine {
@Alias | ['extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,171,627 | 1,001,017 | 133,075 | 1,311 | 1,886 | 434 | 44 | 1 | 6,184 | 335 | 2,041 | 67 | 1 | 1 | 2019-09-30T08:49:44 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,206 | quarkusio/quarkus/4753/4745 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4745 | https://github.com/quarkusio/quarkus/pull/4753 | https://github.com/quarkusio/quarkus/pull/4753 | 1 | fixes | gradle wrapper not created when creating projects on windows | **Describe the bug**
CreateProjectMojo calls gradle instead of gradle.bat/cmd thus on windows gradle wrappers are never created.
https://github.com/quarkusio/quarkus/blob/8582422fd071d3ef152d861ab50de5ca1064e8cf/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java#L219
| ea828fc47fbb02ec8073fb5044dfd33a6cc0c76b | 0abfeafcba9b512a71a11a516d5e5cfb0ccb2356 | https://github.com/quarkusio/quarkus/compare/ea828fc47fbb02ec8073fb5044dfd33a6cc0c76b...0abfeafcba9b512a71a11a516d5e5cfb0ccb2356 | 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 140e28bd265..7e089cd769d 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java
@@ -18,6 +18,7 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
@@ -58,6 +59,8 @@
@Mojo(name = "create", requiresProject = false)
public class CreateProjectMojo extends AbstractMojo {
+ final private static boolean IS_WINDOWS = System.getProperty("os.name").toLowerCase(Locale.ROOT).contains("windows");
+
private static String pluginKey;
public static String getPluginKey() {
@@ -216,7 +219,8 @@ public void execute() throws MojoExecutionException {
private void createGradleWrapper(File projectDirectory) {
try {
- ProcessBuilder pb = new ProcessBuilder("gradle", "wrapper",
+ String gradleName = IS_WINDOWS ? "gradle.bat" : "gradle";
+ ProcessBuilder pb = new ProcessBuilder(gradleName, "wrapper",
"--gradle-version=" + MojoUtils.getGradleWrapperVersion()).directory(projectDirectory)
.inheritIO();
Process x = pb.start();
@@ -224,7 +228,7 @@ private void createGradleWrapper(File projectDirectory) {
x.waitFor();
if (x.exitValue() != 0) {
- getLog().error("Unable to install the Gradle wrapper (./gradlew) in project. See log for details.");
+ getLog().warn("Unable to install the Gradle wrapper (./gradlew) in project. See log for details.");
}
} catch (InterruptedException | IOException e) { | ['devtools/maven/src/main/java/io/quarkus/maven/CreateProjectMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,541,144 | 1,075,389 | 142,833 | 1,477 | 604 | 130 | 8 | 1 | 295 | 18 | 84 | 7 | 1 | 0 | 2019-10-22T11:49: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,207 | quarkusio/quarkus/4752/4749 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4749 | https://github.com/quarkusio/quarkus/pull/4752 | https://github.com/quarkusio/quarkus/pull/4752 | 1 | fixes | Bootstrap maven repo initializer should take into account maven.repo.local property | At this point the local repository location can be configured using settings.xml and QUARKUS_LOCAL_REPO env var with the default pointing to the `~/.m2/repository`. It should also consult `maven.repo.local` system property. | ea828fc47fbb02ec8073fb5044dfd33a6cc0c76b | b03fca06dab05eec08be59de97998ec6418eca71 | https://github.com/quarkusio/quarkus/compare/ea828fc47fbb02ec8073fb5044dfd33a6cc0c76b...b03fca06dab05eec08be59de97998ec6418eca71 | 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 d064ba697d0..c88d79b6a6c 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
@@ -437,11 +437,15 @@ public static Settings getSettings() throws AppModelResolverException {
}
public static String getLocalRepo(Settings settings) {
- String env = System.getenv("QUARKUS_LOCAL_REPO");
- if(env != null) {
- return env;
+ String localRepo = System.getenv("QUARKUS_LOCAL_REPO");
+ if(localRepo != null) {
+ return localRepo;
}
- final String localRepo = settings.getLocalRepository();
+ localRepo = PropertyUtils.getProperty("maven.repo.local");
+ if(localRepo != null) {
+ return localRepo;
+ }
+ localRepo = settings.getLocalRepository();
return localRepo == null ? getDefaultLocalRepo() : localRepo;
}
| ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenRepoInitializer.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,541,144 | 1,075,389 | 142,833 | 1,477 | 499 | 97 | 12 | 1 | 223 | 30 | 47 | 1 | 0 | 0 | 2019-10-22T11:41: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,208 | quarkusio/quarkus/4727/4683 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4683 | https://github.com/quarkusio/quarkus/pull/4727 | https://github.com/quarkusio/quarkus/pull/4727 | 1 | fixes | Class io.quarkus.kafka.client.serialization.JsonbSerializer not included in native image | **Describe the bug**
After packaging/building my kafka producer-consumer application, when trying to run the docker container that contains the native application, I am facing the error: **Class io.quarkus.kafka.client.serialization.JsonbSerializer could not be found**
> Note: running in dev mode and docker with JVM mode the app works fine
**Expected behavior**
My application should start normally without the error above
**Actual behavior**
Here is the stacktrace
```
ERROR [io.sma.rea.mes.imp.ConfiguredChannelFactory] (main) Unable to create the publisher or subscriber during initialization: org.apache.kafka.common.config.ConfigException: Invalid value io.quarkus.kafka.client.serialization.JsonbSerializer for configuration value.serializer: Class io.quarkus.kafka.client.serialization.JsonbSerializer could not be found.
at org.apache.kafka.common.config.ConfigDef.parseType(ConfigDef.java:718)
at org.apache.kafka.common.config.ConfigDef.parseValue(ConfigDef.java:471)
at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:464)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:62)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:75)
at org.apache.kafka.clients.producer.ProducerConfig.<init>(ProducerConfig.java:396)
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:327)
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:271)
at io.vertx.kafka.client.producer.impl.KafkaWriteStreamImpl.create(KafkaWriteStreamImpl.java:52)
at io.vertx.kafka.client.producer.KafkaWriteStream.create(KafkaWriteStream.java:92)
at io.smallrye.reactive.messaging.kafka.KafkaSink.<init>(KafkaSink.java:50)
at io.smallrye.reactive.messaging.kafka.KafkaConnector.getSubscriberBuilder(KafkaConnector.java:73)
at io.smallrye.reactive.messaging.kafka.KafkaConnector_ClientProxy.getSubscriberBuilder(KafkaConnector_ClientProxy.zig:283)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.createSubscriberBuilder(ConfiguredChannelFactory.java:156)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.lambda$register$5(ConfiguredChannelFactory.java:124)
at java.util.HashMap.forEach(HashMap.java:1289)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.register(ConfiguredChannelFactory.java:124)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.initialize(ConfiguredChannelFactory.java:118)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory_ClientProxy.initialize(ConfiguredChannelFactory_ClientProxy.zig:195)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
at io.smallrye.reactive.messaging.extension.MediatorManager.initializeAndRun(MediatorManager.java:132)
at io.smallrye.reactive.messaging.extension.MediatorManager_ClientProxy.initializeAndRun(MediatorManager_ClientProxy.zig:100)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:20)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_4e8937813d9e8faff65c3c07f88fa96615b70e70.notify(SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_4e8937813d9e8faff65c3c07f88fa96615b70e70.zig:51)
at io.quarkus.arc.EventImpl$Notifier.notify(EventImpl.java:228)
at io.quarkus.arc.EventImpl.fire(EventImpl.java:69)
at io.quarkus.arc.runtime.LifecycleEventRunner.fireStartupEvent(LifecycleEventRunner.java:23)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:103)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent32.deploy_0(LifecycleEventsBuildStep$startupEvent32.zig:77)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent32.deploy(LifecycleEventsBuildStep$startupEvent32.zig:36)
at io.quarkus.runner.ApplicationImpl1.doStart(ApplicationImpl1.zig:161)
at io.quarkus.runtime.Application.start(Application.java:93)
at io.quarkus.runtime.Application.run(Application.java:213)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:34)
javax.enterprise.inject.spi.DeploymentException: org.apache.kafka.common.config.ConfigException: Invalid value io.quarkus.kafka.client.serialization.JsonbSerializer for configuration value.serializer: Class io.quarkus.kafka.client.serialization.JsonbSerializer could not be found.
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:22)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_4e8937813d9e8faff65c3c07f88fa96615b70e70.notify(SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_4e8937813d9e8faff65c3c07f88fa96615b70e70.zig:51)
at io.quarkus.arc.EventImpl$Notifier.notify(EventImpl.java:228)
at io.quarkus.arc.EventImpl.fire(EventImpl.java:69)
at io.quarkus.arc.runtime.LifecycleEventRunner.fireStartupEvent(LifecycleEventRunner.java:23)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:103)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent32.deploy_0(LifecycleEventsBuildStep$startupEvent32.zig:77)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent32.deploy(LifecycleEventsBuildStep$startupEvent32.zig:36)
at io.quarkus.runner.ApplicationImpl1.doStart(ApplicationImpl1.zig:161)
at io.quarkus.runtime.Application.start(Application.java:93)
at io.quarkus.runtime.Application.run(Application.java:213)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:34)
Caused by: org.apache.kafka.common.config.ConfigException: Invalid value io.quarkus.kafka.client.serialization.JsonbSerializer for configuration value.serializer: Class io.quarkus.kafka.client.serialization.JsonbSerializer could not be found.
at org.apache.kafka.common.config.ConfigDef.parseType(ConfigDef.java:718)
at org.apache.kafka.common.config.ConfigDef.parseValue(ConfigDef.java:471)
at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:464)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:62)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:75)
at org.apache.kafka.clients.producer.ProducerConfig.<init>(ProducerConfig.java:396)
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:327)
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:271)
at io.vertx.kafka.client.producer.impl.KafkaWriteStreamImpl.create(KafkaWriteStreamImpl.java:52)
at io.vertx.kafka.client.producer.KafkaWriteStream.create(KafkaWriteStream.java:92)
at io.smallrye.reactive.messaging.kafka.KafkaSink.<init>(KafkaSink.java:50)
at io.smallrye.reactive.messaging.kafka.KafkaConnector.getSubscriberBuilder(KafkaConnector.java:73)
at io.smallrye.reactive.messaging.kafka.KafkaConnector_ClientProxy.getSubscriberBuilder(KafkaConnector_ClientProxy.zig:283)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.createSubscriberBuilder(ConfiguredChannelFactory.java:156)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.lambda$register$5(ConfiguredChannelFactory.java:124)
at java.util.HashMap.forEach(HashMap.java:1289)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.register(ConfiguredChannelFactory.java:124)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.initialize(ConfiguredChannelFactory.java:118)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory_ClientProxy.initialize(ConfiguredChannelFactory_ClientProxy.zig:195)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
at io.smallrye.reactive.messaging.extension.MediatorManager.initializeAndRun(MediatorManager.java:132)
at io.smallrye.reactive.messaging.extension.MediatorManager_ClientProxy.initializeAndRun(MediatorManager_ClientProxy.zig:100)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:20)
... 11 more
INFO [io.sma.rea.mes.ext.MediatorManager] (main) Cancel subscriptions
Exception in thread "main" java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl1.doStart(ApplicationImpl1.zig:185)
at io.quarkus.runtime.Application.start(Application.java:93)
at io.quarkus.runtime.Application.run(Application.java:213)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:34)
Caused by: javax.enterprise.inject.spi.DeploymentException: org.apache.kafka.common.config.ConfigException: Invalid value io.quarkus.kafka.client.serialization.JsonbSerializer for configuration value.serializer: Class io.quarkus.kafka.client.serialization.JsonbSerializer could not be found.
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:22)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_4e8937813d9e8faff65c3c07f88fa96615b70e70.notify(SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_4e8937813d9e8faff65c3c07f88fa96615b70e70.zig:51)
at io.quarkus.arc.EventImpl$Notifier.notify(EventImpl.java:228)
at io.quarkus.arc.EventImpl.fire(EventImpl.java:69)
at io.quarkus.arc.runtime.LifecycleEventRunner.fireStartupEvent(LifecycleEventRunner.java:23)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:103)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent32.deploy_0(LifecycleEventsBuildStep$startupEvent32.zig:77)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent32.deploy(LifecycleEventsBuildStep$startupEvent32.zig:36)
at io.quarkus.runner.ApplicationImpl1.doStart(ApplicationImpl1.zig:161)
... 3 more
Caused by: org.apache.kafka.common.config.ConfigException: Invalid value io.quarkus.kafka.client.serialization.JsonbSerializer for configuration value.serializer: Class io.quarkus.kafka.client.serialization.JsonbSerializer could not be found.
at org.apache.kafka.common.config.ConfigDef.parseType(ConfigDef.java:718)
at org.apache.kafka.common.config.ConfigDef.parseValue(ConfigDef.java:471)
at org.apache.kafka.common.config.ConfigDef.parse(ConfigDef.java:464)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:62)
at org.apache.kafka.common.config.AbstractConfig.<init>(AbstractConfig.java:75)
at org.apache.kafka.clients.producer.ProducerConfig.<init>(ProducerConfig.java:396)
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:327)
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:271)
at io.vertx.kafka.client.producer.impl.KafkaWriteStreamImpl.create(KafkaWriteStreamImpl.java:52)
at io.vertx.kafka.client.producer.KafkaWriteStream.create(KafkaWriteStream.java:92)
at io.smallrye.reactive.messaging.kafka.KafkaSink.<init>(KafkaSink.java:50)
at io.smallrye.reactive.messaging.kafka.KafkaConnector.getSubscriberBuilder(KafkaConnector.java:73)
at io.smallrye.reactive.messaging.kafka.KafkaConnector_ClientProxy.getSubscriberBuilder(KafkaConnector_ClientProxy.zig:283)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.createSubscriberBuilder(ConfiguredChannelFactory.java:156)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.lambda$register$5(ConfiguredChannelFactory.java:124)
at java.util.HashMap.forEach(HashMap.java:1289)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.register(ConfiguredChannelFactory.java:124)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.initialize(ConfiguredChannelFactory.java:118)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory_ClientProxy.initialize(ConfiguredChannelFactory_ClientProxy.zig:195)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:647)
at io.smallrye.reactive.messaging.extension.MediatorManager.initializeAndRun(MediatorManager.java:132)
at io.smallrye.reactive.messaging.extension.MediatorManager_ClientProxy.initializeAndRun(MediatorManager_ClientProxy.zig:100)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:20)
... 11 more
```
**To Reproduce**
Steps to reproduce the behavior:
1. Create a project with kafka and JSON-B serialization
2. Build it using native mode
3. Start it. The error will be during the startup
**Configuration**
```properties
mp.messaging.outgoing.news.connector=smallrye-kafka
mp.messaging.outgoing.news.topic=quarkus.news.json
#mp.messaging.outgoing.news.bootstrap.servers=${KAFKA_HOST:localhost}:${KAFKA_PORT:9092}
%dev.mp.messaging.outgoing.news.bootstrap.servers=localhost:9092
mp.messaging.outgoing.news.bootstrap.servers=kafka:9092
mp.messaging.outgoing.news.value.serializer=io.quarkus.kafka.client.serialization.JsonbSerializer
```
**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 "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.2.0.1 (build 25.222-b08-jvmci-19.2-b02, mixed mode)
```
- GraalVM version (if different from Java):
- Quarkus version or git rev: `0.25.0`
**Additional context**
(Add any other context about the problem here.) | 4def43577e1ac5353643b96d4599a191bb549398 | b174c671bef5843afc1521ed65459a2e3b56957e | https://github.com/quarkusio/quarkus/compare/4def43577e1ac5353643b96d4599a191bb549398...b174c671bef5843afc1521ed65459a2e3b56957e | diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
index 69405b8b022..1f10d4f4273 100644
--- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
+++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
@@ -43,6 +43,8 @@
import io.quarkus.gizmo.ClassOutput;
import io.quarkus.gizmo.MethodCreator;
import io.quarkus.gizmo.MethodDescriptor;
+import io.quarkus.kafka.client.serialization.JsonbDeserializer;
+import io.quarkus.kafka.client.serialization.JsonbSerializer;
public class KafkaProcessor {
@@ -57,6 +59,7 @@ public class KafkaProcessor {
ByteBufferSerializer.class,
StringSerializer.class,
FloatSerializer.class,
+ JsonbSerializer.class,
//deserializers
ShortDeserializer.class,
@@ -68,6 +71,7 @@ public class KafkaProcessor {
ByteBufferDeserializer.class,
StringDeserializer.class,
FloatDeserializer.class,
+ JsonbDeserializer.class,
};
static final String TARGET_JAVA_9_CHECKSUM_FACTORY = "io.quarkus.kafka.client.generated.Target_Java9ChecksumFactory";
| ['extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,536,064 | 1,074,378 | 142,689 | 1,474 | 201 | 36 | 4 | 1 | 14,992 | 508 | 3,410 | 167 | 0 | 3 | 2019-10-21T23:34: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,209 | quarkusio/quarkus/4652/4645 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4645 | https://github.com/quarkusio/quarkus/pull/4652 | https://github.com/quarkusio/quarkus/pull/4652 | 1 | fixes | ClassLoader not closed | **Describe the bug**
During builds, a classloader created by the quarkus maven plugin is not closed completely, thus not releasing the jars after the build. This can cause problems when embedding maven. This mainly happens when using concurrent builds and a maven daemon (this always occurs the second time). This means that a reference to a zip file is not released correctly (even though the classloader created by quarkus is correctly closed).
**Expected behavior**
The classloader is closed.
**Actual behavior**
```
Caused by: java.util.zip.ZipException: ZipFile invalid LOC header (bad signature)
at java.base/java.util.zip.ZipFile$ZipFileInputStream.initDataOffset(ZipFile.java:1003)
at java.base/java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:1013)
at java.base/java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:468)
at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:159)
```
| 381e7df4439f5dd9f7a83ae9ec2a5a7469512c1c | e463a4af098546fd2e2482a701fbc4ac3ab0d97e | https://github.com/quarkusio/quarkus/compare/381e7df4439f5dd9f7a83ae9ec2a5a7469512c1c...e463a4af098546fd2e2482a701fbc4ac3ab0d97e | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/util/ServiceUtil.java b/core/deployment/src/main/java/io/quarkus/deployment/util/ServiceUtil.java
index d57d632b8cd..6ab6e390232 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/util/ServiceUtil.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/util/ServiceUtil.java
@@ -7,6 +7,7 @@
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
+import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
@@ -39,7 +40,9 @@ public static Set<String> classNamesNamedIn(ClassLoader classLoader, String file
while (resources.hasMoreElements()) {
final URL url = resources.nextElement();
- try (InputStream is = url.openStream()) {
+ URLConnection con = url.openConnection();
+ con.setUseCaches(false);
+ try (InputStream is = con.getInputStream()) {
try (BufferedInputStream bis = new BufferedInputStream(is)) {
try (InputStreamReader isr = new InputStreamReader(bis, StandardCharsets.UTF_8)) {
try (BufferedReader br = new BufferedReader(isr)) {
@@ -47,6 +50,8 @@ public static Set<String> classNamesNamedIn(ClassLoader classLoader, String file
}
}
}
+ } catch (IOException e) {
+ throw new IOException("Error reading " + url, e);
}
}
| ['core/deployment/src/main/java/io/quarkus/deployment/util/ServiceUtil.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,414,664 | 1,048,309 | 139,293 | 1,398 | 344 | 64 | 7 | 1 | 961 | 99 | 213 | 15 | 0 | 1 | 2019-10-18T08:55: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,211 | quarkusio/quarkus/4567/4565 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4565 | https://github.com/quarkusio/quarkus/pull/4567 | https://github.com/quarkusio/quarkus/pull/4567 | 1 | fixes | BuildStep utilizing InterceptorBindingRegistrarBuildItem results in IllegalArgumentException | **Describe the bug**
I followed the example from the CDI guide for implementing [additional interceptor bindings](https://quarkus.io/guides/cdi-reference#additional-interceptor-bindings). It fails with:
```
java.lang.IllegalArgumentException: Build item class must be leaf (final) types: class io.quarkus.arc.deployment.InterceptorBindingRegistrarBuildItem
at io.quarkus.builder.item.BuildItem.<init>(BuildItem.java:22)
at io.quarkus.builder.item.MultiBuildItem.<init>(MultiBuildItem.java:8)
at io.quarkus.arc.deployment.InterceptorBindingRegistrarBuildItem.<init>(InterceptorBindingRegistrarBuildItem.java:9)
```
Presumably `InterceptorBindingRegistrarBuildItem` should be declared as `final` like the other `BuildItem` implementations?
**Expected behavior**
`InterceptorBindingRegistrarBuildItem` successfully registers the interceptor binding. | f0375704930b06f7b9fa5ae50e648c2b0dbd88bc | 3d21f2d3d87a799b6b555aaefa802c20be247f49 | https://github.com/quarkusio/quarkus/compare/f0375704930b06f7b9fa5ae50e648c2b0dbd88bc...3d21f2d3d87a799b6b555aaefa802c20be247f49 | diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/InterceptorBindingRegistrarBuildItem.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/InterceptorBindingRegistrarBuildItem.java
index cf48e4cf6b3..a399b05f5bb 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/InterceptorBindingRegistrarBuildItem.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/InterceptorBindingRegistrarBuildItem.java
@@ -3,7 +3,7 @@
import io.quarkus.arc.processor.InterceptorBindingRegistrar;
import io.quarkus.builder.item.MultiBuildItem;
-public class InterceptorBindingRegistrarBuildItem extends MultiBuildItem {
+public final class InterceptorBindingRegistrarBuildItem extends MultiBuildItem {
private final InterceptorBindingRegistrar registrar;
public InterceptorBindingRegistrarBuildItem(InterceptorBindingRegistrar registrar) { | ['extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/InterceptorBindingRegistrarBuildItem.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,392,698 | 1,044,163 | 138,817 | 1,387 | 157 | 27 | 2 | 1 | 869 | 58 | 188 | 16 | 1 | 1 | 2019-10-15T10:53: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,212 | quarkusio/quarkus/4546/4545 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4545 | https://github.com/quarkusio/quarkus/pull/4546 | https://github.com/quarkusio/quarkus/pull/4546 | 1 | resolves | Shared lifecycle interceptor instances use wrong CreationalContext | Each interceptor instance should receive a new child `CreationalContext` from the CC of the intercepted bean. This issue follows up on #3530. | 51c3476e97efc5b82f4689db4ece30b5ed945130 | 8f2b288b9b5c74398108225ea23829847826f252 | https://github.com/quarkusio/quarkus/compare/51c3476e97efc5b82f4689db4ece30b5ed945130...8f2b288b9b5c74398108225ea23829847826f252 | 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 31f2824a9c8..7a75c1d6662 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
@@ -854,9 +854,11 @@ protected void implementCreate(ClassOutput classOutput, ClassCreator beanCreator
create.getThis());
ResultHandle interceptorProvider = create.invokeInterfaceMethod(
MethodDescriptors.SUPPLIER_GET, interceptorProviderSupplier);
+ ResultHandle childCtxHandle = create.invokeStaticMethod(MethodDescriptors.CREATIONAL_CTX_CHILD,
+ create.getMethodParam(0));
ResultHandle interceptorInstanceHandle = create.invokeInterfaceMethod(
MethodDescriptors.INJECTABLE_REF_PROVIDER_GET, interceptorProvider,
- create.getMethodParam(0));
+ childCtxHandle);
interceptorToResultHandle.put(interceptor, interceptorInstanceHandle);
ResultHandle wrapHandle = create.invokeStaticMethod(
MethodDescriptor.ofMethod(InitializedInterceptor.class, "of",
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InterceptedBeanMetadataProvider.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InterceptedBeanMetadataProvider.java
index c8955d6ab59..f1b37b7c3cf 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InterceptedBeanMetadataProvider.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InterceptedBeanMetadataProvider.java
@@ -14,10 +14,11 @@ public class InterceptedBeanMetadataProvider implements InjectableReferenceProvi
@Override
public Contextual<?> get(CreationalContext<Contextual<?>> creationalContext) {
+ // First attempt to obtain the creational context of the interceptor bean and then the creational context of the intercepted bean
CreationalContextImpl<?> parent = unwrap(creationalContext).getParent();
if (parent != null) {
- // Intercepted bean creational context
- return parent.getContextual();
+ parent = parent.getParent();
+ return parent != null ? parent.getContextual() : null;
}
return null;
}
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/intercepted/InterceptedBeanInjectionTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/intercepted/InterceptedBeanInjectionTest.java
index ea212c46c98..ca5c43a3b18 100644
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/intercepted/InterceptedBeanInjectionTest.java
+++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/intercepted/InterceptedBeanInjectionTest.java
@@ -5,6 +5,7 @@
import io.quarkus.arc.Arc;
import io.quarkus.arc.test.ArcTestContainer;
import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.context.Dependent;
import javax.enterprise.inject.spi.Bean;
import javax.inject.Inject;
import org.junit.jupiter.api.Test;
@@ -14,7 +15,7 @@ public class InterceptedBeanInjectionTest {
@RegisterExtension
public ArcTestContainer container = new ArcTestContainer(Simple.class,
- SimpleInterceptor.class, InterceptedBean.class);
+ SimpleInterceptor.class, InterceptedBean.class, InterceptedDependent.class);
@Test
public void testInterception() {
@@ -22,6 +23,12 @@ public void testInterception() {
assertEquals(InterceptedBean.class.getName() + InterceptedBean.class.getName(), bean.ping());
assertEquals(InterceptedBean.class.getName(), SimpleInterceptor.aroundConstructResult);
assertEquals(InterceptedBean.class.getName(), SimpleInterceptor.postConstructResult);
+ assertEquals(
+ InterceptedBean.class.getName() + InterceptedDependent.class.getName() + InterceptedDependent.class.getName(),
+ bean.pong());
+ InterceptedDependent dependent = Arc.container().instance(InterceptedDependent.class).get();
+ assertEquals(InterceptedDependent.class.getName() + InterceptedDependent.class.getName(),
+ dependent.pong());
}
@ApplicationScoped
@@ -31,10 +38,27 @@ static class InterceptedBean {
@Inject
Bean<?> bean;
- public String ping() {
+ @Inject
+ InterceptedDependent dependent;
+
+ String ping() {
return bean.getBeanClass().getName();
}
+ String pong() {
+ return dependent.pong();
+ }
+
+ }
+
+ @Dependent
+ static class InterceptedDependent {
+
+ @Simple
+ String pong() {
+ return InterceptedDependent.class.getName();
+ }
+
}
} | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/intercepted/InterceptedBeanInjectionTest.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/InterceptedBeanMetadataProvider.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 5,380,672 | 1,041,870 | 138,470 | 1,383 | 618 | 97 | 9 | 2 | 141 | 22 | 30 | 1 | 0 | 0 | 2019-10-14T11:20: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,213 | quarkusio/quarkus/4501/4499 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4499 | https://github.com/quarkusio/quarkus/pull/4501 | https://github.com/quarkusio/quarkus/pull/4501 | 1 | fixes | quarkus.application.name is not taken into account in stop message | If I add this to my `application.properties`:
```
quarkus.application.name=MyApp
```
Startup message is OK:
```
2019-10-10 14:39:15,327 INFO [io.quarkus] (main) MyApp 1.0-SNAPSHOT (running on Quarkus 999-SNAPSHOT) started in 0.612s. Listening on: http://0.0.0.0:8080
2019-10-10 14:39:15,333 INFO [io.quarkus] (main) Profile prod activated.
2019-10-10 14:39:15,334 INFO [io.quarkus] (main) Installed features: [agroal, cdi, narayana-jta, resteasy, security, security-jdbc]
```
But not the shutdown message:
```
^C2019-10-10 14:39:17,713 INFO [io.quarkus] (main) Quarkus stopped in 0.029s
```
We should fix the shutdown message to be consistent.
Also we need to find a place to document this feature properly. But I couldn't find an obvious place.
Initial PR with the startup name: https://github.com/quarkusio/quarkus/pull/4302 | 239b5c7294f76af99244ea65cb59ec8ad41c9342 | 10df14c488bbca2d5a3bd6b85a00839672f12217 | https://github.com/quarkusio/quarkus/compare/239b5c7294f76af99244ea65cb59ec8ad41c9342...10df14c488bbca2d5a3bd6b85a00839672f12217 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java
index 3c812874270..af9a314a80f 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java
@@ -234,6 +234,11 @@ MainClassBuildItem build(List<StaticBytecodeRecorderBuildItem> staticInitTasks,
mv.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
final ResultHandle appClassInstance = mv.newInstance(ofConstructor(appClassName));
+
+ // Set the application name
+ mv.invokeVirtualMethod(ofMethod(Application.class, "setName", void.class, String.class), appClassInstance,
+ mv.load(applicationInfo.getName()));
+
// run the app
mv.invokeVirtualMethod(ofMethod(Application.class, "run", void.class, String[].class), appClassInstance,
mv.getMethodParam(0));
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 a0e8b2d721b..8cc773f7613 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/Application.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/Application.java
@@ -36,6 +36,7 @@ public abstract class Application {
private final Lock stateLock = Locks.reentrantLock();
private final Condition stateCond = stateLock.newCondition();
+ private String name;
private int state = ST_INITIAL;
private volatile boolean shutdownRequested;
private static volatile Application currentApplication;
@@ -164,7 +165,7 @@ public final void stop() {
stateLock.lock();
try {
state = ST_STOPPED;
- Timing.printStopTime();
+ Timing.printStopTime(name);
stateCond.signalAll();
} finally {
stateLock.unlock();
@@ -178,6 +179,10 @@ public static Application currentApplication() {
protected abstract void doStop();
+ public void setName(String name) {
+ this.name = name;
+ }
+
/**
* Run the application as if it were in a standalone JVM.
*/
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/Timing.java b/core/runtime/src/main/java/io/quarkus/runtime/Timing.java
index 60a993947bb..e834ae4ea71 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/Timing.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/Timing.java
@@ -58,8 +58,8 @@ public static void printStartupTime(String name, String version, String quarkusV
final Logger logger = Logger.getLogger("io.quarkus");
//Use a BigDecimal so we can render in seconds with 3 digits precision, as requested:
final BigDecimal secondsRepresentation = convertToBigDecimalSeconds(bootTimeNanoSeconds);
- String safeAppName = (name == null || name.isEmpty()) ? UNSET_VALUE : name;
- String safeAppVersion = (version == null || version.isEmpty()) ? UNSET_VALUE : version;
+ String safeAppName = (name == null || name.trim().isEmpty()) ? UNSET_VALUE : name;
+ String safeAppVersion = (version == null || version.trim().isEmpty()) ? UNSET_VALUE : version;
if (UNSET_VALUE.equals(safeAppName) || UNSET_VALUE.equals(safeAppVersion)) {
logger.infof("Quarkus %s started in %ss. %s", quarkusVersion, secondsRepresentation, httpServerInfo);
} else {
@@ -71,11 +71,13 @@ public static void printStartupTime(String name, String version, String quarkusV
bootStartTime = -1;
}
- public static void printStopTime() {
+ public static void printStopTime(String name) {
final long stopTimeNanoSeconds = System.nanoTime() - bootStopTime;
final Logger logger = Logger.getLogger("io.quarkus");
final BigDecimal secondsRepresentation = convertToBigDecimalSeconds(stopTimeNanoSeconds);
- logger.infof("Quarkus stopped in %ss", secondsRepresentation);
+ logger.infof("%s stopped in %ss",
+ (UNSET_VALUE.equals(name) || name == null || name.trim().isEmpty()) ? "Quarkus" : name,
+ secondsRepresentation);
bootStopTime = -1;
}
| ['core/runtime/src/main/java/io/quarkus/runtime/Timing.java', 'core/runtime/src/main/java/io/quarkus/runtime/Application.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/MainClassBuildStep.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 5,305,005 | 1,026,862 | 136,510 | 1,364 | 1,130 | 237 | 22 | 3 | 857 | 105 | 286 | 22 | 2 | 3 | 2019-10-10T13:25: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,214 | quarkusio/quarkus/4476/4469 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4469 | https://github.com/quarkusio/quarkus/pull/4476 | https://github.com/quarkusio/quarkus/pull/4476 | 1 | fixes | CNFE on scope defining annotations in the default package | **Describe the bug**
Quarkus fails ungracefully with scope-defining annotations on beans in the default package.
The error: https://gist.github.com/michalszynkiewicz/c489af90ed958b4ff43c7236f4a1b09a
**Expected behavior**
Either just work or produce a user-friendly message.
**To Reproduce**
Steps to reproduce the behavior:
1. clone https://github.com/michalszynkiewicz/quarkus-krakow/tree/failing-scope-on-default/ads
2. `mvn clean compile quarkus:dev` or `mvn clean package && java -jar target/*-runner.jar`
CC @manovotn | 409c1009303e76f2a116937ed63fb6d9c4fda79d | 4e13d22e9b479351184f913b3fdf6bbb4de1af2e | https://github.com/quarkusio/quarkus/compare/409c1009303e76f2a116937ed63fb6d9c4fda79d...4e13d22e9b479351184f913b3fdf6bbb4de1af2e | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AbstractGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AbstractGenerator.java
index e29f8dc6219..d3ba8c05e78 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AbstractGenerator.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AbstractGenerator.java
@@ -81,8 +81,8 @@ protected String getPackageName(BeanInfo bean) {
}
}
String packageName = DotNames.packageName(providerTypeName);
- if (packageName.startsWith("java.")) {
- // It is not possible to place a class in a JDK package
+ if (packageName.isEmpty() || packageName.startsWith("java.")) {
+ // It is not possible to place a class in a JDK package or in default package
packageName = DEFAULT_PACKAGE;
}
return packageName; | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/AbstractGenerator.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,269,069 | 1,019,777 | 135,555 | 1,352 | 280 | 58 | 4 | 1 | 538 | 53 | 156 | 13 | 2 | 0 | 2019-10-09T13:43: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,216 | quarkusio/quarkus/4255/1893 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/1893 | https://github.com/quarkusio/quarkus/pull/4255 | https://github.com/quarkusio/quarkus/pull/4255 | 1 | fixes | WWW-Authenticate Header missing | Given a protected method in a JAX-RS resource:
@GET
@Produces(MediaType.TEXT_HTML)
@RolesAllowed("user-monitor")
public String returnBootstrapHTML() {
...
and Elytron configured to use the embedded Auth:
quarkus.security.embedded.enabled=true
...
...
...
quarkus.security.embedded.auth-mechanism=BASIC
the curl request doesn't receive the correct header "WWW-Authenticate" that start the http challenge:
curl -v http://localhost:8080/gestione-ordini-bar
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8080 (#0)
> GET /gestione-ordini-bar HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.54.0
> Accept: */*
>
< HTTP/1.1 401 Unauthorized
< Connection: keep-alive
< Content-Type: text/html;charset=UTF-8
< Content-Length: 14
< Date: Fri, 05 Apr 2019 14:59:18 GMT
<
* Connection #0 to host localhost left intact
| 055bf49b117782130b5ccbe17509490b5defd80e | 92232816ca786b8bdf6986854b662ac15eb16445 | https://github.com/quarkusio/quarkus/compare/055bf49b117782130b5ccbe17509490b5defd80e...92232816ca786b8bdf6986854b662ac15eb16445 | diff --git a/extensions/elytron-security/deployment/src/test/java/io/quarkus/security/test/BasicAuthTestCase.java b/extensions/elytron-security/deployment/src/test/java/io/quarkus/security/test/BasicAuthTestCase.java
index 4324f093db7..8cc8c2e98e2 100644
--- a/extensions/elytron-security/deployment/src/test/java/io/quarkus/security/test/BasicAuthTestCase.java
+++ b/extensions/elytron-security/deployment/src/test/java/io/quarkus/security/test/BasicAuthTestCase.java
@@ -1,5 +1,6 @@
package io.quarkus.security.test;
+import static org.hamcrest.Matchers.containsStringIgnoringCase;
import static org.hamcrest.Matchers.equalTo;
import org.jboss.shrinkwrap.api.ShrinkWrap;
@@ -54,6 +55,7 @@ public void testSecureAccessSuccess() {
@Test
public void testJaxrsGetFailure() {
RestAssured.when().get("/jaxrs-secured/rolesClass").then()
+ .header("www-authenticate", containsStringIgnoringCase("basic"))
.statusCode(401);
}
diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/RequestFailer.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/RequestFailer.java
index 0cef204bceb..057331085f0 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/RequestFailer.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/RequestFailer.java
@@ -1,16 +1,67 @@
package io.quarkus.resteasy.runtime;
+import java.lang.reflect.Method;
+
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Response;
+import org.jboss.resteasy.core.ResteasyContext;
+
+import io.quarkus.security.identity.CurrentIdentityAssociation;
+import io.quarkus.security.identity.SecurityIdentity;
+import io.quarkus.vertx.http.runtime.security.HttpAuthenticator;
+import io.vertx.ext.web.RoutingContext;
+
/**
* Helper class for JAXRS request failure responses.
*/
public class RequestFailer {
+ //Servlet API may not be present
+ private static final Class<?> HTTP_SERVLET_REQUEST;
+ private static final Class<?> HTTP_SERVLET_RESPONSE;
+ private static final Method AUTHENTICATE;
+
+ static {
+ Class<?> httpServletReq = null;
+ Class<?> httpServletResp = null;
+ Method auth = null;
+ try {
+ httpServletReq = Class.forName("javax.servlet.http.HttpServletRequest");
+ httpServletResp = Class.forName("javax.servlet.http.HttpServletResponse");
+ auth = httpServletReq.getMethod("authenticate", httpServletResp);
+ } catch (Exception e) {
+
+ }
+ AUTHENTICATE = auth;
+ HTTP_SERVLET_REQUEST = httpServletReq;
+ HTTP_SERVLET_RESPONSE = httpServletResp;
+ }
+
public static void fail(ContainerRequestContext requestContext) {
if (requestContext.getSecurityContext().getUserPrincipal() == null) {
- respond(requestContext, 401, "Not authorized");
+
+ SecurityIdentity identity = CurrentIdentityAssociation.current();
+ if (HTTP_SERVLET_REQUEST != null) {
+ Object httpServletRequest = ResteasyContext.getContextData(HTTP_SERVLET_REQUEST);
+ if (httpServletRequest != null) {
+ Object httpServletResponse = ResteasyContext.getContextData(HTTP_SERVLET_RESPONSE);
+ try {
+ AUTHENTICATE.invoke(httpServletRequest, httpServletResponse);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ return;
+ }
+ }
+ HttpAuthenticator authenticator = identity.getAttribute(HttpAuthenticator.class.getName());
+ RoutingContext context = ResteasyContext.getContextData(RoutingContext.class);
+ if (authenticator != null && context != null) {
+ authenticator.sendChallenge(context, null);
+ } else {
+ respond(requestContext, 401, "Not authorized");
+ }
+
} else {
respond(requestContext, 403, "Access forbidden: role not allowed");
}
@@ -21,6 +72,7 @@ private static void respond(ContainerRequestContext context, int status, String
.entity(message)
.type("text/html;charset=UTF-8")
.build();
+
context.abortWith(response);
}
}
diff --git a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
index b3549900e27..e7bd300e68e 100644
--- a/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
+++ b/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java
@@ -75,14 +75,15 @@ private void dispatchRequestContext(RoutingContext request, InputStream is, Vert
association.setIdentity(user.getSecurityIdentity());
}
try {
- dispatch(request.request(), is, output);
+ dispatch(request, is, output);
} finally {
requestContext.terminate();
}
}
- private void dispatch(HttpServerRequest request, InputStream is, VertxOutput output) {
+ private void dispatch(RoutingContext routingContext, InputStream is, VertxOutput output) {
Context ctx = vertx.getOrCreateContext();
+ HttpServerRequest request = routingContext.request();
ResteasyUriInfo uriInfo = VertxUtil.extractUriInfo(request, servletMappingPrefix);
ResteasyHttpHeaders headers = VertxUtil.extractHttpHeaders(request);
HttpServerResponse response = request.response();
@@ -93,6 +94,7 @@ private void dispatch(HttpServerRequest request, InputStream is, VertxOutput out
vertxRequest.setInputStream(is);
try {
ResteasyContext.pushContext(SecurityContext.class, new QuarkusResteasySecurityContext(request));
+ ResteasyContext.pushContext(RoutingContext.class, routingContext);
dispatcher.service(ctx, request, response, vertxRequest, vertxResponse, true);
} catch (Failure e1) {
vertxResponse.setStatus(e1.getErrorCode()); | ['extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java', 'extensions/elytron-security/deployment/src/test/java/io/quarkus/security/test/BasicAuthTestCase.java', 'extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/RequestFailer.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 5,184,303 | 1,003,652 | 133,380 | 1,313 | 2,694 | 475 | 60 | 2 | 935 | 104 | 268 | 38 | 1 | 0 | 2019-09-29T01:31: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,217 | quarkusio/quarkus/4242/4241 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4241 | https://github.com/quarkusio/quarkus/pull/4242 | https://github.com/quarkusio/quarkus/pull/4242 | 1 | fixes | 100% CPU in epoll_wait | **Describe the bug**
In some environments, using native image, all threads reading I/O can spend 100% CPU time polling `epoll_wait(..., timeout=0)`. Turns out this is an effect of `static final io.netty.util.concurrent.ScheduledFutureTask.START_TIME` being set to system-dependent `System.nanoTime()` during compilation and the NioEventLoop behaving in an unexpected way.
Note that this behaviour cannot be reproduced when compiling and running on the same machine, due to the nature of `System.nanoTime()` base value. | c5daa866fb976baf2faa88ea7fb1c184f7a011fd | a80f970853e67a52e63b5082fe1a8a578584fc19 | https://github.com/quarkusio/quarkus/compare/c5daa866fb976baf2faa88ea7fb1c184f7a011fd...a80f970853e67a52e63b5082fe1a8a578584fc19 | 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 bcea7cd2864..eb190661974 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
@@ -18,6 +18,7 @@
import io.quarkus.deployment.builditem.JniBuildItem;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem;
+import io.quarkus.deployment.builditem.substrate.RuntimeReinitializedClassBuildItem;
import io.quarkus.deployment.builditem.substrate.SubstrateConfigBuildItem;
import io.quarkus.deployment.builditem.substrate.SubstrateSystemPropertyBuildItem;
import io.quarkus.netty.BossEventLoopGroup;
@@ -162,4 +163,10 @@ void createExecutors(BuildProducer<RuntimeBeanBuildItem> runtimeBeanBuildItemBui
.build());
}
+ @BuildStep
+ public RuntimeReinitializedClassBuildItem reinitScheduledFutureTask() {
+ return new RuntimeReinitializedClassBuildItem(
+ "io.quarkus.netty.runtime.graal.Holder_io_netty_util_concurrent_ScheduledFutureTask");
+ }
+
}
diff --git a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
index da0521e7f6e..27b179bb9a7 100644
--- a/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
+++ b/extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java
@@ -12,6 +12,7 @@
import javax.net.ssl.TrustManagerFactory;
import com.oracle.svm.core.annotate.Alias;
+import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
@@ -333,6 +334,33 @@ final class Target_io_netty_util_AbstractReferenceCounted {
private static long REFCNT_FIELD_OFFSET;
}
+// This class is runtime-initialized by NettyProcessor
+final class Holder_io_netty_util_concurrent_ScheduledFutureTask {
+ static final long START_TIME = System.nanoTime();
+}
+
+@TargetClass(className = "io.netty.util.concurrent.ScheduledFutureTask")
+final class Target_io_netty_util_concurrent_ScheduledFutureTask {
+ @Delete
+ public static long START_TIME = 0;
+
+ @Substitute
+ static long nanoTime() {
+ return System.nanoTime() - Holder_io_netty_util_concurrent_ScheduledFutureTask.START_TIME;
+ }
+
+ @Alias
+ public long deadlineNanos() {
+ return 0;
+ }
+
+ @Substitute
+ public long delayNanos(long currentTimeNanos) {
+ return Math.max(0,
+ deadlineNanos() - (currentTimeNanos - Holder_io_netty_util_concurrent_ScheduledFutureTask.START_TIME));
+ }
+}
+
class NettySubstitutions {
} | ['extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java', 'extensions/netty/runtime/src/main/java/io/quarkus/netty/runtime/graal/NettySubstitutions.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,172,853 | 1,001,310 | 133,103 | 1,311 | 1,232 | 266 | 35 | 2 | 522 | 69 | 109 | 4 | 0 | 0 | 2019-09-27T11:18: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,218 | quarkusio/quarkus/4240/4239 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4239 | https://github.com/quarkusio/quarkus/pull/4240 | https://github.com/quarkusio/quarkus/pull/4240 | 1 | fixes | High contention on @Transactional annotated methods | The interceptor we use to implement the `@Transactional` does a lookup of the TransactionManager on each need.
Narayana implements this lookup with a synchronized method; however it should be totally fine to cache this lookup even in a constant. | 9b52fcf67d0cace1a450485b8aed748a8a5d8061 | 89abf612d4fcc1732238fb0f8edbf27287426036 | https://github.com/quarkusio/quarkus/compare/9b52fcf67d0cace1a450485b8aed748a8a5d8061...89abf612d4fcc1732238fb0f8edbf27287426036 | diff --git a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java
index 2f0b8ee5cda..22b9f8c5feb 100644
--- a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java
+++ b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java
@@ -18,6 +18,9 @@
@Dependent
public class NarayanaJtaProducers {
+ private static final javax.transaction.UserTransaction USER_TRANSACTION = UserTransaction.userTransaction();
+ private static final javax.transaction.TransactionManager TRANSACTION_MANAGER = TransactionManager.transactionManager();
+
@Produces
@ApplicationScoped
public UserTransactionRegistry userTransactionRegistry() {
@@ -27,14 +30,13 @@ public UserTransactionRegistry userTransactionRegistry() {
@Produces
@ApplicationScoped
public javax.transaction.UserTransaction userTransaction() {
- return UserTransaction.userTransaction();
+ return USER_TRANSACTION;
}
@Produces
@ApplicationScoped
public XAResourceRecoveryRegistry xaResourceRecoveryRegistry() {
return new RecoveryManagerService();
-
}
@Produces
@@ -46,7 +48,7 @@ public TransactionSynchronizationRegistry transactionSynchronizationRegistry() {
@Produces
@ApplicationScoped
public javax.transaction.TransactionManager transactionManager() {
- return TransactionManager.transactionManager();
+ return TRANSACTION_MANAGER;
}
@Produces | ['extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/NarayanaJtaProducers.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,166,109 | 999,962 | 132,939 | 1,310 | 422 | 56 | 8 | 1 | 248 | 39 | 49 | 3 | 0 | 0 | 2019-09-27T10:22: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,219 | quarkusio/quarkus/4179/4178 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4178 | https://github.com/quarkusio/quarkus/pull/4179 | https://github.com/quarkusio/quarkus/pull/4179 | 1 | fixes | ClientProxyGenerator - handle thrown exception types correctly | Currently, we only expect a `ClassType`: https://github.com/quarkusio/quarkus/blob/0.22.0/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java#L100
| 112ca87e55200ea80a3c48727eea361bc3963fd1 | 7739aa495e6c64b2d5f15a216c75a52dd01c41b4 | https://github.com/quarkusio/quarkus/compare/112ca87e55200ea80a3c48727eea361bc3963fd1...7739aa495e6c64b2d5f15a216c75a52dd01c41b4 | 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 4079941d1af..29f0e8172a5 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
@@ -98,13 +98,7 @@ Collection<Resource> generate(BeanInfo bean, String beanClassName, ReflectionReg
// Exceptions
for (Type exception : method.exceptions()) {
- if (exception.kind() == Type.Kind.CLASS) {
- forward.addException(exception.asClassType().toString());
- } else if (exception.kind() == Type.Kind.TYPE_VARIABLE) {
- forward.addException(exception.asTypeVariable().bounds().get(0).asClassType().toString());
- } else {
- throw new IllegalArgumentException("Unknown exception type " + exception);
- }
+ forward.addException(exception.toString());
}
// Method params
ResultHandle[] params = new ResultHandle[method.parameters().size()]; | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,142,144 | 995,387 | 132,241 | 1,304 | 527 | 84 | 8 | 1 | 198 | 7 | 56 | 3 | 1 | 0 | 2019-09-24T13:46: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,221 | quarkusio/quarkus/4153/4151 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4151 | https://github.com/quarkusio/quarkus/pull/4153 | https://github.com/quarkusio/quarkus/pull/4153 | 1 | fixes | Can't run devmode with application which uses a ServletBuildItem | Happens on current master (ca11b856). To reproduce, simply add an extension that uses a `ServletBuildItem`, for example `smallrye-metrics`.
Here a list of URL mappings is wrapped into unmodifiable list https://github.com/quarkusio/quarkus/blob/ca11b856b1dc82ae3ee5e33199ed116ebdbf2700/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/ServletBuildItem.java#L29 but that turns it into `java.util.Collections$UnmodifiableRandomAccessList`
which doesn't have a default constructor, and because there is a call to `io.quarkus.resteasy.runtime.ExceptionMapperRecorder` (https://github.com/quarkusio/quarkus/blob/ca11b856b1dc82ae3ee5e33199ed116ebdbf2700/extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/ExceptionMapperRecorder.java#L16) with the list within its argument, and the `BytecodeRecorderImpl` does not know how to construct it if it is within a different collection, the recording breaks.
Full error
```
09:54:05,587 ERROR [io.qua.dev.DevModeMain] 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.MainClassBuildStep#build threw an exception: java.lang.RuntimeException: Unable to serialize objects of type class java.util.Collections$UnmodifiableRandomAccessList to bytecode as it has no default constructor
at io.quarkus.deployment.recording.BytecodeRecorderImpl$53.createValue(BytecodeRecorderImpl.java:1241)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredArrayStoreParameter$1.write(BytecodeRecorderImpl.java:1548)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$FixedMethodContext.writeInstruction(BytecodeRecorderImpl.java:1646)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$SplitMethodContext.writeInstruction(BytecodeRecorderImpl.java:1603)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredArrayStoreParameter.doPrepare(BytecodeRecorderImpl.java:1545)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$54.doPrepare(BytecodeRecorderImpl.java:1257)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$48.prepare(BytecodeRecorderImpl.java:1025)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$54.doPrepare(BytecodeRecorderImpl.java:1260)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:394)
at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:840)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:149)
at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:180)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:94)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.deployment.steps.MainClassBuildStep#build threw an exception: java.lang.RuntimeException: Unable to serialize objects of type class java.util.Collections$UnmodifiableRandomAccessList to bytecode as it has no default constructor
at io.quarkus.deployment.recording.BytecodeRecorderImpl$53.createValue(BytecodeRecorderImpl.java:1241)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredArrayStoreParameter$1.write(BytecodeRecorderImpl.java:1548)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$FixedMethodContext.writeInstruction(BytecodeRecorderImpl.java:1646)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$SplitMethodContext.writeInstruction(BytecodeRecorderImpl.java:1603)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredArrayStoreParameter.doPrepare(BytecodeRecorderImpl.java:1545)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$54.doPrepare(BytecodeRecorderImpl.java:1257)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$48.prepare(BytecodeRecorderImpl.java:1025)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$54.doPrepare(BytecodeRecorderImpl.java:1260)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:394)
at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:840)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
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:110)
... 3 more
Caused by: java.lang.RuntimeException: Unable to serialize objects of type class java.util.Collections$UnmodifiableRandomAccessList to bytecode as it has no default constructor
at io.quarkus.deployment.recording.BytecodeRecorderImpl$53.createValue(BytecodeRecorderImpl.java:1241)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredArrayStoreParameter$1.write(BytecodeRecorderImpl.java:1548)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$FixedMethodContext.writeInstruction(BytecodeRecorderImpl.java:1646)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$SplitMethodContext.writeInstruction(BytecodeRecorderImpl.java:1603)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredArrayStoreParameter.doPrepare(BytecodeRecorderImpl.java:1545)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$54.doPrepare(BytecodeRecorderImpl.java:1257)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$48.prepare(BytecodeRecorderImpl.java:1025)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$54.doPrepare(BytecodeRecorderImpl.java:1260)
at io.quarkus.deployment.recording.BytecodeRecorderImpl$DeferredParameter.prepare(BytecodeRecorderImpl.java:1524)
at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:394)
at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:840)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
``` | c972f05e0893ecd056e2af635324d3ac0fe04fe2 | 7387ff39b16535269677462412717ae6941bd62a | https://github.com/quarkusio/quarkus/compare/c972f05e0893ecd056e2af635324d3ac0fe04fe2...7387ff39b16535269677462412717ae6941bd62a | 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 c5ec1b6d1df..a46ffa5f482 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
@@ -21,6 +21,7 @@
import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -29,6 +30,8 @@
import java.util.Set;
import java.util.SortedMap;
import java.util.SortedSet;
+import java.util.TreeMap;
+import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -1231,12 +1234,16 @@ ResultHandle createValue(MethodContext context, MethodCreator method, ResultHand
out = method.newInstance(ofConstructor(param.getClass()));
} catch (NoSuchMethodException e) {
//fallback for collection types, such as unmodifiableMap
- if (expectedType == Map.class) {
+ if (SortedMap.class.isAssignableFrom(expectedType)) {
+ out = method.newInstance(ofConstructor(TreeMap.class));
+ } else if (Map.class.isAssignableFrom(expectedType)) {
out = method.newInstance(ofConstructor(LinkedHashMap.class));
- } else if (expectedType == List.class) {
+ } else if (List.class.isAssignableFrom(expectedType)) {
out = method.newInstance(ofConstructor(ArrayList.class));
- } else if (expectedType == Set.class) {
- out = method.newInstance(ofConstructor(Set.class));
+ } else if (SortedSet.class.isAssignableFrom(expectedType)) {
+ out = method.newInstance(ofConstructor(TreeSet.class));
+ } else if (Set.class.isAssignableFrom(expectedType)) {
+ out = method.newInstance(ofConstructor(LinkedHashSet.class));
} else {
throw new RuntimeException("Unable to serialize objects of type " + param.getClass()
+ " to bytecode as it has no default constructor");
diff --git a/core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java b/core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java
index 9a1d3a1ddc0..d09e14a6c07 100644
--- a/core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java
+++ b/core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java
@@ -15,7 +15,9 @@
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import java.util.function.Consumer;
@@ -143,6 +145,40 @@ public void testLargeCollection() throws Exception {
}, beans);
}
+ @Test
+ public void testUnmodifiableMapWithinAMap() throws Exception {
+ Map<Integer, Map<Integer, TestJavaBean>> outerMap = new HashMap<>();
+ outerMap.put(1, Collections.unmodifiableMap(
+ Collections.singletonMap(1, new TestJavaBean())));
+
+ runTest(generator -> {
+ TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class);
+ recorder.map(outerMap);
+ }, outerMap);
+ }
+
+ @Test
+ public void testUnmodifiableListWithinAMap() throws Exception {
+ Map<Integer, List<TestJavaBean>> map = new HashMap<>();
+ map.put(1, Collections.unmodifiableList(Collections.singletonList(new TestJavaBean())));
+
+ runTest(generator -> {
+ TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class);
+ recorder.map(map);
+ }, map);
+ }
+
+ @Test
+ public void testUnmodifiableSetWithinAMap() throws Exception {
+ Map<Integer, Set<TestJavaBean>> map = new HashMap<>();
+ map.put(1, Collections.unmodifiableSet(Collections.singleton(new TestJavaBean())));
+
+ runTest(generator -> {
+ TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class);
+ recorder.map(map);
+ }, map);
+ }
+
@Test
public void testLargeArray() throws Exception {
| ['core/deployment/src/test/java/io/quarkus/deployment/recording/BytecodeRecorderTestCase.java', 'core/deployment/src/main/java/io/quarkus/deployment/recording/BytecodeRecorderImpl.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 4,934,568 | 953,009 | 126,853 | 1,263 | 1,023 | 161 | 15 | 1 | 9,597 | 346 | 2,261 | 99 | 2 | 1 | 2019-09-23T09:06: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,222 | quarkusio/quarkus/4101/4100 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4100 | https://github.com/quarkusio/quarkus/pull/4101 | https://github.com/quarkusio/quarkus/pull/4101 | 1 | fixes | java.lang.IllegalStateException: Shutdown in progress exception while destroying Quarkus app | **Describe the bug**
When CTRL+C'ing a Quarkus app, the following stacktrace appears in the console:
```
^C2019-09-18 18:07:28,429 ERROR [io.qua.run.StartupContext] (main) Running a shutdown task failed: java.lang.IllegalStateException: Shutdown in progress
at java.lang.ApplicationShutdownHooks.add(ApplicationShutdownHooks.java:66)
at java.lang.Runtime.addShutdownHook(Runtime.java:211)
at io.vertx.core.file.impl.FileResolver.setupCacheDir(FileResolver.java:351)
at io.vertx.core.file.impl.FileResolver.<init>(FileResolver.java:87)
at io.vertx.core.impl.VertxImpl.<init>(VertxImpl.java:165)
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)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initialize(VertxCoreRecorder.java:133)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$1.get(VertxCoreRecorder.java:52)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$1.get(VertxCoreRecorder.java:45)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder.destroy(VertxCoreRecorder.java:168)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$2.run(VertxCoreRecorder.java:64)
at io.quarkus.runtime.StartupContext.close(StartupContext.java:43)
at io.quarkus.runner.ApplicationImpl1.doStop(ApplicationImpl1.zig:172)
at io.quarkus.runtime.Application.stop(Application.java:158)
at io.quarkus.runtime.Application.run(Application.java:211)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:34)
```
**Expected behavior**
No stacktrace
**Actual behavior**
Shows stacktrace
**To Reproduce**
Steps to reproduce the behavior:
1. Any Quarkus app running latest master
2. Press Ctrl +C
3. Stacktrace is shown
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Linux ggastald-laptop 5.2.13-200.fc30.x86_64 #1 SMP Fri Sep 6 14:30:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`:
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)
- GraalVM version (if different from Java):
- Quarkus version or git rev: bf2440135785244b174ff19432aa46a1f873b7ea
**Additional context**
(Add any other context about the problem here.)
Doesn't happen with 0.22.0 | 2cb0ceeb2cfb0216cce0d290445c744d7f2ee99e | 2f7010895a147d199730eaff3137de5dbc141ec2 | https://github.com/quarkusio/quarkus/compare/2cb0ceeb2cfb0216cce0d290445c744d7f2ee99e...2f7010895a147d199730eaff3137de5dbc141ec2 | diff --git a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
index 2df951413de..93d245f891e 100644
--- a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
+++ b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
@@ -36,25 +36,13 @@ public class VertxCoreRecorder {
public static final String ENABLE_JSON = "quarkus-internal.vertx.enabled-json";
- static volatile Supplier<Vertx> vertx;
+ static volatile VertxSupplier vertx;
//temporary vertx instance to work around a JAX-RS problem
static volatile Vertx webVertx;
public Supplier<Vertx> configureVertx(BeanContainer container, VertxConfiguration config,
LaunchMode launchMode, ShutdownContext shutdown) {
- vertx = new Supplier<Vertx>() {
-
- Vertx v;
-
- @Override
- public synchronized Vertx get() {
- if (v == null) {
- v = initialize(config);
- }
- return v;
- }
- };
-
+ vertx = new VertxSupplier(config);
VertxCoreProducer producer = container.instance(VertxCoreProducer.class);
producer.initialize(vertx);
if (launchMode != LaunchMode.DEVELOPMENT) {
@@ -162,10 +150,10 @@ private static VertxOptions convertToVertxOptions(VertxConfiguration conf) {
}
void destroy() {
- if (vertx != null) {
+ if (vertx != null && vertx.v != null) {
CountDownLatch latch = new CountDownLatch(1);
AtomicReference<Throwable> problem = new AtomicReference<>();
- vertx.get().close(ar -> {
+ vertx.v.close(ar -> {
if (ar.failed()) {
problem.set(ar.cause());
}
@@ -303,7 +291,7 @@ public Supplier<EventLoopGroup> bossSupplier() {
return new Supplier<EventLoopGroup>() {
@Override
public EventLoopGroup get() {
- return ((VertxImpl) vertx).getAcceptorEventLoopGroup();
+ return ((VertxImpl) vertx.get()).getAcceptorEventLoopGroup();
}
};
}
@@ -316,4 +304,21 @@ public EventLoopGroup get() {
}
};
}
+
+ static class VertxSupplier implements Supplier<Vertx> {
+ final VertxConfiguration config;
+ Vertx v;
+
+ VertxSupplier(VertxConfiguration config) {
+ this.config = config;
+ }
+
+ @Override
+ public synchronized Vertx get() {
+ if (v == null) {
+ v = initialize(config);
+ }
+ return v;
+ }
+ }
}
diff --git a/extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java b/extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java
index fdda5a95bfb..b585e6a9603 100644
--- a/extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java
+++ b/extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java
@@ -54,12 +54,7 @@ public void shouldNotFailWithDefaultConfig() {
configuration.workerPoolSize = 10;
configuration.warningExceptionTime = Duration.ofSeconds(1);
configuration.internalBlockingPoolSize = 5;
- VertxCoreRecorder.vertx = new Supplier<Vertx>() {
- @Override
- public Vertx get() {
- return VertxCoreRecorder.initialize(configuration);
- }
- };
+ VertxCoreRecorder.vertx = new VertxCoreRecorder.VertxSupplier(configuration);
producer.initialize(VertxCoreRecorder.vertx);
verifyProducer();
} | ['extensions/vertx-core/runtime/src/test/java/io/quarkus/vertx/core/runtime/VertxCoreProducerTest.java', 'extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 4,814,003 | 929,248 | 123,423 | 1,235 | 1,139 | 239 | 39 | 1 | 2,489 | 176 | 680 | 52 | 0 | 1 | 2019-09-18T21:32: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,223 | quarkusio/quarkus/4096/4094 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4094 | https://github.com/quarkusio/quarkus/pull/4096 | https://github.com/quarkusio/quarkus/pull/4096 | 1 | fixes | Random HTTP port is shown as zero in the startup logs | **Describe the bug**
Quarkus 0.22.0 allowed starting a service in a random port by specifying 0 as the HTTP port. Quarkus 999-SNAPSHOT does not.
**Expected behavior**
The Quarkus application should start in a random port
**Actual behavior**
It starts in port 0 (?) and doesn't show the assigned port
**To Reproduce**
Steps to reproduce the behavior:
1. `mvn io.quarkus:quarkus-maven-plugin:0.22.0:create -DprojectGroupId=org.acme -DprojectArtifactId=getting-started -DclassName="org.acme.quickstart.GreetingResource" -Dpath="/hello"`
2. Add `quarkus.http.port=0` to application.properties
3. Look at the logs
**Configuration**
```properties
quarkus.http.port=0
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Linux ggastald-laptop 5.2.13-200.fc30.x86_64 #1 SMP Fri Sep 6 14:30:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux`
- Output of `java -version`:
```
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)
```
- GraalVM version (if different from Java):
- Quarkus version or git rev: bf2440135785244b174ff19432aa46a1f873b7ea (master branch)
**Additional context**
This is the output in Quarkus 0.22.0:
```
2019-09-18 16:29:09,130 INFO [io.quarkus] (main) Quarkus 0.22.0 started in 0.954s. Listening on: http://[::]:36127
```
This is the output in Quarkus 999-SNAPSHOT:
```
2019-09-18 16:28:44,116 INFO [io.quarkus] (main) Quarkus 999-SNAPSHOT started in 1.080s. Listening on: http://0.0.0.0:0
``` | 3e01d6a96e8fa96e1e71f6edeccbc20573a2707d | 6424196dc664805897e8c6ca1e6a70f1a57b9b21 | https://github.com/quarkusio/quarkus/compare/3e01d6a96e8fa96e1e71f6edeccbc20573a2707d...6424196dc664805897e8c6ca1e6a70f1a57b9b21 | 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 8f70d6b801d..c6c2e278fa9 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
@@ -375,18 +375,24 @@ public WebDeploymentVerticle(int port, int httpsPort, String host, HttpServerOpt
@Override
public void start(Future<Void> startFuture) throws Exception {
final AtomicInteger remainingCount = new AtomicInteger(httpsOptions != null ? 2 : 1);
- Handler<AsyncResult<HttpServer>> doneHandler = event -> {
+ httpServer = vertx.createHttpServer(httpOptions);
+ httpServer.requestHandler(router);
+ httpServer.listen(port, host, event -> {
+ // Port may be random, so set the actual port
+ httpOptions.setPort(event.result().actualPort());
if (remainingCount.decrementAndGet() == 0) {
startFuture.complete();
}
- };
- httpServer = vertx.createHttpServer(httpOptions);
- httpServer.requestHandler(router);
- httpServer.listen(port, host, doneHandler);
+ });
if (httpsOptions != null) {
httpsServer = vertx.createHttpServer(httpsOptions);
httpsServer.requestHandler(router);
- httpsServer.listen(httpsPort, host, doneHandler);
+ httpsServer.listen(httpsPort, host, event -> {
+ httpsOptions.setPort(event.result().actualPort());
+ if (remainingCount.decrementAndGet() == 0) {
+ startFuture.complete();
+ }
+ });
}
}
| ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 4,814,073 | 929,263 | 123,423 | 1,235 | 928 | 162 | 18 | 1 | 1,617 | 190 | 534 | 43 | 2 | 4 | 2019-09-18T19:56: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,224 | quarkusio/quarkus/4058/4049 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4049 | https://github.com/quarkusio/quarkus/pull/4058 | https://github.com/quarkusio/quarkus/pull/4058 | 1 | resolves | @Produces annotated methods that are not consumed not ignored and result in failed build | **Describe the bug**
Issue described [here](https://github.com/quarkusio/quarkus/issues/2770) persists under 0.20.0.
**Expected behavior**
When using a class with method annotated with `@Produces`, even if never "produced", expect successful build.
**Actual behavior**
Build fails with misleading error message:
```
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.20.0:build (default) on project injector-jira-service: 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.ArcProcessor#generateResources threw an exception: java.lang.IllegalArgumentException: Must be a Class or String, got null
[ERROR] -> [Help 1]
[ERROR]
```
**To Reproduce**
Steps to reproduce the behavior:
Simple reproducer:
```
package service;
@ApplicationScoped
public class SomeResource {
@Inject
SomeService someService;
public void doSomething() {
}
}
```
```
package service;
import client.SomeProvider;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
@ApplicationScoped
public class SomeService {
@Inject
@RequestScoped
SomeProvider someProvider;
// as a workaround, the "produced" but unused bean can be instantiated but ignored to silence this error
// @Inject
// @RequestScoped
// SomeClient someClient;
public void doSomething() {
}
}
```
```
package client;
import java.net.URI;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Produces;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
@RequestScoped
public class SomeProvider {
@Produces
@RequestScoped
public SomeClient getClient() {
return RestClientBuilder
.newBuilder()
.baseUri(URI.create("http://example.com"))
.build(SomeClient.class);
}
}
```
```
package com.cloudbees.sdm.injector.jira.client;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@Consumes("application/json")
@Produces("application/json")
public interface SomeClient {
@GET
@Path("/rest/api/lols")
void getLols();
}
```
Add classes to project and build with maven.
**Configuration**
N/A
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
```
$ uname -a
Darwin ip-192-168-1-137.ec2.internal 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
```
- Output of `java -version`:
```
$ java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit GraalVM EE 19.1.1 (build 25.221-b11-jvmci-19.1-b01, mixed mode)
```
- Quarkus version or git rev: 0.20.0
| cf95687fc330a60972a1a76536052a9f9ea1c86a | 65bae95137c63fb4ae9cbceaf9d7b4bee430e279 | https://github.com/quarkusio/quarkus/compare/cf95687fc330a60972a1a76536052a9f9ea1c86a...65bae95137c63fb4ae9cbceaf9d7b4bee430e279 | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
index 0bec4732f01..82e2e66e3a0 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
@@ -217,6 +217,7 @@ void init() {
long removalStart = System.currentTimeMillis();
Set<BeanInfo> removable = new HashSet<>();
Set<BeanInfo> unusedProducers = new HashSet<>();
+ Set<BeanInfo> unusedButDeclaresProducer = new HashSet<>();
List<BeanInfo> producers = beans.stream().filter(b -> b.isProducerMethod() || b.isProducerField())
.collect(Collectors.toList());
List<InjectionPointInfo> instanceInjectionPoints = injectionPoints.stream()
@@ -245,10 +246,6 @@ void init() {
if (declaresObserver.contains(bean)) {
continue test;
}
- // Declares a producer - see also second pass
- if (declaresProducer.contains(bean)) {
- continue test;
- }
// Instance<Foo>
for (InjectionPointInfo injectionPoint : instanceInjectionPoints) {
if (Beans.hasQualifiers(bean, injectionPoint.getRequiredQualifiers()) && Beans.matchesType(bean,
@@ -256,6 +253,11 @@ void init() {
continue test;
}
}
+ // Declares a producer - see also second pass
+ if (declaresProducer.contains(bean)) {
+ unusedButDeclaresProducer.add(bean);
+ continue test;
+ }
if (bean.isProducerField() || bean.isProducerMethod()) {
// This bean is very likely an unused producer
unusedProducers.add(bean);
@@ -267,9 +269,10 @@ void init() {
Map<BeanInfo, List<BeanInfo>> declaringMap = producers.stream()
.collect(Collectors.groupingBy(BeanInfo::getDeclaringBean));
for (Entry<BeanInfo, List<BeanInfo>> entry : declaringMap.entrySet()) {
- if (unusedProducers.containsAll(entry.getValue())) {
+ BeanInfo declaringBean = entry.getKey();
+ if (unusedButDeclaresProducer.contains(declaringBean) && unusedProducers.containsAll(entry.getValue())) {
// All producers declared by this bean are unused
- removable.add(entry.getKey());
+ removable.add(declaringBean);
}
}
}
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java
index d4984102055..a15b4289aea 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java
@@ -255,6 +255,9 @@ private void addBean(MethodCreator getComponents, ResultHandle beanIdToBeanSuppl
Map<BeanInfo, LazyValue<ResultHandle>> beanToResultSupplierHandle) {
String beanType = beanToGeneratedName.get(bean);
+ if (beanType == null) {
+ throw new IllegalStateException("No bean type found for: " + bean);
+ }
List<InjectionPointInfo> injectionPoints = bean.getInjections().stream().flatMap(i -> i.injectionPoints.stream())
.filter(ip -> !BuiltinBean.resolvesTo(ip)).collect(toList());
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 6c6886ab838..5bdf077e87a 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
@@ -8,6 +8,7 @@
import io.quarkus.arc.ArcContainer;
import io.quarkus.arc.test.ArcTestContainer;
import java.math.BigDecimal;
+import java.math.BigInteger;
import javax.annotation.PostConstruct;
import javax.annotation.Priority;
import javax.enterprise.context.Dependent;
@@ -27,7 +28,8 @@ public class RemoveUnusedBeansTest {
@Rule
public ArcTestContainer container = ArcTestContainer.builder()
.beanClasses(HasObserver.class, Foo.class, FooAlternative.class, HasName.class, UnusedProducers.class,
- InjectedViaInstance.class, InjectedViaProvider.class, Excluded.class, UsedProducers.class)
+ InjectedViaInstance.class, InjectedViaProvider.class, Excluded.class, UsedProducers.class,
+ UnusedProducerButInjected.class, UsedViaInstanceWithUnusedProducer.class, UsesBeanViaInstance.class)
.removeUnusedBeans(true)
.addRemovalExclusion(b -> b.getBeanClass().toString().equals(Excluded.class.getName()))
.build();
@@ -49,6 +51,12 @@ public void testRemoval() {
assertTrue(foo.provider.get().isValid());
assertEquals(1, container.beanManager().getBeans(Foo.class).size());
assertEquals("pong", container.instance(Excluded.class).get().ping());
+ // Producer is unused but declaring bean is injected
+ assertTrue(container.instance(UnusedProducerButInjected.class).isAvailable());
+ assertFalse(container.instance(BigInteger.class).isAvailable());
+ // Producer is unused, declaring bean is only used via Instance
+ assertTrue(container.instance(UsedViaInstanceWithUnusedProducer.class).isAvailable());
+ assertFalse(container.instance(Long.class).isAvailable());
}
@Dependent
@@ -71,6 +79,9 @@ static class Foo {
@Inject
Provider<InjectedViaProvider> provider;
+ @Inject
+ UnusedProducerButInjected injected;
+
String ping() {
return getClass().getName();
}
@@ -140,4 +151,28 @@ String ping() {
}
+ @Singleton
+ static class UnusedProducerButInjected {
+
+ @Produces
+ BigInteger unusedNumber() {
+ return BigInteger.ZERO;
+ }
+
+ }
+
+ @Singleton
+ static class UsedViaInstanceWithUnusedProducer {
+
+ @Produces
+ Long unusedLong = new Long(0);
+ }
+
+ @Singleton
+ static class UsesBeanViaInstance {
+
+ @Inject
+ Instance<UsedViaInstanceWithUnusedProducer> instance;
+ }
+
} | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.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/ComponentsProviderGenerator.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 4,789,596 | 924,670 | 122,939 | 1,234 | 975 | 163 | 18 | 2 | 3,044 | 304 | 754 | 120 | 2 | 7 | 2019-09-17T07:54: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,225 | quarkusio/quarkus/3982/3908 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3908 | https://github.com/quarkusio/quarkus/pull/3982 | https://github.com/quarkusio/quarkus/pull/3982 | 1 | fixes | MP CP integration doesn't allow for user defined custom contexts | I came across this while investigating execution of MP CP TCK on Quarkus.
What the TCK does is define custom contexts (`ThreadContextProvider`s) that are registered via service loader mechanism.
Here is a [link](https://github.com/eclipse/microprofile-context-propagation/blob/master/tck/src/main/java/org/eclipse/microprofile/context/tck/ThreadContextTest.java#L113) to those TCK tests.
However, our current SR CP integration does an early initialization of `SmallRyeContextManager` with set of discovered contexts that is determined before user application is inspected.
The integration happens [here](https://github.com/quarkusio/quarkus/blob/master/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java#L41-L49) and is executed as `STATIC_INIT` which is too early, at least for TCK case.
I am not sure how this would affect actual Quarkus app where users would attempt to do similar thing - I suspect it would be the same.
We are going to need some way to make a second round of `ThreadContextProvider` discovery, or perhaps feed that information directly into `SmallRyeContextManager`?
Ccing @FroMage | c431989b599ac3e68ccf42079c420128a102a0f3 | 7bddfa01156575bf218ea286f367f5ac9ac8b206 | https://github.com/quarkusio/quarkus/compare/c431989b599ac3e68ccf42079c420128a102a0f3...7bddfa01156575bf218ea286f367f5ac9ac8b206 | diff --git a/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java b/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
index 8d68e10e984..2bb1531edd0 100644
--- a/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
+++ b/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
@@ -38,7 +38,7 @@ void buildStatic(SmallRyeContextPropagationRecorder recorder)
throws ClassNotFoundException, IOException {
List<ThreadContextProvider> discoveredProviders = new ArrayList<>();
List<ContextManagerExtension> discoveredExtensions = new ArrayList<>();
- for (Class<?> provider : ServiceUtil.classesNamedIn(SmallRyeContextPropagationRecorder.class.getClassLoader(),
+ for (Class<?> provider : ServiceUtil.classesNamedIn(Thread.currentThread().getContextClassLoader(),
"META-INF/services/" + ThreadContextProvider.class.getName())) {
try {
discoveredProviders.add((ThreadContextProvider) provider.newInstance());
@@ -47,7 +47,7 @@ void buildStatic(SmallRyeContextPropagationRecorder recorder)
e);
}
}
- for (Class<?> extension : ServiceUtil.classesNamedIn(SmallRyeContextPropagationRecorder.class.getClassLoader(),
+ for (Class<?> extension : ServiceUtil.classesNamedIn(Thread.currentThread().getContextClassLoader(),
"META-INF/services/" + ContextManagerExtension.class.getName())) {
try {
discoveredExtensions.add((ContextManagerExtension) extension.newInstance()); | ['extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 4,762,985 | 919,386 | 122,191 | 1,229 | 459 | 82 | 4 | 1 | 1,210 | 132 | 270 | 11 | 2 | 0 | 2019-09-12T07:34: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,204 | quarkusio/quarkus/4813/4812 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4812 | https://github.com/quarkusio/quarkus/pull/4813 | https://github.com/quarkusio/quarkus/pull/4813 | 1 | fixes | Hibernate ORM with Panache not shown as installed features | **Describe the bug**
When using Hibernate ORM with Panache extension, the Installed features list displayed on the log didn't show `hibernate_orm-panache`.
**Expected behavior**
`hibernate_orm-panache` extension is shown in the extension list
**To Reproduce**
Steps to reproduce the behavior:
1. Start an apps with Hibernate ORM with Panache
**Environment (please complete the following information):**
- Quarkus version or git rev: 0.25.0 or master
**Additional context**
The deployment module of Hibernate ORM with Panache is missing a `FeatureBuildItem`.
I will provide a PR to fix this. | a225ca1494dd8d12932e081a6c35f2cfda4c9c3a | 5c08f49046bce710fdd792a92d10711080272547 | https://github.com/quarkusio/quarkus/compare/a225ca1494dd8d12932e081a6c35f2cfda4c9c3a...5c08f49046bce710fdd792a92d10711080272547 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/FeatureBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/FeatureBuildItem.java
index f5c16e4b988..f5bf2d9f167 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/FeatureBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/FeatureBuildItem.java
@@ -17,6 +17,7 @@ public final class FeatureBuildItem extends MultiBuildItem {
public static final String ELASTICSEARCH_REST_CLIENT = "elasticsearch-rest-client";
public static final String FLYWAY = "flyway";
public static final String HIBERNATE_ORM = "hibernate-orm";
+ public static final String HIBERNATE_ORM_PANACHE = "hibernate-orm-panache";
public static final String HIBERNATE_VALIDATOR = "hibernate-validator";
public static final String HIBERNATE_SEARCH_ELASTICSEARCH = "hibernate-search-elasticsearch";
public static final String INFINISPAN_CLIENT = "infinispan-client";
diff --git a/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheResourceProcessor.java b/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheResourceProcessor.java
index eb88f820552..bbfb8146778 100644
--- a/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheResourceProcessor.java
+++ b/extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheResourceProcessor.java
@@ -19,6 +19,7 @@
import io.quarkus.deployment.builditem.ApplicationIndexBuildItem;
import io.quarkus.deployment.builditem.BytecodeTransformerBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.hibernate.orm.deployment.AdditionalJpaModelBuildItem;
import io.quarkus.hibernate.orm.deployment.HibernateEnhancersRegisteredBuildItem;
import io.quarkus.hibernate.orm.panache.PanacheEntity;
@@ -40,6 +41,11 @@ public final class PanacheResourceProcessor {
private static final Set<DotName> UNREMOVABLE_BEANS = Collections.singleton(
DotName.createSimple(EntityManager.class.getName()));
+ @BuildStep
+ FeatureBuildItem featureBuildItem() {
+ return new FeatureBuildItem(FeatureBuildItem.HIBERNATE_ORM_PANACHE);
+ }
+
@BuildStep
List<AdditionalJpaModelBuildItem> produceModel() {
// only useful for the index resolution: hibernate will register it to be transformed, but BuildMojo | ['extensions/panache/hibernate-orm-panache/deployment/src/main/java/io/quarkus/hibernate/orm/panache/deployment/PanacheResourceProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/FeatureBuildItem.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,583,227 | 1,083,675 | 143,978 | 1,493 | 283 | 74 | 7 | 2 | 612 | 84 | 140 | 17 | 0 | 0 | 2019-10-23T15:54: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,203 | quarkusio/quarkus/4840/4838 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4838 | https://github.com/quarkusio/quarkus/pull/4840 | https://github.com/quarkusio/quarkus/pull/4840 | 1 | fixes | HttpAuthenticationMechanism.ChallengeSender.apply - return true instead of null | HttpAuthenticationMechanism.ChallengeSender.apply should probably return `true` instead of `null`
Issue for the discussion https://github.com/quarkusio/quarkus/commit/8f39da48551c27b6e3debc7b5683a704c74f8957#r35642382 | 7e5a87ab42e602949233a4f74b4879010fb7f2d4 | 0329b94b464bc81a5f98f5c1fa0357f33275ba4f | https://github.com/quarkusio/quarkus/compare/7e5a87ab42e602949233a4f74b4879010fb7f2d4...0329b94b464bc81a5f98f5c1fa0357f33275ba4f | diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java
index 47af0f20216..fccef05e13d 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java
@@ -37,7 +37,7 @@ public Boolean apply(ChallengeData challengeData) {
if (challengeData.headerName != null) {
context.response().headers().set(challengeData.headerName, challengeData.headerContent);
}
- return null;
+ return true;
}
}
} | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpAuthenticationMechanism.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,586,810 | 1,084,538 | 143,994 | 1,493 | 51 | 8 | 2 | 1 | 220 | 13 | 68 | 3 | 1 | 0 | 2019-10-24T13:56: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,202 | quarkusio/quarkus/4899/4778 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4778 | https://github.com/quarkusio/quarkus/pull/4899 | https://github.com/quarkusio/quarkus/pull/4899 | 1 | fixes | gradle listExtensions displays mvn instructions | **Describe the bug**
In a project generated with Gradle, run `gradle listExtensions`. You should see in the end the following message:
```
To get more information, append -Dquarkus.extension.format=full to your command line.
Add an extension to your project by adding the dependency to your project or use `mvn quarkus:add-extension -Dextensions="artifactId"`
```
**Expected behavior**
The message should be:
```
To get more information, append <something> to your command line.
Add an extension to your project by adding the dependency to your project or use `gradle addExtension --extensions="artifactId"`
```
**Actual behavior**
It is not
**To Reproduce**
Steps to reproduce the behavior:
1.
```
mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create -DprojectGroupId=org.acme -DprojectArtifactId=foo -DclassName="org.acme.quickstart.GreetingResource" -Dpath="/hello" -Dextensions="resteasy" -DbuildTool=gradle
```
2. `cd foo & ./gradlew listExtensions`
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
```
Linux ggastald-laptop 5.3.6-200.fc30.x86_64 #1 SMP Mon Oct 14 13:11:01 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
```
- Output of `java -version`:
```
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_212-b03)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.212-b03, mixed mode)
```
- GraalVM version (if different from Java): unused
- Quarkus version or git rev: master
**Additional context**
The stacktrace shown in the beginning is already covered in #4705
| c6625e95d46fc3b3510b443291d85215fa072624 | f6388e08841129df8a50a92ad0bd0498b9a35660 | https://github.com/quarkusio/quarkus/compare/c6625e95d46fc3b3510b443291d85215fa072624...f6388e08841129df8a50a92ad0bd0498b9a35660 | diff --git a/independent-projects/tools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java b/independent-projects/tools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java
index bcbd5c86433..96baee635ac 100644
--- a/independent-projects/tools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java
+++ b/independent-projects/tools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java
@@ -16,6 +16,7 @@
import org.apache.maven.model.Dependency;
import io.quarkus.cli.commands.file.BuildFile;
+import io.quarkus.cli.commands.file.GradleBuildFile;
import io.quarkus.dependencies.Extension;
public class ListExtensions {
@@ -63,11 +64,22 @@ public void listExtensions(boolean all, String format, String search) throws IOE
loadedExtensions.forEach(extension -> display(extension, installed, all, currentFormatter));
if ("concise".equalsIgnoreCase(format)) {
- System.out.println("\\nTo get more information, append -Dquarkus.extension.format=full to your command line.");
+ if (this.buildFile instanceof GradleBuildFile) {
+ System.out.println("\\nTo get more information, append --format=full to your command line.");
+ }
+ else {
+ System.out.println("\\nTo get more information, append -Dquarkus.extension.format=full to your command line.");
+ }
}
- System.out.println("\\nAdd an extension to your project by adding the dependency to your " +
- "project or use `mvn quarkus:add-extension -Dextensions=\\"artifactId\\"`");
+ if (this.buildFile instanceof GradleBuildFile) {
+ System.out.println("\\nAdd an extension to your project by adding the dependency to your " +
+ "build.gradle or use `./gradlew addExtension --extensions=\\"artifactId\\"`");
+ }
+ else {
+ System.out.println("\\nAdd an extension to your project by adding the dependency to your " +
+ "pom.xml or use `./mvnw quarkus:add-extension -Dextensions=\\"artifactId\\"`");
+ }
}
}
| ['independent-projects/tools/common/src/main/java/io/quarkus/cli/commands/ListExtensions.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,740,360 | 1,113,598 | 148,368 | 1,527 | 1,261 | 256 | 18 | 1 | 1,613 | 197 | 448 | 47 | 0 | 5 | 2019-10-27T08:12: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,184 | quarkusio/quarkus/5502/5501 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5501 | https://github.com/quarkusio/quarkus/pull/5502 | https://github.com/quarkusio/quarkus/pull/5502 | 1 | fixes | Platform resolver fails in offline mode when the local repo contains metadata but not the artifacts | In that case, the resolver is able to determine the latest version of the platform but fails to actually resolve it.
Unless the user has requested explicitly the desired platform coordinates, the agreed upon behavior in this case is to log a warn and fallback to the platform bundled with the tools. | 18b4bd11e39530ab0fb134f6c0e06e79a9758dbe | 44b0146b90ce83269c30c1e6df7ac597b13e24f3 | https://github.com/quarkusio/quarkus/compare/18b4bd11e39530ab0fb134f6c0e06e79a9758dbe...44b0146b90ce83269c30c1e6df7ac597b13e24f3 | diff --git a/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java b/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java
index 28a289f6320..f1e0da1587b 100644
--- a/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java
+++ b/independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java
@@ -206,8 +206,8 @@ private QuarkusPlatformDescriptor resolveJsonDescriptor(AppModelResolver artifac
return resolveJsonArtifactFromArgs(artifactResolver);
} catch (VersionNotAvailableException e) {
final QuarkusPlatformDescriptor platform = resolveJsonArtifactFromBom(artifactResolver);
- log.warn(e.getLocalizedMessage() + ", falling back to bundled " + platform.getBomGroupId()
- + ":" + platform.getBomArtifactId() + "::pom:" + platform.getBomVersion() + " based on Quarkus "
+ log.warn(e.getLocalizedMessage() + ", falling back to the bundled platform based on " + platform.getBomGroupId()
+ + ":" + platform.getBomArtifactId() + "::pom:" + platform.getBomVersion() + " and Quarkus version "
+ platform.getQuarkusVersion());
return platform;
}
@@ -221,11 +221,21 @@ private QuarkusPlatformDescriptor resolveJsonArtifactFromArgs(AppModelResolver a
String jsonGroupId = this.jsonGroupId;
String jsonArtifactId = this.jsonArtifactId;
String jsonVersion = this.jsonVersion;
+ // If some of the coordinates are missing, we are trying the default ones
+ int defaultCoords = 0;
if (jsonGroupId == null) {
- jsonGroupId = getProperty(PROP_PLATFORM_JSON_GROUP_ID, ToolsConstants.DEFAULT_PLATFORM_BOM_GROUP_ID);
+ jsonGroupId = getProperty(PROP_PLATFORM_JSON_GROUP_ID);
+ if(jsonGroupId == null) {
+ jsonGroupId = ToolsConstants.DEFAULT_PLATFORM_BOM_GROUP_ID;
+ ++defaultCoords;
+ }
}
if (jsonArtifactId == null) {
- jsonArtifactId = getProperty(PROP_PLATFORM_JSON_ARTIFACT_ID, ToolsConstants.DEFAULT_PLATFORM_BOM_ARTIFACT_ID);
+ jsonArtifactId = getProperty(PROP_PLATFORM_JSON_ARTIFACT_ID);
+ if(jsonArtifactId == null) {
+ jsonArtifactId = ToolsConstants.DEFAULT_PLATFORM_BOM_ARTIFACT_ID;
+ ++defaultCoords;
+ }
}
if (jsonVersion == null) {
if (jsonVersionRange != null) {
@@ -240,11 +250,21 @@ private QuarkusPlatformDescriptor resolveJsonArtifactFromArgs(AppModelResolver a
} else {
jsonVersion = getProperty(PROP_PLATFORM_JSON_VERSION);
if (jsonVersion == null) {
- jsonVersion = resolveLatestJsonVersion(artifactResolver, jsonGroupId, jsonArtifactId, jsonVersionRange);
+ jsonVersion = resolveLatestJsonVersion(artifactResolver, jsonGroupId, jsonArtifactId, null);
+ ++defaultCoords;
}
}
}
- return loadFromJsonArtifact(artifactResolver, new AppArtifact(jsonGroupId, jsonArtifactId, null, "json", jsonVersion));
+ try {
+ return loadFromJsonArtifact(artifactResolver,
+ new AppArtifact(jsonGroupId, jsonArtifactId, null, "json", jsonVersion));
+ } catch (VersionNotAvailableException e) {
+ if(defaultCoords == 3) {
+ // complete coords were the default ones, so we can re-throw and try the bundled platform
+ throw e;
+ }
+ throw new IllegalStateException("Failed to resolve the JSON artifact with the requested coordinates", e);
+ }
}
private QuarkusPlatformDescriptor resolveJsonArtifactFromBom(AppModelResolver artifactResolver) throws PlatformDescriptorLoadingException {
@@ -264,31 +284,56 @@ private QuarkusPlatformDescriptor resolveJsonArtifactFromBom(AppModelResolver ar
String bomVersion = this.bomVersion;
try {
return loadFromBomCoords(artifactResolver, bomGroupId, bomArtifactId, bomVersion, null);
- } catch(Exception e) {
+ } catch(VersionNotAvailableException e) {
if (!tryingDefaultCoords) {
- throw e;
+ throw new IllegalStateException("Failed to resolve the platform BOM using the provided coordinates", e);
}
- log.debug("Failed to resolve the default BOM coordinates, falling back to the bundled platform artifacts");
+ log.debug("Failed to resolve Quarkus platform BOM using the default coordinates, falling back to the bundled Quarkus platform artifacts");
}
Model bundledBom = loadBundledPom();
- bomGroupId = this.bomGroupId == null ? getGroupId(bundledBom) : this.bomGroupId;
+ bomGroupId = this.bomGroupId;
+ if(bomGroupId != null) {
+ if(!bomGroupId.equals(getGroupId(bundledBom))) {
+ throw new IllegalStateException("Failed to resolve Quarkus platform BOM with the requested groupId " + bomGroupId);
+ }
+ } else {
+ bomGroupId = getGroupId(bundledBom);
+ }
if(bomGroupId == null) {
failedDetermineDefaultPlatformCoords();
}
- bomArtifactId = this.bomArtifactId == null ? getArtifactId(bundledBom) : this.bomArtifactId;
+
+ bomArtifactId = this.bomArtifactId;
+ if(bomArtifactId != null) {
+ if(!bomArtifactId.equals(getArtifactId(bundledBom))) {
+ throw new IllegalStateException("Failed to resolve Quarkus platform BOM with the requested artifactId " + bomArtifactId);
+ }
+ } else {
+ bomArtifactId = getArtifactId(bundledBom);
+ }
if(bomArtifactId == null) {
failedDetermineDefaultPlatformCoords();
}
+
bomVersion = this.bomVersion;
- if(bomVersion == null && this.bomVersionRange == null) {
+ if(bomVersion != null) {
+ if(!bomVersion.equals(getVersion(bundledBom))) {
+ throw new IllegalStateException("Failed to resolve Quarkus platform BOM with the requested version " + bomVersion);
+ }
+ } else if(this.bomVersionRange == null) {
bomVersion = getVersion(bundledBom);
}
- return loadFromBomCoords(artifactResolver, bomGroupId, bomArtifactId, bomVersion, bundledBom);
+ try {
+ return loadFromBomCoords(artifactResolver, bomGroupId, bomArtifactId, bomVersion, bundledBom);
+ } catch (VersionNotAvailableException e) {
+ // this should never happen
+ throw new IllegalStateException("Failed to load the bundled platform artifacts", e);
+ }
}
private QuarkusPlatformDescriptor loadFromBomCoords(AppModelResolver artifactResolver, String bomGroupId,
- String bomArtifactId, String bomVersion, Model bundledBom) throws PlatformDescriptorLoadingException {
+ String bomArtifactId, String bomVersion, Model bundledBom) throws PlatformDescriptorLoadingException, VersionNotAvailableException {
if(bomVersion == null) {
String bomVersionRange = this.bomVersionRange;
if(bomVersionRange == null) {
@@ -299,13 +344,13 @@ private QuarkusPlatformDescriptor loadFromBomCoords(AppModelResolver artifactRes
try {
bomVersion = artifactResolver.getLatestVersionFromRange(bomArtifact, bomVersionRange);
} catch (AppModelResolverException e) {
- throw new IllegalStateException("Failed to resolve the latest version of " + bomArtifact, e);
+ throw new VersionNotAvailableException("Failed to resolve the latest version of " + bomArtifact, e);
}
if(bomVersion == null) {
- throw new IllegalStateException("Failed to resolve the latest version of " + bomArtifact);
+ throw new VersionNotAvailableException("Failed to resolve the latest version of " + bomArtifact);
}
}
- log.debug("Resolving Quarkus platform descriptor from %s:%s::pom:%s", bomGroupId, bomArtifactId, bomVersion);
+ log.debug("Resolving Quarkus platform BOM %s:%s::pom:%s", bomGroupId, bomArtifactId, bomVersion);
bundledBom = loadBundledPomIfNull(bundledBom);
// Check whether the BOM on the classpath is matching the requested one
@@ -338,11 +383,10 @@ private QuarkusPlatformDescriptor loadFromBomCoords(AppModelResolver artifactRes
log.debug("Failed to locate quarkus.properties on the classpath");
}
} else {
- log.debug("Failed to locate Quarkus JSON platform descriptor on the classpath");
+ log.debug("Failed to locate Quarkus platform descriptor on the classpath");
}
}
- // first we are looking for the same GAV as the BOM but with JSON type
return loadFromJsonArtifact(artifactResolver, new AppArtifact(bomGroupId, bomArtifactId, null, "json", bomVersion));
}
@@ -350,21 +394,24 @@ private void failedDetermineDefaultPlatformCoords() {
throw new IllegalStateException("Failed to determine the Maven coordinates of the default Quarkus platform");
}
- private QuarkusPlatformDescriptor loadFromJsonArtifact(AppModelResolver artifactResolver, AppArtifact jsonArtifact) {
+ private QuarkusPlatformDescriptor loadFromJsonArtifact(AppModelResolver artifactResolver, AppArtifact jsonArtifact) throws VersionNotAvailableException {
try {
- log.debug("Attempting to resolve Quarkus JSON platform descriptor as %s", jsonArtifact);
+ log.debug("Attempting to resolve Quarkus platform descriptor %s", jsonArtifact);
return loadFromFile(artifactResolver.resolve(jsonArtifact));
} catch(PlatformDescriptorLoadingException e) {
- throw new IllegalStateException("Failed to load Quarkus platform descriptor from " + jsonArtifact, e);
+ // the artifact was successfully resolved but processing of it has failed
+ throw new IllegalStateException("Failed to load Quarkus platform descriptor " + jsonArtifact, e);
} catch (Exception e) {
- log.debug("Failed to resolve %s due to %s", jsonArtifact, e);
+ log.debug("Failed to load %s due to %s", jsonArtifact, e.getLocalizedMessage());
// it didn't work, now we are trying artifactId-descriptor-json
final AppArtifact fallbackArtifact = new AppArtifact(jsonArtifact.getGroupId(), jsonArtifact.getArtifactId() + "-descriptor-json", null, "json", jsonArtifact.getVersion());
- log.debug("Attempting to resolve Quarkus JSON platform descriptor as %s", fallbackArtifact);
+ log.debug("Attempting to resolve Quarkus platform descriptor %s", fallbackArtifact);
try {
return loadFromFile(artifactResolver.resolve(fallbackArtifact));
- } catch (Exception e1) {
- throw new IllegalStateException("Failed to resolve the JSON descriptor artifact as " + jsonArtifact, e);
+ } catch (AppModelResolverException e1) {
+ throw new VersionNotAvailableException("Failed to resolve Quarkus platform descriptor " + jsonArtifact, e);
+ } catch(Exception e2) {
+ throw new IllegalStateException("Failed to load Quarkus platform descriptor " + jsonArtifact, e);
}
}
}
@@ -399,7 +446,7 @@ private QuarkusPlatformDescriptor loadPlatformDescriptor(AppModelResolver mvn, f
boolean externalLoader = false;
if(jsonDescrLoaderCl == null) {
final AppArtifact jsonDescrArtifact = new AppArtifact(ToolsConstants.IO_QUARKUS, "quarkus-platform-descriptor-json", null, "jar", quarkusCoreVersion);
- log.debug("Resolving Quarkus JSON platform descriptor loader from %s", jsonDescrArtifact);
+ log.debug("Resolving Quarkus JSON platform descriptor loader %s", jsonDescrArtifact);
final URL jsonDescrUrl;
try {
final Path path = mvn.resolve(jsonDescrArtifact);
@@ -500,7 +547,7 @@ private String resolveLatestJsonVersion(AppModelResolver artifactResolver, Strin
private String resolveLatestFromVersionRange(AppModelResolver mvn, String groupId, String artifactId, String classifier, String type, final String versionRange)
throws AppModelResolverException, VersionNotAvailableException {
final AppArtifact appArtifact = new AppArtifact(groupId, artifactId, classifier, type, versionRange);
- log.debug("Resolving the latest version of " + appArtifact);
+ log.debug("Resolving the latest version of %s", appArtifact);
final String latestVersion = mvn.getLatestVersionFromRange(appArtifact, versionRange);
if(latestVersion == null) {
throw new VersionNotAvailableException("Failed to resolve the latest version of " + appArtifact); | ['independent-projects/tools/platform-descriptor-resolver-json/src/main/java/io/quarkus/platform/descriptor/resolver/json/QuarkusJsonPlatformDescriptorResolver.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,924,927 | 1,148,597 | 152,883 | 1,582 | 7,701 | 1,545 | 103 | 1 | 300 | 52 | 56 | 2 | 0 | 0 | 2019-11-15T00:16: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,185 | quarkusio/quarkus/5466/3311 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3311 | https://github.com/quarkusio/quarkus/pull/5466 | https://github.com/quarkusio/quarkus/pull/5466 | 1 | resolves | ArC removes indirect referenced beans | Quarkus in version 19.1 removes indirect referenced beans.
Lets have following scenario. You define an interface for your strategies and an services that depending on any argument, returns the appropriate strategy. These strategies are defined as beans. As these beans are not referenced directly with injections, but only through the interface, the are removed by ArC. The only way to fix it, is by setting `quarkus.arc.remove-unused-beans=false`
```java
public interface Exporter<T extends Exportable> {
boolean accept(Class<T> clazz);
String export(T object);
}
@ApplicationScoped
public class ApplicationExporter implements Exporter<Application> {
boolean accept(Class<Application> clazz) { return clazz instanceof Application; }
String export(Application application) {
...
}
}
@ApplicationScoped
public class ExporterService {
@Inject
Instance<Exporter<? extends Exportable>> exporters;
public <T>Exporter<T> getExporter(Class<T> exporterClazz) {
// BUG: exporters are empty!
return StreamSupport.stream(exporters.spliterator(), false)
.filter(exporter -> exporter.accept(exporterClazz))
.findFirst().orElseThrow(...);
}
}
```
If there is an `@Inject javax.enterprise.inject.Instance<T>` Quarkus (ArC) should keep all classes implementing `T`. | fe5a40bd9dcab5dfc70421ee3a2f5095679fd639 | d7397dfd82e6ed2ff9a4830d00dda4c295070e78 | https://github.com/quarkusio/quarkus/compare/fe5a40bd9dcab5dfc70421ee3a2f5095679fd639...d7397dfd82e6ed2ff9a4830d00dda4c295070e78 | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanResolver.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanResolver.java
index f2e494f0000..ee0aac6d692 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanResolver.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanResolver.java
@@ -125,6 +125,8 @@ boolean matchesNoBoxing(Type requiredType, Type beanType) {
}
return true;
}
+ } else if (WILDCARD_TYPE.equals(requiredType.kind())) {
+ return parametersMatch(requiredType, beanType);
}
return false;
}
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 fc3f720bebe..974fde05bdb 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
@@ -28,7 +28,9 @@ public class RemoveUnusedBeansTest {
@RegisterExtension
public ArcTestContainer container = ArcTestContainer.builder()
.beanClasses(HasObserver.class, Foo.class, FooAlternative.class, HasName.class, UnusedProducers.class,
- InjectedViaInstance.class, InjectedViaProvider.class, Excluded.class, UsedProducers.class,
+ InjectedViaInstance.class, InjectedViaInstanceWithWildcard.class, InjectedViaInstanceWithWildcard2.class,
+ InjectedViaProvider.class, Excluded.class,
+ UsedProducers.class,
UnusedProducerButInjected.class, UsedViaInstanceWithUnusedProducer.class, UsesBeanViaInstance.class)
.removeUnusedBeans(true)
.addRemovalExclusion(b -> b.getBeanClass().toString().equals(Excluded.class.getName()))
@@ -40,6 +42,8 @@ public void testRemoval() {
assertTrue(container.instance(HasObserver.class).isAvailable());
assertTrue(container.instance(HasName.class).isAvailable());
assertTrue(container.instance(InjectedViaInstance.class).isAvailable());
+ assertTrue(container.instance(InjectedViaInstanceWithWildcard.class).isAvailable());
+ assertTrue(container.instance(InjectedViaInstanceWithWildcard2.class).isAvailable());
assertTrue(container.instance(InjectedViaProvider.class).isAvailable());
assertTrue(container.instance(String.class).isAvailable());
assertTrue(container.instance(UsedProducers.class).isAvailable());
@@ -96,6 +100,12 @@ static class FooAlternative extends Foo {
@Inject
Instance<InjectedViaInstance> instance;
+ @Inject
+ Instance<? extends InjectedViaInstanceWithWildcard> instanceWildcard;
+
+ @Inject
+ Instance<Comparable<? extends Foo>> instanceWildcard2;
+
@Inject
String foo;
@@ -106,6 +116,21 @@ static class InjectedViaInstance {
}
+ @Singleton
+ static class InjectedViaInstanceWithWildcard {
+
+ }
+
+ @Singleton
+ static class InjectedViaInstanceWithWildcard2 implements Comparable<FooAlternative> {
+
+ @Override
+ public int compareTo(FooAlternative o) {
+ return 0;
+ }
+
+ }
+
@Singleton
static class InjectedViaProvider {
| ['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/BeanResolver.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,927,786 | 1,149,110 | 152,945 | 1,582 | 125 | 26 | 2 | 1 | 1,348 | 147 | 281 | 32 | 0 | 1 | 2019-11-14T10:29: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,187 | quarkusio/quarkus/5415/5406 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5406 | https://github.com/quarkusio/quarkus/pull/5415 | https://github.com/quarkusio/quarkus/pull/5415 | 2 | fixes | Spring data Jpa extension : sort with Pageable does not work | When I use the extension of spring data Jpa, the sort with Pageable does not work.
This is my exp:
```
@GET
@Produces("application/json")
public List<Fruit> findAll() {
return fruitRepository.findAll(PageRequest.of(0,3, Sort.by(Sort.Direction.DESC, "id"))).getContent();
}
```
the method sort does not work as if it does not exist | c4f1b99bcbe7f7fd5811e463f4a4af76f35dceb1 | 09bc0f97c7308d47c2730594c99bdc6eda6fc812 | https://github.com/quarkusio/quarkus/compare/c4f1b99bcbe7f7fd5811e463f4a4af76f35dceb1...09bc0f97c7308d47c2730594c99bdc6eda6fc812 | diff --git a/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java b/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java
index 5f2dae7036f..a5b7438866c 100644
--- a/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java
+++ b/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java
@@ -10,6 +10,8 @@
import org.jboss.jandex.IndexView;
import org.jboss.jandex.MethodInfo;
import org.jboss.jandex.Type;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
import io.quarkus.gizmo.ClassCreator;
import io.quarkus.gizmo.FieldDescriptor;
@@ -106,6 +108,16 @@ public void add(ClassCreator classCreator, FieldDescriptor entityClassFieldDescr
methodCreator.getMethodParam(sortParameterIndex));
} else if (parseResult.getSort() != null) {
finalQuery += JpaOperations.toOrderBy(parseResult.getSort());
+ } else if (pageableParameterIndex != null) {
+ ResultHandle pageable = methodCreator.getMethodParam(pageableParameterIndex);
+ ResultHandle pageableSort = methodCreator.invokeInterfaceMethod(
+ MethodDescriptor.ofMethod(Pageable.class, "getSort", Sort.class),
+ pageable);
+ sort = methodCreator.invokeStaticMethod(
+ MethodDescriptor.ofMethod(TypesConverter.class, "toPanacheSort",
+ io.quarkus.panache.common.Sort.class,
+ org.springframework.data.domain.Sort.class),
+ pageableSort);
}
// call JpaOperations.find()
diff --git a/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/StockMethodsAdder.java b/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/StockMethodsAdder.java
index 5da885919f0..6ab5c4bf3fd 100644
--- a/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/StockMethodsAdder.java
+++ b/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/StockMethodsAdder.java
@@ -33,6 +33,7 @@
import org.springframework.data.domain.Sort;
import io.quarkus.deployment.bean.JavaBeanUtil;
+import io.quarkus.gizmo.AssignableResultHandle;
import io.quarkus.gizmo.BranchResult;
import io.quarkus.gizmo.BytecodeCreator;
import io.quarkus.gizmo.ClassCreator;
@@ -544,17 +545,44 @@ private void generateFindAllWithPageable(ClassCreator classCreator, FieldDescrip
"(Lorg/springframework/data/domain/Pageable;)Lorg/springframework/data/domain/Page<L%s;>;",
entityTypeStr.replace('.', '/')));
- ResultHandle page = findAll.invokeStaticMethod(
+ ResultHandle pageable = findAll.getMethodParam(0);
+ ResultHandle pageableSort = findAll.invokeInterfaceMethod(
+ MethodDescriptor.ofMethod(Pageable.class, "getSort", Sort.class),
+ pageable);
+
+ ResultHandle panachePage = findAll.invokeStaticMethod(
MethodDescriptor.ofMethod(TypesConverter.class, "toPanachePage",
io.quarkus.panache.common.Page.class, Pageable.class),
- findAll.getMethodParam(0));
- ResultHandle panacheQuery = findAll.invokeStaticMethod(
+ pageable);
+ ResultHandle panacheSort = findAll.invokeStaticMethod(
+ MethodDescriptor.ofMethod(TypesConverter.class, "toPanacheSort",
+ io.quarkus.panache.common.Sort.class,
+ org.springframework.data.domain.Sort.class),
+ pageableSort);
+
+ // depending on whether there was a io.quarkus.panache.common.Sort returned, we need to execute a different findAll method
+ BranchResult sortNullBranch = findAll.ifNull(panacheSort);
+ BytecodeCreator sortNullTrue = sortNullBranch.trueBranch();
+ BytecodeCreator sortNullFalse = sortNullBranch.falseBranch();
+ AssignableResultHandle panacheQueryVar = findAll.createVariable(PanacheQuery.class);
+
+ ResultHandle panacheQueryWithoutSort = sortNullTrue.invokeStaticMethod(
ofMethod(JpaOperations.class, "findAll", PanacheQuery.class, Class.class),
- findAll.readInstanceField(entityClassFieldDescriptor, findAll.getThis()));
- panacheQuery = findAll.invokeInterfaceMethod(
+ sortNullTrue.readInstanceField(entityClassFieldDescriptor, sortNullTrue.getThis()));
+ sortNullTrue.assign(panacheQueryVar, panacheQueryWithoutSort);
+ sortNullTrue.breakScope();
+
+ ResultHandle panacheQueryWithSort = sortNullFalse.invokeStaticMethod(
+ ofMethod(JpaOperations.class, "findAll", PanacheQuery.class, Class.class,
+ io.quarkus.panache.common.Sort.class),
+ sortNullFalse.readInstanceField(entityClassFieldDescriptor, sortNullFalse.getThis()), panacheSort);
+ sortNullFalse.assign(panacheQueryVar, panacheQueryWithSort);
+ sortNullFalse.breakScope();
+
+ ResultHandle panacheQuery = findAll.invokeInterfaceMethod(
MethodDescriptor.ofMethod(PanacheQuery.class, "page", PanacheQuery.class,
io.quarkus.panache.common.Page.class),
- panacheQuery, page);
+ panacheQueryVar, panachePage);
ResultHandle list = findAll.invokeInterfaceMethod(
MethodDescriptor.ofMethod(PanacheQuery.class, "list", List.class),
panacheQuery);
diff --git a/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/CountryResource.java b/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/CountryResource.java
index 85b35b227ae..4a7ef5cde54 100644
--- a/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/CountryResource.java
+++ b/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/CountryResource.java
@@ -2,6 +2,7 @@
import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
import javax.persistence.NoResultException;
import javax.ws.rs.GET;
@@ -36,6 +37,14 @@ public String page(@PathParam("size") int pageSize, @PathParam("num") int pageNu
return page.hasPrevious() + " - " + page.hasNext() + " / " + page.getNumberOfElements();
}
+ @GET
+ @Path("/page-sorted/{size}/{num}")
+ @Produces("text/plain")
+ public String pageSorted(@PathParam("size") int pageSize, @PathParam("num") int pageNum) {
+ Page<Country> page = countryRepository.findAll(PageRequest.of(pageNum, pageSize, Sort.by(Sort.Direction.DESC, "id")));
+ return page.stream().map(Country::getId).map(Object::toString).collect(Collectors.joining(","));
+ }
+
@GET
@Path("/new/{name}/{iso3}")
@Produces("application/json")
diff --git a/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonRepository.java b/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonRepository.java
index b72e83d7ae5..7d1a90dafe0 100644
--- a/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonRepository.java
+++ b/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonRepository.java
@@ -17,6 +17,8 @@ public interface PersonRepository extends CrudRepository<Person, Long>, PersonFr
List<Person> findByName(String name);
+ List<Person> findByName(String name, Pageable pageable);
+
List<Person> findByName(String name, Sort sort);
Page<Person> findByNameOrderByJoined(String name, Pageable pageable);
diff --git a/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonResource.java b/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonResource.java
index 1968e34fa28..0d5f1554f42 100644
--- a/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonResource.java
+++ b/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonResource.java
@@ -122,6 +122,14 @@ public List<Person> byName(@PathParam("name") String name) {
return personRepository.findByName(name);
}
+ @GET
+ @Path("/name-pageable/{name}")
+ @Produces("text/plain")
+ public String byNamePageable(@PathParam("name") String name) {
+ return personRepository.findByName(name, PageRequest.of(0, 2, Sort.by(new Sort.Order(Sort.Direction.DESC, "id"))))
+ .stream().map(Person::getId).map(Object::toString).collect(Collectors.joining(","));
+ }
+
@GET
@Path("/name/joinedOrder/{name}/page/{size}/{num}")
public String byNamePage(@PathParam("name") String name, @PathParam("size") int pageSize, @PathParam("num") int pageNum) {
diff --git a/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/CountryResourceTest.java b/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/CountryResourceTest.java
index 7627826f415..d7325850560 100644
--- a/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/CountryResourceTest.java
+++ b/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/CountryResourceTest.java
@@ -9,9 +9,11 @@
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.stream.Collectors;
import org.junit.jupiter.api.Test;
@@ -53,6 +55,15 @@ void testPage() {
.body(is("true - false / 0"));
}
+ @Test
+ void testPageSorted() {
+ String response = when().get("/country/page-sorted/2/0").then()
+ .statusCode(200)
+ .extract().response().asString();
+ assertThat(Arrays.stream(response.split(",")).map(Long::parseLong).collect(Collectors.toList()))
+ .isSortedAccordingTo(Comparator.reverseOrder());
+ }
+
@Test
void testGetOne() {
when().get("/country/getOne/1").then()
diff --git a/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/PersonResourceTest.java b/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/PersonResourceTest.java
index 1e0308fd469..7e5a7cdc8a3 100644
--- a/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/PersonResourceTest.java
+++ b/integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/PersonResourceTest.java
@@ -7,6 +7,7 @@
import static org.hamcrest.Matchers.is;
import java.util.Arrays;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -73,6 +74,15 @@ void testFindByName() {
.body("size()", is(3));
}
+ @Test
+ void testFindByNamePageSorted() {
+ String response = when().get("/person/name-pageable/DeMar").then()
+ .statusCode(200)
+ .extract().response().asString();
+ assertThat(Arrays.stream(response.split(",")).map(Long::parseLong).collect(Collectors.toList()))
+ .isSortedAccordingTo(Comparator.reverseOrder());
+ }
+
@Test
void testFindBySortedByJoinedDesc() {
List<Person> people = when().get("/person/name/DeMar/order/joined").then() | ['extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/StockMethodsAdder.java', 'integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/PersonResourceTest.java', 'integration-tests/spring-data-jpa/src/test/java/io/quarkus/it/spring/data/jpa/CountryResourceTest.java', 'integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonResource.java', 'integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonRepository.java', 'extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/DerivedMethodsAdder.java', 'integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/CountryResource.java'] | {'.java': 7} | 7 | 7 | 0 | 0 | 7 | 5,894,856 | 1,142,912 | 152,212 | 1,571 | 3,633 | 562 | 52 | 2 | 367 | 45 | 89 | 13 | 0 | 1 | 2019-11-12T17:32: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,188 | quarkusio/quarkus/5396/5373 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5373 | https://github.com/quarkusio/quarkus/pull/5396 | https://github.com/quarkusio/quarkus/pull/5396 | 1 | resolves | @InterceptorBinding no longer recognized/fired when they have additional fields | This interceptor binding is working fine, if there is an interceptor (having @Priority annotation or not, @AroundInvoke gets fired wherever @StorageThreadSession is annotated):
```
@Target({TYPE, METHOD})
@Retention(RUNTIME)
@InterceptorBinding
public @interface StorageThreadSession {
}
```
adding a field to the binding definition, @AroundInvoke stops working, it seems the interceptor binding is not recognized at all in this case:
```
@Target({TYPE, METHOD})
@Retention(RUNTIME)
@InterceptorBinding
public @interface StorageThreadSession {
Class qualifier() default Object.class;
}
```
I can split up my annotation but I don't think that this is the desired behaviour. | 17faac6ceef7c286bd94be0c82c814a7a6f28b82 | 3bddda8d432754a505a37ac88ffd16c73bce7fff | https://github.com/quarkusio/quarkus/compare/17faac6ceef7c286bd94be0c82c814a7a6f28b82...3bddda8d432754a505a37ac88ffd16c73bce7fff | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorResolver.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorResolver.java
index a56248fa9f4..03b31e778f7 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorResolver.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorResolver.java
@@ -81,7 +81,7 @@ private boolean isInterceptorBinding(AnnotationInstance interceptorBinding, Anno
String annotationField = value.name();
if (!interceptorBindingClass.method(annotationField).hasAnnotation(DotNames.NONBINDING)
&& !nonBindingFields.contains(annotationField)
- && !value.equals(interceptorBinding.value(annotationField))) {
+ && !value.equals(interceptorBinding.valueWithDefault(beanDeployment.getIndex(), annotationField))) {
matches = false;
break;
}
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/bindingdefaultvalue/BindingDefaultValueTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/bindingdefaultvalue/BindingDefaultValueTest.java
index ef050f8241c..04e98fc52a5 100644
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/bindingdefaultvalue/BindingDefaultValueTest.java
+++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/bindingdefaultvalue/BindingDefaultValueTest.java
@@ -37,7 +37,7 @@ String ping() {
}
- @MyTransactional("alpha")
+ @MyTransactional
@Priority(1)
@Interceptor
public static class AlphaInterceptor { | ['independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/interceptors/bindingdefaultvalue/BindingDefaultValueTest.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorResolver.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,901,752 | 1,144,128 | 152,351 | 1,572 | 213 | 32 | 2 | 1 | 701 | 88 | 145 | 23 | 0 | 2 | 2019-11-12T09:53: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,189 | quarkusio/quarkus/5347/5317 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5317 | https://github.com/quarkusio/quarkus/pull/5347 | https://github.com/quarkusio/quarkus/pull/5347 | 2 | fixes | Exception when using a custom interface in Spring Data JPA | Mentioned in #4104, the issue is still in 1.0.0.CR1.
Repository codes https://github.com/hantsy/quarkus-sandbox/blob/master/spring-post-service/src/main/java/com/example/PostRepository.java#L6
```bash
12:31:52,971 ERROR [io.qua.dev.DevModeMain] Failed to start Quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type com.example.PostRepositoryImpl and qualifiers [@Default]
- java member: com.example.PostRepositoryImpl#customImplClass1
- declared on CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- available beans:
- CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- CLASS bean [types=[com.example.PostRepositoryImpl, java.lang.Object, com.example.PostRepositoryCustom], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:850)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:220)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:106)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:251)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type com.example.PostRepositoryImpl and qualifiers [@Default]
- java member: com.example.PostRepositoryImpl#customImplClass1
- declared on CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- available beans:
- CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- CLASS bean [types=[com.example.PostRepositoryImpl, java.lang.Object, com.example.PostRepositoryCustom], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:487)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:404)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:212)
... 14 more
at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:157)
at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:177)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:95)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type com.example.PostRepositoryImpl and qualifiers [@Default]
- java member: com.example.PostRepositoryImpl#customImplClass1
- declared on CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- available beans:
- CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- CLASS bean [types=[com.example.PostRepositoryImpl, java.lang.Object, com.example.PostRepositoryCustom], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:850)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:220)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:106)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:251)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type com.example.PostRepositoryImpl and qualifiers [@Default]
- java member: com.example.PostRepositoryImpl#customImplClass1
- declared on CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- available beans:
- CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- CLASS bean [types=[com.example.PostRepositoryImpl, java.lang.Object, com.example.PostRepositoryCustom], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:487)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:404)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:212)
... 14 more
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:130)
at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:111)
... 3 more
Caused by: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type com.example.PostRepositoryImpl and qualifiers [@Default]
- java member: com.example.PostRepositoryImpl#customImplClass1
- declared on CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- available beans:
- CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- CLASS bean [types=[com.example.PostRepositoryImpl, java.lang.Object, com.example.PostRepositoryCustom], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:850)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:220)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:106)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:251)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$1.execute(ExtensionLoader.java:941)
at io.quarkus.builder.BuildContext.run(BuildContext.java:415)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2011)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1535)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1426)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type com.example.PostRepositoryImpl and qualifiers [@Default]
- java member: com.example.PostRepositoryImpl#customImplClass1
- declared on CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- available beans:
- CLASS bean [types=[com.example.PostRepositoryImpl, org.springframework.data.jpa.repository.JpaRepository<com.example.Post, java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<com.example.Post>, org.springframework.data.repository.CrudRepository<com.example.Post, java.lang.String>, com.example.PostRepository, org.springframework.data.repository.Repository<com.example.Post, java.lang.String>, java.lang.Object, com.example.PostRepositoryCustom, org.springframework.data.repository.PagingAndSortingRepository<com.example.Post, java.lang.String>], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
- CLASS bean [types=[com.example.PostRepositoryImpl, java.lang.Object, com.example.PostRepositoryCustom], qualifiers=[@Default, @Any], target=com.example.PostRepositoryImpl]
at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:487)
at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:404)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:212)
... 14 more
```
| 60be0d9a6c03fe71a572e535bcd041140e58b592 | e476a74d8dad90035ba2d3b811898261e7cad3aa | https://github.com/quarkusio/quarkus/compare/60be0d9a6c03fe71a572e535bcd041140e58b592...e476a74d8dad90035ba2d3b811898261e7cad3aa | diff --git a/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/SpringDataRepositoryCreator.java b/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/SpringDataRepositoryCreator.java
index 7ae0f5aa90c..582a6d404bd 100644
--- a/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/SpringDataRepositoryCreator.java
+++ b/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/SpringDataRepositoryCreator.java
@@ -19,6 +19,7 @@
import org.jboss.jandex.IndexView;
import org.jboss.jandex.Type;
+import io.quarkus.deployment.util.HashUtil;
import io.quarkus.deployment.util.JandexUtil;
import io.quarkus.gizmo.ClassCreator;
import io.quarkus.gizmo.ClassOutput;
@@ -73,10 +74,11 @@ public void implementCrudRepository(ClassInfo repositoryToImplement) {
}
Map<String, FieldDescriptor> fragmentImplNameToFieldDescriptor = new HashMap<>();
- String generatedClassName = repositoryToImplement.name().toString() + "Impl";
+ String repositoryToImplementStr = repositoryToImplement.name().toString();
+ String generatedClassName = repositoryToImplementStr + "_" + HashUtil.sha1(repositoryToImplementStr) + "Impl";
try (ClassCreator classCreator = ClassCreator.builder().classOutput(classOutput)
.className(generatedClassName)
- .interfaces(repositoryToImplement.name().toString())
+ .interfaces(repositoryToImplementStr)
.build()) {
classCreator.addAnnotation(ApplicationScoped.class);
diff --git a/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonFragmentImpl.java b/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonRepositoryImpl.java
similarity index 87%
rename from integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonFragmentImpl.java
rename to integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonRepositoryImpl.java
index e05ceab2dc6..9495f483384 100644
--- a/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonFragmentImpl.java
+++ b/integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonRepositoryImpl.java
@@ -5,7 +5,7 @@
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-public class PersonFragmentImpl implements PersonFragment, PersonFragment2 {
+public class PersonRepositoryImpl implements PersonFragment, PersonFragment2 {
@PersistenceContext
EntityManager entityManager; | ['extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/generate/SpringDataRepositoryCreator.java', 'integration-tests/spring-data-jpa/src/main/java/io/quarkus/it/spring/data/jpa/PersonFragmentImpl.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,889,560 | 1,141,984 | 152,121 | 1,568 | 460 | 84 | 6 | 1 | 17,127 | 600 | 3,441 | 116 | 1 | 1 | 2019-11-09T10:10: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,190 | quarkusio/quarkus/5328/5318 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5318 | https://github.com/quarkusio/quarkus/pull/5328 | https://github.com/quarkusio/quarkus/pull/5328 | 1 | fixes | Unexpected behavior of path matching for configuration-based security policies | If I have a permission for a path like
`quarkus.http.auth.permission.mypermission.paths=/a/*`
Then requests to `/a/anything` should be matched to it, but they are not.
If I change it to
`quarkus.http.auth.permission.mypermission.paths=/a*`
Only then requests to `/a/anything` will start getting authorization checks.
This is contradictory to what is described in the documentation https://quarkus.io/guides/security#matching-on-paths-methods | 5fea8c0bda93f85d403295eb0f5cb4b8791be0c6 | fcbf465251be30a38c9b173a66c446e2ad4b4fde | https://github.com/quarkusio/quarkus/compare/5fea8c0bda93f85d403295eb0f5cb4b8791be0c6...fcbf465251be30a38c9b173a66c446e2ad4b4fde | diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/RolesAllowedTestCase.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/RolesAllowedTestCase.java
index 7278e611a42..614fe67f4c8 100644
--- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/RolesAllowedTestCase.java
+++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/RolesAllowedTestCase.java
@@ -20,9 +20,9 @@ public class RolesAllowedTestCase {
"quarkus.http.auth.basic=true\\n" +
"quarkus.http.auth.policy.r1.roles-allowed=test\\n" +
"quarkus.http.auth.policy.r2.roles-allowed=admin\\n" +
- "quarkus.http.auth.permission.roles1.paths=/roles1,/deny,/permit,/combined\\n" +
+ "quarkus.http.auth.permission.roles1.paths=/roles1,/deny,/permit,/combined,/wildcard1/*,/wildcard2*\\n" +
"quarkus.http.auth.permission.roles1.policy=r1\\n" +
- "quarkus.http.auth.permission.roles2.paths=/roles2,/deny,/permit/combined\\n" +
+ "quarkus.http.auth.permission.roles2.paths=/roles2,/deny,/permit/combined,/wildcard3/*\\n" +
"quarkus.http.auth.permission.roles2.policy=r2\\n" +
"quarkus.http.auth.permission.permit1.paths=/permit\\n" +
"quarkus.http.auth.permission.permit1.policy=permit\\n" +
@@ -178,4 +178,94 @@ public void testRolesAllowedCombinedWithDenyAll() {
.assertThat()
.statusCode(403);
}
+
+ @Test
+ public void testWildcardMatchingWithSlash() {
+ RestAssured
+ .given()
+ .auth()
+ .preemptive()
+ .basic("test", "test")
+ .when()
+ .get("/wildcard1/a")
+ .then()
+ .assertThat()
+ .statusCode(200);
+
+ RestAssured
+ .given()
+ .auth()
+ .preemptive()
+ .basic("test", "test")
+ .when()
+ .get("/wildcard1/a/")
+ .then()
+ .assertThat()
+ .statusCode(200);
+
+ RestAssured
+ .given()
+ .when()
+ .get("/wildcard1/a")
+ .then()
+ .assertThat()
+ .statusCode(401);
+
+ RestAssured
+ .given()
+ .when()
+ .get("/wildcard1/a/")
+ .then()
+ .assertThat()
+ .statusCode(401);
+
+ RestAssured
+ .given()
+ .when()
+ .get("/wildcard3XXX")
+ .then()
+ .assertThat()
+ .statusCode(200);
+ }
+
+ @Test
+ public void testWildcardMatchingWithoutSlash() {
+ RestAssured
+ .given()
+ .auth()
+ .preemptive()
+ .basic("test", "test")
+ .when()
+ .get("/wildcard2/a")
+ .then()
+ .assertThat()
+ .statusCode(200);
+
+ RestAssured
+ .given()
+ .auth()
+ .preemptive()
+ .basic("test", "test")
+ .when()
+ .get("/wildcard2")
+ .then()
+ .assertThat()
+ .statusCode(200);
+
+ RestAssured
+ .given()
+ .when()
+ .get("/wildcard2")
+ .then()
+ .assertThat()
+ .statusCode(401);
+
+ RestAssured
+ .given()
+ .when()
+ .get("/wildcard2/a")
+ .then()
+ .assertThat()
+ .statusCode(401);
+ }
}
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PathMatchingHttpSecurityPolicy.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PathMatchingHttpSecurityPolicy.java
index 1d1b754453a..24badd42743 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PathMatchingHttpSecurityPolicy.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PathMatchingHttpSecurityPolicy.java
@@ -93,7 +93,10 @@ void init(HttpBuildTimeConfig config, Map<String, Supplier<HttpSecurityPolicy>>
List<HttpMatcher> perms = new ArrayList<>();
tempMap.put(path, perms);
perms.add(m);
- if (path.endsWith("*")) {
+ if (path.endsWith("/*")) {
+ String stripped = path.substring(0, path.length() - 2);
+ pathMatcher.addPrefixPath(stripped.isEmpty() ? "/" : stripped, perms);
+ } else if (path.endsWith("*")) {
pathMatcher.addPrefixPath(path.substring(0, path.length() - 1), perms);
} else {
pathMatcher.addExactPath(path, perms); | ['extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/security/RolesAllowedTestCase.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/PathMatchingHttpSecurityPolicy.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,887,252 | 1,141,509 | 152,057 | 1,564 | 325 | 61 | 5 | 1 | 452 | 50 | 105 | 9 | 1 | 0 | 2019-11-08T12:41: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,192 | quarkusio/quarkus/5232/5231 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5231 | https://github.com/quarkusio/quarkus/pull/5232 | https://github.com/quarkusio/quarkus/pull/5232 | 1 | fixes | Mailer extension replyTo doesn't work | **Describe the bug**
If you call `setReplyTo` in a `Mail` object, the `ReactiveMailerImpl` doesn't add the corresponding header.
**Expected behavior**
The `ReactiveMailerImpl ` should add the replyTo attribute of `Mail` to the corresponding `MailMessage`, allowing mail clients (such as Outlook or Gmail) to reply to the correct address.
**Actual behavior**
The header is not added, and replies are always sent to the sender (`Mail#from`).
**Additional context**
The issue is caused by the lack of a replyTo field in `io.vertx.ext.mail.MailMessage`.
As a temporary workaround you can set the reply-to as a header, calling `Mail.addHeader("Reply-To", replyToAddress);` and it will work as expected.
For consistency, Quarkus Mailer sould either remove the attribute replyTo from the `Mail` class, or modify the `ReactiveMailerImpl` to add the field as a header (preferably the later). | 1c6d3aa1046ef72d590581686b72021a86f4b532 | d616d51e91c60357afd3b342f6c4eb7145122e54 | https://github.com/quarkusio/quarkus/compare/1c6d3aa1046ef72d590581686b72021a86f4b532...d616d51e91c60357afd3b342f6c4eb7145122e54 | diff --git a/extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/ReactiveMailerImpl.java b/extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/ReactiveMailerImpl.java
index 42e62ca9655..50eacf66a7b 100644
--- a/extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/ReactiveMailerImpl.java
+++ b/extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/ReactiveMailerImpl.java
@@ -73,7 +73,7 @@ public CompletionStage<Void> send(Mail... mails) {
private CompletionStage<Void> send(Mail mail, MailMessage message) {
if (mock) {
- LOGGER.infof("Sending email {} from {} to {}, text body: \\n{}\\nhtml body: \\n{}",
+ LOGGER.infof("Sending email %s from %s to %s, text body: \\n%s\\nhtml body: \\n%s",
message.getSubject(), message.getFrom(), message.getTo(),
message.getText(), message.getHtml());
return mockMailbox.send(mail);
@@ -98,7 +98,6 @@ private CompletionStage<MailMessage> toMailMessage(Mail mail) {
} else {
message.setFrom(this.from);
}
-
message.setTo(mail.getTo());
message.setCc(mail.getCc());
message.setBcc(mail.getBcc());
@@ -106,6 +105,9 @@ private CompletionStage<MailMessage> toMailMessage(Mail mail) {
message.setText(mail.getText());
message.setHtml(mail.getHtml());
message.setHeaders(toMultimap(mail.getHeaders()));
+ if (mail.getReplyTo() != null) {
+ message.addHeader("Reply-To", mail.getReplyTo());
+ }
List<CompletionStage<?>> stages = new ArrayList<>();
List<MailAttachment> attachments = new CopyOnWriteArrayList<>();
diff --git a/extensions/mailer/runtime/src/test/java/io/quarkus/mailer/runtime/MailerImplTest.java b/extensions/mailer/runtime/src/test/java/io/quarkus/mailer/runtime/MailerImplTest.java
index 414c0d3402e..73f794af8c4 100644
--- a/extensions/mailer/runtime/src/test/java/io/quarkus/mailer/runtime/MailerImplTest.java
+++ b/extensions/mailer/runtime/src/test/java/io/quarkus/mailer/runtime/MailerImplTest.java
@@ -197,6 +197,18 @@ void testAttachments() throws MessagingException, IOException {
assertThat(value).isEqualTo("Hello 2");
}
+ @Test
+ void testReplyToHeaderIsSet() throws MessagingException {
+ mailer.send(Mail.withText(TO, "Test", "testHeaders")
+ .setReplyTo("[email protected]"))
+ .toCompletableFuture().join();
+ assertThat(wiser.getMessages()).hasSize(1);
+ WiserMessage actual = wiser.getMessages().get(0);
+ MimeMessage msg = actual.getMimeMessage();
+ assertThat(msg.getHeader("Reply-To")).containsExactly("[email protected]");
+ assertThat(msg.getReplyTo()).containsExactly(InternetAddress.parse("[email protected]"));
+ }
+
private String getContent(WiserMessage msg) {
try {
return getTextFromMimeMultipart((MimeMultipart) msg.getMimeMessage().getContent()); | ['extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/ReactiveMailerImpl.java', 'extensions/mailer/runtime/src/test/java/io/quarkus/mailer/runtime/MailerImplTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,898,070 | 1,143,828 | 152,315 | 1,567 | 305 | 84 | 6 | 1 | 903 | 128 | 210 | 15 | 0 | 0 | 2019-11-05T21:43: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,193 | quarkusio/quarkus/5228/5224 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5224 | https://github.com/quarkusio/quarkus/pull/5228 | https://github.com/quarkusio/quarkus/pull/5228 | 1 | fixes | Cannot add extensions to Gradle project with comma-separated extensions list | **Describe the bug**
In the guide: https://quarkus.io/guides/gradle-tooling#dealing-with-extensions
it looks like we can add extensions in a comma-separated list like so:
`./gradlew addExtension --extensions="quarkus-artemis-jms,quarkus-vertx"`
However, for my Gradle project, I get this message:
```
> Task :addExtension
❌ Cannot find a dependency matching 'quarkus-artemis-jms,quarkus-vertx', maybe a typo?
```
I took those extensions from the list provided with ./gradlew listExtensions.
**Expected behavior**
Should be able to install each extension in the comma-separated list
**Actual behavior**
I get the error message above
**To Reproduce**
Steps to reproduce the behavior:
1. Create a new Gradle project using the Quarkus Maven plugin (as explained in the guide)
2. Create Gradle wrapper using `gradle wrapper` (I'm using Gradle 5.6.4)
3. Run `./gradlew addExtension --extensions="quarkus-artemis-jms,quarkus-vertx"`
Step 2 is optional, the extensions don't install whether or not I use the wrapper.
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
Linux unused-10-15-17-2.yyz.redhat.com 5.0.17-300.fc30.x86_64 #1 SMP Mon May 20 15:36:26 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)
- Quarkus version or git rev:
0.28.1 | 25fcaffdab0a965f9bec3468ce16986a1b7b8f85 | a975e478bddf9b58984e10aa1ba936b2fd15e238 | https://github.com/quarkusio/quarkus/compare/25fcaffdab0a965f9bec3468ce16986a1b7b8f85...a975e478bddf9b58984e10aa1ba936b2fd15e238 | diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusAddExtension.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusAddExtension.java
index ebb5051c2cc..9639f52ccfe 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusAddExtension.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusAddExtension.java
@@ -1,7 +1,9 @@
package io.quarkus.gradle.tasks;
+import static java.util.Arrays.stream;
+import static java.util.stream.Collectors.toSet;
+
import java.io.IOException;
-import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -37,10 +39,13 @@ public List<String> getExtensionsToAdd() {
@TaskAction
public void addExtension() {
-
setupPlatformDescriptor();
- Set<String> extensionsSet = new HashSet<>(getExtensionsToAdd());
+ Set<String> extensionsSet = getExtensionsToAdd()
+ .stream()
+ .flatMap(ext -> stream(ext.split(",")))
+ .map(String::trim)
+ .collect(toSet());
try {
new AddExtensions(new GradleBuildFile(new FileProjectWriter(getProject().getProjectDir())))
.addExtensions(extensionsSet); | ['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusAddExtension.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,898,070 | 1,143,828 | 152,315 | 1,567 | 408 | 73 | 11 | 1 | 1,488 | 189 | 431 | 40 | 1 | 1 | 2019-11-05T20:00: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,194 | quarkusio/quarkus/5187/5186 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5186 | https://github.com/quarkusio/quarkus/pull/5187 | https://github.com/quarkusio/quarkus/pull/5187 | 1 | fixes | Unable to change debug port in dev mode | **Describe the bug**
The DevMojo no longer respects the `debug` option when setting up the debug port it dev mode. Looks to be a result of commit https://github.com/quarkusio/quarkus/commit/66d25b78f0cd386b6deb7a3eeb20e3fb665bb01e
**Expected behavior**
`mvn compile quarkus:dev -Ddebug=5006` should listen on port 5006 for debugger connections.
**Actual behavior**
Dev mode always listens to port 5005 for debugger connections.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a Quarkus project using at least version 0.27.0
2. Start the project with a debug port of something other than 5005
3. Note in the console that it uses 5005 instead of the specified value
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
```
Linux vm 5.0.0-32-generic #34-Ubuntu SMP Wed Oct 2 02:06:48 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
- Quarkus version or git rev: 0.28.0
| a69d94e99f4d522b4f8d1ea1d8559f250dad650d | 6228504c9aedce3a5485f55a8125bfe9592d329d | https://github.com/quarkusio/quarkus/compare/a69d94e99f4d522b4f8d1ea1d8559f250dad650d...6228504c9aedce3a5485f55a8125bfe9592d329d | 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 e70d77a2c6d..a0d0607fa1d 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -264,15 +264,6 @@ public void execute() throws MojoFailureException, MojoExecutionException {
suspend = "n";
}
- boolean useDebugMode = true;
- // debug mode not specified
- // make sure 5005 is not used, we don't want to just fail if something else is using it
- try (Socket socket = new Socket(InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }), 5005)) {
- getLog().error("Port 5005 in use, not starting in debug mode");
- useDebugMode = false;
- } catch (IOException e) {
- }
-
if (jvmArgs != null) {
args.addAll(Arrays.asList(jvmArgs.split(" ")));
}
@@ -283,7 +274,7 @@ public void execute() throws MojoFailureException, MojoExecutionException {
args.add("-Xverify:none");
}
- DevModeRunner runner = new DevModeRunner(args, useDebugMode);
+ DevModeRunner runner = new DevModeRunner(args);
runner.prepare();
runner.run();
@@ -308,7 +299,7 @@ public void execute() throws MojoFailureException, MojoExecutionException {
}
}
if (changed) {
- DevModeRunner newRunner = new DevModeRunner(args, useDebugMode);
+ DevModeRunner newRunner = new DevModeRunner(args);
try {
newRunner.prepare();
} catch (Exception e) {
@@ -414,11 +405,9 @@ class DevModeRunner {
private final List<String> args;
private Process process;
private Set<Path> pomFiles = new HashSet<>();
- private final boolean useDebugMode;
- DevModeRunner(List<String> args, boolean useDebugMode) {
+ DevModeRunner(List<String> args) {
this.args = new ArrayList<>(args);
- this.useDebugMode = useDebugMode;
}
/**
@@ -426,6 +415,14 @@ class DevModeRunner {
*/
void prepare() throws Exception {
if (debug == null) {
+ boolean useDebugMode = true;
+ // debug mode not specified
+ // make sure 5005 is not used, we don't want to just fail if something else is using it
+ try (Socket socket = new Socket(InetAddress.getByAddress(new byte[] { 127, 0, 0, 1 }), 5005)) {
+ getLog().error("Port 5005 in use, not starting in debug mode");
+ useDebugMode = false;
+ } catch (IOException e) {
+ }
if (useDebugMode) {
args.add("-Xdebug");
args.add("-Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=" + suspend); | ['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,888,868 | 1,141,924 | 152,044 | 1,564 | 1,471 | 319 | 25 | 1 | 1,243 | 168 | 384 | 32 | 1 | 2 | 2019-11-04T20:58: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,195 | quarkusio/quarkus/5179/5176 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5176 | https://github.com/quarkusio/quarkus/pull/5179 | https://github.com/quarkusio/quarkus/pull/5179 | 1 | fixes | quarkus.vertx.max-worker-execute-time not picking up | **Describe the bug**
The property `quarkus.vertx.max-worker-execute-time` is not recognized by the quarkus application.
**Expected behavior**
I would expect to see a the configuted value as time limit in the logs of the quarkus application.
**Actual behavior**
Still getting the warning with the default (?) value of 60000ms.
```
2019-11-04 15:13:56,641 WARNING [io.ver.cor.imp.BlockedThreadChecker] (vertx-blocked-thread-checker) Thread Thread[vert.x-worker-thread-5,5,main]=Thread[vert.x-worker-thread-5,5,main] has been blocked for 78245 ms, time limit is 60000 ms:
```
**To Reproduce**
Steps to reproduce the behavior:
1. build a 'standard app'
2. add the mentioned property
3. try to run in a timeout
**Configuration**
```properties
# Add your application.properties here, if applicable.
#quarkus.vertx.max-worker-execute-time=100
quarkus.vertx.max-worker-execute-time=100s
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
quarkus: 0.27.0
**Additional context**
(Add any other context about the problem here.)
| 83e11852a2dad6a4769bb807f5166c09827fa8c5 | 4e3aec02d7517028da32fb64f62f421da9baad23 | https://github.com/quarkusio/quarkus/compare/83e11852a2dad6a4769bb807f5166c09827fa8c5...4e3aec02d7517028da32fb64f62f421da9baad23 | diff --git a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
index d86ffbe4544..e6af79f7d06 100644
--- a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
+++ b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
@@ -3,10 +3,13 @@
import static io.vertx.core.file.impl.FileResolver.CACHE_DIR_BASE_PROP_NAME;
import java.io.File;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier;
import java.util.regex.Pattern;
@@ -143,16 +146,27 @@ private static VertxOptions convertToVertxOptions(VertxConfiguration conf) {
.setFileCacheDir(fileCacheDir)
.setClassPathResolvingEnabled(conf.classpathResolving));
options.setWorkerPoolSize(conf.workerPoolSize);
- options.setBlockedThreadCheckInterval(conf.warningExceptionTime.toMillis());
options.setInternalBlockingPoolSize(conf.internalBlockingPoolSize);
+
+ options.setBlockedThreadCheckInterval(conf.warningExceptionTime.toMillis());
if (conf.eventLoopsPoolSize.isPresent()) {
options.setEventLoopPoolSize(conf.eventLoopsPoolSize.getAsInt());
} else {
options.setEventLoopPoolSize(calculateDefaultIOThreads());
}
- // TODO - Add the ability to configure these times in ns when long will be supported
- // options.setMaxEventLoopExecuteTime(conf.maxEventLoopExecuteTime)
- // .setMaxWorkerExecuteTime(conf.maxWorkerExecuteTime)
+
+ Optional<Duration> maxEventLoopExecuteTime = conf.maxEventLoopExecuteTime;
+ if (maxEventLoopExecuteTime.isPresent()) {
+ options.setMaxEventLoopExecuteTime(maxEventLoopExecuteTime.get().toMillis());
+ options.setMaxEventLoopExecuteTimeUnit(TimeUnit.MILLISECONDS);
+ }
+
+ Optional<Duration> maxWorkerExecuteTime = conf.maxWorkerExecuteTime;
+ if (maxWorkerExecuteTime.isPresent()) {
+ options.setMaxWorkerExecuteTime(maxWorkerExecuteTime.get().toMillis());
+ options.setMaxWorkerExecuteTimeUnit(TimeUnit.MILLISECONDS);
+ }
+
options.setWarningExceptionTime(conf.warningExceptionTime.toNanos());
return options;
diff --git a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxOptionsBuilder.java b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxOptionsBuilder.java
deleted file mode 100644
index 5099fdec8fe..00000000000
--- a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxOptionsBuilder.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package io.quarkus.vertx.core.runtime;
-
-import static io.vertx.core.file.impl.FileResolver.CACHE_DIR_BASE_PROP_NAME;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-
-import io.quarkus.vertx.core.runtime.config.ClusterConfiguration;
-import io.quarkus.vertx.core.runtime.config.EventBusConfiguration;
-import io.quarkus.vertx.core.runtime.config.VertxConfiguration;
-import io.vertx.core.VertxOptions;
-import io.vertx.core.eventbus.EventBusOptions;
-import io.vertx.core.file.FileSystemOptions;
-import io.vertx.core.http.ClientAuth;
-import io.vertx.core.net.JksOptions;
-import io.vertx.core.net.PemKeyCertOptions;
-import io.vertx.core.net.PemTrustOptions;
-import io.vertx.core.net.PfxOptions;
-
-public class VertxOptionsBuilder {
-
- private static final Pattern COMMA_PATTERN = Pattern.compile(",");
-
- static VertxOptions buildVertxOptions(VertxConfiguration conf) {
- VertxOptions options = new VertxOptions();
-
- // Order matters, as the cluster options modifies the event bus options.
- buildEventBusOptions(conf, options);
- buildClusterOptions(conf, options);
- buildFileSystemOptions(conf, options);
-
- options.setWorkerPoolSize(conf.workerPoolSize);
- options.setInternalBlockingPoolSize(conf.internalBlockingPoolSize);
-
- options.setBlockedThreadCheckInterval(conf.warningExceptionTime.toMillis());
- options.setWarningExceptionTime(conf.warningExceptionTime.toNanos());
- conf.maxEventLoopExecuteTime.ifPresent(d -> options.setMaxEventLoopExecuteTime(d.toMillis()));
- conf.maxWorkerExecuteTime.ifPresent(d -> options.setMaxWorkerExecuteTime(d.toMillis()));
-
- conf.eventLoopsPoolSize.ifPresent(options::setEventLoopPoolSize);
-
- return options;
- }
-
- private static void buildFileSystemOptions(VertxConfiguration conf, VertxOptions options) {
- String fileCacheDir = System.getProperty(CACHE_DIR_BASE_PROP_NAME,
- System.getProperty("java.io.tmpdir", ".") + File.separator + "quarkus-vertx-cache");
-
- options.setFileSystemOptions(new FileSystemOptions()
- .setFileCacheDir(fileCacheDir)
- .setFileCachingEnabled(conf.caching)
- .setClassPathResolvingEnabled(conf.classpathResolving));
- }
-
- private static void buildClusterOptions(VertxConfiguration conf, VertxOptions options) {
- ClusterConfiguration cluster = conf.cluster;
- EventBusOptions eb = options.getEventBusOptions();
- eb.setClustered(cluster.clustered);
- eb.setClusterPingReplyInterval(cluster.pingReplyInterval.toMillis());
- eb.setClusterPingInterval(cluster.pingInterval.toMillis());
- if (cluster.host != null) {
- eb.setHost(cluster.host);
- }
- cluster.port.ifPresent(eb::setPort);
- cluster.publicHost.ifPresent(eb::setClusterPublicHost);
- cluster.publicPort.ifPresent(eb::setClusterPublicPort);
- }
-
- private static void buildEventBusOptions(VertxConfiguration conf, VertxOptions options) {
- EventBusConfiguration eb = conf.eventbus;
- EventBusOptions opts = new EventBusOptions();
- opts.setAcceptBacklog(eb.acceptBacklog.orElse(-1));
- opts.setClientAuth(ClientAuth.valueOf(eb.clientAuth.toUpperCase()));
- opts.setConnectTimeout((int) (Math.min(Integer.MAX_VALUE, eb.connectTimeout.toMillis())));
- opts.setIdleTimeout(
- eb.idleTimeout.map(d -> Math.max(1, (int) Math.min(Integer.MAX_VALUE, d.getSeconds()))).orElse(0));
- opts.setSendBufferSize(eb.sendBufferSize.orElse(-1));
- opts.setSoLinger(eb.soLinger.orElse(-1));
- opts.setSsl(eb.ssl);
- opts.setReceiveBufferSize(eb.receiveBufferSize.orElse(-1));
- opts.setReconnectAttempts(eb.reconnectAttempts);
- opts.setReconnectInterval(eb.reconnectInterval.toMillis());
- opts.setReuseAddress(eb.reuseAddress);
- opts.setReusePort(eb.reusePort);
- opts.setTrafficClass(eb.trafficClass.orElse(-1));
- opts.setTcpKeepAlive(eb.tcpKeepAlive);
- opts.setTcpNoDelay(eb.tcpNoDelay);
- opts.setTrustAll(eb.trustAll);
-
- // Certificates and trust.
- if (eb.keyCertificatePem != null) {
- List<String> certs = new ArrayList<>();
- List<String> keys = new ArrayList<>();
- eb.keyCertificatePem.certs.ifPresent(
- s -> certs.addAll(COMMA_PATTERN.splitAsStream(s).map(String::trim).collect(Collectors.toList())));
- eb.keyCertificatePem.keys.ifPresent(
- s -> keys.addAll(COMMA_PATTERN.splitAsStream(s).map(String::trim).collect(Collectors.toList())));
- PemKeyCertOptions o = new PemKeyCertOptions()
- .setCertPaths(certs)
- .setKeyPaths(keys);
- opts.setPemKeyCertOptions(o);
- }
-
- if (eb.keyCertificateJks != null) {
- JksOptions o = new JksOptions();
- eb.keyCertificateJks.path.ifPresent(o::setPath);
- eb.keyCertificateJks.password.ifPresent(o::setPassword);
- opts.setKeyStoreOptions(o);
- }
-
- if (eb.keyCertificatePfx != null) {
- PfxOptions o = new PfxOptions();
- eb.keyCertificatePfx.path.ifPresent(o::setPath);
- eb.keyCertificatePfx.password.ifPresent(o::setPassword);
- opts.setPfxKeyCertOptions(o);
- }
-
- if (eb.trustCertificatePem != null) {
- eb.trustCertificatePem.certs.ifPresent(s -> {
- PemTrustOptions o = new PemTrustOptions();
- COMMA_PATTERN.splitAsStream(s).map(String::trim).forEach(o::addCertPath);
- opts.setPemTrustOptions(o);
- });
- }
-
- if (eb.trustCertificateJks != null) {
- JksOptions o = new JksOptions();
- eb.trustCertificateJks.path.ifPresent(o::setPath);
- eb.trustCertificateJks.password.ifPresent(o::setPassword);
- opts.setTrustStoreOptions(o);
- }
-
- if (eb.trustCertificatePfx != null) {
- PfxOptions o = new PfxOptions();
- eb.trustCertificatePfx.path.ifPresent(o::setPath);
- eb.trustCertificatePfx.password.ifPresent(o::setPassword);
- opts.setPfxTrustOptions(o);
- }
- options.setEventBusOptions(opts);
- }
-}
diff --git a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxRecorder.java b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxRecorder.java
index af047494241..f2e12b96710 100644
--- a/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxRecorder.java
+++ b/extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxRecorder.java
@@ -161,11 +161,6 @@ private void registerCodecs(Map<Class<?>, Class<?>> codecByClass) {
}
}
- private void registerCodec(Class<?> typeToAdd, MessageCodec codec) {
- EventBus eventBus = vertx.eventBus();
- eventBus.registerDefaultCodec(typeToAdd, codec);
- }
-
public RuntimeValue<Vertx> forceStart(Supplier<Vertx> vertx) {
return new RuntimeValue<>(vertx.get());
} | ['extensions/vertx/runtime/src/main/java/io/quarkus/vertx/runtime/VertxRecorder.java', 'extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxOptionsBuilder.java', 'extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 5,893,251 | 1,142,861 | 152,129 | 1,565 | 7,831 | 1,607 | 171 | 3 | 1,322 | 147 | 358 | 39 | 0 | 2 | 2019-11-04T15:27: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,196 | quarkusio/quarkus/5159/5158 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5158 | https://github.com/quarkusio/quarkus/pull/5159 | https://github.com/quarkusio/quarkus/pull/5159 | 1 | fixes | Please add null check for LambdaHttpHandler.java line 84 -> request.getMultiValueHeaders() | Hi There,
Could you please add a null value check in LambdaHttpHandler.java line 84 -> request.getMultiValueHeaders()
I able to send a request with out any http headers from AWS Api gateway and it fails in the above mentioned class with null pointer exception.
Thanks,
Ravi | 08e8878616c1fbb7d90daebb41a345892eeb5d19 | 92d296ea94e70df23418996b46b5d009b4cef303 | https://github.com/quarkusio/quarkus/compare/08e8878616c1fbb7d90daebb41a345892eeb5d19...92d296ea94e70df23418996b46b5d009b4cef303 | diff --git a/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java b/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java
index b09b474a58a..2169542d9e1 100644
--- a/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java
+++ b/extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java
@@ -84,8 +84,10 @@ private AwsProxyResponse nettyDispatch(VirtualClientConnection connection, AwsPr
}
DefaultHttpRequest nettyRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
HttpMethod.valueOf(request.getHttpMethod()), path);
- for (Map.Entry<String, List<String>> header : request.getMultiValueHeaders().entrySet()) {
- nettyRequest.headers().add(header.getKey(), header.getValue());
+ if (request.getMultiValueHeaders() != null) { //apparently this can be null if no headers are sent
+ for (Map.Entry<String, List<String>> header : request.getMultiValueHeaders().entrySet()) {
+ nettyRequest.headers().add(header.getKey(), header.getValue());
+ }
}
if (!nettyRequest.headers().contains(HttpHeaderNames.HOST)) {
nettyRequest.headers().add(HttpHeaderNames.HOST, "localhost"); | ['extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,889,223 | 1,142,186 | 152,054 | 1,565 | 484 | 98 | 6 | 1 | 284 | 45 | 59 | 8 | 0 | 0 | 2019-11-04T07:10: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,197 | quarkusio/quarkus/5112/5110 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5110 | https://github.com/quarkusio/quarkus/pull/5112 | https://github.com/quarkusio/quarkus/pull/5112 | 1 | fixes | Native build fails when additionalBuildArg is commented out | Native build fails when `additionalBuildArg` is commented out. Thrown exception is: Failed to generate a native image: Failed to augment application classes: Property quarkus.native.additional-build-args not found
It's happening with 0.26.1, 0.27.0 and master when using quarkus-maven-plugin - native-image goal definition in pom.xml. Wasn't happening with 0.25.0 and earlier versions.
Snippet from pom.xml:
```xml
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
<additionalBuildArgs>
<!-- <additionalBuildArg>-Dfoo</additionalBuildArg> -->
</additionalBuildArgs>
</configuration>
```
Workaround:
Comment out or remove whole `<additionalBuildArgs>`
Stacktrace:
```
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:0.27.0:native-image (default) on project getting-started: Failed to generate a native image: Failed to augment application classes: Property quarkus.native.additional-build-args not found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:0.27.0:native-image (default) on project getting-started: Failed to generate a native image
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 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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to generate a native image
at io.quarkus.maven.NativeImageMojo.execute (NativeImageMojo.java:305)
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 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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: io.quarkus.creator.AppCreatorException: Failed to augment application classes
at io.quarkus.creator.phase.augment.AugmentTask.run (AugmentTask.java:190)
at io.quarkus.creator.phase.augment.AugmentTask.run (AugmentTask.java:48)
at io.quarkus.creator.CuratedApplicationCreator.runTask (CuratedApplicationCreator.java:139)
at io.quarkus.maven.NativeImageMojo.execute (NativeImageMojo.java:303)
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 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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.util.NoSuchElementException: Property quarkus.native.additional-build-args not found
at io.smallrye.config.SmallRyeConfig.propertyNotFound (SmallRyeConfig.java:221)
at io.smallrye.config.SmallRyeConfig.getValues (SmallRyeConfig.java:87)
at io.smallrye.config.SmallRyeConfig.getValues (SmallRyeConfig.java:72)
at io.quarkus.runtime.configuration.ConfigUtils.getValues (ConfigUtils.java:113)
at io.quarkus.deployment.configuration.ObjectListConfigType.acceptConfigurationValueIntoGroup (ObjectListConfigType.java:102)
at io.quarkus.deployment.configuration.GroupConfigType.acceptConfigurationValueIntoLeaf (GroupConfigType.java:238)
at io.quarkus.deployment.configuration.ObjectListConfigType.acceptConfigurationValue (ObjectListConfigType.java:48)
at io.quarkus.deployment.configuration.ConfigDefinition.loadConfiguration (ConfigDefinition.java:501)
at io.quarkus.deployment.ExtensionLoader.loadStepsFrom (ExtensionLoader.java:229)
at io.quarkus.deployment.QuarkusAugmentor.run (QuarkusAugmentor.java:85)
at io.quarkus.creator.phase.augment.AugmentTask.run (AugmentTask.java:181)
at io.quarkus.creator.phase.augment.AugmentTask.run (AugmentTask.java:48)
at io.quarkus.creator.CuratedApplicationCreator.runTask (CuratedApplicationCreator.java:139)
at io.quarkus.maven.NativeImageMojo.execute (NativeImageMojo.java:303)
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 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.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)
```
Steps to reproduce:
```
mvn io.quarkus:quarkus-maven-plugin:0.26.0:create -DprojectGroupId=org.acme -DprojectArtifactId=getting-started -DclassName="org.acme.quickstart.GreetingResource" -Dpath="/hello"
cd getting-started
sed -i "" "s/0.26.0/0.27.0/g" pom.xml
code pom.xml ## adjust configuration to match above snippet
mvn clean verify -Dnative
``` | 84f50ef4834507997b27be461ab40ed268c954df | 5061c0bdd5d538d8c27b91dc1f277383585e0f64 | https://github.com/quarkusio/quarkus/compare/84f50ef4834507997b27be461ab40ed268c954df...5061c0bdd5d538d8c27b91dc1f277383585e0f64 | 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 5b9f3462fab..6bf9329ffaa 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
@@ -434,7 +434,7 @@ public void accept(ConfigBuilder configBuilder) {
configs.add("quarkus.native.add-all-charsets", addAllCharsets);
- if (additionalBuildArgs != null) {
+ if (additionalBuildArgs != null && !additionalBuildArgs.isEmpty()) {
configs.add("quarkus.native.additional-build-args",
additionalBuildArgs.stream()
.map(val -> val.replace("\\\\", "\\\\\\\\"))
@@ -448,9 +448,9 @@ public void accept(ConfigBuilder configBuilder) {
configs.add("quarkus.native.debug-symbols", debugSymbols);
configs.add("quarkus.native.enable-reports", enableReports);
- if (containerRuntime != null) {
+ if (containerRuntime != null && !containerRuntime.trim().isEmpty()) {
configs.add("quarkus.native.container-runtime", containerRuntime);
- } else if (dockerBuild != null) {
+ } else if (dockerBuild != null && !dockerBuild.trim().isEmpty()) {
if (!dockerBuild.isEmpty() && !dockerBuild.toLowerCase().equals("false")) {
if (dockerBuild.toLowerCase().equals("true")) {
configs.add("quarkus.native.container-runtime", "docker");
@@ -459,7 +459,7 @@ public void accept(ConfigBuilder configBuilder) {
}
}
}
- if (containerRuntimeOptions != null) {
+ if (containerRuntimeOptions != null && !containerRuntimeOptions.trim().isEmpty()) {
configs.add("quarkus.native.container-runtime-options", containerRuntimeOptions);
}
configs.add("quarkus.native.dump-proxies", dumpProxies);
@@ -479,10 +479,10 @@ public void accept(ConfigBuilder configBuilder) {
configs.add("quarkus.native.full-stack-traces", fullStackTraces);
- if (graalvmHome != null) {
+ if (graalvmHome != null && !graalvmHome.trim().isEmpty()) {
configs.add("quarkus.native.graalvm-home", graalvmHome);
}
- if (nativeImageXmx != null) {
+ if (nativeImageXmx != null && !nativeImageXmx.trim().isEmpty()) {
configs.add("quarkus.native.native-image-xmx", nativeImageXmx);
}
configs.add("quarkus.native.report-errors-at-runtime", reportErrorsAtRuntime);
diff --git a/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java
index e832f9b692c..7678980dc51 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java
@@ -324,7 +324,7 @@ public void accept(ConfigBuilder configBuilder) {
if (addAllCharsets != null) {
configs.add("quarkus.native.add-all-charsets", addAllCharsets.toString());
}
- if (additionalBuildArgs != null) {
+ if (additionalBuildArgs != null && !additionalBuildArgs.isEmpty()) {
configs.add("quarkus.native.additional-build-args", additionalBuildArgs);
}
if (autoServiceLoaderRegistration != null) {
@@ -345,10 +345,10 @@ public void accept(ConfigBuilder configBuilder) {
if (enableReports != null) {
configs.add("quarkus.native.enable-reports", enableReports.toString());
}
- if (containerRuntime != null) {
+ if (containerRuntime != null && !containerRuntime.trim().isEmpty()) {
configs.add("quarkus.native.container-runtime", containerRuntime);
- } else if (dockerBuild != null) {
- if (!dockerBuild.isEmpty() && !dockerBuild.toLowerCase().equals("false")) {
+ } else if (dockerBuild != null && !dockerBuild.trim().isEmpty()) {
+ if (!dockerBuild.toLowerCase().equals("false")) {
if (dockerBuild.toLowerCase().equals("true")) {
configs.add("quarkus.native.container-runtime", "docker");
} else {
@@ -356,7 +356,7 @@ public void accept(ConfigBuilder configBuilder) {
}
}
}
- if (containerRuntimeOptions != null) {
+ if (containerRuntimeOptions != null && !containerRuntimeOptions.trim().isEmpty()) {
configs.add("quarkus.native.container-runtime-options", containerRuntimeOptions);
}
if (dumpProxies != null) {
@@ -395,13 +395,13 @@ public void accept(ConfigBuilder configBuilder) {
if (fullStackTraces != null) {
configs.add("quarkus.native.full-stack-traces", fullStackTraces.toString());
}
- if (graalvmHome != null) {
+ if (graalvmHome != null && !graalvmHome.trim().isEmpty()) {
configs.add("quarkus.native.graalvm-home", graalvmHome.toString());
}
- if (javaHome != null) {
+ if (javaHome != null && !javaHome.toString().isEmpty()) {
configs.add("quarkus.native.java-home", javaHome.toString());
}
- if (nativeImageXmx != null) {
+ if (nativeImageXmx != null && !nativeImageXmx.trim().isEmpty()) {
configs.add("quarkus.native.native-image-xmx", nativeImageXmx.toString());
}
if (reportErrorsAtRuntime != null) { | ['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusNative.java', 'devtools/maven/src/main/java/io/quarkus/maven/NativeImageMojo.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,872,690 | 1,139,155 | 151,714 | 1,563 | 1,916 | 395 | 28 | 2 | 11,143 | 493 | 2,620 | 141 | 0 | 3 | 2019-11-01T10:30: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,198 | quarkusio/quarkus/5077/5063 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/5063 | https://github.com/quarkusio/quarkus/pull/5077 | https://github.com/quarkusio/quarkus/pull/5077 | 1 | resolves | ComponentsProviderGenerator - break the generated getComponents() method for large deployments into multiple methods | Otherwise we end up with `org.objectweb.asm.MethodTooLargeException`. `BytecodeRecorderImpl` already has something similar implemented. | cbdc08edf435b0048272e75ccef15369a3424ddb | ca77890b3277b6e1e7f567e290f1f1ad52e247c6 | https://github.com/quarkusio/quarkus/compare/cbdc08edf435b0048272e75ccef15369a3424ddb...ca77890b3277b6e1e7f567e290f1f1ad52e247c6 | 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 4f8c40e307d..8a638e6ad37 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
@@ -144,7 +144,7 @@ Collection<Resource> generateSyntheticBean(BeanInfo bean, ReflectionRegistration
// Foo_Bean implements InjectableBean<T>
ClassCreator beanCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
- .interfaces(InjectableBean.class).build();
+ .interfaces(InjectableBean.class, Supplier.class).build();
// Fields
FieldCreator beanTypes = beanCreator.getFieldCreator(FIELD_NAME_BEAN_TYPES, Set.class)
@@ -195,6 +195,7 @@ Collection<Resource> generateSyntheticBean(BeanInfo bean, ReflectionRegistration
constructor.returnValue(null);
implementGetIdentifier(bean, beanCreator);
+ implementSupplierGet(beanCreator);
if (!bean.hasDefaultDestroy()) {
implementDestroy(bean, beanCreator, providerTypeName, Collections.emptyMap(), reflectionRegistration,
isApplicationClass, baseName);
@@ -246,7 +247,7 @@ Collection<Resource> generateClassBean(BeanInfo bean, ClassInfo beanClass, Refle
// Foo_Bean implements InjectableBean<T>
ClassCreator beanCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
- .interfaces(InjectableBean.class).build();
+ .interfaces(InjectableBean.class, Supplier.class).build();
// Fields
FieldCreator beanTypes = beanCreator.getFieldCreator(FIELD_NAME_BEAN_TYPES, Set.class)
@@ -275,6 +276,7 @@ Collection<Resource> generateClassBean(BeanInfo bean, ClassInfo beanClass, Refle
annotationLiterals);
implementGetIdentifier(bean, beanCreator);
+ implementSupplierGet(beanCreator);
if (!bean.hasDefaultDestroy()) {
implementDestroy(bean, beanCreator, providerTypeName, injectionPointToProviderSupplierField, reflectionRegistration,
isApplicationClass, baseName);
@@ -341,7 +343,7 @@ Collection<Resource> generateProducerMethodBean(BeanInfo bean, MethodInfo produc
// Foo_Bean implements InjectableBean<T>
ClassCreator beanCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
- .interfaces(InjectableBean.class).build();
+ .interfaces(InjectableBean.class, Supplier.class).build();
// Fields
FieldCreator beanTypes = beanCreator.getFieldCreator(FIELD_NAME_BEAN_TYPES, Set.class)
@@ -369,6 +371,7 @@ Collection<Resource> generateProducerMethodBean(BeanInfo bean, MethodInfo produc
annotationLiterals);
implementGetIdentifier(bean, beanCreator);
+ implementSupplierGet(beanCreator);
if (!bean.hasDefaultDestroy()) {
implementDestroy(bean, beanCreator, providerTypeName, injectionPointToProviderField, reflectionRegistration,
isApplicationClass, baseName);
@@ -426,7 +429,7 @@ Collection<Resource> generateProducerFieldBean(BeanInfo bean, FieldInfo producer
// Foo_Bean implements InjectableBean<T>
ClassCreator beanCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
- .interfaces(InjectableBean.class).build();
+ .interfaces(InjectableBean.class, Supplier.class).build();
// Fields
FieldCreator beanTypes = beanCreator.getFieldCreator(FIELD_NAME_BEAN_TYPES, Set.class)
@@ -450,6 +453,7 @@ Collection<Resource> generateProducerFieldBean(BeanInfo bean, FieldInfo producer
annotationLiterals);
implementGetIdentifier(bean, beanCreator);
+ implementSupplierGet(beanCreator);
if (!bean.hasDefaultDestroy()) {
implementDestroy(bean, beanCreator, providerTypeName, null, reflectionRegistration, isApplicationClass, baseName);
}
@@ -1514,6 +1518,11 @@ protected void implementGetName(BeanInfo bean, ClassCreator beanCreator) {
}
}
+ protected void implementSupplierGet(ClassCreator beanCreator) {
+ MethodCreator get = beanCreator.getMethodCreator("get", Object.class).setModifiers(ACC_PUBLIC);
+ get.returnValue(get.getThis());
+ }
+
private String getProxyTypeName(BeanInfo bean, String baseName) {
return getPackageName(bean) + "." + baseName + ClientProxyGenerator.CLIENT_PROXY_SUFFIX;
}
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java
index 232dd3c348e..8c6c60da26b 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java
@@ -1,12 +1,12 @@
package io.quarkus.arc.processor;
import static java.util.stream.Collectors.toList;
+import static org.objectweb.asm.Opcodes.ACC_PRIVATE;
import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
import io.quarkus.arc.Arc;
import io.quarkus.arc.Components;
import io.quarkus.arc.ComponentsProvider;
-import io.quarkus.arc.impl.LazyValue;
import io.quarkus.arc.processor.ResourceOutput.Resource;
import io.quarkus.gizmo.ClassCreator;
import io.quarkus.gizmo.MethodCreator;
@@ -38,8 +38,9 @@
public class ComponentsProviderGenerator extends AbstractGenerator {
static final String COMPONENTS_PROVIDER_SUFFIX = "_ComponentsProvider";
-
static final String SETUP_PACKAGE = Arc.class.getPackage().getName() + ".setup";
+ static final String ADD_OBSERVERS = "addObservers";
+ static final String ADD_BEANS = "addBeans";
protected final AnnotationLiteralProcessor annotationLiterals;
@@ -67,51 +68,73 @@ Collection<Resource> generate(String name, BeanDeployment beanDeployment, Map<Be
MethodCreator getComponents = componentsProvider.getMethodCreator("getComponents", Components.class)
.setModifiers(ACC_PUBLIC);
- // Map<String, Supplier<InjectableBean<?>>> beanIdToBeanSupplier = new HashMap<>();
- ResultHandle beanIdToBeanSupplierHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(HashMap.class));
-
+ // Maps a bean to all injection points it is resolved to
// Bar -> Foo, Baz
// Foo -> Baz
// Interceptor -> Baz
- Map<BeanInfo, List<BeanInfo>> beanToInjections = new HashMap<>();
- for (BeanInfo bean : beanDeployment.getBeans()) {
- if (bean.isProducerMethod() || bean.isProducerField()) {
- beanToInjections.computeIfAbsent(bean.getDeclaringBean(), d -> new ArrayList<>()).add(bean);
- }
- for (Injection injection : bean.getInjections()) {
- for (InjectionPointInfo injectionPoint : injection.injectionPoints) {
- if (!BuiltinBean.resolvesTo(injectionPoint)) {
- beanToInjections.computeIfAbsent(injectionPoint.getResolvedBean(), d -> new ArrayList<>()).add(bean);
- }
- }
- }
- if (bean.getDisposer() != null) {
- for (InjectionPointInfo injectionPoint : bean.getDisposer().getInjection().injectionPoints) {
- if (!BuiltinBean.resolvesTo(injectionPoint)) {
- beanToInjections.computeIfAbsent(injectionPoint.getResolvedBean(), d -> new ArrayList<>()).add(bean);
- }
- }
- }
- for (InterceptorInfo interceptor : bean.getBoundInterceptors()) {
- beanToInjections.computeIfAbsent(interceptor, d -> new ArrayList<>()).add(bean);
- }
+ Map<BeanInfo, List<BeanInfo>> beanToInjections = initBeanToInjections(beanDeployment);
+
+ // Break bean processing into multiple addBeans() methods
+ // Map<String, InjectableBean<?>>
+ ResultHandle beanIdToBeanHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(HashMap.class));
+ processBeans(componentsProvider, getComponents, beanIdToBeanHandle, beanToInjections, beanToGeneratedName,
+ beanDeployment);
+
+ // Break observers processing into multiple ddObservers() methods
+ ResultHandle observersHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(ArrayList.class));
+ processObservers(componentsProvider, getComponents, beanDeployment, beanIdToBeanHandle, observersHandle,
+ observerToGeneratedName);
+
+ // Custom contexts
+ ResultHandle contextsHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(ArrayList.class));
+ for (Entry<ScopeInfo, Function<MethodCreator, ResultHandle>> entry : beanDeployment.getCustomContexts().entrySet()) {
+ ResultHandle contextHandle = entry.getValue().apply(getComponents);
+ getComponents.invokeInterfaceMethod(MethodDescriptors.LIST_ADD, contextsHandle, contextHandle);
}
- // Also process interceptors injection points
- for (InterceptorInfo interceptor : beanDeployment.getInterceptors()) {
- for (Injection injection : interceptor.getInjections()) {
- for (InjectionPointInfo injectionPoint : injection.injectionPoints) {
- if (!BuiltinBean.resolvesTo(injectionPoint)) {
- beanToInjections.computeIfAbsent(injectionPoint.getResolvedBean(), d -> new ArrayList<>())
- .add(interceptor);
- }
- }
+
+ ResultHandle transitiveBindingsHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(HashMap.class));
+ for (Entry<DotName, Set<AnnotationInstance>> entry : beanDeployment.getTransitiveInterceptorBindings().entrySet()) {
+ ResultHandle bindingsHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(HashSet.class));
+ for (AnnotationInstance binding : entry.getValue()) {
+ // Create annotation literals first
+ ClassInfo bindingClass = beanDeployment.getInterceptorBinding(binding.name());
+ getComponents.invokeInterfaceMethod(MethodDescriptors.SET_ADD, bindingsHandle,
+ annotationLiterals.process(getComponents, classOutput, bindingClass, binding,
+ SETUP_PACKAGE));
}
+ getComponents.invokeInterfaceMethod(MethodDescriptors.MAP_PUT, transitiveBindingsHandle,
+ getComponents.loadClass(entry.getKey().toString()), bindingsHandle);
}
- Map<BeanInfo, LazyValue<ResultHandle>> beanToResultSupplierHandle = new HashMap<>();
- List<BeanInfo> processed = new ArrayList<>();
+ ResultHandle beansHandle = getComponents.invokeInterfaceMethod(
+ MethodDescriptor.ofMethod(Map.class, "values", Collection.class),
+ beanIdToBeanHandle);
+
+ ResultHandle componentsHandle = getComponents.newInstance(
+ MethodDescriptor.ofConstructor(Components.class, Collection.class, Collection.class, Collection.class,
+ Map.class),
+ beansHandle, observersHandle, contextsHandle, transitiveBindingsHandle);
+ getComponents.returnValue(componentsHandle);
+
+ // Finally write the bytecode
+ componentsProvider.close();
+
+ List<Resource> resources = new ArrayList<>();
+ for (Resource resource : classOutput.getResources()) {
+ resources.add(resource);
+ resources.add(ResourceImpl.serviceProvider(ComponentsProvider.class.getName(),
+ (resource.getName().replace('/', '.')).getBytes(Charset.forName("UTF-8"))));
+ }
+ return resources;
+ }
+
+ private void processBeans(ClassCreator componentsProvider, MethodCreator getComponents, ResultHandle beanIdToBeanHandle,
+ Map<BeanInfo, List<BeanInfo>> beanToInjections,
+ Map<BeanInfo, String> beanToGeneratedName, BeanDeployment beanDeployment) {
+
+ Set<BeanInfo> processed = new HashSet<>();
+ BeanAdder beanAdder = new BeanAdder(componentsProvider, getComponents, processed);
- // At this point we are going to fill the beanIdToBeanSupplier map
// - iterate over beanToInjections entries and process beans for which all dependencies are already present in the map
// - when a bean is processed the map entry is removed
// - if we're stuck and the map is not empty ISE is thrown
@@ -129,12 +152,12 @@ Collection<Resource> generate(String name, BeanDeployment beanDeployment, Map<Be
}
stuck = true;
// First try to proces beans that are not dependencies
- stuck = addBeans(beanToInjections, processed, beanToResultSupplierHandle, getComponents, beanIdToBeanSupplierHandle,
+ stuck = addBeans(beanAdder, beanToInjections, processed, beanIdToBeanHandle,
beanToGeneratedName, b -> !isDependency(b, beanToInjections));
if (stuck) {
// It seems we're stuck but we can try to process normal scoped beans that can prevent a circular dependency
- stuck = addBeans(beanToInjections, processed, beanToResultSupplierHandle, getComponents,
- beanIdToBeanSupplierHandle, beanToGeneratedName,
+ stuck = addBeans(beanAdder, beanToInjections, processed, beanIdToBeanHandle,
+ beanToGeneratedName,
b -> {
// Try to process non-producer beans first, including declaring beans of producers
if (b.isProducerField() || b.isProducerMethod()) {
@@ -143,8 +166,8 @@ Collection<Resource> generate(String name, BeanDeployment beanDeployment, Map<Be
return b.getScope().isNormal() || !isDependency(b, beanToInjections);
});
if (stuck) {
- stuck = addBeans(beanToInjections, processed, beanToResultSupplierHandle, getComponents,
- beanIdToBeanSupplierHandle, beanToGeneratedName,
+ stuck = addBeans(beanAdder, beanToInjections, processed,
+ beanIdToBeanHandle, beanToGeneratedName,
b -> !isDependency(b, beanToInjections) || b.getScope().isNormal());
}
}
@@ -152,97 +175,78 @@ Collection<Resource> generate(String name, BeanDeployment beanDeployment, Map<Be
// Finally process beans and interceptors that are not dependencies
for (BeanInfo bean : beanDeployment.getBeans()) {
if (!processed.contains(bean)) {
- addBean(getComponents, beanIdToBeanSupplierHandle, bean, beanToGeneratedName, beanToResultSupplierHandle);
+ beanAdder.addBean(bean, beanIdToBeanHandle, beanToGeneratedName);
}
}
for (BeanInfo interceptor : beanDeployment.getInterceptors()) {
if (!processed.contains(interceptor)) {
- addBean(getComponents, beanIdToBeanSupplierHandle, interceptor, beanToGeneratedName,
- beanToResultSupplierHandle);
+ beanAdder.addBean(interceptor, beanIdToBeanHandle, beanToGeneratedName);
}
}
- // Observers
- ResultHandle observersHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(ArrayList.class));
- for (ObserverInfo observer : beanDeployment.getObservers()) {
- String observerType = observerToGeneratedName.get(observer);
- List<InjectionPointInfo> injectionPoints = observer.getInjection().injectionPoints.stream()
- .filter(ip -> !BuiltinBean.resolvesTo(ip))
- .collect(toList());
- List<ResultHandle> params = new ArrayList<>();
- List<String> paramTypes = new ArrayList<>();
+ // Make sure the last addBeans() method is closed properly
+ beanAdder.close();
+ }
- ResultHandle resultSupplierHandle = beanToResultSupplierHandle.get(observer.getDeclaringBean()).get();
- params.add(resultSupplierHandle);
- paramTypes.add(Type.getDescriptor(Supplier.class));
- for (InjectionPointInfo injectionPoint : injectionPoints) {
- resultSupplierHandle = beanToResultSupplierHandle.get(injectionPoint.getResolvedBean()).get();
- params.add(resultSupplierHandle);
- paramTypes.add(Type.getDescriptor(Supplier.class));
+ private void processObservers(ClassCreator componentsProvider, MethodCreator getComponents, BeanDeployment beanDeployment,
+ ResultHandle beanIdToBeanHandle, ResultHandle observersHandle, Map<ObserverInfo, String> observerToGeneratedName) {
+ try (ObserverAdder observerAdder = new ObserverAdder(componentsProvider, getComponents)) {
+ for (ObserverInfo observer : beanDeployment.getObservers()) {
+ observerAdder.addObserver(observer, beanIdToBeanHandle, observersHandle, observerToGeneratedName);
}
- ResultHandle observerInstance = getComponents.newInstance(
- MethodDescriptor.ofConstructor(observerType, paramTypes.toArray(new String[0])),
- params.toArray(new ResultHandle[0]));
- getComponents.invokeInterfaceMethod(MethodDescriptors.LIST_ADD, observersHandle, observerInstance);
- }
-
- // Custom contexts
- ResultHandle contextsHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(ArrayList.class));
- for (Entry<ScopeInfo, Function<MethodCreator, ResultHandle>> entry : beanDeployment.getCustomContexts().entrySet()) {
- ResultHandle contextHandle = entry.getValue().apply(getComponents);
- getComponents.invokeInterfaceMethod(MethodDescriptors.LIST_ADD, contextsHandle, contextHandle);
}
+ }
- ResultHandle transitiveBindingsHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(HashMap.class));
- for (Entry<DotName, Set<AnnotationInstance>> entry : beanDeployment.getTransitiveInterceptorBindings().entrySet()) {
- ResultHandle bindingsHandle = getComponents.newInstance(MethodDescriptor.ofConstructor(HashSet.class));
- for (AnnotationInstance binding : entry.getValue()) {
- // Create annotation literals first
- ClassInfo bindingClass = beanDeployment.getInterceptorBinding(binding.name());
- getComponents.invokeInterfaceMethod(MethodDescriptors.SET_ADD, bindingsHandle,
- annotationLiterals.process(getComponents, classOutput, bindingClass, binding,
- SETUP_PACKAGE));
+ private Map<BeanInfo, List<BeanInfo>> initBeanToInjections(BeanDeployment beanDeployment) {
+ Map<BeanInfo, List<BeanInfo>> beanToInjections = new HashMap<>();
+ for (BeanInfo bean : beanDeployment.getBeans()) {
+ if (bean.isProducerMethod() || bean.isProducerField()) {
+ beanToInjections.computeIfAbsent(bean.getDeclaringBean(), d -> new ArrayList<>()).add(bean);
+ }
+ for (Injection injection : bean.getInjections()) {
+ for (InjectionPointInfo injectionPoint : injection.injectionPoints) {
+ if (!BuiltinBean.resolvesTo(injectionPoint)) {
+ beanToInjections.computeIfAbsent(injectionPoint.getResolvedBean(), d -> new ArrayList<>()).add(bean);
+ }
+ }
+ }
+ if (bean.getDisposer() != null) {
+ for (InjectionPointInfo injectionPoint : bean.getDisposer().getInjection().injectionPoints) {
+ if (!BuiltinBean.resolvesTo(injectionPoint)) {
+ beanToInjections.computeIfAbsent(injectionPoint.getResolvedBean(), d -> new ArrayList<>()).add(bean);
+ }
+ }
+ }
+ for (InterceptorInfo interceptor : bean.getBoundInterceptors()) {
+ beanToInjections.computeIfAbsent(interceptor, d -> new ArrayList<>()).add(bean);
}
- getComponents.invokeInterfaceMethod(MethodDescriptors.MAP_PUT, transitiveBindingsHandle,
- getComponents.loadClass(entry.getKey().toString()), bindingsHandle);
}
-
- // final Collection beans = beanIdToBeanSupplier.values();
- ResultHandle beansHandle = getComponents.invokeInterfaceMethod(
- MethodDescriptor.ofMethod(Map.class, "values", Collection.class),
- beanIdToBeanSupplierHandle);
-
- ResultHandle componentsHandle = getComponents.newInstance(
- MethodDescriptor.ofConstructor(Components.class, Collection.class, Collection.class, Collection.class,
- Map.class),
- beansHandle, observersHandle, contextsHandle, transitiveBindingsHandle);
- getComponents.returnValue(componentsHandle);
-
- // Finally write the bytecode
- componentsProvider.close();
-
- List<Resource> resources = new ArrayList<>();
- for (Resource resource : classOutput.getResources()) {
- resources.add(resource);
- // TODO proper name conversion
- resources.add(ResourceImpl.serviceProvider(ComponentsProvider.class.getName(),
- (resource.getName().replace('/', '.')).getBytes(Charset.forName("UTF-8"))));
+ // Also process interceptors injection points
+ for (InterceptorInfo interceptor : beanDeployment.getInterceptors()) {
+ for (Injection injection : interceptor.getInjections()) {
+ for (InjectionPointInfo injectionPoint : injection.injectionPoints) {
+ if (!BuiltinBean.resolvesTo(injectionPoint)) {
+ beanToInjections.computeIfAbsent(injectionPoint.getResolvedBean(), d -> new ArrayList<>())
+ .add(interceptor);
+ }
+ }
+ }
}
- return resources;
+ // Note that we do not have to process observer injection points because observers are always processed after all beans are ready
+ return beanToInjections;
}
- private boolean addBeans(Map<BeanInfo, List<BeanInfo>> beanToInjections, List<BeanInfo> processed,
- Map<BeanInfo, LazyValue<ResultHandle>> beanToResultSupplierHandle, MethodCreator getComponents,
- ResultHandle beanIdToBeanSupplierHandle, Map<BeanInfo, String> beanToGeneratedName, Predicate<BeanInfo> filter) {
+ private boolean addBeans(BeanAdder beanAdder,
+ Map<BeanInfo, List<BeanInfo>> beanToInjections, Set<BeanInfo> processed,
+ ResultHandle beanIdToBeanHandle, Map<BeanInfo, String> beanToGeneratedName, Predicate<BeanInfo> filter) {
boolean stuck = true;
for (Iterator<Entry<BeanInfo, List<BeanInfo>>> iterator = beanToInjections.entrySet().iterator(); iterator
.hasNext();) {
Entry<BeanInfo, List<BeanInfo>> entry = iterator.next();
BeanInfo bean = entry.getKey();
if (filter.test(bean)) {
- addBean(getComponents, beanIdToBeanSupplierHandle, bean, beanToGeneratedName,
- beanToResultSupplierHandle);
iterator.remove();
+ beanAdder.addBean(bean, beanIdToBeanHandle, beanToGeneratedName);
processed.add(bean);
stuck = false;
}
@@ -250,75 +254,192 @@ private boolean addBeans(Map<BeanInfo, List<BeanInfo>> beanToInjections, List<Be
return stuck;
}
- private void addBean(MethodCreator getComponents, ResultHandle beanIdToBeanSupplierHandle, BeanInfo bean,
- Map<BeanInfo, String> beanToGeneratedName,
- Map<BeanInfo, LazyValue<ResultHandle>> beanToResultSupplierHandle) {
+ private boolean isDependency(BeanInfo bean, Map<BeanInfo, List<BeanInfo>> beanToInjections) {
+ for (Iterator<Entry<BeanInfo, List<BeanInfo>>> iterator = beanToInjections.entrySet().iterator(); iterator.hasNext();) {
+ Entry<BeanInfo, List<BeanInfo>> entry = iterator.next();
+ if (entry.getValue().contains(bean)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ static class ObserverAdder implements AutoCloseable {
+
+ private static final int GROUP_LIMIT = 30;
+ private int group;
+ private int observersAdded;
+ private MethodCreator addObserversMethod;
+ private final MethodCreator getComponentsMethod;
+ private final ClassCreator componentsProvider;
- String beanType = beanToGeneratedName.get(bean);
- if (beanType == null) {
- throw new IllegalStateException("No bean type found for: " + bean);
+ public ObserverAdder(ClassCreator componentsProvider, MethodCreator getComponentsMethod) {
+ this.group = 1;
+ this.getComponentsMethod = getComponentsMethod;
+ this.componentsProvider = componentsProvider;
}
- List<InjectionPointInfo> injectionPoints = bean.getInjections().stream().flatMap(i -> i.injectionPoints.stream())
- .filter(ip -> !BuiltinBean.resolvesTo(ip)).collect(toList());
- List<ResultHandle> params = new ArrayList<>();
- List<String> paramTypes = new ArrayList<>();
-
- if (bean.isProducerMethod() || bean.isProducerField()) {
- ResultHandle resultSupplierHandle = beanToResultSupplierHandle.get(bean.getDeclaringBean()).get();
- if (resultSupplierHandle == null) {
- throw new IllegalStateException(
- "A supplier for a declaring bean of a producer bean is not available - most probaly an unsupported circular dependency use case \\n - declaring bean: "
- + bean.getDeclaringBean() + "\\n - producer bean: " + bean);
+ public void close() {
+ if (addObserversMethod != null) {
+ addObserversMethod.returnValue(null);
}
- params.add(resultSupplierHandle);
- paramTypes.add(Type.getDescriptor(Supplier.class));
}
- for (InjectionPointInfo injectionPoint : injectionPoints) {
- // new MapValueSupplier(beanIdToBeanSupplier, id);
- ResultHandle beanIdHandle = getComponents.load(injectionPoint.getResolvedBean().getIdentifier());
- ResultHandle beanSupplierHandle = getComponents.newInstance(MethodDescriptors.MAP_VALUE_SUPPLIER_CONSTRUCTOR,
- beanIdToBeanSupplierHandle, beanIdHandle);
+ void addObserver(ObserverInfo observer, ResultHandle beanIdToBeanHandle, ResultHandle observersHandle,
+ Map<ObserverInfo, String> observerToGeneratedName) {
+
+ if (addObserversMethod == null || observersAdded >= GROUP_LIMIT) {
+ if (addObserversMethod != null) {
+ addObserversMethod.returnValue(null);
+ }
+ observersAdded = 0;
+ // First add next addObservers(map) method
+ addObserversMethod = componentsProvider
+ .getMethodCreator(ADD_OBSERVERS + group++, void.class, Map.class, List.class)
+ .setModifiers(ACC_PRIVATE);
+ // Invoke addObservers(map) inside the getComponents() method
+ getComponentsMethod.invokeVirtualMethod(
+ MethodDescriptor.ofMethod(componentsProvider.getClassName(),
+ addObserversMethod.getMethodDescriptor().getName(), void.class, Map.class, List.class),
+ getComponentsMethod.getThis(), beanIdToBeanHandle, observersHandle);
+ }
+ observersAdded++;
+
+ // Append to the addObservers() method body
+ beanIdToBeanHandle = addObserversMethod.getMethodParam(0);
+ observersHandle = addObserversMethod.getMethodParam(1);
+
+ String observerType = observerToGeneratedName.get(observer);
+ List<InjectionPointInfo> injectionPoints = observer.getInjection().injectionPoints.stream()
+ .filter(ip -> !BuiltinBean.resolvesTo(ip))
+ .collect(toList());
+ List<ResultHandle> params = new ArrayList<>();
+ List<String> paramTypes = new ArrayList<>();
- params.add(beanSupplierHandle);
+ // First param - declaring bean
+ params.add(addObserversMethod.invokeInterfaceMethod(MethodDescriptors.MAP_GET,
+ beanIdToBeanHandle, addObserversMethod.load(observer.getDeclaringBean().getIdentifier())));
paramTypes.add(Type.getDescriptor(Supplier.class));
- }
- if (bean.getDisposer() != null) {
- for (InjectionPointInfo injectionPoint : bean.getDisposer().getInjection().injectionPoints) {
- ResultHandle resultSupplierHandle = beanToResultSupplierHandle.get(injectionPoint.getResolvedBean()).get();
- params.add(resultSupplierHandle);
+ for (InjectionPointInfo injectionPoint : injectionPoints) {
+ params.add(addObserversMethod.invokeInterfaceMethod(MethodDescriptors.MAP_GET,
+ beanIdToBeanHandle, addObserversMethod.load(injectionPoint.getResolvedBean().getIdentifier())));
paramTypes.add(Type.getDescriptor(Supplier.class));
}
- }
- for (InterceptorInfo interceptor : bean.getBoundInterceptors()) {
- ResultHandle resultSupplierHandle = beanToResultSupplierHandle.get(interceptor).get();
- params.add(resultSupplierHandle);
- paramTypes.add(Type.getDescriptor(Supplier.class));
+ ResultHandle observerInstance = addObserversMethod.newInstance(
+ MethodDescriptor.ofConstructor(observerType, paramTypes.toArray(new String[0])),
+ params.toArray(new ResultHandle[0]));
+ addObserversMethod.invokeInterfaceMethod(MethodDescriptors.LIST_ADD, observersHandle, observerInstance);
}
- // Foo_Bean bean2 = new Foo_Bean(bean2)
- ResultHandle beanInstance = getComponents.newInstance(
- MethodDescriptor.ofConstructor(beanType, paramTypes.toArray(new String[0])),
- params.toArray(new ResultHandle[0]));
- // beans.put(..., bean2)
- final ResultHandle beanInfoHandle = getComponents.load(bean.getIdentifier());
- getComponents.invokeInterfaceMethod(MethodDescriptors.MAP_PUT, beanIdToBeanSupplierHandle, beanInfoHandle,
- beanInstance);
-
- // Create a Supplier that will return the bean instance at runtime.
- beanToResultSupplierHandle.put(bean, new LazyValue<>(
- () -> getComponents.newInstance(MethodDescriptors.FIXED_VALUE_SUPPLIER_CONSTRUCTOR, beanInstance)));
}
- private boolean isDependency(BeanInfo bean, Map<BeanInfo, List<BeanInfo>> beanToInjections) {
- for (Iterator<Entry<BeanInfo, List<BeanInfo>>> iterator = beanToInjections.entrySet().iterator(); iterator.hasNext();) {
- Entry<BeanInfo, List<BeanInfo>> entry = iterator.next();
- if (entry.getValue().contains(bean)) {
- return true;
+ static class BeanAdder implements AutoCloseable {
+
+ private static final int GROUP_LIMIT = 30;
+ private int group;
+ private int beansWritten;
+ private MethodCreator addBeansMethod;
+ private final MethodCreator getComponentsMethod;
+ private final ClassCreator componentsProvider;
+ private final Set<BeanInfo> processedBeans;
+
+ public BeanAdder(ClassCreator componentsProvider, MethodCreator getComponentsMethod, Set<BeanInfo> processed) {
+ this.group = 1;
+ this.getComponentsMethod = getComponentsMethod;
+ this.componentsProvider = componentsProvider;
+ this.processedBeans = processed;
+ }
+
+ public void close() {
+ if (addBeansMethod != null) {
+ addBeansMethod.returnValue(null);
}
}
- return false;
+
+ void addBean(BeanInfo bean, ResultHandle beanIdToBeanHandle,
+ Map<BeanInfo, String> beanToGeneratedName) {
+
+ if (addBeansMethod == null || beansWritten >= GROUP_LIMIT) {
+ if (addBeansMethod != null) {
+ addBeansMethod.returnValue(null);
+ }
+ beansWritten = 0;
+ // First add next addBeans(map) method
+ addBeansMethod = componentsProvider.getMethodCreator(ADD_BEANS + group++, void.class, Map.class)
+ .setModifiers(ACC_PRIVATE);
+ // Invoke addBeans(map) inside the getComponents() method
+ getComponentsMethod.invokeVirtualMethod(
+ MethodDescriptor.ofMethod(componentsProvider.getClassName(),
+ addBeansMethod.getMethodDescriptor().getName(), void.class, Map.class),
+ getComponentsMethod.getThis(), beanIdToBeanHandle);
+ }
+ beansWritten++;
+
+ // Append to the addBeans() method body
+ beanIdToBeanHandle = addBeansMethod.getMethodParam(0);
+ String beanType = beanToGeneratedName.get(bean);
+ if (beanType == null) {
+ throw new IllegalStateException("No bean type found for: " + bean);
+ }
+
+ List<InjectionPointInfo> injectionPoints = bean.getInjections().stream().flatMap(i -> i.injectionPoints.stream())
+ .filter(ip -> !BuiltinBean.resolvesTo(ip)).collect(toList());
+ List<ResultHandle> params = new ArrayList<>();
+ List<String> paramTypes = new ArrayList<>();
+
+ if (bean.isProducerMethod() || bean.isProducerField()) {
+ if (!processedBeans.contains(bean.getDeclaringBean())) {
+ throw new IllegalStateException(
+ "Declaring bean of a producer bean is not available - most probaly an unsupported circular dependency use case \\n - declaring bean: "
+ + bean.getDeclaringBean() + "\\n - producer bean: " + bean);
+ }
+ params.add(addBeansMethod.invokeInterfaceMethod(MethodDescriptors.MAP_GET,
+ beanIdToBeanHandle, addBeansMethod.load(bean.getDeclaringBean().getIdentifier())));
+ paramTypes.add(Type.getDescriptor(Supplier.class));
+ }
+ for (InjectionPointInfo injectionPoint : injectionPoints) {
+ if (processedBeans.contains(injectionPoint.getResolvedBean())) {
+ params.add(addBeansMethod.invokeInterfaceMethod(MethodDescriptors.MAP_GET,
+ beanIdToBeanHandle, addBeansMethod.load(injectionPoint.getResolvedBean().getIdentifier())));
+ } else {
+ // Dependency was not processed yet - use MapValueSupplier
+ params.add(addBeansMethod.newInstance(
+ MethodDescriptors.MAP_VALUE_SUPPLIER_CONSTRUCTOR,
+ beanIdToBeanHandle, addBeansMethod.load(injectionPoint.getResolvedBean().getIdentifier())));
+ }
+ paramTypes.add(Type.getDescriptor(Supplier.class));
+ }
+ if (bean.getDisposer() != null) {
+ for (InjectionPointInfo injectionPoint : bean.getDisposer().getInjection().injectionPoints) {
+ params.add(addBeansMethod.newInstance(
+ MethodDescriptors.MAP_VALUE_SUPPLIER_CONSTRUCTOR,
+ beanIdToBeanHandle, addBeansMethod.load(injectionPoint.getResolvedBean().getIdentifier())));
+ paramTypes.add(Type.getDescriptor(Supplier.class));
+ }
+ }
+ for (InterceptorInfo interceptor : bean.getBoundInterceptors()) {
+ if (processedBeans.contains(interceptor)) {
+ params.add(addBeansMethod.invokeInterfaceMethod(MethodDescriptors.MAP_GET,
+ beanIdToBeanHandle, addBeansMethod.load(interceptor.getIdentifier())));
+ } else {
+ // Bound interceptor was not processed yet - use MapValueSupplier
+ params.add(addBeansMethod.newInstance(
+ MethodDescriptors.MAP_VALUE_SUPPLIER_CONSTRUCTOR,
+ beanIdToBeanHandle, addBeansMethod.load(interceptor.getIdentifier())));
+ }
+ paramTypes.add(Type.getDescriptor(Supplier.class));
+ }
+
+ // Foo_Bean bean = new Foo_Bean(bean3)
+ ResultHandle beanInstance = addBeansMethod.newInstance(
+ MethodDescriptor.ofConstructor(beanType, paramTypes.toArray(new String[0])),
+ params.toArray(new ResultHandle[0]));
+ // beans.put(id, bean)
+ final ResultHandle beanIdHandle = addBeansMethod.load(bean.getIdentifier());
+ addBeansMethod.invokeInterfaceMethod(MethodDescriptors.MAP_PUT, beanIdToBeanHandle, beanIdHandle,
+ beanInstance);
+ }
+
}
}
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorGenerator.java
index 07c570520f4..2bcd661e701 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorGenerator.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorGenerator.java
@@ -25,6 +25,7 @@
import java.util.Map;
import java.util.Set;
import java.util.function.Predicate;
+import java.util.function.Supplier;
import javax.enterprise.inject.spi.InterceptionType;
import javax.interceptor.InvocationContext;
import org.jboss.jandex.AnnotationInstance;
@@ -73,7 +74,7 @@ Collection<Resource> generate(InterceptorInfo interceptor, ReflectionRegistratio
// MyInterceptor_Bean implements InjectableInterceptor<T>
ClassCreator interceptorCreator = ClassCreator.builder().classOutput(classOutput).className(generatedName)
- .interfaces(InjectableInterceptor.class)
+ .interfaces(InjectableInterceptor.class, Supplier.class)
.build();
// Fields
@@ -92,6 +93,7 @@ Collection<Resource> generate(InterceptorInfo interceptor, ReflectionRegistratio
bindings.getFieldDescriptor());
implementGetIdentifier(interceptor, interceptorCreator);
+ implementSupplierGet(interceptorCreator);
implementCreate(classOutput, interceptorCreator, interceptor, providerTypeName, baseName, injectionPointToProviderField,
interceptorToProviderField,
reflectionRegistration, targetPackage, isApplicationClass); | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/InterceptorGenerator.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 5,864,569 | 1,137,707 | 151,548 | 1,563 | 30,241 | 5,446 | 472 | 3 | 135 | 12 | 27 | 1 | 0 | 0 | 2019-10-31T13:52: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,200 | quarkusio/quarkus/4950/4815 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4815 | https://github.com/quarkusio/quarkus/pull/4950 | https://github.com/quarkusio/quarkus/pull/4950 | 1 | fixes | No hot reload on bad configuration wich block the quarkus startup and when http.port is overridden | **Describe the bug**
If you configure a bad value that block the first application start, there is no way to have hot reload.
If you start on a good value, but after plug a bbad config, the hot reload is ok. A configuration change will trigger the hot reload as wanted.
**Expected behavior**
The hot reload is trigger if you change the configuration file, or a code change, even it never could be started correctly.
**Actual behavior**
The hot reload is broken if the app never could be started a first time.
**To Reproduce**
Steps to reproduce the behavior:
1. configure a bad jdbc url on hibernate (or flyway)
2. start the app
3. change to good value (it won't reload)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Darwin 18.5.0 Darwin Kernel Version 18.5.0
- Output of `java -version`: openjdk version "13" 2019-09-17
- GraalVM version (if different from Java):
- Quarkus version or git rev: 0.25.0
**Additional context**
(Add any other context about the problem here.)
@cescoffier the issue that we discuss after the quarkus workshop | 4aa96e528bf656de904e6a9796e757a5081409ef | 30ec90bb116c60a77a98638dca3019914b4710e1 | https://github.com/quarkusio/quarkus/compare/4aa96e528bf656de904e6a9796e757a5081409ef...30ec90bb116c60a77a98638dca3019914b4710e1 | 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 37aff77da4c..40092f8331d 100644
--- a/core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
+++ b/core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
@@ -96,10 +96,6 @@ public void start() throws Exception {
if (context.isAbortOnFailedStart()) {
throw new RuntimeException(deploymentProblem == null ? compileProblem : deploymentProblem);
}
- log.error("Failed to start Quarkus, attempting to start hot replacement endpoint to recover");
- if (runtimeUpdatesProcessor != null) {
- runtimeUpdatesProcessor.startupFailed();
- }
}
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
@@ -180,6 +176,20 @@ public void execute(BuildContext context) {
runner.run();
DevModeMain.runner = runner;
deploymentProblem = null;
+
+ } catch (Throwable t) {
+ deploymentProblem = t;
+ if (context.isAbortOnFailedStart() || liveReload) {
+ log.error("Failed to start quarkus", t);
+ } else {
+ //we need to set this here, while we still have the correct TCCL
+ //this is so the config is still valid, and we can read HTTP config from application.properties
+ log.error("Failed to start Quarkus, attempting to start hot replacement endpoint to recover");
+ if (runtimeUpdatesProcessor != null) {
+ runtimeUpdatesProcessor.startupFailed();
+ }
+ }
+
} finally {
Thread.currentThread().setContextClassLoader(old);
} | ['core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,747,010 | 1,114,827 | 148,517 | 1,527 | 957 | 167 | 18 | 1 | 1,125 | 183 | 274 | 27 | 0 | 0 | 2019-10-28T22:32: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,201 | quarkusio/quarkus/4914/4824 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4824 | https://github.com/quarkusio/quarkus/pull/4914 | https://github.com/quarkusio/quarkus/pull/4914 | 1 | fixes | Cannot use runtime quarkus.security.users.file.* config | **Describe the bug**
I have successfully setup quarkus.security.users.file.* (enabled, users, roles, realm-name) config but the only place where I can have it to work is inside the application.properties file. I think this whould be overridable at startup using java -Dquarkus.security...... options.
**Expected behavior**
These configuration properties are marked as "Configuration property fixed at build time" in the Quarkus all-config page but in my opinion, this should be overridableat runtime, and my users / groups / passwords files could be generated by the people I distribute the app to, I would not be forced to ask them for their passwords / hashes/ users, in order to build them in.
**Actual behavior**
Configuration properties not being taken into account at startup
**To Reproduce**
Steps to reproduce the behavior:
1. Use
quarkus.security.users.file.enabled=true
In application.properties
2. Launch the app using
3. Get an exception :
java.lang.IllegalStateException: No PropertiesRealmConfig users/roles settings found. Configure the quarkus.security.file.{enabled,users,roles,authMechanism,realmName} properties
at io.quarkus.elytron.security.runtime.ElytronPropertiesFileRecorder$1.run(ElytronPropertiesFileRecorder.java:68)
at io.quarkus.elytron.security.runtime.ElytronRecorder.runLoadTask(ElytronRecorder.java:31)
at io.quarkus.deployment.steps.ElytronDeploymentProcessor$loadRealm15.deploy_0(ElytronDeploymentProcessor$loadRealm15.zig:70)
at io.quarkus.deployment.steps.ElytronDeploymentProcessor$loadRealm15.deploy(ElytronDeploymentProcessor$loadRealm15.zig:36)
at io.quarkus.runner.ApplicationImpl1.doStart(ApplicationImpl1.zig:105)
at io.quarkus.runtime.Application.start(Application.java:93)
at io.quarkus.runtime.Application.run(Application.java:213)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:34)
**Configuration**
```properties
Configuration file
# key = value
quarkus.http.port=8080
quarkus.http.ssl-port=443
quarkus.http.ssl.certificate.key-store-file=keystore.jks
quarkus.http.ssl.certificate.key-store-password=mypasswd
quarkus.security.users.file.enabled=true
```
**Screenshots**
NA
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Linux raspberrypi 4.19.66-v7l+ #1253 SMP Thu Aug 15 12:02:08 BST 2019 armv7l GNU/Linux
- Output of `java -version`: openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1+rpi1-b01)
OpenJDK Client VM (build 25.212-b01, mixed mode)
- GraalVM version (if different from Java):
- Quarkus version or git rev: 0.24.0
**Additional context**
Zulip description here : https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Option.20quarkus.2Esecurity.2Eusers.2Efile.2Eenabled
| 575042827160e63fdfa24c49e43ac97005ac8d3a | 7d85723773770ee4c2d197f28b3d9877facc260a | https://github.com/quarkusio/quarkus/compare/575042827160e63fdfa24c49e43ac97005ac8d3a...7d85723773770ee4c2d197f28b3d9877facc260a | diff --git a/extensions/elytron-security-properties-file/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPropertiesFileRecorder.java b/extensions/elytron-security-properties-file/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPropertiesFileRecorder.java
index d39d15f683a..fff0e886ec5 100644
--- a/extensions/elytron-security-properties-file/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPropertiesFileRecorder.java
+++ b/extensions/elytron-security-properties-file/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPropertiesFileRecorder.java
@@ -3,6 +3,9 @@
import java.io.IOException;
import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.security.Provider;
import java.util.ArrayList;
import java.util.HashMap;
@@ -50,25 +53,37 @@ public Runnable loadRealm(RuntimeValue<SecurityRealm> realm, PropertiesRealmConf
return new Runnable() {
@Override
public void run() {
- log.debugf("loadRealm, config=%s", config);
- SecurityRealm secRealm = realm.getValue();
- if (!(secRealm instanceof LegacyPropertiesSecurityRealm)) {
- return;
- }
- log.debugf("Trying to loader users: /%s", config.users);
- URL users = Thread.currentThread().getContextClassLoader().getResource(config.users);
- log.debugf("users: %s", users);
- log.debugf("Trying to loader roles: %s", config.roles);
- URL roles = Thread.currentThread().getContextClassLoader().getResource(config.roles);
- log.debugf("roles: %s", roles);
- if (users == null && roles == null) {
- String msg = String.format(
- "No PropertiesRealmConfig users/roles settings found. Configure the quarkus.security.file.%s properties",
- config.help());
- throw new IllegalStateException(msg);
- }
- LegacyPropertiesSecurityRealm propsRealm = (LegacyPropertiesSecurityRealm) secRealm;
try {
+ log.debugf("loadRealm, config=%s", config);
+ SecurityRealm secRealm = realm.getValue();
+ if (!(secRealm instanceof LegacyPropertiesSecurityRealm)) {
+ return;
+ }
+ log.debugf("Trying to loader users: /%s", config.users);
+ URL users;
+ Path p = Paths.get(config.users);
+ if (Files.exists(p)) {
+ users = p.toUri().toURL();
+ } else {
+ users = Thread.currentThread().getContextClassLoader().getResource(config.users);
+ }
+ log.debugf("users: %s", users);
+ log.debugf("Trying to loader roles: %s", config.roles);
+ URL roles;
+ p = Paths.get(config.roles);
+ if (Files.exists(p)) {
+ roles = p.toUri().toURL();
+ } else {
+ roles = Thread.currentThread().getContextClassLoader().getResource(config.roles);
+ }
+ log.debugf("roles: %s", roles);
+ if (users == null && roles == null) {
+ String msg = String.format(
+ "No PropertiesRealmConfig users/roles settings found. Configure the quarkus.security.file.%s properties",
+ config.help());
+ throw new IllegalStateException(msg);
+ }
+ LegacyPropertiesSecurityRealm propsRealm = (LegacyPropertiesSecurityRealm) secRealm;
propsRealm.load(users.openStream(), roles.openStream());
} catch (IOException e) {
throw new RuntimeException(e); | ['extensions/elytron-security-properties-file/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPropertiesFileRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,726,463 | 1,110,551 | 147,875 | 1,525 | 2,946 | 481 | 51 | 1 | 2,811 | 250 | 716 | 55 | 1 | 1 | 2019-10-28T02:39:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,695 | quarkusio/quarkus/18948/18937 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18937 | https://github.com/quarkusio/quarkus/pull/18948 | https://github.com/quarkusio/quarkus/pull/18948 | 1 | resolves | Deactivating Micrometer default binders | ### Describe the bug
It's not possible to deactivate the default Micrometer binders with a single property.
### Expected behavior
Should be able to set:
```
quarkus.micrometer.binder-enabled-default=false
```
### Actual behavior
Needed to set:
```
quarkus.micrometer.binder-enabled-default=false
quarkus.micrometer.binder.jvm=false
quarkus.micrometer.binder.system=false
```
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 86f9b20f100b7d90f982ffe57139c11b1953ee61 | 6b1c35532879e01152171f71e423df34ed61082f | https://github.com/quarkusio/quarkus/compare/86f9b20f100b7d90f982ffe57139c11b1953ee61...6b1c35532879e01152171f71e423df34ed61082f | diff --git a/extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/GlobalDefaultDisabledTest.java b/extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/GlobalDefaultDisabledTest.java
index 1f311fabe1f..70464d7ad25 100644
--- a/extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/GlobalDefaultDisabledTest.java
+++ b/extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/GlobalDefaultDisabledTest.java
@@ -10,8 +10,8 @@
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.composite.CompositeMeterRegistry;
+import io.quarkus.micrometer.test.Util;
import io.quarkus.test.QuarkusUnitTest;
-import io.restassured.RestAssured;
/**
* Should not have any registered MeterRegistry objects when micrometer is disabled
@@ -23,7 +23,8 @@ public class GlobalDefaultDisabledTest {
.withConfigurationResource("test-logging.properties")
.overrideConfigKey("quarkus.micrometer.registry-enabled-default", "false")
.overrideConfigKey("quarkus.micrometer.binder-enabled-default", "false")
- .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class));
+ .setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
+ .addClasses(Util.class));
@Inject
MeterRegistry registry;
@@ -32,13 +33,14 @@ public class GlobalDefaultDisabledTest {
public void testMeterRegistryPresent() {
// Composite Meter Registry
Assertions.assertNotNull(registry, "A registry should be configured");
+
Assertions.assertTrue(registry instanceof CompositeMeterRegistry,
"Injected registry should be a CompositeMeterRegistry, was " + registry.getClass().getName());
- }
- @Test
- public void testNoPrometheusEndpoint() {
- // Micrometer is enabled, prometheus is not.
- RestAssured.when().get("/prometheus").then().statusCode(404);
+ Assertions.assertTrue(((CompositeMeterRegistry) registry).getRegistries().isEmpty(),
+ "No child registries should be present: " + ((CompositeMeterRegistry) registry).getRegistries());
+
+ Assertions.assertNull(registry.find("jvm.info").counter(),
+ "JVM Info counter should not be present, found: " + Util.listMeters(registry, "jvm.info"));
}
}
diff --git a/extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/export/NoDefaultPrometheusTest.java b/extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/export/NoDefaultPrometheusTest.java
index 169a5cf2760..760ce9abb34 100644
--- a/extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/export/NoDefaultPrometheusTest.java
+++ b/extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/export/NoDefaultPrometheusTest.java
@@ -22,6 +22,7 @@ public class NoDefaultPrometheusTest {
.setFlatClassPath(true)
.withConfigurationResource("test-logging.properties")
.overrideConfigKey("quarkus.micrometer.binder-enabled-default", "false")
+ .overrideConfigKey("quarkus.micrometer.binder.jvm", "true")
.overrideConfigKey("quarkus.micrometer.export.prometheus.enabled", "true")
.overrideConfigKey("quarkus.micrometer.export.prometheus.default-registry", "false")
.overrideConfigKey("quarkus.micrometer.registry-enabled-default", "false")
@@ -50,6 +51,9 @@ public void testMeterRegistryPresent() {
Assertions.assertEquals(subPromRegistry, promRegistry,
"Should be the same bean as the PrometheusMeterRegistry. Found " + subRegistries);
+ Assertions.assertNotNull(registry.find("jvm.info").counter(),
+ "JVM Info counter should be present, found: " + registry.getMeters());
+
String result = promRegistry.scrape();
Assertions.assertTrue(result.contains("customKey=\\"customValue\\""),
"Scrape result should contain common tags from the custom registry configuration. Found\\n" + result);
diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java
index fa61d99a6e3..bc58d9d1329 100644
--- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java
+++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java
@@ -104,7 +104,7 @@ public void configureRegistries(MicrometerConfig config,
}
// Base JVM Metrics
- if (config.binder.jvm) {
+ if (config.checkBinderEnabledWithDefault(() -> config.binder.jvm)) {
new ClassLoaderMetrics().bindTo(Metrics.globalRegistry);
new JvmHeapPressureMetrics().bindTo(Metrics.globalRegistry);
new JvmMemoryMetrics().bindTo(Metrics.globalRegistry);
@@ -115,8 +115,8 @@ public void configureRegistries(MicrometerConfig config,
}
}
- // System
- if (config.binder.system) {
+ // System metrics
+ if (config.checkBinderEnabledWithDefault(() -> config.binder.system)) {
new UptimeMetrics().bindTo(Metrics.globalRegistry);
new ProcessorMetrics().bindTo(Metrics.globalRegistry);
new FileDescriptorMetrics().bindTo(Metrics.globalRegistry);
diff --git a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java
index 0ec10d0f951..a32f88f2d8c 100644
--- a/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java
+++ b/extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java
@@ -97,10 +97,12 @@ public static class BinderConfig {
/**
* Micrometer JVM metrics support.
* <p>
- * Micrometer JVM metrics support is enabled by default.
+ * Support for JVM metrics will be enabled if Micrometer
+ * support is enabled, and either this value is true, or this
+ * value is unset and {@code quarkus.micrometer.binder-enabled-default} is true.
*/
- @ConfigItem(defaultValue = "true")
- public boolean jvm;
+ @ConfigItem
+ public Optional<Boolean> jvm;
public KafkaConfigGroup kafka;
public MPMetricsConfigGroup mpMetrics;
@@ -108,10 +110,12 @@ public static class BinderConfig {
/**
* Micrometer System metrics support.
* <p>
- * Micrometer System metrics support is enabled by default.
+ * Support for System metrics will be enabled if Micrometer
+ * support is enabled, and either this value is true, or this
+ * value is unset and {@code quarkus.micrometer.binder-enabled-default} is true.
*/
- @ConfigItem(defaultValue = "true")
- public boolean system;
+ @ConfigItem
+ public Optional<Boolean> system;
public VertxConfigGroup vertx;
} | ['extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/config/MicrometerConfig.java', 'extensions/micrometer/runtime/src/main/java/io/quarkus/micrometer/runtime/MicrometerRecorder.java', 'extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/GlobalDefaultDisabledTest.java', 'extensions/micrometer/deployment/src/test/java/io/quarkus/micrometer/deployment/export/NoDefaultPrometheusTest.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 17,637,369 | 3,429,225 | 452,572 | 4,710 | 1,138 | 245 | 22 | 2 | 763 | 96 | 188 | 49 | 0 | 2 | 2021-07-22T17:44:01 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,686 | quarkusio/quarkus/19225/18977 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18977 | https://github.com/quarkusio/quarkus/pull/19225 | https://github.com/quarkusio/quarkus/pull/19225 | 1 | fixes | Reactive REST Client breaks Hibernate Reactive Transactions | ### Describe the bug
When combining the Reactive REST client with Hibernate Reactive, the Reactive REST client seems to break Context Propagation, leading to Hibernate Transactions not working as intended.
### Expected behavior
Using Reactive REST Client does not have any negative effects on Hibernate Reactive
### Actual behavior
Using Reactive REST Client will break Hibernate Reactive Transactions because a call to `sessionFactory.withSession()` within an existing transaction will result in a new session being created instead of re-using the previously existing session residing in context.
### How to Reproduce?
Reproducer: https://github.com/markusdlugi/hibernate-reactive-with-transaction (don't get confused by the naming)
Steps to reproduce the behavior:
1. Run the application
2. Open `http://localhost:8080/test`. It will fail with `java.lang.IllegalStateException: Couldn't find author 1`
3. Remove the REST call (`TestResource` line 48). If you repeat the test, it will now work, you get an author and some books.
4. Revert your change and add the REST call again. The test will fail again.
5. Remove the Hibernate Transaction by replacing `.withTransaction((session, tx)` in line 43 with `.withSession(session`. The test will now work again, even though the REST call is still in place.
It seems like after the REST call, the `session2` in the reproducer is not the same session as `session1` where the entity was initially persisted. This leads to the error. Seems like the Reactive REST client messes up the context propagation.
Not sure why the example works when getting rid of the transaction entirely, though.
### Output of `uname -a` or `ver`
Microsoft Windows [Version 10.0.18363.1556]
### Output of `java -version`
OpenJDK 64-Bit Server VM Corretto-11.0.10.9.1 (build 11.0.10+9-LTS, mixed mode)
### GraalVM version (if different from Java)
N/A
### Quarkus version or git rev
2.0.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.6.3
### Additional information
Possibly related to #16949? But this one seems more severe because you cannot mix Hibernate Reactive Transactions and the REST client at all. | 5ddaf8d13f01201f05da30d5750813bdc91b11b6 | 8dd0af4e8c0ad3ccd96d2035e0942ba3a3f7fd29 | https://github.com/quarkusio/quarkus/compare/5ddaf8d13f01201f05da30d5750813bdc91b11b6...8dd0af4e8c0ad3ccd96d2035e0942ba3a3f7fd29 | diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java
index 3e332a87d60..0256fd40771 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java
@@ -45,4 +45,9 @@ void shouldHaveApplicationScopeByDefault() {
Bean<?> resolvedBean = beanManager.resolve(beans);
assertThat(resolvedBean.getScope()).isEqualTo(ApplicationScoped.class);
}
+
+ @Test
+ void shouldInvokeClientResponseOnSameContext() {
+ assertThat(testBean.bug18977()).isEqualTo("Hello");
+ }
}
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloClient2.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloClient2.java
index ab81bc507fb..660c55a0260 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloClient2.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloClient2.java
@@ -1,16 +1,26 @@
package io.quarkus.rest.client.reactive;
import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
+import io.smallrye.mutiny.Uni;
+
@RegisterRestClient(configKey = "hello2")
public interface HelloClient2 {
@POST
@Consumes(MediaType.TEXT_PLAIN)
@Path("/")
String echo(String name);
+
+ @GET
+ String bug18977();
+
+ @GET
+ @Path("delay")
+ Uni<String> delay();
}
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java
index 938d18738d1..5b18bc9564f 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java
@@ -1,6 +1,9 @@
package io.quarkus.rest.client.reactive;
+import java.time.Duration;
+
import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -8,6 +11,11 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;
+import org.eclipse.microprofile.rest.client.inject.RestClient;
+import org.junit.jupiter.api.Assertions;
+
+import io.smallrye.mutiny.Uni;
+
@Path("/hello")
@Produces(MediaType.TEXT_PLAIN)
@Consumes(MediaType.TEXT_PLAIN)
@@ -16,4 +24,24 @@ public class HelloResource {
public String echo(String name, @Context Request request) {
return "hello, " + name;
}
+
+ @RestClient
+ HelloClient2 client2;
+
+ @GET
+ public Uni<String> something() {
+ Thread thread = Thread.currentThread();
+ return client2.delay()
+ .map(foo -> {
+ Assertions.assertSame(thread, Thread.currentThread());
+ return foo;
+ });
+ }
+
+ @Path("delay")
+ @GET
+ public Uni<String> delay() {
+ return Uni.createFrom().item("Hello")
+ .onItem().delayIt().by(Duration.ofMillis(500));
+ }
}
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java
index 06fd623c7da..8d7eade3b2f 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java
@@ -27,4 +27,8 @@ String helloViaBuiltClient(String name) {
.build(HelloClient.class);
return helloClient.echo(name);
}
+
+ String bug18977() {
+ return client2.bug18977();
+ }
}
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderDisabledAutodiscoveryTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderDisabledAutodiscoveryTest.java
index b318c03b039..97922399e96 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderDisabledAutodiscoveryTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderDisabledAutodiscoveryTest.java
@@ -15,6 +15,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
+import io.quarkus.rest.client.reactive.HelloClient2;
import io.quarkus.rest.client.reactive.HelloResource;
import io.quarkus.test.QuarkusUnitTest;
import io.quarkus.test.common.http.TestHTTPResource;
@@ -24,9 +25,11 @@ public class ProviderDisabledAutodiscoveryTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
- .addClasses(HelloResource.class, HelloClient.class, GlobalRequestFilter.class, GlobalResponseFilter.class)
+ .addClasses(HelloResource.class, HelloClient2.class, HelloClient.class, GlobalRequestFilter.class,
+ GlobalResponseFilter.class)
.addAsResource(
new StringAsset(setUrlForClass(HelloClient.class)
+ + setUrlForClass(HelloClient2.class)
+ "quarkus.rest-client-reactive.provider-autodiscovery=false"),
"application.properties"));
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderPriorityTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderPriorityTest.java
index 45e8178d2de..2bcb717b51a 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderPriorityTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderPriorityTest.java
@@ -13,6 +13,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
+import io.quarkus.rest.client.reactive.HelloClient2;
import io.quarkus.rest.client.reactive.HelloResource;
import io.quarkus.test.QuarkusUnitTest;
@@ -23,12 +24,14 @@ public class ProviderPriorityTest {
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(HelloResource.class,
HelloClient.class,
+ HelloClient2.class,
HelloClientWithFilter.class,
ResponseFilterLowestPrio.class,
GlobalResponseFilter.class,
GlobalResponseFilterLowPrio.class)
.addAsResource(
new StringAsset(setUrlForClass(HelloClient.class)
+ + setUrlForClass(HelloClient2.class)
+ setUrlForClass(HelloClientWithFilter.class)),
"application.properties"));
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderTest.java
index 897db05f57d..8470d770a40 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderTest.java
@@ -16,6 +16,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
+import io.quarkus.rest.client.reactive.HelloClient2;
import io.quarkus.rest.client.reactive.HelloResource;
import io.quarkus.test.QuarkusUnitTest;
import io.quarkus.test.common.http.TestHTTPResource;
@@ -25,11 +26,12 @@ public class ProviderTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
- .addClasses(HelloResource.class, HelloClient.class, GlobalRequestFilter.class,
+ .addClasses(HelloResource.class, HelloClient2.class, HelloClient.class, GlobalRequestFilter.class,
GlobalResponseFilter.class, GlobalRequestFilterConstrainedToServer.class,
GlobalFeature.class)
.addAsResource(
- new StringAsset(setUrlForClass(HelloClient.class)),
+ new StringAsset(setUrlForClass(HelloClient.class)
+ + setUrlForClass(HelloClient2.class)),
"application.properties"));
@RestClient
diff --git a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java
index 467166cdf2d..33733d240ea 100644
--- a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java
+++ b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java
@@ -1,5 +1,6 @@
package org.jboss.resteasy.reactive.client.impl;
+import io.vertx.core.Context;
import io.vertx.core.MultiMap;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpClient;
@@ -219,7 +220,14 @@ public HttpClientResponse getVertxClientResponse() {
@Override
protected Executor getEventLoop() {
if (httpClientRequest == null) {
- return restClient.getVertx().nettyEventLoopGroup().next();
+ // make sure we execute the client callbacks on the same context as the current thread
+ Context context = restClient.getVertx().getOrCreateContext();
+ return new Executor() {
+ @Override
+ public void execute(Runnable command) {
+ context.runOnContext(v -> command.run());
+ }
+ };
} else {
return new Executor() {
@Override | ['extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderPriorityTest.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloClient2.java', 'independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/RestClientRequestContext.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderTest.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/TestBean.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/provider/ProviderDisabledAutodiscoveryTest.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/BasicRestClientTest.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/HelloResource.java'] | {'.java': 8} | 8 | 8 | 0 | 0 | 8 | 18,302,551 | 3,559,693 | 468,906 | 4,812 | 496 | 87 | 10 | 1 | 2,204 | 321 | 508 | 50 | 2 | 0 | 2021-08-04T12:51:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,687 | quarkusio/quarkus/19100/19051 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19051 | https://github.com/quarkusio/quarkus/pull/19100 | https://github.com/quarkusio/quarkus/pull/19100 | 1 | fixes | Quarkus fails to report a correct exception when conflicting authentication mechanisms are used (was Quarkus: can't verify Auth0 token) | ### Describe the bug
I have the following OIDC configuration:
```
quarkus.oidc.auth-server-url=https://cognio.eu.auth0.com
quarkus.oidc.client-id=<redacted>
quarkus.oidc.credentials.secret=<redacted>
quarkus.oidc.token.audience=<redacted>
quarkus.oidc.authentication.scopes=openid,profile,email
quarkus.http.auth.permission.authenticated.paths=/*
quarkus.http.auth.permission.authenticated.policy=authenticated
```
While trying to access any endpoint with a valid access token I receive following response:
```
HTTP/1.1 401 Unauthorized
www-authenticate: Bearer
content-length: 0
```
If logging level is set to DEBUG the following stack trace is printed:
```
2021-07-28 14:47:08,037 DEBUG [io.sma.jwt.aut.principal] (vert.x-eventloop-thread-7) SRJWT08019: AuthContextInfo is: JWTAuthContextInfo{publicVerificationKey=null, secretVerificationKey=null, privateDecryptionKey=null, secretDecryptionKey=null, issuedBy='null', expGracePeriodSecs=60, maxTimeToLiveSecs=null, publicKeyLocation='null', publicKeyContent='null', decryptionKeyLocation='null', decryptionKeyContent='null', jwksRefreshInterval=60, tokenHeader='Authorization', tokenCookie='null', alwaysCheckAuthorization=false, tokenKeyId='null', tokenDecryptionKeyId='null', tokenSchemes=[Bearer], requireNamedPrincipal=true, defaultSubClaim='null', subPath='null', defaultGroupsClaim='null', groupsPath='null', signatureAlgorithm=RS256, keyEncryptionAlgorithm=RSA_OAEP, keyFormat=ANY, expectedAudience=null, groupsSeparator=' ', relaxVerificationKeyValidation=true, verifyCertificateThumbprint=false}
2021-07-28 14:47:08,040 DEBUG [io.sma.jwt.aut.principal] (vert.x-eventloop-thread-7) SRJWT08005: Verification key is unresolvable
2021-07-28 14:47:08,040 DEBUG [io.qua.sma.jwt.run.aut.MpJwtValidator] (vert.x-eventloop-thread-7) Authentication failed: io.smallrye.jwt.auth.principal.ParseException: SRJWT07000: Failed to verify a token
at io.smallrye.jwt.auth.principal.DefaultJWTTokenParser.parseClaims(DefaultJWTTokenParser.java:164)
at io.smallrye.jwt.auth.principal.DefaultJWTTokenParser.parse(DefaultJWTTokenParser.java:56)
at io.smallrye.jwt.auth.principal.DefaultJWTCallerPrincipalFactory.parse(DefaultJWTCallerPrincipalFactory.java:31)
at io.smallrye.jwt.auth.principal.DefaultJWTParser.parse(DefaultJWTParser.java:60)
at io.smallrye.jwt.auth.principal.DefaultJWTParser_Subclass.parse$$superforward1(DefaultJWTParser_Subclass.zig:517)
at io.smallrye.jwt.auth.principal.DefaultJWTParser_Subclass$$function$$6.apply(DefaultJWTParser_Subclass$$function$$6.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at io.smallrye.jwt.auth.principal.DefaultJWTParser_Subclass.parse(DefaultJWTParser_Subclass.zig:1180)
at io.smallrye.jwt.auth.principal.DefaultJWTParser_ClientProxy.parse(DefaultJWTParser_ClientProxy.zig:298)
at io.quarkus.smallrye.jwt.runtime.auth.MpJwtValidator$1.accept(MpJwtValidator.java:53)
at io.quarkus.smallrye.jwt.runtime.auth.MpJwtValidator$1.accept(MpJwtValidator.java:49)
at io.smallrye.context.impl.wrappers.SlowContextualConsumer.accept(SlowContextualConsumer.java:21)
at io.smallrye.mutiny.operators.uni.builders.UniCreateWithEmitter.subscribe(UniCreateWithEmitter.java:22)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni.subscribe(UniOnItemTransformToUni.java:25)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni.subscribe(UniOnItemTransformToUni.java:25)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniMemoizeOp.subscribe(UniMemoizeOp.java:76)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.groups.UniSubscribe.withSubscriber(UniSubscribe.java:50)
at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:104)
at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:51)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$3.handle(VertxHttpHotReplacementSetup.java:88)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$3.handle(VertxHttpHotReplacementSetup.java:77)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:124)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.jose4j.lang.UnresolvableKeyException: SRJWT07003: Failed to load a key from null
at io.smallrye.jwt.auth.principal.AbstractKeyLocationResolver.reportLoadKeyException(AbstractKeyLocationResolver.java:180)
at io.smallrye.jwt.auth.principal.KeyLocationResolver.<init>(KeyLocationResolver.java:47)
at io.smallrye.jwt.auth.principal.DefaultJWTTokenParser.getVerificationKeyResolver(DefaultJWTTokenParser.java:236)
at io.smallrye.jwt.auth.principal.DefaultJWTTokenParser.parseClaims(DefaultJWTTokenParser.java:99)
... 42 more
Caused by: java.lang.NullPointerException
at io.smallrye.jwt.util.ResourceUtils.getResourceStream(ResourceUtils.java:68)
at io.smallrye.jwt.util.ResourceUtils.readResource(ResourceUtils.java:44)
at io.smallrye.jwt.auth.principal.AbstractKeyLocationResolver.readKeyContent(AbstractKeyLocationResolver.java:131)
at io.smallrye.jwt.auth.principal.KeyLocationResolver.initializeKeyContent(KeyLocationResolver.java:95)
at io.smallrye.jwt.auth.principal.KeyLocationResolver.<init>(KeyLocationResolver.java:45)
... 44 more
```
### Expected behavior
Quarkus should successfully verify token and give access to endpoint.
### Actual behavior
Quarkus throws exception.
### How to Reproduce?
Steps to reproduce:
1. Create free Auth0 tenant.
2. Create new API application with RSA256 signing algorithm.
3. Add `http://localhost:8080/` to allowed callback URLs for the API application.
4. Rewrite redacted values from configuration with the corresponding API application properties.
5. Start service.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
11.0.12
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.0.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
### Additional information
_No response_ | c83927e8e5eff69cd5f8c8f2f638b23714f3bf70 | 7c63f4da44faeeca8df9924b617f0cc9ed3d8865 | https://github.com/quarkusio/quarkus/compare/c83927e8e5eff69cd5f8c8f2f638b23714f3bf70...7c63f4da44faeeca8df9924b617f0cc9ed3d8865 | diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java
index f3ec0c42821..1fdcbe9a246 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java
@@ -9,6 +9,7 @@
import io.quarkus.oidc.OIDCException;
import io.quarkus.oidc.OidcTenantConfig;
+import io.quarkus.oidc.common.runtime.OidcConstants;
import io.quarkus.security.identity.IdentityProviderManager;
import io.quarkus.security.identity.SecurityIdentity;
import io.quarkus.security.identity.request.AuthenticationRequest;
@@ -79,6 +80,6 @@ public Set<Class<? extends AuthenticationRequest>> getCredentialTypes() {
public HttpCredentialTransport getCredentialTransport() {
//not 100% correct, but enough for now
//if OIDC is present we don't really want another bearer mechanism
- return new HttpCredentialTransport(HttpCredentialTransport.Type.AUTHORIZATION, "bearer");
+ return new HttpCredentialTransport(HttpCredentialTransport.Type.AUTHORIZATION, OidcConstants.BEARER_SCHEME);
}
}
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpCredentialTransport.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpCredentialTransport.java
index 935f19193e9..cd3ba29798c 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpCredentialTransport.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpCredentialTransport.java
@@ -26,7 +26,7 @@ public HttpCredentialTransport(Type transportType, String typeTarget) {
public HttpCredentialTransport(Type transportType, String typeTarget, String authenticationScheme) {
this.transportType = Objects.requireNonNull(transportType);
this.typeTarget = Objects.requireNonNull(typeTarget).toLowerCase();
- this.authenticationScheme = Objects.requireNonNull(authenticationScheme);
+ this.authenticationScheme = Objects.requireNonNull(authenticationScheme).toLowerCase();
}
public enum Type { | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/security/HttpCredentialTransport.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,730,064 | 3,447,179 | 454,784 | 4,721 | 449 | 78 | 5 | 2 | 7,916 | 362 | 1,964 | 125 | 2 | 3 | 2021-07-29T15:59:14 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,688 | quarkusio/quarkus/19070/19037 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19037 | https://github.com/quarkusio/quarkus/pull/19070 | https://github.com/quarkusio/quarkus/pull/19070 | 1 | fixes | Multipart Class Defined Outside Resource Implementation Fails with CNFE "Populator" | ### Describe the bug
When I define a class meant to be used as a payload in both my REST client and resource I get a CNFE stating that the "populator" could not be located. If I put the class with the resource it works fine.
Referencing a conversation with Michal on [Google Groups](https://groups.google.com/g/quarkus-dev/c/oq73n_QJzxI/m/zJw0CtJsAAAJ).
**Issue 1 demonstrates the error / Working 2 demonstrates what worked:**
[reproduce-issue1.zip](https://github.com/quarkusio/quarkus/files/6888330/reproduce-issue1.zip)
[reproduce-working2.zip](https://github.com/quarkusio/quarkus/files/6888336/reproduce-working2.zip)
NOTE: Hopefully I did not mix up my reproducers.
### Expected behavior
Class defined in a separate module can be used as the payload from the client and in the resource.
### Actual behavior
Class not found exception - "Populator" when the payload is defined in another module.
ClassNotFoundException: io.platform.api.publish.FilePackage_generated_populator
### How to Reproduce?
Run `mvn clean install` on the issue attached above
### Output of `uname -a` or `ver`
Ubuntu / WSL
### Output of `java -version`
JDK 11 in the POM / 15 as the default.
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.0.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
3.8.1
### Additional information
I forgot to include the Jandex plugin in my reproducer but my modules all are invoking it (and I see the IDX file). I have also tried adding a `beans.xml` but that did not help. Anything but the multipart payload seems to work though when separated between an API jar and the service jar. | 856d0c3fa707a813694e6c89323a2849daad00f3 | c09a500dd7efba5284d2bf436b540bfa737711cf | https://github.com/quarkusio/quarkus/compare/856d0c3fa707a813694e6c89323a2849daad00f3...c09a500dd7efba5284d2bf436b540bfa737711cf | diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java
index c31d4bc9096..4271339ce3c 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java
@@ -230,7 +230,8 @@ protected void handleMultipart(ClassInfo multipartClassInfo) {
}
reflectiveClassProducer.produce(new ReflectiveClassBuildItem(false, false, className));
String populatorClassName = MultipartPopulatorGenerator.generate(multipartClassInfo,
- new GeneratedClassGizmoAdaptor(generatedClassBuildItemBuildProducer, true), index);
+ new GeneratedClassGizmoAdaptor(generatedClassBuildItemBuildProducer, applicationClassPredicate.test(className)),
+ index);
multipartGeneratedPopulators.put(className, populatorClassName);
// transform the multipart pojo (and any super-classes) so we can access its fields no matter what | ['extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/main/java/io/quarkus/resteasy/reactive/server/deployment/QuarkusServerEndpointIndexer.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,711,042 | 3,443,710 | 454,287 | 4,718 | 255 | 48 | 3 | 1 | 1,740 | 240 | 431 | 50 | 3 | 0 | 2021-07-29T00:00:09 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,689 | quarkusio/quarkus/19053/19049 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19049 | https://github.com/quarkusio/quarkus/pull/19053 | https://github.com/quarkusio/quarkus/pull/19053 | 1 | close | CLI "quarkus dev" command is not working with gradle kotlin | ### Describe the bug
quarkus dev command is not working with gradle kotlin
### Expected behavior
should work
### Actual behavior
```
[ERROR] ❗ Unable to launch project in dev mode: Was not able to find a build file in: /Users/ia3andy/Downloads/code-with-quarkus
````
### How to Reproduce?
1. Generate some project with code.quarkus using Gradle Kotlin: https://stage.code.quarkus.io/?b=GRADLE_KOTLIN_DSL&e=resteasy&e=resteasy-jackson&e=hibernate-validator
2. Copy `quarkus dev` command in the popup
3. Unzip and cd
4.
```shell
$ quarkus dev
[ERROR] ❗ Unable to launch project in dev mode: Was not able to find a build file in: /Users/ia3andy/Downloads/code-with-quarkus
```
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 6ec78b90cc4b1e00b498fd0a123b10ad962c0637 | 5cbd3e736edc2378de9d5ad4998f54e469ec013b | https://github.com/quarkusio/quarkus/compare/6ec78b90cc4b1e00b498fd0a123b10ad962c0637...5cbd3e736edc2378de9d5ad4998f54e469ec013b | diff --git a/devtools/cli/src/main/java/io/quarkus/cli/build/GradleRunner.java b/devtools/cli/src/main/java/io/quarkus/cli/build/GradleRunner.java
index faaa3c3b65d..d95bfecfcca 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/build/GradleRunner.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/build/GradleRunner.java
@@ -235,9 +235,13 @@ void setGradleProperties(ArrayDeque<String> args, boolean batchMode) {
}
void verifyBuildFile() {
- File buildFile = projectRoot.resolve("build.gradle").toFile();
- if (!buildFile.isFile()) {
- throw new IllegalStateException("Was not able to find a build file in: " + projectRoot);
+ for (String buildFileName : buildTool.getBuildFiles()) {
+ File buildFile = projectRoot.resolve(buildFileName).toFile();
+ if (buildFile.exists()) {
+ return;
+ }
}
+ throw new IllegalStateException("Was not able to find a build file in: " + projectRoot
+ + " based on the following list: " + String.join(",", buildTool.getBuildFiles()));
}
} | ['devtools/cli/src/main/java/io/quarkus/cli/build/GradleRunner.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,689,073 | 3,439,542 | 453,760 | 4,715 | 625 | 124 | 10 | 1 | 1,025 | 144 | 285 | 48 | 1 | 2 | 2021-07-28T09:29:17 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,690 | quarkusio/quarkus/19007/19001 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19001 | https://github.com/quarkusio/quarkus/pull/19007 | https://github.com/quarkusio/quarkus/pull/19007 | 1 | fixes | DevMode Runtime ClassLoader is never closed | ### Describe the bug
Tracing the constructors and `close` methods on `QuarkusClassLoader` one can see that during a live-reload this is the sequence of relevant events:
- start a new "Deployment Class Loader: DEV"
- stop a "Deployment Class Loader: DEV"
- start a new "Quarkus Runtime ClassLoader: DEV"
So at each re-deply, two new classloaders are constructed, but only one is being closed. The "Runtime ClassLoader" is never explicitly closed.
It doesn't seem critical: as far as I can tell with limited testing this doesn't seem to result in a real leak, and the classloader is still eventually collected by GC.
The `closeTasks` runnables that could be registered on a "Quarkus Runtime ClassLoader: DEV" are also not executed, but as far as I can see these are typically an empty list.
`ResourceBundle.clearCache` is also not being processed, but this also seems harmless in pracice.
@stuartwdouglas could you have a look? Feel free to close if it's intended.
### Quarkus version or git rev
main @ `dcf7c09377`
| 8377c6dc4783daa6390e7e58c0a1a9b865809f82 | 05d0462182b431c9e63af6b260b89898dacb1f01 | https://github.com/quarkusio/quarkus/compare/8377c6dc4783daa6390e7e58c0a1a9b865809f82...05d0462182b431c9e63af6b260b89898dacb1f01 | diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/RunningQuarkusApplicationImpl.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/RunningQuarkusApplicationImpl.java
index 609c0433356..79a69b073fd 100644
--- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/RunningQuarkusApplicationImpl.java
+++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/RunningQuarkusApplicationImpl.java
@@ -8,15 +8,16 @@
import org.eclipse.microprofile.config.ConfigProvider;
import io.quarkus.bootstrap.app.RunningQuarkusApplication;
+import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
public class RunningQuarkusApplicationImpl implements RunningQuarkusApplication {
private final Closeable closeTask;
- private final ClassLoader classLoader;
+ private final QuarkusClassLoader classLoader;
private boolean closing;
- public RunningQuarkusApplicationImpl(Closeable closeTask, ClassLoader classLoader) {
+ public RunningQuarkusApplicationImpl(Closeable closeTask, QuarkusClassLoader classLoader) {
this.closeTask = closeTask;
this.classLoader = classLoader;
}
@@ -30,7 +31,11 @@ public ClassLoader getClassLoader() {
public void close() throws Exception {
if (!closing) {
closing = true;
- closeTask.close();
+ try {
+ closeTask.close();
+ } finally {
+ classLoader.close();
+ }
}
}
| ['core/deployment/src/main/java/io/quarkus/runner/bootstrap/RunningQuarkusApplicationImpl.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,676,071 | 3,436,997 | 453,457 | 4,714 | 508 | 97 | 11 | 1 | 1,045 | 167 | 247 | 21 | 0 | 0 | 2021-07-26T21:39:52 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,693 | quarkusio/quarkus/18965/18942 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18942 | https://github.com/quarkusio/quarkus/pull/18965 | https://github.com/quarkusio/quarkus/pull/18965 | 1 | fixes | Should start a single Vertx instance, or guarantee unique thread names | ### Describe the bug
When starting Quarkus in dev mode, there are two independent Vert.x engined started:
1. One by `VertxCoreRecorder#initialize` triggered by `ResteasyStandaloneRecorder`
2. One by `DevConsoleProcessor#initializeVirtual`.
This doesn't seem efficient (is it necessary?) and is extremely confusing, as both instances are starting threads which have overlapping names; so for example I now have two different copies of `vert.x-eventloop-thread-0`, making it puzzling to resolve some of the memory leaks.
### Expected behavior
Ideally, start a single vert.x. (Is the second start by design @stuartwdouglas , @FroMage ?)
If that's not possible, let's try at least to have them produce unambiguous thread names.
### Quarkus version or git rev
`cf73c98c5b` | 08afe29cd99d5e4719f966ef834d0e46219ce426 | dbf29e890758038a2be68544253db2b42fe881c9 | https://github.com/quarkusio/quarkus/compare/08afe29cd99d5e4719f966ef834d0e46219ce426...dbf29e890758038a2be68544253db2b42fe881c9 | diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java
index 0af391b45bf..8a84e13f6da 100644
--- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java
+++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java
@@ -28,6 +28,7 @@
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
+import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -103,13 +104,18 @@
import io.quarkus.vertx.http.runtime.logstream.LogStreamRecorder;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
+import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.impl.Http1xServerConnection;
import io.vertx.core.impl.EventLoopContext;
+import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.impl.VertxInternal;
+import io.vertx.core.impl.VertxThread;
import io.vertx.core.net.impl.VertxHandler;
+import io.vertx.core.net.impl.transport.Transport;
+import io.vertx.core.spi.VertxThreadFactory;
import io.vertx.ext.web.Route;
import io.vertx.ext.web.Router;
import io.vertx.ext.web.RoutingContext;
@@ -134,7 +140,7 @@ public static void initializeVirtual() {
if (virtualBootstrap != null) {
return;
}
- devConsoleVertx = Vertx.vertx();
+ devConsoleVertx = initializeDevConsoleVertx();
VertxInternal vertx = (VertxInternal) devConsoleVertx;
QuarkusClassLoader ccl = (QuarkusClassLoader) DevConsoleProcessor.class.getClassLoader();
ccl.addCloseTask(new Runnable() {
@@ -213,6 +219,35 @@ public void handle(HttpServerRequest event) {
}
+ /**
+ * Boots the Vert.x instance used by the DevConsole,
+ * applying some minimal tuning and customizations.
+ *
+ * @return the initialized Vert.x instance
+ */
+ private static Vertx initializeDevConsoleVertx() {
+ final VertxOptions vertxOptions = new VertxOptions();
+ //Smaller than default, but larger than 1 to be on the safe side.
+ int POOL_SIZE = 2;
+ vertxOptions.setEventLoopPoolSize(POOL_SIZE);
+ vertxOptions.setWorkerPoolSize(POOL_SIZE);
+ vertxOptions.getMetricsOptions().setEnabled(false);
+ //Not good for development:
+ vertxOptions.getFileSystemOptions().setFileCachingEnabled(false);
+ VertxBuilder builder = new VertxBuilder(vertxOptions);
+ builder.threadFactory(new VertxThreadFactory() {
+ @Override
+ public VertxThread newVertxThread(Runnable target, String name, boolean worker, long maxExecTime,
+ TimeUnit maxExecTimeUnit) {
+ //Customize the Thread names so to not conflict with the names generated by the main Quarkus Vert.x instance
+ return new VertxThread(target, "[DevConsole]" + name, worker, maxExecTime, maxExecTimeUnit);
+ }
+ });
+ builder.transport(Transport.JDK);
+ builder.init();
+ return builder.vertx();
+ }
+
protected static void newRouter(Engine engine,
NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) {
| ['extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/console/DevConsoleProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,643,683 | 3,430,672 | 452,715 | 4,712 | 1,722 | 362 | 37 | 1 | 800 | 110 | 190 | 21 | 0 | 0 | 2021-07-23T11:21:30 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,694 | quarkusio/quarkus/18955/18954 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18954 | https://github.com/quarkusio/quarkus/pull/18955 | https://github.com/quarkusio/quarkus/pull/18955 | 1 | fixes | quarkus:dependency-tree fails on conditional dependencies unless they are present in the local repo | ### Describe the bug
Assuming the local repo does not contain the `io.quarkiverse.logging.logback` artifacts, create a project using `qs create -x logback -S 2.1` then
````
[aloubyansky@lenora code-with-quarkus]$ mvn quarkus:dependency-tree
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.acme:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- quarkus-maven-plugin:2.1.0.CR1:dependency-tree (default-cli) @ code-with-quarkus ---
[INFO] Quarkus application PROD mode build dependency tree:
Downloading from central: https://repo.maven.apache.org/maven2/io/quarkiverse/logging/logback/quarkus-logging-logback/0.1.0/quarkus-logging-logback-0.1.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/io/quarkiverse/logging/logback/quarkus-logging-logback/0.1.0/quarkus-logging-logback-0.1.0.pom (1.9 kB at 3.9 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/io/quarkiverse/logging/logback/quarkus-logging-logback-parent/0.1.0/quarkus-logging-logback-parent-0.1.0.pom
Downloaded from central: https://repo.maven.apache.org/maven2/io/quarkiverse/logging/logback/quarkus-logging-logback-parent/0.1.0/quarkus-logging-logback-parent-0.1.0.pom (3.4 kB at 70 kB/s)
Downloading from central: https://repo.maven.apache.org/maven2/io/quarkiverse/logging/logback/quarkus-logging-logback/0.1.0/quarkus-logging-logback-0.1.0.jar
Downloaded from central: https://repo.maven.apache.org/maven2/io/quarkiverse/logging/logback/quarkus-logging-logback/0.1.0/quarkus-logging-logback-0.1.0.jar (3.1 kB at 64 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.176 s
[INFO] Finished at: 2021-07-23T07:48:55+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.1.0.CR1:dependency-tree (default-cli) on project code-with-quarkus: Failed to resolve application model org.acme:code-with-quarkus::pom:1.0.0-SNAPSHOT dependencies: io.quarkus.bootstrap.resolver.maven.BootstrapMavenException: Failed to resolve artifact io.quarkiverse.logging.logback:quarkus-logging-logback-impl:jar:0.1.0: Could not find artifact io.quarkiverse.logging.logback:quarkus-logging-logback-impl:jar:0.1.0 -> [Help 1]
````
Building the project properly downloads the dependencies and then `quarkus:dependency-tree` works. | 84fc1d02fb294a45b7d18326bad2849db48648bc | 4e60b1d3c61979d996cf307d662cc5d4d00cc361 | https://github.com/quarkusio/quarkus/compare/84fc1d02fb294a45b7d18326bad2849db48648bc...4e60b1d3c61979d996cf307d662cc5d4d00cc361 | diff --git a/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java
index f3b6e4d90c5..d8d2c28a287 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java
@@ -30,7 +30,7 @@ public class DependencyTreeMojo extends AbstractMojo {
@Parameter(defaultValue = "${project}", readonly = true, required = true)
protected MavenProject project;
- @Parameter(defaultValue = "${project.remoteRepositories}", readonly = true, required = true)
+ @Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true, required = true)
private List<RemoteRepository> repos;
/** | ['devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,640,751 | 3,430,059 | 452,639 | 4,711 | 202 | 39 | 2 | 1 | 2,660 | 163 | 745 | 29 | 6 | 1 | 2021-07-23T06:08:34 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,696 | quarkusio/quarkus/18944/18943 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18943 | https://github.com/quarkusio/quarkus/pull/18944 | https://github.com/quarkusio/quarkus/pull/18944 | 1 | fixes | dev-mode Classloader leak via Vert.x internal worker pool | ### Describe the bug
This is similar to #18911, but it turns out Vert.x has an additional internal pool which is keeping hold of previous classloaders: these threads are lazily started (so easy to miss in a simple app) and follow the naming scheme `vertx-internal-blocking-` N
### Expected behavior
We should reset these as well.
| 86f9b20f100b7d90f982ffe57139c11b1953ee61 | 9d410c1edb7c1dd3c01a7c9dd4ad666cf99bd9c6 | https://github.com/quarkusio/quarkus/compare/86f9b20f100b7d90f982ffe57139c11b1953ee61...9d410c1edb7c1dd3c01a7c9dd4ad666cf99bd9c6 | diff --git a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
index c7c0357c730..8823f29604f 100644
--- a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
+++ b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
@@ -7,6 +7,7 @@
import static io.quarkus.vertx.core.runtime.SSLConfigHelper.configurePfxTrustOptions;
import java.io.File;
+import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -133,12 +134,8 @@ private void tryCleanTccl(Vertx devModeVertx) {
//this is a best effort attempt to clean out the old TCCL from
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- EnhancedQueueExecutor executor = extractExecutor(devModeVertx);
-
- final Thread[] runningThreads = executor.getRunningThreads();
- for (Thread t : runningThreads) {
- t.setContextClassLoader(cl);
- }
+ resetExecutorsClassloaderContext(extractWorkerPool(devModeVertx), cl);
+ resetExecutorsClassloaderContext(extractInternalWorkerPool(devModeVertx), cl);
EventLoopGroup group = ((VertxImpl) devModeVertx).getEventLoopGroup();
for (EventExecutor i : group) {
@@ -154,13 +151,37 @@ public void run() {
}
+ private WorkerPool extractInternalWorkerPool(Vertx devModeVertx) {
+ VertxImpl vertxImpl = (VertxImpl) devModeVertx;
+ final Object internalWorkerPool;
+ final Field field;
+ try {
+ field = VertxImpl.class.getDeclaredField("internalWorkerPool");
+ field.setAccessible(true);
+ } catch (NoSuchFieldException e) {
+ throw new RuntimeException(e);
+ }
+ try {
+ internalWorkerPool = field.get(vertxImpl);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+
+ return (WorkerPool) internalWorkerPool;
+ }
+
+ private WorkerPool extractWorkerPool(Vertx devModeVertx) {
+ final ContextInternal ctx = (ContextInternal) devModeVertx.getOrCreateContext();
+ return ctx.workerPool();
+ }
+
/**
* Extract the JBoss Threads EnhancedQueueExecutor from the Vertx instance
- * this is messy as it needs to use reflection until Vertx can expose it.
+ * and reset all threads to use the given ClassLoader.
+ * This is messy as it needs to use reflection until Vertx can expose it:
+ * - https://github.com/eclipse-vertx/vert.x/pull/4029
*/
- private EnhancedQueueExecutor extractExecutor(Vertx devModeVertx) {
- final ContextInternal ctx = (ContextInternal) devModeVertx.getOrCreateContext();
- final WorkerPool workerPool = ctx.workerPool();
+ private void resetExecutorsClassloaderContext(WorkerPool workerPool, ClassLoader cl) {
final Method executorMethod;
try {
executorMethod = WorkerPool.class.getDeclaredMethod("executor");
@@ -175,7 +196,10 @@ private EnhancedQueueExecutor extractExecutor(Vertx devModeVertx) {
throw new RuntimeException(e);
}
EnhancedQueueExecutor executor = (EnhancedQueueExecutor) result;
- return executor;
+ final Thread[] runningThreads = executor.getRunningThreads();
+ for (Thread t : runningThreads) {
+ t.setContextClassLoader(cl);
+ }
}
public IOThreadDetector detector() { | ['extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,637,369 | 3,429,225 | 452,572 | 4,710 | 2,084 | 430 | 46 | 1 | 340 | 55 | 76 | 8 | 0 | 0 | 2021-07-22T16:50:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,684 | quarkusio/quarkus/19291/19269 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19269 | https://github.com/quarkusio/quarkus/pull/19291 | https://github.com/quarkusio/quarkus/pull/19291 | 1 | fixes | quarkus starts database testcontainer even if quarkus.datasource.start-container set to false | ### Describe the bug
There is testcontainers lib in classpath
`quarkus.datasource.start-container` set to false in the application.properties
when run tests without any tests that starts testcontainer and Docker available it fails because quarkus tries to run testcontainer.
It's needed to completely decouple unit tests and integration tests. (So it can be achieved by excluding integration test by JUnit 5 tag but it fails if run unit tests on a machine without Docker due to the reason described above).
### Expected behavior
`mvn clean test` should pass if it runs only tests that doesn't use testcontainers and Docker is turned off.
when `quarkus.datasource.start-container` set to false
### Actual behavior
It fails:
```
Caused by: io.quarkus.builder.BuildException:
Build failure: Build failed due to errors
[error]: Build step io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor#launchDatabases threw an exception: java.lang.IllegalStateException: Could not f
ind a valid Docker environment. Please see logs and check configuration
at org.testcontainers.dockerclient.DockerClientProviderStrategy.lambda$getFirstValidStrategy$7(DockerClientProviderStrategy.java:215)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at org.testcontainers.dockerclient.DockerClientProviderStrategy.getFirstValidStrategy(DockerClientProviderStrategy.java:207)
at org.testcontainers.DockerClientFactory.getOrInitializeStrategy(DockerClientFactory.java:136)
at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:178)
at org.testcontainers.LazyDockerClient.getDockerClient(LazyDockerClient.java:14)
at org.testcontainers.LazyDockerClient.authConfig(LazyDockerClient.java:12)
at org.testcontainers.containers.GenericContainer.start(GenericContainer.java:310)
at io.quarkus.devservices.postgresql.deployment.PostgresqlDevServicesProcessor$1.startDatabase(PostgresqlDevServicesProcessor.java:43)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.startDevDb(DevServicesDatasourceProcessor.java:217)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.launchDatabases(DevServicesDatasourceProcessor.java:103)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:920)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
```
As you can see there is call of
`io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor.launchDatabases(DevServicesDatasourceProcessor.java:103)`
### How to Reproduce?
Quarkus version:
- Create quarkus project add testcontainers, Postgres or download the existing simple demo project
[todo-list.zip](https://github.com/quarkusio/quarkus/files/6945398/todo-list.zip)
- Turn off Docker
- run `mvn clean test` in this project (it's not going to run tests that uses testcontainer as they are excluded by surefire plugin with junit tags)
### Output of `uname -a` or `ver`
Microsoft Windows [Version 10.0.19042.1110]
### Output of `java -version`
java version "11.0.11" 2021-04-20 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.11+9-LTS-194) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.11+9-LTS-194, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
1.13.7.Final (it's also reproducible for 2.1.1.Final but output is different)
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: C:\\ProgramData\\chocolatey\\lib\\maven\\apache-maven-3.6.3\\bin\\.. Java version: 11.0.11, vendor: Oracle Corporation, runtime: C:\\Program Files\\Java\\jdk-11.0.11 Default locale: en_US, platform encoding: Cp1251 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
### Additional information
_No response_ | 626b2dce604661f2e0efd7150fb3897081225306 | e8fe2d617506cba2f366360bf56c891e1ccf1562 | https://github.com/quarkusio/quarkus/compare/626b2dce604661f2e0efd7150fb3897081225306...e8fe2d617506cba2f366360bf56c891e1ccf1562 | diff --git a/extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DataSourceRuntimeConfig.java b/extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DataSourceRuntimeConfig.java
index 843523b3b08..82c9f351e8c 100644
--- a/extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DataSourceRuntimeConfig.java
+++ b/extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DataSourceRuntimeConfig.java
@@ -36,13 +36,4 @@ public class DataSourceRuntimeConfig {
*/
@ConfigItem
public Optional<String> credentialsProviderName = Optional.empty();
-
- /**
- * If this is true then when running in dev or test mode Quarkus will attempt to start a testcontainers based
- * database with these provided settings.
- *
- * This is not supported for all databases, and will not work in production.
- */
- @ConfigItem(defaultValue = "false")
- public boolean startContainer;
} | ['extensions/datasource/runtime/src/main/java/io/quarkus/datasource/runtime/DataSourceRuntimeConfig.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,783,703 | 3,457,545 | 456,154 | 4,733 | 348 | 75 | 9 | 1 | 4,743 | 359 | 1,145 | 80 | 1 | 1 | 2021-08-08T20:53:21 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,697 | quarkusio/quarkus/18922/18887 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18887 | https://github.com/quarkusio/quarkus/pull/18922 | https://github.com/quarkusio/quarkus/pull/18922 | 1 | fixes | Quarkus continuous test mode hides server output | ### Describe the bug
I am using the new continuous test mode, which is awesome.
Now when I work on some test-driven coding, I write a test, write the code and then Quarkus runs my test and shows me that my code is not working:
```
2021-07-21 12:26:16,957 ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #11 ====================
2021-07-21 12:26:16,957 ERROR [io.qua.test] (Test runner thread) Test CheckerTest#basicCheck() failed
: java.lang.AssertionError: 1 expectation failed.
Expected status code <200> but was <500>.
at io.restassured.internal.ValidatableResponseImpl.statusCode(ValidatableResponseImpl.groovy)
at com.redhat.clouddot.poc.funq.CheckerTest.basicCheck(CheckerTest.java:26)
2021-07-21 12:26:16,957 ERROR [io.qua.test] (Test runner thread) >>>>>>>>>>>>>>>>>>>> 1 TEST FAILED <<<<<<<<<<<<<<<<<<<<
--
1 test failed (1 passing, 0 skipped), 2 tests were run in 467ms. Tests completed at 12:26:16.
Press [r] to re-run, [v] to view full results, [p] to pause, [h] for more options>
```
But it hides the internal error message that the server would produce, which would help me understand why my code fails.
E.g. when I trigger the same rest-test not from a `@QuarkusTest` and `RestAssured`, but via `curl` , I get my normal stack trace that tells me what does not work in my code.
### Expected behavior
Test failure output and server output are shown
### Actual behavior
Only test output is shown, but server output is omitted
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1.0.CR1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | efa085f98b499b8db3959e38c87f2169f4eb07bd | 45e3b5c49c034f4eaad92e692485b36966839706 | https://github.com/quarkusio/quarkus/compare/efa085f98b499b8db3959e38c87f2169f4eb07bd...45e3b5c49c034f4eaad92e692485b36966839706 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java
index 3ba2ce6afc4..019c1c0680a 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java
@@ -33,7 +33,8 @@ public class TestConsoleHandler implements TestListener {
private static final Logger log = Logger.getLogger("io.quarkus.test");
- public static final ConsoleCommand TOGGLE_TEST_OUTPUT = new ConsoleCommand('o', "Toggle test output",
+ public static final ConsoleCommand TOGGLE_TEST_OUTPUT = new ConsoleCommand('o', "Toggle test output", "Toggle test output",
+ 1000,
new ConsoleCommand.HelpState(TestSupport.instance().get()::isDisplayTestOutput),
() -> TestSupport.instance().get().toggleTestOutput());
| ['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,629,060 | 3,427,566 | 452,370 | 4,707 | 254 | 54 | 3 | 1 | 1,922 | 265 | 502 | 62 | 0 | 1 | 2021-07-22T01:04:42 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,698 | quarkusio/quarkus/18912/18911 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18911 | https://github.com/quarkusio/quarkus/pull/18912 | https://github.com/quarkusio/quarkus/pull/18912 | 1 | fixes | dev-mode Classloader leaks via the vertx blocking executor pool | ### Describe the bug
The code in https://github.com/quarkusio/quarkus/blob/fadd877ddbe5dd32c57b0a2b67a342367714f7dd/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java#L129 isn't really doing what it's supposed to do as all tasks being passed to `executeBlocking` are being run within the same context, and with ordering requested so they are guaranteed to be associated to a single thread and then run in order.
I have a fix coming.
| d0555c781c15cbc684684b3d79f98f2507658a94 | 0e412f1cd8671480dcc6ccb58b95a5ab9d52df00 | https://github.com/quarkusio/quarkus/compare/d0555c781c15cbc684684b3d79f98f2507658a94...0e412f1cd8671480dcc6ccb58b95a5ab9d52df00 | diff --git a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
index ed799c7014c..c7c0357c730 100644
--- a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
+++ b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
@@ -7,6 +7,8 @@
import static io.quarkus.vertx.core.runtime.SSLConfigHelper.configurePfxTrustOptions;
import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
@@ -25,6 +27,7 @@
import org.jboss.logging.Logger;
import org.jboss.threads.ContextHandler;
+import org.jboss.threads.EnhancedQueueExecutor;
import org.wildfly.common.cpu.ProcessorInfo;
import io.netty.channel.EventLoopGroup;
@@ -41,7 +44,6 @@
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Handler;
-import io.vertx.core.Promise;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.dns.AddressResolverOptions;
@@ -53,6 +55,7 @@
import io.vertx.core.impl.VertxBuilder;
import io.vertx.core.impl.VertxImpl;
import io.vertx.core.impl.VertxThread;
+import io.vertx.core.impl.WorkerPool;
import io.vertx.core.spi.VertxThreadFactory;
import io.vertx.core.spi.resolver.ResolverProvider;
@@ -129,19 +132,14 @@ public void handle(AsyncResult<Void> event) {
private void tryCleanTccl(Vertx devModeVertx) {
//this is a best effort attempt to clean out the old TCCL from
ClassLoader cl = Thread.currentThread().getContextClassLoader();
- for (int i = 0; i < blockingThreadPoolSize; ++i) {
- devModeVertx.executeBlocking(new Handler<Promise<Object>>() {
- @Override
- public void handle(Promise<Object> event) {
- Thread.currentThread().setContextClassLoader(cl);
- try {
- Thread.sleep(50);
- } catch (InterruptedException e) {
- }
- }
- }, null);
+ EnhancedQueueExecutor executor = extractExecutor(devModeVertx);
+
+ final Thread[] runningThreads = executor.getRunningThreads();
+ for (Thread t : runningThreads) {
+ t.setContextClassLoader(cl);
}
+
EventLoopGroup group = ((VertxImpl) devModeVertx).getEventLoopGroup();
for (EventExecutor i : group) {
i.execute(new Runnable() {
@@ -156,6 +154,30 @@ public void run() {
}
+ /**
+ * Extract the JBoss Threads EnhancedQueueExecutor from the Vertx instance
+ * this is messy as it needs to use reflection until Vertx can expose it.
+ */
+ private EnhancedQueueExecutor extractExecutor(Vertx devModeVertx) {
+ final ContextInternal ctx = (ContextInternal) devModeVertx.getOrCreateContext();
+ final WorkerPool workerPool = ctx.workerPool();
+ final Method executorMethod;
+ try {
+ executorMethod = WorkerPool.class.getDeclaredMethod("executor");
+ executorMethod.setAccessible(true);
+ } catch (NoSuchMethodException e) {
+ throw new RuntimeException(e);
+ }
+ final Object result;
+ try {
+ result = executorMethod.invoke(workerPool);
+ } catch (IllegalAccessException | InvocationTargetException e) {
+ throw new RuntimeException(e);
+ }
+ EnhancedQueueExecutor executor = (EnhancedQueueExecutor) result;
+ return executor;
+ }
+
public IOThreadDetector detector() {
return new IOThreadDetector() {
@Override | ['extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,622,798 | 3,426,319 | 452,242 | 4,707 | 1,940 | 350 | 46 | 1 | 486 | 55 | 125 | 6 | 1 | 0 | 2021-07-21T16:37:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,699 | quarkusio/quarkus/18877/18864 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18864 | https://github.com/quarkusio/quarkus/pull/18877 | https://github.com/quarkusio/quarkus/pull/18877 | 1 | fixes | Classloader leak in MP ContextManagerProvider / Smallrye SmallRyeContextManagerProvider | ### Describe the bug
When running a Quarkus application in dev-mode, at each code reload an additional copy of the application is loaded in memory, but old classloaders are not being released in full, leading to exhausting both heap memory and metaspace after some reloads.
This is the patch to GC root, the classloader which should have been removed on the top:
```
Class Name | Shallow Heap | Retained Heap
-----------------------------------------------------------------------------------------------------------------------------------------
io.quarkus.bootstrap.classloading.QuarkusClassLoader @ 0x41a03c490 | 128 | 314,552
'- key java.util.HashMap$Node @ 0x41bc4dc28 | 32 | 1,016
'- [6] java.util.HashMap$Node[16] @ 0x415b7c388 | 80 | 1,540,800
'- table java.util.HashMap @ 0x415b7c358 | 48 | 1,540,848
'- contextManagersForClassLoader io.smallrye.context.SmallRyeContextManagerProvider @ 0x415b7c348| 16 | 1,540,864
'- value java.util.concurrent.atomic.AtomicReference @ 0x415b7c338 | 16 | 1,540,880
'- INSTANCE class org.eclipse.microprofile.context.spi.ContextManagerProvider @ 0x415b7c2c0| 8 | 1,540,944
'- [227] java.lang.Object[5120] @ 0x41f8fba18 | 20,496 | 2,172,536
'- elementData java.util.Vector @ 0x417ce1560 | 32 | 2,172,568
'- classes io.quarkus.bootstrap.classloading.QuarkusClassLoader @ 0x417ce1368 | 128 | 9,650,128
-----------------------------------------------------------------------------------------------------------------------------------------
```
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
Open the `hibernate-orm-quickstart` from the quickstarts, run it in dev-mode and trigger live reloading N times.
Then connect a heap dump analyzer, you'll find N copies of all application classes.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
`b470a90cf3`
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 0cea0e1b6a4d39734c047ff223b951d88f9a8ad2 | 78e5635337067e9135530e46465397fdf05d50ae | https://github.com/quarkusio/quarkus/compare/0cea0e1b6a4d39734c047ff223b951d88f9a8ad2...78e5635337067e9135530e46465397fdf05d50ae | diff --git a/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java b/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
index a74e825dbf2..2e124d4e412 100644
--- a/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
+++ b/extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java
@@ -19,6 +19,7 @@
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ExecutorBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.util.ServiceUtil;
import io.quarkus.smallrye.context.runtime.SmallRyeContextPropagationProvider;
import io.quarkus.smallrye.context.runtime.SmallRyeContextPropagationRecorder;
@@ -67,11 +68,12 @@ void buildStatic(SmallRyeContextPropagationRecorder recorder)
@Record(ExecutionTime.RUNTIME_INIT)
void build(SmallRyeContextPropagationRecorder recorder,
ExecutorBuildItem executorBuildItem,
+ ShutdownContextBuildItem shutdownContextBuildItem,
BuildProducer<FeatureBuildItem> feature,
BuildProducer<SyntheticBeanBuildItem> syntheticBeans) {
feature.produce(new FeatureBuildItem(Feature.SMALLRYE_CONTEXT_PROPAGATION));
- recorder.configureRuntime(executorBuildItem.getExecutorProxy());
+ recorder.configureRuntime(executorBuildItem.getExecutorProxy(), shutdownContextBuildItem);
// Synthetic bean for ManagedExecutor
syntheticBeans.produce(
diff --git a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java
index def1211fa46..8451084b80f 100644
--- a/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java
+++ b/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java
@@ -10,6 +10,7 @@
import org.eclipse.microprofile.context.spi.ThreadContextProvider;
import io.quarkus.arc.Arc;
+import io.quarkus.runtime.ShutdownContext;
import io.quarkus.runtime.annotations.Recorder;
import io.smallrye.context.SmallRyeContextManager;
import io.smallrye.context.SmallRyeContextManagerProvider;
@@ -40,7 +41,7 @@ public void configureStaticInit(List<ThreadContextProvider> discoveredProviders,
builder.withContextManagerExtensions(discoveredExtensions.toArray(new ContextManagerExtension[0]));
}
- public void configureRuntime(ExecutorService executorService) {
+ public void configureRuntime(ExecutorService executorService, ShutdownContext shutdownContext) {
// associate the static init manager to the runtime CL
ContextManagerProvider contextManagerProvider = ContextManagerProvider.instance();
// finish building our manager
@@ -49,6 +50,12 @@ public void configureRuntime(ExecutorService executorService) {
SmallRyeContextManager contextManager = builder.build();
contextManagerProvider.registerContextManager(contextManager, Thread.currentThread().getContextClassLoader());
+ shutdownContext.addShutdownTask(new Runnable() {
+ @Override
+ public void run() {
+ contextManagerProvider.releaseContextManager(contextManager);
+ }
+ });
}
public Supplier<Object> initializeManagedExecutor(ExecutorService executorService) { | ['extensions/smallrye-context-propagation/deployment/src/main/java/io/quarkus/smallrye/context/deployment/SmallRyeContextPropagationProcessor.java', 'extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,608,026 | 3,423,395 | 451,954 | 4,703 | 738 | 127 | 13 | 2 | 2,845 | 255 | 598 | 60 | 0 | 1 | 2021-07-21T01:15:18 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,700 | quarkusio/quarkus/18867/16895 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/16895 | https://github.com/quarkusio/quarkus/pull/18867 | https://github.com/quarkusio/quarkus/pull/18867 | 1 | fix | Unable to make the Vert.x cache directory in Windows | ## Describe the bug
When running a Quarkus application in Windows, this warning is sometimes printed:
```
{"timestamp":"2021-04-28 13:02:58","sequence":346,"loggerClassName":"org.jboss.logging.Logger","loggerName":"io.quarkus.vertx.core.runtime.VertxCoreRecorder","level":"WARN","message":"Unable to make the Vert.x cache directory (C:\\\\Users\\\\RUNNER~1\\\\AppData\\\\Local\\\\Temp\\\\vertx-cache) world readable and writable","threadName":"main","threadId":1,"mdc":{},"ndc":"","hostName":"fv-az158-860","processName":"target/quarkus-app/quarkus-run.jar","processId":3172}
```
Which is unexpected as it should create a temporary folder.
I think this is related to the changes made in https://github.com/quarkusio/quarkus/issues/7678. Concretely: https://github.com/quarkusio/quarkus/pull/15541/files#diff-a38e0d86cf6a637c19b6e0a0e23959f644886bdcc0f0e5615ce7cfa0e6bc9909R244
### Expected behavior
The Vert.x cache directory should work in Windows
## To Reproduce
A windows based machine is needed.
Steps to reproduce the behavior:
1. git clone `https://github.com/Sgitario/quarkus-startstop`
2. cd `quarkus-startstop`
3. git checkout `reproducer_16895`
4. `mvn clean verify -Ptestsuite -Dtest=ArtifactGeneratorBOMTest#quarkusUniverseBomExtensionsA`
The test should pass, but it's failing.
## Environment (please complete the following information):
### Quarkus version or git rev
1.13.2
| 41b53fba69ef0628588273b06f935b945f1699df | 4a5221633c7f8f33fc98bbbdaf0471f9bdc9d4f2 | https://github.com/quarkusio/quarkus/compare/41b53fba69ef0628588273b06f935b945f1699df...4a5221633c7f8f33fc98bbbdaf0471f9bdc9d4f2 | diff --git a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
index ed799c7014c..7482133f4d3 100644
--- a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
+++ b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
@@ -11,6 +11,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
@@ -259,9 +260,13 @@ private static VertxOptions convertToVertxOptions(VertxConfiguration conf, Vertx
if (!tmp.mkdirs()) {
LOGGER.warnf("Unable to create Vert.x cache directory : %s", tmp.getAbsolutePath());
}
- if (!(tmp.setReadable(true, false) && tmp.setWritable(true, false))) {
- LOGGER.warnf("Unable to make the Vert.x cache directory (%s) world readable and writable",
- tmp.getAbsolutePath());
+ String os = System.getProperty("os.name").toLowerCase(Locale.ENGLISH);
+ if (!os.contains("windows")) {
+ // Do not execute the following on windows.
+ if (!(tmp.setReadable(true, false) && tmp.setWritable(true, false))) {
+ LOGGER.warnf("Unable to make the Vert.x cache directory (%s) world readable and writable",
+ tmp.getAbsolutePath());
+ }
}
}
| ['extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,610,442 | 3,423,735 | 451,995 | 4,703 | 767 | 129 | 11 | 1 | 1,414 | 117 | 399 | 29 | 3 | 1 | 2021-07-20T16:30: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 |
2,701 | quarkusio/quarkus/18813/18767 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18767 | https://github.com/quarkusio/quarkus/pull/18813 | https://github.com/quarkusio/quarkus/pull/18813 | 1 | fixes | quarkus projects does not have maven compiler configured | ### Describe the bug
`quarkus21 create --registry-client -S 2.1` create projects that when trying to run `quarkus dev` or `mvn quarkus:dev` fails with:
```
[WARNING] The quarkus-maven-plugin build goal was not configured for this project, skipping quarkus:dev as this is assumed to be a support library. If you want to run quarkus dev on this project make sure the quarkus-maven-plugin is configured with a build goal.
```
same fails with `-S 2.0`
### Expected behavior
that projects created have working devmode
### Actual behavior
_No response_
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | be50aabb58ded4941fc710849951a2d62a80434d | fa96b729844730430dcf9e6737478a0aa22e6244 | https://github.com/quarkusio/quarkus/compare/be50aabb58ded4941fc710849951a2d62a80434d...fa96b729844730430dcf9e6737478a0aa22e6244 | 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 c1502b5df17..6897aa4e15a 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -88,7 +88,6 @@
import io.quarkus.deployment.dev.QuarkusDevModeLauncher;
import io.quarkus.maven.MavenDevModeLauncher.Builder;
import io.quarkus.maven.components.MavenVersionEnforcer;
-import io.quarkus.maven.utilities.MojoUtils;
/**
* The dev mojo, that runs a quarkus app in a forked process. A background compilation process is launched and any changes are
@@ -344,9 +343,9 @@ public void execute() throws MojoFailureException, MojoExecutionException {
handleAutoCompile();
if (enforceBuildGoal) {
- Plugin pluginDef = MojoUtils.checkProjectForMavenBuildPlugin(project);
-
- if (pluginDef == null) {
+ final PluginDescriptor pluginDescr = getPluginDescriptor();
+ final Plugin pluginDef = getConfiguredPluginOrNull(pluginDescr.getGroupId(), pluginDescr.getArtifactId());
+ if (pluginDef == null || !isGoalConfigured(pluginDef, "build")) {
getLog().warn("The quarkus-maven-plugin build goal was not configured for this project, " +
"skipping quarkus:dev as this is assumed to be a support library. If you want to run quarkus dev" +
" on this project make sure the quarkus-maven-plugin is configured with a build goal.");
@@ -504,10 +503,14 @@ private void initToolchain() throws MojoExecutionException {
}
private void triggerPrepare() throws MojoExecutionException {
- final PluginDescriptor pluginDescr = (PluginDescriptor) getPluginContext().get("pluginDescriptor");
+ final PluginDescriptor pluginDescr = getPluginDescriptor();
executeIfConfigured(pluginDescr.getGroupId(), pluginDescr.getArtifactId(), QUARKUS_GENERATE_CODE_GOAL);
}
+ private PluginDescriptor getPluginDescriptor() {
+ return (PluginDescriptor) getPluginContext().get("pluginDescriptor");
+ }
+
private void triggerCompile(boolean test) throws MojoExecutionException {
handleResources(test);
@@ -531,7 +534,7 @@ private void handleResources(boolean test) throws MojoExecutionException {
private void executeIfConfigured(String pluginGroupId, String pluginArtifactId, String goal) throws MojoExecutionException {
final Plugin plugin = getConfiguredPluginOrNull(pluginGroupId, pluginArtifactId);
- if (plugin == null || plugin.getExecutions().stream().noneMatch(exec -> exec.getGoals().contains(goal))) {
+ if (!isGoalConfigured(plugin, goal)) {
return;
}
getLog().info("Invoking " + plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() + ":" + goal
@@ -550,6 +553,18 @@ private void executeIfConfigured(String pluginGroupId, String pluginArtifactId,
pluginManager));
}
+ public boolean isGoalConfigured(Plugin plugin, String goal) {
+ if (plugin == null) {
+ return false;
+ }
+ for (PluginExecution pluginExecution : plugin.getExecutions()) {
+ if (pluginExecution.getGoals().contains(goal)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private Xpp3Dom getPluginConfig(Plugin plugin, String goal) throws MojoExecutionException {
Xpp3Dom mergedConfig = null;
if (!plugin.getExecutions().isEmpty()) {
diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java
index 2b6a2d31f19..d999be4fd96 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java
@@ -15,10 +15,8 @@
import org.apache.maven.model.Dependency;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
-import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@@ -188,21 +186,6 @@ public static String credentials(final Dependency d) {
return String.format("%s:%s", d.getGroupId(), d.getArtifactId());
}
- public static Plugin checkProjectForMavenBuildPlugin(MavenProject project) {
- for (Plugin plugin : project.getBuildPlugins()) {
- if (plugin.getGroupId().equals("io.quarkus")
- && plugin.getArtifactId().equals("quarkus-maven-plugin")) {
- for (PluginExecution pluginExecution : plugin.getExecutions()) {
- if (pluginExecution.getGoals().contains("build")) {
- return plugin;
- }
- }
- }
- }
-
- return null;
- }
-
/**
* Element wrapper class for configuration elements
*/ | ['independent-projects/tools/devtools-common/src/main/java/io/quarkus/maven/utilities/MojoUtils.java', 'devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,555,507 | 3,413,257 | 450,728 | 4,692 | 1,955 | 380 | 44 | 2 | 969 | 143 | 240 | 45 | 0 | 1 | 2021-07-19T13:42:34 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,702 | quarkusio/quarkus/18707/18522 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18522 | https://github.com/quarkusio/quarkus/pull/18707 | https://github.com/quarkusio/quarkus/pull/18707 | 1 | fixes | Jacoco extensions results in java.lang.NoSuchMethodError: 'boolean[] ***.$jacocoInit()' for kotlin when panache repo is injected | ## Describe the bug
In [this reproduction project](https://github.com/languitar/quarkus-jacoco-kotlin-issue) `mvn verify` results in the following test error:
```
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.751 s <<< FAILURE! - in org.acme.rest.GreetingResourceTest
[ERROR] org.acme.rest.GreetingResourceTest.testHelloEndpoint Time elapsed: 0.004 s <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: Failed to create test instance
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoSuchMethodError: 'boolean[] org.acme.rest.FooEntityRepo.$jacocoInit()'
```
This happens in case:
* the quarkus jacoco extension is included
* AND a Panache repository is injected into a test class
Things work if only one of the above conditions is met.
### Expected behavior
Tests can be executed and coverage reports are functional.
### Actual behavior
```
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.751 s <<< FAILURE! - in org.acme.rest.GreetingResourceTest
[ERROR] org.acme.rest.GreetingResourceTest.testHelloEndpoint Time elapsed: 0.004 s <<< ERROR!
org.junit.jupiter.api.extension.TestInstantiationException: Failed to create test instance
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NoSuchMethodError: 'boolean[] org.acme.rest.FooEntityRepo.$jacocoInit()'
```
## To Reproduce
Steps to reproduce the behavior:
1. Clone the [reproduction project](https://github.com/languitar/quarkus-jacoco-kotlin-issue)
2. Execute `mvn verify`
### Configuration
As included in the project
## Environment (please complete the following information):
### Output of `uname -a` or `ver`
```
Linux pres 5.10.47-1-lts #1 SMP Wed, 30 Jun 2021 13:52:19 +0000 x86_64 GNU/Linux
```
### Output of `java -version`
```
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9)
OpenJDK 64-Bit Server VM (build 11.0.11+9, mixed mode)
```
### GraalVM version (if different from Java)
not used here
### Quarkus version or git rev
As in the project. 2.0.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
```
Apache Maven 3.8.1 (NON-CANONICAL_2021-04-26T21:52:54Z_root)
Maven home: /opt/maven
Java version: 11.0.11, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-11-openjdk
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.10.47-1-lts", arch: "amd64", family: "unix"
``` | 9316b3c6cfafe79df6c155a766b0a678a357ce5b | 26e3ac74788248dd2bd90116c15a2f61c198fe35 | https://github.com/quarkusio/quarkus/compare/9316b3c6cfafe79df6c155a766b0a678a357ce5b...26e3ac74788248dd2bd90116c15a2f61c198fe35 | diff --git a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java
index 77d86cdd539..08dcce4ca1c 100644
--- a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java
+++ b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java
@@ -537,6 +537,9 @@ public MethodVisitor visitMethod(int access, String name, String descriptor, Str
.orElse(null);
if (methodInfo != null && !methodInfo.hasAnnotation(DOTNAME_GENERATE_BRIDGE)) {
return super.visitMethod(access, name, descriptor, signature, exceptions);
+ } else if (name.contains("$")) {
+ //some agents such as jacoco add new methods, they generally have $ in the name
+ return super.visitMethod(access, name, descriptor, signature, exceptions);
}
return null;
} | ['extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/visitors/KotlinPanacheClassOperationGenerationVisitor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,516,593 | 3,405,198 | 449,816 | 4,685 | 222 | 44 | 3 | 1 | 2,723 | 299 | 757 | 77 | 2 | 5 | 2021-07-15T06:38:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,703 | quarkusio/quarkus/18686/18575 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18575 | https://github.com/quarkusio/quarkus/pull/18686 | https://github.com/quarkusio/quarkus/pull/18686 | 1 | fixes | Custom OpenTelemetry SpanExporter breaks Jaeger exporter | ## Describe the bug
When using the quarkus-opentelemetry extension as well as the quarkus-opentelemetry-exporter-jaeger extension adding a custom `SpanExporter` makes the jaeger exporter stop working.
### Expected behavior
Both exporters are able to export spans and no warning occurs.
### Actual behavior
The jaeger exporter stops working and the following warning is output to console on startup:
```
2021-07-09 17:49:12,944 WARN [io.qua.ope.exp.jae.run.LateBoundBatchSpanProcessor] (Quarkus Main Thread) No BatchSpanProcessor delegate specified, no action taken.
```
The custom exporter seems to be working though.
## To Reproduce
Adding to following class to a code-with-quarkus with both extensions and previously working tracing to a local jaeger reproduces the behavior:
```java
package org.acme;
import io.opentelemetry.sdk.common.CompletableResultCode;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import io.quarkus.arc.Unremovable;
import javax.enterprise.context.ApplicationScoped;
import java.util.Collection;
@Unremovable
@ApplicationScoped
public class CustomExporter implements SpanExporter {
@Override
public CompletableResultCode export(Collection<SpanData> spans) {
System.out.println("CustomExporter.export");
return CompletableResultCode.ofSuccess();
}
@Override
public CompletableResultCode flush() {
return CompletableResultCode.ofSuccess();
}
@Override
public CompletableResultCode shutdown() {
return CompletableResultCode.ofSuccess();
}
}
```
### Quarkus version or git rev
2.0.1.Final
| 087e562a9f76af911c071423bcdaba6a2504e0e9 | 7ae4ba1d203419a8b9400907e2e79a0473256400 | https://github.com/quarkusio/quarkus/compare/087e562a9f76af911c071423bcdaba6a2504e0e9...7ae4ba1d203419a8b9400907e2e79a0473256400 | diff --git a/extensions/opentelemetry/opentelemetry-exporter-jaeger/runtime/src/main/java/io/quarkus/opentelemetry/exporter/jaeger/runtime/LateBoundBatchSpanProcessor.java b/extensions/opentelemetry/opentelemetry-exporter-jaeger/runtime/src/main/java/io/quarkus/opentelemetry/exporter/jaeger/runtime/LateBoundBatchSpanProcessor.java
index c690576be63..0e5415ca22c 100644
--- a/extensions/opentelemetry/opentelemetry-exporter-jaeger/runtime/src/main/java/io/quarkus/opentelemetry/exporter/jaeger/runtime/LateBoundBatchSpanProcessor.java
+++ b/extensions/opentelemetry/opentelemetry-exporter-jaeger/runtime/src/main/java/io/quarkus/opentelemetry/exporter/jaeger/runtime/LateBoundBatchSpanProcessor.java
@@ -60,7 +60,7 @@ public void onEnd(ReadableSpan span) {
public boolean isEndRequired() {
if (delegate == null) {
logDelegateNotFound();
- return false;
+ return true;
}
return delegate.isEndRequired();
}
diff --git a/extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/LateBoundBatchSpanProcessor.java b/extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/LateBoundBatchSpanProcessor.java
index 76b2cb0d3ed..6b2e8cb5272 100644
--- a/extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/LateBoundBatchSpanProcessor.java
+++ b/extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/LateBoundBatchSpanProcessor.java
@@ -60,7 +60,7 @@ public void onEnd(ReadableSpan span) {
public boolean isEndRequired() {
if (delegate == null) {
logDelegateNotFound();
- return false;
+ return true;
}
return delegate.isEndRequired();
} | ['extensions/opentelemetry/opentelemetry-exporter-otlp/runtime/src/main/java/io/quarkus/opentelemetry/exporter/otlp/runtime/LateBoundBatchSpanProcessor.java', 'extensions/opentelemetry/opentelemetry-exporter-jaeger/runtime/src/main/java/io/quarkus/opentelemetry/exporter/jaeger/runtime/LateBoundBatchSpanProcessor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,510,727 | 3,404,171 | 449,672 | 4,685 | 104 | 16 | 4 | 2 | 1,697 | 163 | 369 | 50 | 0 | 2 | 2021-07-14T15:50:48 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,705 | quarkusio/quarkus/18635/18492 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18492 | https://github.com/quarkusio/quarkus/pull/18635 | https://github.com/quarkusio/quarkus/pull/18635 | 1 | fixes | Ctrl+C is broken if pressed within Transactional (Quarkus 2.0.1.Final) | ## Describe the bug
It seems that since Quarkus 2.0.1.Final, if Ctrl+C is pressed while in a `Transactional` block, quarkus:dev is not stopped. It is necessary to kill -9 the process.
### Expected behavior
quarkus:dev should stop when Ctrl+C is pressed, application should terminate.
### Actual behavior
When Ctrl+C is pressed while the application is in a `Transactional` block ^C is written to the terminal, but the application does not respond. Later (when the task completes or the transaction timeout passes) some exceptions are printed.
## To Reproduce
Use attached reproducer:
- Start it, with: `mvn quarkus:dev -Dquarkus.test.flat-class-path=true`
- Trigger the transaction: curl http://localhost:8080/fruits
- Press Ctrl+C to stop quarkus:dev
-
## Environment (please complete the following information):
### Output of `uname -a` or `ver`
`Linux a 5.12.9-1-MANJARO #1 SMP PREEMPT Thu Jun 3 14:56:42 UTC 2021 x86_64 GNU/Linux`
### Output of `java -version`
```
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)
```
### GraalVM version (if different from Java)
### Quarkus version or git rev
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
```
Apache Maven 3.8.1 (NON-CANONICAL_2021-04-26T21:52:54Z_root)
Maven home: /opt/maven
Java version: 11, vendor: Oracle Corporation, runtime: /opt/openjdk-11
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.12.9-1-manjaro", arch: "amd64", family: "unix"
```
## Additional context
Work if Quarkus version < 2.0
| eca263e861d18673ae500da1144fd68be59cb01a | 8fcea3ea44701ac1a2a77fbc775f6778f6fc4858 | https://github.com/quarkusio/quarkus/compare/eca263e861d18673ae500da1144fd68be59cb01a...8fcea3ea44701ac1a2a77fbc775f6778f6fc4858 | diff --git a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/CDIDelegatingTransactionManager.java b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/CDIDelegatingTransactionManager.java
index cf8c6fe7860..db0f965516b 100644
--- a/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/CDIDelegatingTransactionManager.java
+++ b/extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/CDIDelegatingTransactionManager.java
@@ -18,6 +18,8 @@
import javax.transaction.TransactionManager;
import javax.transaction.TransactionScoped;
+import org.jboss.logging.Logger;
+
/**
* A delegating transaction manager which receives an instance of Narayana transaction manager
* and delegates all calls to it.
@@ -25,6 +27,9 @@
*/
@Singleton
public class CDIDelegatingTransactionManager implements TransactionManager, Serializable {
+
+ private static final Logger log = Logger.getLogger(CDIDelegatingTransactionManager.class);
+
private static final long serialVersionUID = 1598L;
private final transient com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple delegate;
@@ -113,13 +118,18 @@ public void commit() throws RollbackException, HeuristicMixedException, Heuristi
*/
@Override
public void rollback() throws IllegalStateException, SecurityException, SystemException {
- if (this.transactionScopeBeforeDestroyed != null) {
- this.transactionScopeBeforeDestroyed.fire(this.getTransaction());
+ try {
+ if (this.transactionScopeBeforeDestroyed != null) {
+ this.transactionScopeBeforeDestroyed.fire(this.getTransaction());
+ }
+ } catch (Throwable t) {
+ log.error("Failed to fire @BeforeDestroyed(TransactionScoped.class)", t);
}
try {
delegate.rollback();
} finally {
+ //we don't need a catch block here, if this one fails we just let the exception propagate
if (this.transactionScopeDestroyed != null) {
this.transactionScopeDestroyed.fire(this.toString());
} | ['extensions/narayana-jta/runtime/src/main/java/io/quarkus/narayana/jta/runtime/CDIDelegatingTransactionManager.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,448,156 | 3,392,062 | 448,202 | 4,668 | 676 | 121 | 14 | 1 | 1,651 | 227 | 483 | 45 | 1 | 2 | 2021-07-13T04:40:42 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,685 | quarkusio/quarkus/19243/19242 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19242 | https://github.com/quarkusio/quarkus/pull/19243 | https://github.com/quarkusio/quarkus/pull/19243 | 1 | fix | Deprecate usage of `@ConfigProperty` in ReactiveMessagingKafkaConfig | ### Describe the bug
The usage of `@ConfigProperty` in https://github.com/quarkusio/quarkus/blob/7820ff6111f97d82c5e5855bf4f503d59b4d4471/extensions/smallrye-reactive-messaging-kafka/runtime/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/ReactiveMessagingKafkaConfig.java#L16 is leading to have this warning message when using this extension:
```
WARN [io.qua.con.build] (main) Using @ConfigProperty for Quarkus configuration items is deprecated (use @ConfigItem instead) at io.quarkus.smallrye.reactivemessaging.kafka.ReactiveMessagingKafkaConfig#enableGracefulShutdownInDevAndTestMode
```
We should replace `@ConfigProperty` by `@ConfigItem`.
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 7820ff6111f97d82c5e5855bf4f503d59b4d4471 | 74ee51d94657628973ba2732663dcd911cde4cbc | https://github.com/quarkusio/quarkus/compare/7820ff6111f97d82c5e5855bf4f503d59b4d4471...74ee51d94657628973ba2732663dcd911cde4cbc | diff --git a/extensions/smallrye-reactive-messaging-kafka/runtime/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/ReactiveMessagingKafkaConfig.java b/extensions/smallrye-reactive-messaging-kafka/runtime/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/ReactiveMessagingKafkaConfig.java
index 1e45d53a154..8278f33d0c1 100644
--- a/extensions/smallrye-reactive-messaging-kafka/runtime/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/ReactiveMessagingKafkaConfig.java
+++ b/extensions/smallrye-reactive-messaging-kafka/runtime/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/ReactiveMessagingKafkaConfig.java
@@ -1,7 +1,6 @@
package io.quarkus.smallrye.reactivemessaging.kafka;
-import org.eclipse.microprofile.config.inject.ConfigProperty;
-
+import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigRoot;
@ConfigRoot(name = "reactive-messaging.kafka")
@@ -13,7 +12,7 @@ public class ReactiveMessagingKafkaConfig {
* While this setting is highly recommended in production, in dev and test modes, it's disabled by default.
* This setting allows to re-enable it.
*/
- @ConfigProperty(defaultValue = "false")
+ @ConfigItem(defaultValue = "false")
public boolean enableGracefulShutdownInDevAndTestMode;
} | ['extensions/smallrye-reactive-messaging-kafka/runtime/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/ReactiveMessagingKafkaConfig.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,782,936 | 3,457,399 | 456,138 | 4,733 | 201 | 40 | 5 | 1 | 1,110 | 111 | 293 | 45 | 1 | 1 | 2021-08-05T07:21:51 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,683 | quarkusio/quarkus/19315/19314 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19314 | https://github.com/quarkusio/quarkus/pull/19315 | https://github.com/quarkusio/quarkus/pull/19315 | 1 | fixes | Performance: contention on Logger instance caused by Vertx warning | ### Describe the bug
Class `io.vertx.core.impl.ContextImpl` is logging a frequent warning about "You have disabled TCCL checks".
This warning is now pointless (according to the vert.x team it's a legacy) and is being removed in upcoming Vert.x releases, but until we can upgrade this is causing significant contention on the Logger infrastructure when under load.
We're currently filtering the output; a more effective solution (until we upgrade Vertx) is to reconfigure the cathegory: PR coming.
| 85142f9184f79d5f985e8268944145f73eb08095 | 4832547bad3663a417179a852d503822c0da6c97 | https://github.com/quarkusio/quarkus/compare/85142f9184f79d5f985e8268944145f73eb08095...4832547bad3663a417179a852d503822c0da6c97 | 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 e6f6e1fef3c..ef373c89186 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
@@ -19,6 +19,7 @@
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.logging.Logger;
+import org.jboss.logmanager.Level;
import org.jboss.logmanager.LogManager;
import io.quarkus.arc.deployment.SyntheticBeanBuildItem;
@@ -32,6 +33,7 @@
import io.quarkus.deployment.builditem.ExecutorBuildItem;
import io.quarkus.deployment.builditem.IOThreadDetectorBuildItem;
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
+import io.quarkus.deployment.builditem.LogCategoryBuildItem;
import io.quarkus.deployment.builditem.ServiceStartBuildItem;
import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.builditem.ThreadFactoryBuildItem;
@@ -77,6 +79,17 @@ LogCleanupFilterBuildItem cleanupVertxWarnings() {
return new LogCleanupFilterBuildItem("io.vertx.core.impl.ContextImpl", "You have disabled TCCL checks");
}
+ @BuildStep
+ LogCategoryBuildItem preventLoggerContention() {
+ //Prevent the Logging warning about the TCCL checks being disabled to be logged;
+ //this is similar to #cleanupVertxWarnings but prevents it by changing the level:
+ // it takes advantage of the fact that there is a single other log in thi class,
+ // and it happens to be at error level.
+ //This is more effective than the LogCleanupFilterBuildItem as we otherwise have
+ //contention since this message could be logged very frequently.
+ return new LogCategoryBuildItem("io.vertx.core.impl.ContextImpl", Level.ERROR);
+ }
+
@BuildStep
@Record(ExecutionTime.STATIC_INIT)
IOThreadDetectorBuildItem ioThreadDetector(VertxCoreRecorder recorder) { | ['extensions/vertx-core/deployment/src/main/java/io/quarkus/vertx/core/deployment/VertxCoreProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,800,252 | 3,460,658 | 456,597 | 4,737 | 749 | 155 | 13 | 1 | 507 | 75 | 105 | 8 | 0 | 0 | 2021-08-10T10:40:30 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,754 | quarkusio/quarkus/17377/17327 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17327 | https://github.com/quarkusio/quarkus/pull/17377 | https://github.com/quarkusio/quarkus/pull/17377 | 1 | fixes | WebSockets in Extensions | ## Describe the bug
From https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/Dev.20UI.3A.20Log.20stream.20not.20working.20anymore
Recent version of Quarkus (seems like 1.13.3 and 2.0.Alpha*) the extensions that use WebSockets sometimes get an error (Request already read) when trying to upgrade the request to Websocket.
Example, the websocket that allows Subscriptions on GraphQL: https://github.com/quarkusio/quarkus/blob/d411ab5f990269a44a9587410f6478d6d97964a7/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLSubscriptionHandler.java#L47
The order of that route is set to `Integer.MIN_VALUE`, but seems like some other routes too.
One option, as discussed with @cescoffier, is to not use a normal route that does an upgrade, but to allow extensions to produce a new BuildItem specifically for WebSockets, that then gets added to the server.
### Expected behavior
(Describe the expected behavior clearly and concisely.)
The Websocket should always work.
### Actual behavior
(Describe the actual behavior clearly and concisely.)
The WebSocket sometimes work
## To Reproduce
Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).
Get https://github.com/phillip-kruger/graphql-experimental/tree/Subscriptions
(Note the branch is `Subscriptions`)
Build the root, the `cd` into subscription-example, run `quarkus:dev` and go to localhost:8080.
When you click on connect, it sometimes work.
### Configuration
```properties
# Add your application.properties here, if applicable.
```
### Screenshots
(If applicable, add screenshots to help explain your problem.)
## Environment (please complete the following information):
### Output of `uname -a` or `ver`
`Linux pkruger 5.11.20-300.fc34.x86_64 #1 SMP Wed May 12 12:45:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux`
### Output of `java -version`
```
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
```
### GraalVM version (if different from Java)
### Quarkus version or git rev
`999-SNAPSHOT`
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
```
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/maven/apache-maven-3.6.3
Java version: 11, vendor: Oracle Corporation, runtime: /opt/JDK/jdk-11
Default locale: en_ZA, platform encoding: UTF-8
OS name: "linux", version: "5.11.20-300.fc34.x86_64", arch: "amd64", family: "unix"
```
## Additional context
(Add any other context about the problem here.)
| 6c63c63237bcb7188c86adafe61a831cbc4cae8c | bc70b26f7814095868b76d8b9690cf95ac286e70 | https://github.com/quarkusio/quarkus/compare/6c63c63237bcb7188c86adafe61a831cbc4cae8c...bc70b26f7814095868b76d8b9690cf95ac286e70 | 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 971871c9e06..9a447378887 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
@@ -143,10 +143,7 @@ public void handle(HttpServerRequest httpServerRequest) {
//as it is possible filters such as the auth filter can do blocking tasks
//as the underlying handler has not had a chance to install a read handler yet
//and data that arrives while the blocking task is being processed will be lost
- if (httpServerRequest.method() != HttpMethod.GET) {
- //we don't pause for GET requests, as there is no data
- httpServerRequest.pause();
- }
+ httpServerRequest.pause();
Handler<HttpServerRequest> rh = VertxHttpRecorder.rootHandler;
if (rh != null) {
rh.handle(httpServerRequest); | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 16,510,648 | 3,210,265 | 425,334 | 4,483 | 235 | 43 | 5 | 1 | 2,678 | 316 | 747 | 71 | 3 | 3 | 2021-05-19T22:35:46 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,671 | quarkusio/quarkus/19520/19338 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19338 | https://github.com/quarkusio/quarkus/pull/19520 | https://github.com/quarkusio/quarkus/pull/19520 | 1 | closes | CoreSerializationInGraalITCase of integration test Main fails with latest GraalVM | ### Describe the bug
CoreSerializationInGraalITCase of integration test Main fails with latest GraalVM.
See https://github.com/graalvm/mandrel/runs/3296489189?check_suite_focus=true#step:9:440
### Expected behavior
Test should pass.
### Actual behavior
Test fails with:
```
[ERROR] io.quarkus.it.main.CoreSerializationInGraalITCase.testEntitySerializationFromServlet Time elapsed: 0.052 s <<< FAILURE!
java.lang.AssertionError:
1 expectation failed.
Response body doesn't match expectation.
Expected: is "OK"
Actual: java.io.InvalidClassException: io.quarkus.it.corestuff.serialization.SomeSerializationObject; no valid constructor
java.io.InvalidClassException: io.quarkus.it.corestuff.serialization.SomeSerializationObject; no valid constructor
at java.io.ObjectStreamClass$ExceptionInfo.newInvalidClassException(ObjectStreamClass.java:159)
at java.io.ObjectStreamClass.checkDeserialize(ObjectStreamClass.java:875)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2170)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:493)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:451)
at io.quarkus.it.corestuff.SerializationTestEndpoint.reflectiveSetterInvoke(SerializationTestEndpoint.java:50)
at io.quarkus.it.corestuff.SerializationTestEndpoint.doGet(SerializationTestEndpoint.java:29)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:503)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at io.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.quarkus.micrometer.runtime.binder.vertx.VertxMeterBinderUndertowServletFilter.doFilter(VertxMeterBinderUndertowServletFilter.java:28)
at javax.servlet.http.HttpFilter.doFilter(HttpFilter.java:97)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:67)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AuthenticationConstraintHandler.handleRequest(AuthenticationConstraintHandler.java:53)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:59)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:247)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:56)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:111)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:108)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1.call(UndertowDeploymentRecorder.java:589)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:152)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$1.handleRequest(UndertowDeploymentRecorder.java:119)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:290)
at io.undertow.server.DefaultExchangeHandler.handle(DefaultExchangeHandler.java:18)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$5$1.run(UndertowDeploymentRecorder.java:415)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:536)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
```
### How to Reproduce?
1. Download the "jdk" artifact from https://github.com/graalvm/mandrel/actions/runs/1118484129
2. Unzip it and then unarchive `jdk.tgz`
3. `export GRAALVM_HOME=path/to/extracted/mandrelvm`
4. `./mvnw -B --settings .github/mvn-settings.xml --fail-at-end -DfailIfNoTests=false -Dnative -Dnative.surefire.skip -Dformat.skip -Dno-descriptor-tests -DskipDocs -Dquarkus.container-image.build=false -pl integration-tests/main verify`
### Output of `uname -a` or `ver`
Linux 5.12.15-300.fc34.x86_64 #1 SMP Wed Jul 7 19:46:50 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment 18.9 (build 11.0.12+7) OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7, mixed mode, sharing)
### GraalVM version (if different from Java)
e3dd4282fe23d2a37fc8b6f2507c86a39d41bb02
### Quarkus version or git rev
57d1dae99a635b32951d7e1594f0969fc61dceb1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: /home/zakkak/.m2/wrapper/dists/apache-maven-3.8.1-bin/2l5mhf2pq2clrde7f7qp1rdt5m/apache-maven-3.8.1 Java version: 11.0.12, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.12.0.7-0.fc34.x86_64 Default locale: en_IE, platform encoding: UTF-8 OS name: "linux", version: "5.12.15-300.fc34.x86_64", arch: "amd64", family: "unix"
### Additional information
The graal change that brought this up appears to be https://github.com/oracle/graal/pull/3050
I am not sure it's worth digging this further. I think we should adapt Quarkus' serialization support (https://github.com/quarkusio/quarkus/pull/15380/files) to use the new feature instead when using GraalVM >=21.3.
WDYT?
cc @JiriOndrusek | ed6f31b693cebc9839dc6667a0e830fd313f5583 | 4921b9fb9f076c1015de8603a45833e3d2c40357 | https://github.com/quarkusio/quarkus/compare/ed6f31b693cebc9839dc6667a0e830fd313f5583...4921b9fb9f076c1015de8603a45833e3d2c40357 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
index dacefc389d6..4709fdaac3a 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java
@@ -538,13 +538,53 @@ private MethodDescriptor createRegisterSerializationForClassMethod(ClassCreator
ofMethod(Thread.class, "getContextClassLoader", ClassLoader.class),
currentThread);
- ResultHandle objectClass = tc.invokeStaticMethod(
- ofMethod(Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class),
- tc.load("java.lang.Object"), tc.load(false), tccl);
+ MethodDescriptor forNameMethodDescriptor = ofMethod(Class.class, "forName", Class.class, String.class, boolean.class,
+ ClassLoader.class);
+
+ MethodDescriptor lookupMethod = ofMethod("com.oracle.svm.util.ReflectionUtil", "lookupMethod", Method.class,
+ Class.class, String.class,
+ Class[].class);
+ MethodDescriptor invokeMethodDescriptor = ofMethod(Method.class, "invoke", Object.class, Object.class,
+ Object[].class);
+
+ BranchResult graalVm21_3Test = tc.ifGreaterEqualZero(
+ tc.invokeVirtualMethod(VERSION_COMPARE_TO, tc.invokeStaticMethod(VERSION_CURRENT),
+ tc.marshalAsArray(int.class, tc.load(21), tc.load(3))));
+
+ BytecodeCreator greaterThan21_3 = graalVm21_3Test.trueBranch();
+ ResultHandle runtimeSerializationClass = greaterThan21_3.invokeStaticMethod(forNameMethodDescriptor,
+ greaterThan21_3.load("org.graalvm.nativeimage.hosted.RuntimeSerialization"),
+ greaterThan21_3.load(false), tccl);
+ ResultHandle registerArgTypes = greaterThan21_3.newArray(Class.class, greaterThan21_3.load(1));
+ greaterThan21_3.writeArrayValue(registerArgTypes, 0, greaterThan21_3.loadClass(Class[].class));
+ ResultHandle registerLookupMethod = greaterThan21_3.invokeStaticMethod(lookupMethod, runtimeSerializationClass,
+ greaterThan21_3.load("register"), registerArgTypes);
+ ResultHandle registerArgs = greaterThan21_3.newArray(Object.class, greaterThan21_3.load(1));
+ ResultHandle classesToRegister = greaterThan21_3.newArray(Class.class, greaterThan21_3.load(1));
+ greaterThan21_3.writeArrayValue(classesToRegister, 0, clazz);
+ greaterThan21_3.writeArrayValue(registerArgs, 0, classesToRegister);
+ greaterThan21_3.invokeVirtualMethod(invokeMethodDescriptor, registerLookupMethod,
+ greaterThan21_3.loadNull(), registerArgs);
+ greaterThan21_3.returnValue(null);
+
+ ResultHandle objectClass = tc.invokeStaticMethod(forNameMethodDescriptor, tc.load("java.lang.Object"),
+ tc.load(false), tccl);
+ ResultHandle serializationRegistryClass = tc.invokeStaticMethod(forNameMethodDescriptor,
+ tc.load("com.oracle.svm.core.jdk.serialize.SerializationRegistry"),
+ tc.load(false), tccl);
+ ResultHandle addReflectionsClass = tc.invokeStaticMethod(forNameMethodDescriptor,
+ tc.load("com.oracle.svm.reflect.serialize.hosted.SerializationFeature"),
+ tc.load(false), tccl);
ResultHandle serializationSupport = tc.invokeStaticMethod(
IMAGE_SINGLETONS_LOOKUP,
- tc.loadClass("com.oracle.svm.core.jdk.serialize.SerializationRegistry"));
+ serializationRegistryClass);
+
+ ResultHandle addReflectionsLookupArgs = tc.newArray(Class.class, tc.load(2));
+ tc.writeArrayValue(addReflectionsLookupArgs, 0, tc.loadClass(Class.class));
+ tc.writeArrayValue(addReflectionsLookupArgs, 1, tc.loadClass(Class.class));
+ ResultHandle addReflectionsLookupMethod = tc.invokeStaticMethod(lookupMethod, addReflectionsClass,
+ tc.load("addReflections"), addReflectionsLookupArgs);
ResultHandle reflectionFactory = tc.invokeStaticMethod(
ofMethod("sun.reflect.ReflectionFactory", "getReflectionFactory", "sun.reflect.ReflectionFactory"));
@@ -552,7 +592,7 @@ private MethodDescriptor createRegisterSerializationForClassMethod(ClassCreator
AssignableResultHandle newSerializationConstructor = tc.createVariable(Constructor.class);
ResultHandle externalizableClass = tc.invokeStaticMethod(
- ofMethod(Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class),
+ forNameMethodDescriptor,
tc.load("java.io.Externalizable"), tc.load(false), tccl);
BranchResult isExternalizable = tc
@@ -562,13 +602,12 @@ private MethodDescriptor createRegisterSerializationForClassMethod(ClassCreator
ResultHandle array1 = ifIsExternalizable.newArray(Class.class, tc.load(1));
ResultHandle classClass = ifIsExternalizable.invokeStaticMethod(
- ofMethod(Class.class, "forName", Class.class, String.class, boolean.class, ClassLoader.class),
+ forNameMethodDescriptor,
ifIsExternalizable.load("java.lang.Class"), ifIsExternalizable.load(false), tccl);
ifIsExternalizable.writeArrayValue(array1, 0, classClass);
ResultHandle externalizableLookupMethod = ifIsExternalizable.invokeStaticMethod(
- ofMethod("com.oracle.svm.util.ReflectionUtil", "lookupMethod", Method.class, Class.class, String.class,
- Class[].class),
+ lookupMethod,
ifIsExternalizable.loadClass(ObjectStreamClass.class), ifIsExternalizable.load("getExternalizableConstructor"),
array1);
@@ -576,18 +615,17 @@ private MethodDescriptor createRegisterSerializationForClassMethod(ClassCreator
ifIsExternalizable.writeArrayValue(array2, 0, clazz);
ResultHandle externalizableConstructor = ifIsExternalizable.invokeVirtualMethod(
- ofMethod(Method.class, "invoke", Object.class, Object.class,
- Object[].class),
- externalizableLookupMethod, ifIsExternalizable.loadNull(), array2);
+ invokeMethodDescriptor, externalizableLookupMethod, ifIsExternalizable.loadNull(), array2);
ResultHandle externalizableConstructorClass = ifIsExternalizable.invokeVirtualMethod(
ofMethod(Constructor.class, "getDeclaringClass", Class.class),
externalizableConstructor);
- ifIsExternalizable.invokeStaticMethod(
- ofMethod("com.oracle.svm.reflect.serialize.hosted.SerializationFeature", "addReflections", void.class,
- Class.class, Class.class),
- clazz, externalizableConstructorClass);
+ ResultHandle addReflectionsArgs1 = ifIsExternalizable.newArray(Class.class, tc.load(2));
+ ifIsExternalizable.writeArrayValue(addReflectionsArgs1, 0, clazz);
+ ifIsExternalizable.writeArrayValue(addReflectionsArgs1, 1, externalizableConstructorClass);
+ ifIsExternalizable.invokeVirtualMethod(invokeMethodDescriptor, addReflectionsLookupMethod,
+ ifIsExternalizable.loadNull(), addReflectionsArgs1);
ifIsExternalizable.returnValue(null);
@@ -618,26 +656,22 @@ private MethodDescriptor createRegisterSerializationForClassMethod(ClassCreator
ofMethod(Constructor.class, "getDeclaringClass", Class.class),
newSerializationConstructor);
- ResultHandle lookupMethod = tc.invokeStaticMethod(
- ofMethod("com.oracle.svm.util.ReflectionUtil", "lookupMethod", Method.class, Class.class, String.class,
- Class[].class),
- tc.loadClass(Constructor.class), tc.load("getConstructorAccessor"),
+ ResultHandle getConstructorAccessor = tc.invokeStaticMethod(
+ lookupMethod, tc.loadClass(Constructor.class), tc.load("getConstructorAccessor"),
tc.newArray(Class.class, tc.load(0)));
ResultHandle accessor = tc.invokeVirtualMethod(
- ofMethod(Method.class, "invoke", Object.class, Object.class,
- Object[].class),
- lookupMethod, newSerializationConstructor,
+ invokeMethodDescriptor, getConstructorAccessor, newSerializationConstructor,
tc.newArray(Object.class, tc.load(0)));
tc.invokeVirtualMethod(
ofMethod("com.oracle.svm.reflect.serialize.SerializationSupport", "addConstructorAccessor",
Object.class, Class.class, Class.class, Object.class),
serializationSupport, clazz, newSerializationConstructorClass, accessor);
- tc.invokeStaticMethod(
- ofMethod("com.oracle.svm.reflect.serialize.hosted.SerializationFeature", "addReflections", void.class,
- Class.class, Class.class),
- clazz, objectClass);
+ ResultHandle addReflectionsArgs2 = tc.newArray(Class.class, tc.load(2));
+ tc.writeArrayValue(addReflectionsArgs2, 0, clazz);
+ tc.writeArrayValue(addReflectionsArgs2, 1, objectClass);
+ tc.invokeVirtualMethod(invokeMethodDescriptor, addReflectionsLookupMethod, tc.loadNull(), addReflectionsArgs2);
addSerializationForClass.returnValue(null);
| ['core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageAutoFeatureStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,920,080 | 3,484,053 | 459,442 | 4,761 | 6,309 | 1,250 | 86 | 1 | 8,494 | 367 | 2,121 | 121 | 4 | 1 | 2021-08-19T23:04: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 |
2,662 | quarkusio/quarkus/19708/19621 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19621 | https://github.com/quarkusio/quarkus/pull/19708 | https://github.com/quarkusio/quarkus/pull/19708 | 1 | fixes | Response head already sent Exception | ### Describe the bug
When using lazy JWT authentication with http permissions observing below exceptions if JWT token in the request is expired.
```
[io.ver.ext.web.RoutingContext] (vert.x-eventloop-thread-22) Unhandled exception in router: java.lang.IllegalStateException: Response head already sent
or
[io.ver.ext.web.RoutingContext] (vert.x-eventloop-thread-0) Unhandled exception in router: java.lang.IllegalStateException: Response has already been written
```
**Quarkus Extensions used:** cdi, security, smallrye-context-propagation, smallrye-jwt, smallrye-openapi, swagger-ui, vertx, vertx-web
Config used:
```
quarkus.http.auth.proactive=false
quarkus.http.auth.permission.permit.paths=/q/*,/api/hello
quarkus.http.auth.permission.permit.policy=permit
quarkus.http.auth.permission.loggedin.paths=/api/*
quarkus.http.auth.permission.loggedin.policy=authenticated
```
### Expected behavior
No Runtime exceptions
### Actual behavior
Observing below exception
```
2021-08-24 17:00:00,950 ERROR [io.ver.ext.web.RoutingContext] (vert.x-eventloop-thread-22) Unhandled exception in router: java.lang.IllegalStateException: Response head already sent
at io.vertx.core.http.impl.Http1xServerResponse.checkHeadWritten(Http1xServerResponse.java:675)
at io.vertx.core.http.impl.Http1xServerResponse.setStatusCode(Http1xServerResponse.java:144)
at io.quarkus.vertx.http.runtime.QuarkusErrorHandler.handle(QuarkusErrorHandler.java:77)
at io.quarkus.vertx.http.runtime.QuarkusErrorHandler.handle(QuarkusErrorHandler.java:24)
at io.vertx.ext.web.impl.RouteState.handleFailure(RouteState.java:1133)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:148)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
at io.vertx.ext.web.impl.RoutingContextImpl.doFail(RoutingContextImpl.java:591)
at io.vertx.ext.web.impl.RoutingContextImpl.fail(RoutingContextImpl.java:184)
at io.vertx.ext.web.impl.RoutingContextImpl.fail(RoutingContextImpl.java:173)
at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$3.accept(HttpAuthorizer.java:140)
at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$3.accept(HttpAuthorizer.java:137)
```
Observed below exception as well though not able to reproduce it always
```
2021-08-24 14:02:19,090 ERROR [io.ver.ext.web.RoutingContext] (vert.x-eventloop-thread-0) Unhandled exception in router: java.lang.IllegalStateException: Response has already been written
at io.vertx.core.http.impl.Http1xServerResponse.checkValid(Http1xServerResponse.java:669)
at io.vertx.core.http.impl.Http1xServerResponse.endHandler(Http1xServerResponse.java:310)
at io.vertx.ext.web.impl.RoutingContextImpl.getEndHandlers(RoutingContextImpl.java:573)
at io.vertx.ext.web.impl.RoutingContextImpl.addEndHandler(RoutingContextImpl.java:436)
at io.quarkus.vertx.web.runtime.RouteHandler.handle(RouteHandler.java:90)
at io.quarkus.vertx.web.runtime.RouteHandler.handle(RouteHandler.java:22)
at io.vertx.ext.web.impl.RouteState.handleFailure(RouteState.java:1133)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:148)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
at io.vertx.ext.web.impl.RoutingContextImpl.doFail(RoutingContextImpl.java:591)
at io.vertx.ext.web.impl.RoutingContextImpl.fail(RoutingContextImpl.java:184)
at io.vertx.ext.web.impl.RoutingContextImpl.fail(RoutingContextImpl.java:173)
at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$3.accept(HttpAuthorizer.java:140)
at io.quarkus.vertx.http.runtime.security.HttpAuthorizer$3.accept(HttpAuthorizer.java:137)
```
### How to Reproduce?
https://github.com/MM87037/routing-error
Start the service and run below command
```
curl "http://localhost:8080/api/user" -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJUZXN0Iiwic3ViIjoidW5tVW93TlBRNVEzdVh4WDNPRVkwTnRTRnNOWFZ6SlZnYVZyNm40MWNYbyIsInByZWZlcnJlZF91c2VybmFtZSI6IlRlc3RVc2VyQGNvbXBhbnkuY29tIiwiYXVkIjoiZjkzZWUxYTgtYmExYS00NDk0LWJmZTEtNjQzODIzMDIyNWVhIiwiaWF0IjoxNjI5NzMzMzE1LCJleHAiOjE2Mjk3MzY5MTUsIm5hbWUiOiJUZXN0IFVzZXIiLCJyb2xlcyI6WyJ3cml0ZSIsInJlYWQiLCJyZWxlYXNlIl0sImp0aSI6ImUzMGMxNWZjLTA0YzEtNDM0Yi1iZTZjLTU0N2E3Zjk4MjI0MiJ9.f52Q1JrH4JjeDbwn4NthuBYursCjeRrgd4uvCx0wGpilxaOVm7nvHlFkTKbiRofpEl8kE4YEangEGpiXPfn33Q5fZ_C2TjgQyrbNu9-IbSeDStLxIbhawW-NjyTI3EQY0zUrN9aOHvOWDitNTUVjBxHCIf1WTmyL15X6XT1qBczpTZKr-kkFs2L0Gxereu_gNxWgUPcyfC0vTOhjt3prZcpksv2W26gpKdTdJBmXm0xeOlkdxeIao_2kiJWTxJ22aUSLCESodNex-QV-40EjUz7B4YHSfEJ16mUjgLAOcpIwjjjZAvdHV92oa6alIgbbb35VjeqlPmKc29gQJNQP1Q'
```
or
Run maven build
```
mvn clean verify
```
### Output of `uname -a` or `ver`
Windows 10 Git Bash or Linux ids-slpdf-service-117-qd7hx 3.10.0-1160.36.2.el7.x86_64 #1 SMP Thu Jul 8 02:53:40 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "11.0.12" 2021-07-20
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.0 and above
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
maven 3.8.1
### Additional information
_No response_ | 0e58c45b82b3df7095544a34c6eb8be323f3442b | 9c553639dd19035c4936c4f9ec89be16dac78d6f | https://github.com/quarkusio/quarkus/compare/0e58c45b82b3df7095544a34c6eb8be323f3442b...9c553639dd19035c4936c4f9ec89be16dac78d6f | diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/QuarkusErrorHandler.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/QuarkusErrorHandler.java
index 04fae63b0f3..6484de2a3f3 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/QuarkusErrorHandler.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/QuarkusErrorHandler.java
@@ -41,40 +41,49 @@ public QuarkusErrorHandler(boolean showStack) {
@Override
public void handle(RoutingContext event) {
- if (event.failure() == null) {
- event.response().setStatusCode(event.statusCode());
- event.response().end();
- return;
- }
- //this can happen if there is no auth mechanisms
- if (event.failure() instanceof UnauthorizedException) {
- HttpAuthenticator authenticator = event.get(HttpAuthenticator.class.getName());
- if (authenticator != null) {
- authenticator.sendChallenge(event).subscribe().with(new Consumer<Boolean>() {
- @Override
- public void accept(Boolean aBoolean) {
- event.response().end();
- }
- }, new Consumer<Throwable>() {
- @Override
- public void accept(Throwable throwable) {
- event.fail(throwable);
- }
- });
- } else {
+ try {
+ if (event.failure() == null) {
+ event.response().setStatusCode(event.statusCode());
+ event.response().end();
+ return;
+ }
+ //this can happen if there is no auth mechanisms
+ if (event.failure() instanceof UnauthorizedException) {
+ HttpAuthenticator authenticator = event.get(HttpAuthenticator.class.getName());
+ if (authenticator != null) {
+ authenticator.sendChallenge(event).subscribe().with(new Consumer<Boolean>() {
+ @Override
+ public void accept(Boolean aBoolean) {
+ event.response().end();
+ }
+ }, new Consumer<Throwable>() {
+ @Override
+ public void accept(Throwable throwable) {
+ event.fail(throwable);
+ }
+ });
+ } else {
+ event.response().setStatusCode(HttpResponseStatus.UNAUTHORIZED.code()).end();
+ }
+ return;
+ }
+ if (event.failure() instanceof ForbiddenException) {
+ event.response().setStatusCode(HttpResponseStatus.FORBIDDEN.code()).end();
+ return;
+ }
+ if (event.failure() instanceof AuthenticationFailedException) {
+ //generally this should be handled elsewhere
+ //but if we get to this point bad things have happened
+ //so it is better to send a response than to hang
event.response().setStatusCode(HttpResponseStatus.UNAUTHORIZED.code()).end();
+ return;
+ }
+ } catch (IllegalStateException e) {
+ //ignore this if the response is already started
+ if (!event.response().ended()) {
+ //could be that just the head is committed
+ event.response().end();
}
- return;
- }
- if (event.failure() instanceof ForbiddenException) {
- event.response().setStatusCode(HttpResponseStatus.FORBIDDEN.code()).end();
- return;
- }
- if (event.failure() instanceof AuthenticationFailedException) {
- //generally this should be handled elsewhere
- //but if we get to this point bad things have happened
- //so it is better to send a response than to hang
- event.response().setStatusCode(HttpResponseStatus.UNAUTHORIZED.code()).end();
return;
}
@@ -100,6 +109,15 @@ public void accept(Throwable throwable) {
} else {
log.errorf(exception, "HTTP Request to %s failed, error id: %s", event.request().uri(), uuid);
}
+ //we have logged the error
+ //now lets see if we can actually send a response
+ //if not we just return
+ if (event.response().ended()) {
+ return;
+ } else if (event.response().headWritten()) {
+ event.response().end();
+ return;
+ }
String accept = event.request().getHeader("Accept");
if (accept != null && accept.contains("application/json")) {
event.response().headers().set(HttpHeaderNames.CONTENT_TYPE, "application/json; charset=utf-8");
diff --git a/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/NdjsonMultiRouteTest.java b/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/NdjsonMultiRouteTest.java
index 97e31d96090..8c2d6528967 100644
--- a/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/NdjsonMultiRouteTest.java
+++ b/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/NdjsonMultiRouteTest.java
@@ -47,7 +47,7 @@ public void testNdjsonMultiRoute() {
// We get the item followed by the exception
when().get("/hello-and-fail").then().statusCode(200)
.body(containsString("\\"Hello\\""))
- .body(containsString("boom"));
+ .body(not(containsString("boom")));
when().get("/void").then().statusCode(204).body(hasLength(0));
diff --git a/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SSEMultiRouteTest.java b/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SSEMultiRouteTest.java
index 6c998dbf1a1..3dd1656631f 100644
--- a/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SSEMultiRouteTest.java
+++ b/extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SSEMultiRouteTest.java
@@ -44,7 +44,7 @@ public void testSSEMultiRoute() {
// We get the item followed by the exception
when().get("/hello-and-fail").then().statusCode(200)
.body(containsString("id: 0"))
- .body(containsString("boom"));
+ .body(not(containsString("boom")));
when().get("/buffer").then().statusCode(200)
.body(is("data: Buffer\\nid: 0\\n\\n")) | ['extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/NdjsonMultiRouteTest.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/QuarkusErrorHandler.java', 'extensions/vertx-web/deployment/src/test/java/io/quarkus/vertx/web/mutiny/SSEMultiRouteTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 17,985,802 | 3,497,003 | 460,955 | 4,770 | 3,798 | 616 | 82 | 1 | 5,201 | 279 | 1,660 | 106 | 2 | 6 | 2021-08-27T02:00:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,663 | quarkusio/quarkus/19706/19655 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19655 | https://github.com/quarkusio/quarkus/pull/19706 | https://github.com/quarkusio/quarkus/pull/19706 | 1 | fixes | Index doesn't pick up new interface implementations during dev mode | ### Describe the bug
I'm encountering an issue with my extension (https://github.com/quarkiverse/quarkus-operator-sdk) and dev mode: the extension allows you to bypass a lot of boilerplate by only providing implementations of a given interface and does the wiring needed to create a functioning (CLI) application.
I create my app using my extension with no initial classes, my extension processor automatically creates some objects that try to register known implementations of a given interface via a `StartupEvent` listener.
No implementations => nothing to do => my extension throws an exception to tell the user to add some implementations: all good
If I now add some implementation with dev mode still running and force the app to restart, my extension still fails to find any implementation and therefore fails the app again.
### Expected behavior
I'd expect the added classes implementing the target interface to be visible by my extension without having to exit the dev mode.
### Actual behavior
New implementations of the interface don't appear to be picked up by the index.
### How to Reproduce?
1. `git clone https://github.com/metacosm/dev-mode-bug.git`
2. `git co step-1`: initial state, no `ResourceController` implementation
3. `mvn quarkus:dev` => `ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): io.javaoperatorsdk.operator.OperatorException: No ResourceController exists. Exiting!`
4. In another terminal to keep dev mode running: `git co step-2` to move the code to a state where a `ResourceController` implementation exists
5. In first terminal, press `space` to restart the app, observe that we still get the same exception
### Output of `uname -a` or `ver`
Darwin wakizashi.home 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64
### Output of `java -version`
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
### GraalVM version (if different from Java)
Irrelevant
### Quarkus version or git rev
2.1.3
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
mvn --version Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f) Maven home: /usr/local/Cellar/maven/3.8.2/libexec Java version: 11.0.11, vendor: AdoptOpenJDK, runtime: /Users/claprun/.sdkman/candidates/java/11.0.11.hs-adpt Default locale: en_FR, platform encoding: UTF-8 OS name: "mac os x", version: "11.5", arch: "x86_64", family: "mac"
### Additional information
_No response_ | 7db3b10ffb28b7691cd2af7f2a044a9257dfc08d | 3935094e8c5a8b206dea0668ccf7d82bc2447b74 | https://github.com/quarkusio/quarkus/compare/7db3b10ffb28b7691cd2af7f2a044a9257dfc08d...3935094e8c5a8b206dea0668ccf7d82bc2447b74 | 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 abeab532960..c015ef36958 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -653,22 +653,13 @@ private void addProject(MavenDevModeLauncher.Builder builder, LocalProject local
if (mavenProject == null) {
projectDirectory = localProject.getDir().toAbsolutePath().toString();
Path sourcePath = localProject.getSourcesSourcesDir().toAbsolutePath();
- if (Files.isDirectory(sourcePath)) {
- sourcePaths = Collections.singleton(sourcePath);
- } else {
- sourcePaths = Collections.emptySet();
- }
+ sourcePaths = Collections.singleton(sourcePath);
Path testSourcePath = localProject.getTestSourcesSourcesDir().toAbsolutePath();
- if (Files.isDirectory(testSourcePath)) {
- testSourcePaths = Collections.singleton(testSourcePath);
- } else {
- testSourcePaths = Collections.emptySet();
- }
+ testSourcePaths = Collections.singleton(testSourcePath);
} else {
projectDirectory = mavenProject.getBasedir().getPath();
sourcePaths = mavenProject.getCompileSourceRoots().stream()
.map(Paths::get)
- .filter(Files::isDirectory)
.map(Path::toAbsolutePath)
.collect(Collectors.toCollection(LinkedHashSet::new));
testSourcePaths = mavenProject.getTestCompileSourceRoots().stream()
diff --git a/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java b/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
index 475a22423ad..22e5190d88f 100644
--- a/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
+++ b/integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java
@@ -275,6 +275,37 @@ public void testThatTheApplicationIsReloadedOnJavaChange() throws MavenInvocatio
.atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains("carambar"));
}
+ @Test
+ public void testThatNonExistentSrcDirCanBeAdded() throws MavenInvocationException, IOException {
+ testDir = initProject("projects/classic", "projects/project-classic-run-java-change");
+
+ File sourceDir = new File(testDir, "src/main/java");
+ File sourceDirMoved = new File(testDir, "src/main/java-moved");
+ if (!sourceDir.renameTo(sourceDirMoved)) {
+ Assertions.fail("move failed");
+ }
+ //we need this to make run and check work
+ File hello = new File(testDir, "src/main/resources/META-INF/resources/app/hello");
+ hello.getParentFile().mkdir();
+ try (var o = new FileOutputStream(hello)) {
+ o.write("hello".getBytes(StandardCharsets.UTF_8));
+ }
+
+ runAndCheck();
+ hello.delete();
+ if (!DevModeTestUtils.getHttpResponse("/app/hello", 404)) {
+ Assertions.fail("expected resource to be deleted");
+ }
+ if (!sourceDirMoved.renameTo(sourceDir)) {
+ Assertions.fail("move failed");
+ }
+
+ // Wait until we get "hello"
+ await()
+ .pollDelay(100, TimeUnit.MILLISECONDS)
+ .atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains("hello"));
+ }
+
@Test
public void testThatInstrumentationBasedReloadWorks() throws MavenInvocationException, IOException {
testDir = initProject("projects/classic-inst", "projects/project-intrumentation-reload"); | ['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java', 'integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,968,197 | 3,493,728 | 460,562 | 4,770 | 612 | 97 | 13 | 1 | 2,704 | 361 | 716 | 49 | 2 | 0 | 2021-08-26T22:57:36 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,664 | quarkusio/quarkus/19647/19645 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19645 | https://github.com/quarkusio/quarkus/pull/19647 | https://github.com/quarkusio/quarkus/pull/19647 | 1 | closes | #19534 broke backwards compatibility with GraalVM/Mandrel 20.3 | ### Describe the bug
https://github.com/quarkusio/quarkus/pull/19534 results in the following exception when using GraalVM/Mandrel 20.3
```
java.lang.ClassNotFoundException: com.oracle.svm.core.jdk.JDK16OrEarlier
```
### Expected behavior
Tests and applications should build with GraalVM/Mandrel 20.3.
### Actual behavior
Tests and applications fail to build with GraalVM/Mandrel 20.3.
### How to Reproduce?
Build any integration test/quarkus app using `-Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel:20.3-java11`
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
11.0.12
### GraalVM version (if different from Java)
20.3
### Quarkus version or git rev
cc16df8dd324cecfedba06aec04c1bf2d17e62f3
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
Full stack trace:
```
Fatal error:java.lang.TypeNotPresentException: Type com.oracle.svm.core.jdk.JDK16OrEarlier not present
at java.base/sun.reflect.annotation.TypeNotPresentExceptionProxy.generateException(TypeNotPresentExceptionProxy.java:46)
at java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:86)
at com.sun.proxy.$Proxy62.onlyWith(Unknown Source)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:883)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:287)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:265)
at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:919)
at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:853)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:554)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:469)
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:183)
Caused by: java.lang.ClassNotFoundException: com.oracle.svm.core.jdk.JDK16OrEarlier
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at java.base/sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114)
at java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125)
at java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at java.base/sun.reflect.annotation.AnnotationParser.parseSig(AnnotationParser.java:440)
at java.base/sun.reflect.annotation.AnnotationParser.parseClassValue(AnnotationParser.java:421)
at java.base/sun.reflect.annotation.AnnotationParser.lambda$parseClassArray$0(AnnotationParser.java:719)
at java.base/sun.reflect.annotation.AnnotationParser.parseArrayElements(AnnotationParser.java:747)
at java.base/sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:718)
at java.base/sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:532)
at java.base/sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:356)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:287)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:121)
at java.base/sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:73)
at java.base/java.lang.Class.createAnnotationData(Class.java:3757)
at java.base/java.lang.Class.annotationData(Class.java:3746)
at java.base/java.lang.Class.getAnnotations(Class.java:3682)
at com.oracle.svm.hosted.ImageClassLoader.canLoadAnnotations(ImageClassLoader.java:133)
at com.oracle.svm.hosted.ImageClassLoader.handleClass(ImageClassLoader.java:170)
at com.oracle.svm.hosted.AbstractNativeImageClassLoaderSupport$ClassInit.handleClassFileName(AbstractNativeImageClassLoaderSupport.java:288)
at com.oracle.svm.hosted.AbstractNativeImageClassLoaderSupport$ClassInit$1.lambda$visitFile$0(AbstractNativeImageClassLoaderSupport.java:225)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
... 5 more
``` | 9fc6d6dac9e0d263fe70fbed117d72ff91070263 | 5efc4ca2fb9f884c09e350ac044154ad7b0f9247 | https://github.com/quarkusio/quarkus/compare/9fc6d6dac9e0d263fe70fbed117d72ff91070263...5efc4ca2fb9f884c09e350ac044154ad7b0f9247 | diff --git a/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutions.java b/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutions.java
index 9557212c5dc..78f0fee74d7 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutions.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutions.java
@@ -4,7 +4,8 @@
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
-import com.oracle.svm.core.jdk.JDK16OrEarlier;
+
+import io.quarkus.runtime.util.JavaVersionUtil.JDK16OrEarlier;
@TargetClass(className = "sun.java2d.cmm.lcms.LCMS", onlyWith = JDK16OrEarlier.class)
final class Target_sun_java2d_cmm_lcms_LCMS {
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutionsJDK17.java b/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutionsJDK17.java
index 90f53d9b777..baf8034401c 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutionsJDK17.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutionsJDK17.java
@@ -4,7 +4,8 @@
import com.oracle.svm.core.annotate.Substitute;
import com.oracle.svm.core.annotate.TargetClass;
-import com.oracle.svm.core.jdk.JDK17OrLater;
+
+import io.quarkus.runtime.util.JavaVersionUtil.JDK17OrLater;
@TargetClass(className = "sun.java2d.cmm.lcms.LCMS", onlyWith = JDK17OrLater.class)
final class Target_sun_java2d_cmm_lcms_LCMS_JDK17 {
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/graal/Target_sun_security_jca_JCAUtil.java b/core/runtime/src/main/java/io/quarkus/runtime/graal/Target_sun_security_jca_JCAUtil.java
index b6e4791951c..436b15a4db6 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/graal/Target_sun_security_jca_JCAUtil.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/graal/Target_sun_security_jca_JCAUtil.java
@@ -5,9 +5,10 @@
import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.TargetClass;
-import com.oracle.svm.core.jdk.JDK17OrLater;
-@TargetClass(className = "sun.security.jca.JCAUtil", onlyWith = JDK17OrLater.class)
+import io.quarkus.runtime.util.JavaVersionUtil;
+
+@TargetClass(className = "sun.security.jca.JCAUtil", onlyWith = JavaVersionUtil.JDK17OrLater.class)
public final class Target_sun_security_jca_JCAUtil {
@Alias
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/util/JavaVersionUtil.java b/core/runtime/src/main/java/io/quarkus/runtime/util/JavaVersionUtil.java
index 082a6378b0e..6a78ce2e558 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/util/JavaVersionUtil.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/util/JavaVersionUtil.java
@@ -1,5 +1,6 @@
package io.quarkus.runtime.util;
+import java.util.function.BooleanSupplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -10,6 +11,8 @@ public class JavaVersionUtil {
private static boolean IS_JAVA_11_OR_NEWER;
private static boolean IS_JAVA_13_OR_NEWER;
private static boolean IS_GRAALVM_JDK;
+ private static boolean IS_JAVA_16_OR_OLDER;
+ private static boolean IS_JAVA_17_OR_NEWER;
static {
performChecks();
@@ -22,9 +25,13 @@ static void performChecks() {
int first = Integer.parseInt(matcher.group(1));
IS_JAVA_11_OR_NEWER = (first >= 11);
IS_JAVA_13_OR_NEWER = (first >= 13);
+ IS_JAVA_16_OR_OLDER = (first <= 16);
+ IS_JAVA_17_OR_NEWER = (first >= 17);
} else {
IS_JAVA_11_OR_NEWER = false;
IS_JAVA_13_OR_NEWER = false;
+ IS_JAVA_16_OR_OLDER = false;
+ IS_JAVA_17_OR_NEWER = false;
}
String vmVendor = System.getProperty("java.vm.vendor");
@@ -39,7 +46,31 @@ public static boolean isJava13OrHigher() {
return IS_JAVA_13_OR_NEWER;
}
+ public static boolean isJava16OrLower() {
+ return IS_JAVA_16_OR_OLDER;
+ }
+
+ public static boolean isJava17OrHigher() {
+ return IS_JAVA_17_OR_NEWER;
+ }
+
public static boolean isGraalvmJdk() {
return IS_GRAALVM_JDK;
}
+
+ /* Clone of com.oracle.svm.core.jdk.JDK17OrLater to work around #19645 issue with GraalVM 20.3 */
+ public static class JDK17OrLater implements BooleanSupplier {
+ @Override
+ public boolean getAsBoolean() {
+ return JavaVersionUtil.isJava17OrHigher();
+ }
+ }
+
+ /* Clone of com.oracle.svm.core.jdk.JDK16OrEarlier to work around #19645 issue with GraalVM 20.3 */
+ public static class JDK16OrEarlier implements BooleanSupplier {
+ @Override
+ public boolean getAsBoolean() {
+ return JavaVersionUtil.isJava16OrLower();
+ }
+ }
} | ['core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutionsJDK17.java', 'core/runtime/src/main/java/io/quarkus/runtime/graal/LCMSSubstitutions.java', 'core/runtime/src/main/java/io/quarkus/runtime/graal/Target_sun_security_jca_JCAUtil.java', 'core/runtime/src/main/java/io/quarkus/runtime/util/JavaVersionUtil.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 17,952,335 | 3,490,618 | 460,195 | 4,767 | 1,631 | 414 | 42 | 4 | 5,045 | 202 | 1,150 | 91 | 1 | 2 | 2021-08-25T09:48:25 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,665 | quarkusio/quarkus/19618/19467 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19467 | https://github.com/quarkusio/quarkus/pull/19618 | https://github.com/quarkusio/quarkus/pull/19618 | 1 | fixes | Hibernate Multitenant project with a @RequestScoped TenantResolver throws javax.enterprise.context.ContextNotActiveException | ### Describe the bug
I'm using the `SCHEMA` hibernate multitenant option, implementing a `TenantResolver` that is `@RequestScoped` so that I can use an `@Inject`ed `JsonWebToken`
At startup, the app logs a warning when trying to call the `getDefaultTenantId` method to get the connection metadata ( see below ). This happens in 2.1.*, and didn't happen in 1.1.*, so it seems a regression.
More severe is that if I use the hibernate migrations(*), the app won't start as it can't get the default tenant. The error stack is similar but it's triggered from the migration classes. See the attached multitenant-2.1.2-migrate.zip file
```
2021-08-17 23:16:05,767 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): javax.enterprise.context.ContextNotActiveException
at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:40)
at io.portx.quarkus.multitenant.CableTenantResolver_ClientProxy.arc$delegate(CableTenantResolver_ClientProxy.zig:42)
at io.portx.quarkus.multitenant.CableTenantResolver_ClientProxy.getDefaultTenantId(CableTenantResolver_ClientProxy.zig:128)
at io.quarkus.hibernate.orm.runtime.tenant.HibernateMultiTenantConnectionProvider.getAnyConnectionProvider(HibernateMultiTenantConnectionProvider.java:37)
at org.hibernate.engine.jdbc.connections.spi.AbstractMultiTenantConnectionProvider.getAnyConnection(AbstractMultiTenantConnectionProvider.java:26)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$MultiTenantConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:208)
at org.hibernate.resource.transaction.backend.jta.internal.DdlTransactionIsolatorJtaImpl.<init>(DdlTransactionIsolatorJtaImpl.java:59)
at org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl.buildDdlTransactionIsolator(JtaTransactionCoordinatorBuilderImpl.java:46)
at org.hibernate.tool.schema.internal.HibernateSchemaManagementTool.getDdlTransactionIsolator(HibernateSchemaManagementTool.java:189)
at org.hibernate.tool.schema.internal.HibernateSchemaManagementTool.buildGenerationTargets(HibernateSchemaManagementTool.java:147)
at org.hibernate.tool.schema.internal.SchemaDropperImpl.doDrop(SchemaDropperImpl.java:110)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:153)
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:81)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:327)
at io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.build(FastBootEntityManagerFactoryBuilder.java:71)
at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.createEntityManagerFactory(FastBootHibernatePersistenceProvider.java:67)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:149)
at io.quarkus.hibernate.orm.runtime.JPAConfig$1.run(JPAConfig.java:58)
at java.base/java.lang.Thread.run(Thread.java:829)
```
(*) I know that https://quarkus.io/guides/hibernate-orm#configuring-the-application doesn't recommend using the hibernate generation with a multitenant config, but it's useful for a dev or test setup where I run just one schema.
To avoid this warning/error, as a workaround I have to use an `@ApplicationScoped` TenantResolver and then get the JsonWebToken "manually" using:
```java
if ( Arc.container().requestContext().isActive() ) {
jwt = CDI.current().select(JsonWebToken.class).get();
} else {
throw new RuntimeException("Could not extract tenant information from JWT because the RequestContext is not active");
}
```
Here's the full stack trace:
```
2021-08-17 22:04:56,066 WARN [org.hib.eng.jdb.env.int.JdbcEnvironmentInitiator] (JPA Startup Thread: <default>) HHH000342: Could not obtain connection to query metadata: javax.enterprise.context.ContextNotActiveException
at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:40)
at io.portx.quarkus.multitenant.CableTenantResolver_ClientProxy.arc$delegate(CableTenantResolver_ClientProxy.zig:42)
at io.portx.quarkus.multitenant.CableTenantResolver_ClientProxy.getDefaultTenantId(CableTenantResolver_ClientProxy.zig:128)
at io.quarkus.hibernate.orm.runtime.tenant.HibernateMultiTenantConnectionProvider.getAnyConnectionProvider(HibernateMultiTenantConnectionProvider.java:37)
at org.hibernate.engine.jdbc.connections.spi.AbstractMultiTenantConnectionProvider.getAnyConnection(AbstractMultiTenantConnectionProvider.java:26)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$MultiTenantConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:208)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:68)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:107)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:246)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.SessionFactoryOptionsBuilder.<init>(SessionFactoryOptionsBuilder.java:263)
at io.quarkus.hibernate.orm.runtime.recording.PrevalidatedQuarkusMetadata.buildSessionFactoryOptionsBuilder(PrevalidatedQuarkusMetadata.java:69)
at io.quarkus.hibernate.orm.runtime.boot.FastBootEntityManagerFactoryBuilder.build(FastBootEntityManagerFactoryBuilder.java:69)
at io.quarkus.hibernate.orm.runtime.FastBootHibernatePersistenceProvider.createEntityManagerFactory(FastBootHibernatePersistenceProvider.java:67)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:80)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at io.quarkus.hibernate.orm.runtime.JPAConfig$LazyPersistenceUnit.get(JPAConfig.java:149)
at io.quarkus.hibernate.orm.runtime.JPAConfig$1.run(JPAConfig.java:58)
at java.base/java.lang.Thread.run(Thread.java:829)
```
### Expected behavior
No warnings, TenantResolver created and `getDefaultTenantId` called
### Actual behavior
See stack trace above
### How to Reproduce?
I'm adding a mvn project to reproduce the error. Run `./mvnw compile quarkus:dev`
[multitenant-2.1.2.zip](https://github.com/quarkusio/quarkus/files/7003865/multitenant-2.1.2.zip)
Compare with the 1.1.7 version which runs ok ( this needs a pg db running )
[1.1.7.zip](https://github.com/quarkusio/quarkus/files/7003993/1.1.7.zip)
### Output of `uname -a` or `ver`
Darwin MBP-15-Ramiro.local 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64
### Output of `java -version`
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
### GraalVM version (if different from Java)
not used
### Quarkus version or git rev
2.1.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /Users/ramiro/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3 Java version: 11.0.11, vendor: AdoptOpenJDK, runtime: /Users/ramiro/.sdkman/candidates/java/11.0.11.hs-adpt Default locale: en_AR, platform encoding: UTF-8 OS name: "mac os x", version: "11.3", arch: "x86_64", family: "mac"
### Additional information
_No response_ | 03b62587c858286a89652f51c2e2aa37e30d0a0d | dd99c0e8ba442d95264a8de62897a1c110ca0d99 | https://github.com/quarkusio/quarkus/compare/03b62587c858286a89652f51c2e2aa37e30d0a0d...dd99c0e8ba442d95264a8de62897a1c110ca0d99 | diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java
index ddf8000db0f..141965ec47b 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java
@@ -1,9 +1,12 @@
package io.quarkus.hibernate.orm.runtime.tenant;
+import java.lang.annotation.Annotation;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import javax.enterprise.context.RequestScoped;
+import javax.enterprise.context.SessionScoped;
import javax.enterprise.inject.Default;
import org.hibernate.engine.jdbc.connections.spi.AbstractMultiTenantConnectionProvider;
@@ -12,6 +15,7 @@
import io.quarkus.arc.Arc;
import io.quarkus.arc.InstanceHandle;
+import io.quarkus.arc.ManagedContext;
import io.quarkus.hibernate.orm.PersistenceUnit.PersistenceUnitLiteral;
import io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil;
@@ -19,7 +23,6 @@
* Maps from the Quarkus {@link TenantConnectionResolver} to the {@link HibernateMultiTenantConnectionProvider} model.
*
* @author Michael Schnell
- *
*/
public final class HibernateMultiTenantConnectionProvider extends AbstractMultiTenantConnectionProvider {
@@ -34,7 +37,23 @@ public HibernateMultiTenantConnectionProvider(String persistenceUnitName) {
@Override
protected ConnectionProvider getAnyConnectionProvider() {
- String tenantId = tenantResolver(persistenceUnitName).getDefaultTenantId();
+ InstanceHandle<TenantResolver> tenantResolver = tenantResolver(persistenceUnitName);
+ String tenantId;
+ // Activate RequestScope if the TenantResolver is @RequestScoped or @SessionScoped
+ ManagedContext requestContext = Arc.container().requestContext();
+ Class<? extends Annotation> tenantScope = tenantResolver.getBean().getScope();
+ boolean requiresRequestScope = (tenantScope == RequestScoped.class || tenantScope == SessionScoped.class);
+ boolean forceRequestActivation = (!requestContext.isActive() && requiresRequestScope);
+ try {
+ if (forceRequestActivation) {
+ requestContext.activate();
+ }
+ tenantId = tenantResolver.get().getDefaultTenantId();
+ } finally {
+ if (forceRequestActivation) {
+ requestContext.deactivate();
+ }
+ }
if (tenantId == null) {
throw new IllegalStateException("Method 'TenantResolver.getDefaultTenantId()' returned a null value. "
+ "This violates the contract of the interface!");
@@ -88,7 +107,7 @@ private static ConnectionProvider resolveConnectionProvider(String persistenceUn
*
* @return Current tenant resolver.
*/
- private static TenantResolver tenantResolver(String persistenceUnitName) {
+ private static InstanceHandle<TenantResolver> tenantResolver(String persistenceUnitName) {
InstanceHandle<TenantResolver> resolverInstance;
if (PersistenceUnitUtil.isDefaultPersistenceUnit(persistenceUnitName)) {
resolverInstance = Arc.container().instance(TenantResolver.class, Default.Literal.INSTANCE);
@@ -102,7 +121,7 @@ private static TenantResolver tenantResolver(String persistenceUnitName) {
+ "You need to create an implementation for this interface to allow resolving the current tenant identifier.",
TenantResolver.class.getSimpleName(), persistenceUnitName));
}
- return resolverInstance.get();
+ return resolverInstance;
}
} | ['extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,944,205 | 3,488,847 | 460,011 | 4,765 | 1,421 | 245 | 27 | 1 | 8,633 | 474 | 2,020 | 118 | 3 | 3 | 2021-08-24T15:52:08 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,666 | quarkusio/quarkus/19605/19599 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19599 | https://github.com/quarkusio/quarkus/pull/19605 | https://github.com/quarkusio/quarkus/pull/19605 | 1 | closes | Setting quarkus.redis.devservices.enabled to false does not work | ### Describe the bug
Hi,
Although I set quarkus.redis.devservices.enabled to false, looks like still redis database is tried to be started using docker and start up time goes up to 100 secs in a hello world application. Though, this does not prevent redis client connect to configured database on localhost.
application.properties
`quarkus.redis.devservices.enabled=false`
console log
`Unable to connect to DOCKER_HOST URI tcp://192.168.XX.XXX:2376, make sure docker is running on the specified host`
`2021-08-23 22:01:16,068 WARN [io.qua.dep.IsDockerWorking] (main) Unable to connect to DOCKER_HOST URI tcp://192.168.99.100:2376, make sure docker is running on the specified host
2021-08-23 22:02:34,924 INFO [io.quarkus] (Quarkus Main Thread) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.1.3.Final) started in 101.368s. Listening on: http://localhost:8080
2021-08-23 22:02:34,929 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-08-23 22:02:34,931 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [agroal, cdi, hibernate-orm, jdbc-mysql, narayana-jta, redis-client, resteasy, resteasy-jackson, smallrye-context-propagation, vertx]
`
I removed all redis client dependencies and code, left only a simple rest endpoint, I did not see above log happen and start up time was around 1 sec as I expected
### Expected behavior
Skip invoking a redis database using docker.
### Actual behavior
Run docker to invoke a redis db
### How to Reproduce?
1. Set up local or connect to remote redis
2. Add redis client to gradle.properties
3. Add quarkus.redis.devservices.enabled=false in application.properties
4. Add redis config details of an existing redis db
5. Run the application on IntelliJ using gradle's quarkusDev task
### Output of `uname -a` or `ver`
Microsoft Windows [Version 10.0.19043.1165]
### Output of `java -version`
openjdk version "14.0.1" 2020-04-14
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1.1.Final, 2.1.3.Final and 2.2.0.CR1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 6.9
### Additional information
_No response_ | 532a9d481378af60d188c6e5421cc9d478ea0298 | 0daa9c9dd0057c547654247b13b9f43c5bdbd531 | https://github.com/quarkusio/quarkus/compare/532a9d481378af60d188c6e5421cc9d478ea0298...0daa9c9dd0057c547654247b13b9f43c5bdbd531 | diff --git a/extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java b/extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java
index 52a73e09abf..f0edb1dc239 100644
--- a/extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java
+++ b/extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java
@@ -55,8 +55,9 @@ public class DevServicesRedisProcessor {
private static volatile List<Closeable> closeables;
private static volatile Map<String, DevServiceConfiguration> capturedDevServicesConfiguration;
private static volatile boolean first = true;
+ private static volatile Boolean dockerRunning = null;
- @BuildStep(onlyIfNot = IsNormal.class, onlyIf = { IsDockerRunningSilent.class, GlobalDevServicesConfig.Enabled.class })
+ @BuildStep(onlyIfNot = IsNormal.class, onlyIf = { GlobalDevServicesConfig.Enabled.class })
public void startRedisContainers(LaunchModeBuildItem launchMode,
Optional<DevServicesSharedNetworkBuildItem> devServicesSharedNetworkBuildItem,
BuildProducer<DevServicesConfigResultBuildItem> devConfigProducer, RedisBuildTimeConfig config) {
@@ -102,6 +103,7 @@ public void startRedisContainers(LaunchModeBuildItem launchMode,
if (first) {
first = false;
Runnable closeTask = () -> {
+ dockerRunning = null;
if (closeables != null) {
for (Closeable closeable : closeables) {
try {
@@ -138,6 +140,17 @@ private StartResult startContainer(String connectionName, DevServicesConfig devS
return null;
}
+ if (dockerRunning == null) {
+ dockerRunning = new IsDockerRunningSilent().getAsBoolean();
+ }
+
+ if (!dockerRunning) {
+ log.warn("Please configure quarkus.redis.hosts for "
+ + (isDefault(connectionName) ? "default redis client" : connectionName)
+ + " or get a working docker instance");
+ return null;
+ }
+
DockerImageName dockerImageName = DockerImageName.parse(devServicesConfig.imageName.orElse(REDIS_6_ALPINE))
.asCompatibleSubstituteFor(REDIS_6_ALPINE);
| ['extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,931,300 | 3,486,128 | 459,730 | 4,764 | 732 | 153 | 15 | 1 | 2,269 | 298 | 643 | 60 | 1 | 0 | 2021-08-24T07:42:41 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,667 | quarkusio/quarkus/19600/19596 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19596 | https://github.com/quarkusio/quarkus/pull/19600 | https://github.com/quarkusio/quarkus/pull/19600 | 1 | fixes | Cannot toggle back to test mode after pause | ### Describe the bug
In dev mode, you cannot toggle back to test mode after pausing tests.
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
// some of this is pseudo code
1. cli create app resteasy (from 999-SNAPSHOT bom)
2. mvn quarkus:dev
3. Press "r" to start test mode
4. Press "p" to pause test mode
5. Press "r" to restart test mode
"r" option is removed from menu and test mode is not active.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
This was tested from 'main' | 08b3740af835cb78e5a7d0aabde48944a420f191 | 68e85dd85bfd1a0ef71fafb22b4530cf82fb5dc1 | https://github.com/quarkusio/quarkus/compare/08b3740af835cb78e5a7d0aabde48944a420f191...68e85dd85bfd1a0ef71fafb22b4530cf82fb5dc1 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java
index cdb39a59eb6..8367de53f34 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java
@@ -90,7 +90,10 @@ private void setupPausedConsole() {
public void run() {
if (lastResults == null) {
testsStatusOutput.setMessage(BLUE + "Starting tests" + RESET);
+ } else {
+ testsStatusOutput.setMessage(null);
}
+ setupTestsRunningConsole();
TestSupport.instance().get().start();
}
}));
@@ -103,8 +106,10 @@ private void setupFirstRunConsole() {
} else {
testsStatusOutput.setMessage(BLUE + "Running tests for the first time" + RESET);
}
- consoleContext.reset();
- addTestOutput();
+ if (firstRun) {
+ consoleContext.reset();
+ addTestOutput();
+ }
}
void addTestOutput() { | ['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestConsoleHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,920,080 | 3,484,053 | 459,442 | 4,761 | 289 | 46 | 9 | 1 | 809 | 136 | 213 | 48 | 0 | 0 | 2021-08-24T03:39:56 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,668 | quarkusio/quarkus/19582/18642 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18642 | https://github.com/quarkusio/quarkus/pull/19582 | https://github.com/quarkusio/quarkus/pull/19582 | 1 | fixes | Security provider BC + Native Mode not working in Quarkus v2.0 | ### Describe the bug
Since upgrading Quarkus to version 2.0 the security provider Bouncy Castle seems not supported anymore.
**Quarkus Platform (working):** 1.13.0.Final
**Quarkus Platform (not working):** 2.0.1.Final
_Related Dependencies:_
```
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</dependency>
```
Register Security Provider in _application.properties_
```
### Security ###
quarkus.security.security-providers=BC
```
According to migration guide (https://github.com/quarkusio/quarkus/wiki/Migration-Guide-2.0) no additional changes required.
### Expected behavior
BouncCastle should work without modifications as it did in previous Quarkus version.
### Actual behavior
Executing native image works basically but if a method will be called requiring Bouncy Castle an exception will be thrown:
* NoSuchAlgorithm
* ClassNotFound
### How to Reproduce?
* update quarkus version in pom.xml to 2.0.1.Final
* compile native image
* run application and call method requiring Bounc Castle as security provider
* retrieve NoSuchAlgorithm or ClassNotFound exception
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
11.0.11
### GraalVM version (if different from Java)
GraalVM 21.1.0
### Quarkus version or git rev
2.0.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
maven
### Additional information
Building native image using following command:
`mvn -f myapp-xxx/pom.xml clean package -Pnative -Dgoogle.cloud.credentials=*** -Dquarkus.container-image.username=oauth2accesstoken -Dquarkus.container-image.*** -Dquarkus.native.container-build=true -Dquarkus.container-image.build=true -Dquarkus.container-image.push=true -Dquarkus.profile=stage -DskipTests`
Full Stack Trace
`java.security.NoSuchAlgorithmException: class configured for KeyPairGenerator (provider: BC) cannot be found.
at java.security.Provider$Service.getImplClass(Provider.java:1933)
at java.security.Provider$Service.newInstance(Provider.java:1894)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:206)
at java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:300)
at at.ebs.iot.workerservice.service.DatabaseService.generateKeyPair(DatabaseService.java:55)
at at.ebs.iot.workerservice.service.DatabaseService.updateDeviceKeyPool(DatabaseService.java:37)
at at.ebs.iot.workerservice.service.DatabaseService_Subclass.updateDeviceKeyPool$$superforward1(DatabaseService_Subclass.zig:101)
at at.ebs.iot.workerservice.service.DatabaseService_Subclass$$function$$1.apply(DatabaseService_Subclass$$function$$1.zig:24)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:127)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:100)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:32)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:53)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:26)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(TransactionalInterceptorRequired_Bean.zig:340)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at at.ebs.iot.workerservice.service.DatabaseService_Subclass.updateDeviceKeyPool(DatabaseService_Subclass.zig:157)
at at.ebs.iot.workerservice.service.DatabaseService_Bean.create(DatabaseService_Bean.zig:291)
at at.ebs.iot.workerservice.service.DatabaseService_Bean.create(DatabaseService_Bean.zig:307)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:96)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:17)
at at.ebs.iot.workerservice.service.DatabaseService_ClientProxy.arc$delegate(DatabaseService_ClientProxy.zig:67)
at at.ebs.iot.workerservice.service.DatabaseService_ClientProxy.arc_contextualInstance(DatabaseService_ClientProxy.zig:82)
at at.ebs.iot.workerservice.service.DatabaseService_Observer_Synthetic_d70cd75bf32ab6598217b9a64a8473d65e248c05.notify(DatabaseService_Observer_Synthetic_d70cd75bf32ab6598217b9a64a8473d65e248c05.zig:94)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:300)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:282)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:70)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:128)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:97)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(LifecycleEventsBuildStep$startupEvent1144526294.zig:87)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(LifecycleEventsBuildStep$startupEvent1144526294.zig:40)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:864)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:101)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$EC
at com.oracle.svm.core.hub.ClassForNameSupport.forName(ClassForNameSupport.java:64)
at java.lang.ClassLoader.loadClass(ClassLoader.java:290)
at java.security.Provider$Service.getImplClass(Provider.java:1920)
... 45 more` | de3c639bebf5893edc04b6272628c00c26f0a1e0 | 7cb7e1b169e6b973bd69479c6b7a1036349403d5 | https://github.com/quarkusio/quarkus/compare/de3c639bebf5893edc04b6272628c00c26f0a1e0...7cb7e1b169e6b973bd69479c6b7a1036349403d5 | diff --git a/extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java b/extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java
index 726419f7d97..d6bd449991c 100644
--- a/extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java
+++ b/extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java
@@ -146,6 +146,12 @@ private static void prepareBouncyCastleProvider(BuildProducer<ReflectiveClassBui
reflection.produce(new ReflectiveClassBuildItem(true, true,
isFipsMode ? SecurityProviderUtils.BOUNCYCASTLE_FIPS_PROVIDER_CLASS_NAME
: SecurityProviderUtils.BOUNCYCASTLE_PROVIDER_CLASS_NAME));
+ reflection.produce(new ReflectiveClassBuildItem(true, true,
+ "org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi"));
+ reflection.produce(new ReflectiveClassBuildItem(true, true,
+ "org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$EC"));
+ reflection.produce(new ReflectiveClassBuildItem(true, true,
+ "org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyPairGeneratorSpi"));
reflection.produce(new ReflectiveClassBuildItem(true, true,
"org.bouncycastle.jcajce.provider.asymmetric.rsa.PSSSignatureSpi"));
reflection.produce(new ReflectiveClassBuildItem(true, true,
diff --git a/integration-tests/bouncycastle/src/main/java/io/quarkus/it/bouncycastle/BouncyCastleEndpoint.java b/integration-tests/bouncycastle/src/main/java/io/quarkus/it/bouncycastle/BouncyCastleEndpoint.java
index 153318831b2..b2b2bd35649 100644
--- a/integration-tests/bouncycastle/src/main/java/io/quarkus/it/bouncycastle/BouncyCastleEndpoint.java
+++ b/integration-tests/bouncycastle/src/main/java/io/quarkus/it/bouncycastle/BouncyCastleEndpoint.java
@@ -1,5 +1,6 @@
package io.quarkus.it.bouncycastle;
+import java.security.KeyPairGenerator;
import java.security.Security;
import java.security.Signature;
import java.util.Arrays;
@@ -26,4 +27,20 @@ public String checkSHA256withRSAandMGF1() throws Exception {
Signature.getInstance("SHA256withRSAandMGF1", "BC");
return "success";
}
+
+ @GET
+ @Path("generateEcKeyPair")
+ public String generateEcKeyPair() throws Exception {
+ KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC", "BC");
+ keyPairGenerator.generateKeyPair();
+ return "success";
+ }
+
+ @GET
+ @Path("generateRsaKeyPair")
+ public String generateRsaKeyPair() throws Exception {
+ KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA", "BC");
+ keyPairGenerator.generateKeyPair();
+ return "success";
+ }
}
diff --git a/integration-tests/bouncycastle/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleTestCase.java b/integration-tests/bouncycastle/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleTestCase.java
index 0f94b08af0e..6cdf2a18795 100644
--- a/integration-tests/bouncycastle/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleTestCase.java
+++ b/integration-tests/bouncycastle/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleTestCase.java
@@ -30,4 +30,24 @@ public void testSHA256withRSAandMGF1() {
.body(equalTo("success"));
}
+ @Test
+ public void testGenerateEcKeyPair() {
+ RestAssured.given()
+ .when()
+ .get("/jca/generateEcKeyPair")
+ .then()
+ .statusCode(200)
+ .body(equalTo("success"));
+ }
+
+ @Test
+ public void testGenerateRsaKeyPair() {
+ RestAssured.given()
+ .when()
+ .get("/jca/generateRsaKeyPair")
+ .then()
+ .statusCode(200)
+ .body(equalTo("success"));
+ }
+
} | ['extensions/security/deployment/src/main/java/io/quarkus/security/deployment/SecurityProcessor.java', 'integration-tests/bouncycastle/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleTestCase.java', 'integration-tests/bouncycastle/src/main/java/io/quarkus/it/bouncycastle/BouncyCastleEndpoint.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 17,917,989 | 3,483,661 | 459,382 | 4,761 | 477 | 102 | 6 | 1 | 6,783 | 316 | 1,647 | 122 | 1 | 2 | 2021-08-23T12:48:07 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,669 | quarkusio/quarkus/19523/19519 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19519 | https://github.com/quarkusio/quarkus/pull/19523 | https://github.com/quarkusio/quarkus/pull/19523 | 1 | fixes | BlockingOperationNotAllowedException is thrown when access database with panache in TenantConfigResolver | ### Describe the bug
The tenant configs are saved in database which will be loaded dynamically with `Panache` by `TenantConfigResolver`, but `resolve` is running in `IO thread` and `EntityManager` of `Panache` is expected to run in `worker thread` to not block the `IO` one. Thus the `BlockingOperationNotAllowedException` is thrown. Here is the stacktrace:
```
ERROR [io.ver.ext.web.RoutingContext] (vert.x-eventloop-thread-5) Unhandled exception in router: io.quarkus.runtime.BlockingOperationNotAllowedException: You have attempted to perform a blocking operation on a IO thread. This is not allowed, as blocking the IO thread will cause major performance issues with your application. If you want to perform blocking EntityManager operations make sure you are doing it from a worker thread.
at io.quarkus.hibernate.orm.runtime.session.TransactionScopedSession.checkBlocking(TransactionScopedSession.java:111)
at io.quarkus.hibernate.orm.runtime.session.TransactionScopedSession.createQuery(TransactionScopedSession.java:342)
at io.quarkus.hibernate.orm.runtime.session.ForwardingSession.createQuery(ForwardingSession.java:168)
at io.quarkus.hibernate.orm.runtime.session.ForwardingSession.createQuery(ForwardingSession.java:47)
at org.hibernate.Session_5b93bee577ae2f8d76647de04cfab36afbf52958_Synthetic_ClientProxy.createQuery(Session_5b93bee577ae2f8d76647de04cfab36afbf52958_Synthetic_ClientProxy.zig:1916)
at io.quarkus.hibernate.orm.panache.common.runtime.CommonPanacheQueryImpl.createBaseQuery(CommonPanacheQueryImpl.java:339)
at io.quarkus.hibernate.orm.panache.common.runtime.CommonPanacheQueryImpl.createQuery(CommonPanacheQueryImpl.java:315)
at io.quarkus.hibernate.orm.panache.common.runtime.CommonPanacheQueryImpl.firstResult(CommonPanacheQueryImpl.java:260)
at io.quarkus.hibernate.orm.panache.kotlin.runtime.PanacheQueryImpl.firstResult(PanacheQueryImpl.kt:117)
at ai.bidwise.backend.account.repository.TenantConfigRepositoryImpl.findByTenant(TenantConfigRepository.kt:17)
at ai.bidwise.backend.account.repository.TenantConfigRepositoryImpl_Subclass.findByTenant$$superforward1(TenantConfigRepositoryImpl_Subclass.zig:1635)
at ai.bidwise.backend.account.repository.TenantConfigRepositoryImpl_Subclass$$function$$53.apply(TenantConfigRepositoryImpl_Subclass$$function$$53.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at ai.bidwise.backend.account.repository.TenantConfigRepositoryImpl_Subclass.findByTenant(TenantConfigRepositoryImpl_Subclass.zig:2667)
at ai.bidwise.backend.account.repository.TenantConfigRepositoryImpl_ClientProxy.findByTenant(TenantConfigRepositoryImpl_ClientProxy.zig:1863)
at ai.bidwise.backend.account.resolver.MultiTenantConfigResolver.resolve(MultiTenantConfigResolver.kt:39)
at ai.bidwise.backend.account.resolver.MultiTenantConfigResolver_Subclass.resolve$$superforward1(MultiTenantConfigResolver_Subclass.zig:254)
at ai.bidwise.backend.account.resolver.MultiTenantConfigResolver_Subclass$$function$$9.apply(MultiTenantConfigResolver_Subclass$$function$$9.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at ai.bidwise.backend.account.resolver.MultiTenantConfigResolver_Subclass.resolve(MultiTenantConfigResolver_Subclass.zig:531)
at ai.bidwise.backend.account.resolver.MultiTenantConfigResolver_ClientProxy.resolve(MultiTenantConfigResolver_ClientProxy.zig:248)
at io.quarkus.oidc.runtime.DefaultTenantConfigResolver.getDynamicTenantConfig(DefaultTenantConfigResolver.java:147)
at io.quarkus.oidc.runtime.DefaultTenantConfigResolver.resolveConfig(DefaultTenantConfigResolver.java:65)
at io.quarkus.oidc.runtime.DefaultTenantConfigResolver_Subclass.resolveConfig$$superforward1(DefaultTenantConfigResolver_Subclass.zig:400)
at io.quarkus.oidc.runtime.DefaultTenantConfigResolver_Subclass$$function$$4.apply(DefaultTenantConfigResolver_Subclass$$function$$4.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at io.quarkus.oidc.runtime.DefaultTenantConfigResolver_Subclass.resolveConfig(DefaultTenantConfigResolver_Subclass.zig:830)
at io.quarkus.oidc.runtime.DefaultTenantConfigResolver_ClientProxy.resolveConfig(DefaultTenantConfigResolver_ClientProxy.zig:304)
at io.quarkus.oidc.runtime.OidcAuthenticationMechanism.resolve(OidcAuthenticationMechanism.java:59)
at io.quarkus.oidc.runtime.OidcAuthenticationMechanism.authenticate(OidcAuthenticationMechanism.java:40)
at io.quarkus.oidc.runtime.OidcAuthenticationMechanism_Subclass.authenticate$$superforward1(OidcAuthenticationMechanism_Subclass.zig:334)
at io.quarkus.oidc.runtime.OidcAuthenticationMechanism_Subclass$$function$$4.apply(OidcAuthenticationMechanism_Subclass$$function$$4.zig:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at io.quarkus.oidc.runtime.OidcAuthenticationMechanism_Subclass.authenticate(OidcAuthenticationMechanism_Subclass.zig:738)
at io.quarkus.oidc.runtime.OidcAuthenticationMechanism_ClientProxy.authenticate(OidcAuthenticationMechanism_ClientProxy.zig:249)
at io.quarkus.vertx.http.runtime.security.HttpAuthenticator.attemptAuthentication(HttpAuthenticator.java:109)
at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_Subclass.attemptAuthentication$$superforward1(HttpAuthenticator_Subclass.zig:241)
at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_Subclass$$function$$3.apply(HttpAuthenticator_Subclass$$function$$3.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.monitor(InvocationInterceptor.java:51)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor_Bean.intercept(InvocationInterceptor_Bean.zig:521)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_Subclass.attemptAuthentication(HttpAuthenticator_Subclass.zig:517)
at io.quarkus.vertx.http.runtime.security.HttpAuthenticator_ClientProxy.attemptAuthentication(HttpAuthenticator_ClientProxy.zig:186)
at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:101)
at io.quarkus.vertx.http.runtime.security.HttpSecurityRecorder$2.handle(HttpSecurityRecorder.java:51)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup.handleHotReplacementRequest(VertxHttpHotReplacementSetup.java:49)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$5.handle(VertxHttpRecorder.java:350)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$5.handle(VertxHttpRecorder.java:346)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1127)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:151)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:133)
at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:55)
at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:37)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$9.handle(VertxHttpRecorder.java:428)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$9.handle(VertxHttpRecorder.java:425)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$1.handle(VertxHttpRecorder.java:150)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$1.handle(VertxHttpRecorder.java:132)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$3.handle(VertxHttpHotReplacementSetup.java:86)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$3.handle(VertxHttpHotReplacementSetup.java:77)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:124)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:834)
```
### Expected behavior
Reading tenant configs from database should work in `TenantConfigResolver`.
### Actual behavior
`BlockingOperationNotAllowedException` is thrown when access database with panache in `TenantConfigResolver`
### How to Reproduce?
https://github.com/quarkusio/quarkus-quickstarts/tree/main/security-openid-connect-multi-tenancy-quickstart
1. try to read the config from database.
### Output of `uname -a` or `ver`
Darwin C02T81GVG8WL 19.6.0 Darwin Kernel Version 19.6.0: Tue Jun 22 19:49:55 PDT 2021; root:xnu-6153.141.35~1/RELEASE_X86_64 x86_64
### Output of `java -version`
openjdk version "11.0.9.1" 2020-11-04 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9.1+1) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
------------------------------------------------------------ Gradle 6.9 ------------------------------------------------------------ Build time: 2021-05-07 07:28:53 UTC Revision: afe2e24ababc7b0213ccffff44970aa18035fc0e Kotlin: 1.4.20 Groovy: 2.5.12 Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020 JVM: 11.0.9.1 (AdoptOpenJDK 11.0.9.1+1) OS: Mac OS X 10.15.7 x86_64
### Additional information
I think we should change `resolve` method to return `Uni<OidcTenantConfig>` to support this feature. | 8445d007174e8882d385a74c26929549a2b724c9 | 02b4a5e1d7a239f0a27059e648668312c2405d42 | https://github.com/quarkusio/quarkus/compare/8445d007174e8882d385a74c26929549a2b724c9...02b4a5e1d7a239f0a27059e648668312c2405d42 | diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/TenantConfigResolver.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/TenantConfigResolver.java
index 06d81b2106f..c0f9143cef2 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/TenantConfigResolver.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/TenantConfigResolver.java
@@ -1,5 +1,8 @@
package io.quarkus.oidc;
+import java.util.function.Supplier;
+
+import io.smallrye.mutiny.Uni;
import io.vertx.ext.web.RoutingContext;
/**
@@ -19,5 +22,32 @@ public interface TenantConfigResolver {
* @param context the routing context
* @return the tenant configuration. If {@code null}, indicates that the default configuration/tenant should be chosen
*/
- OidcTenantConfig resolve(RoutingContext context);
+ @Deprecated
+ default OidcTenantConfig resolve(RoutingContext context) {
+ throw new UnsupportedOperationException("resolve not implemented");
+ }
+
+ /**
+ * Returns a {@link OidcTenantConfig} given a {@code RoutingContext}.
+ *
+ * @param requestContext the routing context
+ * @return the tenant configuration. If the uni resolves to {@code null}, indicates that the default configuration/tenant
+ * should be chosen
+ */
+ default Uni<OidcTenantConfig> resolve(RoutingContext routingContext, TenantConfigRequestContext requestContext) {
+ return Uni.createFrom().item(resolve(routingContext));
+ }
+
+ /**
+ * A context object that can be used to run blocking tasks
+ * <p>
+ * Blocking config providers should used this context object to run blocking tasks, to prevent excessive and
+ * unnecessary delegation to thread pools
+ */
+ interface TenantConfigRequestContext {
+
+ Uni<OidcTenantConfig> runBlocking(Supplier<OidcTenantConfig> function);
+
+ }
+
}
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java
index 3cce7802ed7..b823072f937 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java
@@ -1,5 +1,7 @@
package io.quarkus.oidc.runtime;
+import java.util.function.Function;
+
import io.netty.handler.codec.http.HttpHeaderNames;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.quarkus.oidc.AccessTokenCredential;
@@ -20,13 +22,17 @@ public class BearerAuthenticationMechanism extends AbstractOidcAuthenticationMec
public Uni<SecurityIdentity> authenticate(RoutingContext context,
IdentityProviderManager identityProviderManager) {
- String token = extractBearerToken(context, resolver.resolveConfig(context));
-
- // if a bearer token is provided try to authenticate
- if (token != null) {
- return authenticate(identityProviderManager, context, new AccessTokenCredential(token, context));
- }
- return Uni.createFrom().nullItem();
+ return resolver.resolveConfig(context).chain(new Function<OidcTenantConfig, Uni<? extends SecurityIdentity>>() {
+ @Override
+ public Uni<? extends SecurityIdentity> apply(OidcTenantConfig oidcTenantConfig) {
+ String token = extractBearerToken(context, oidcTenantConfig);
+ // if a bearer token is provided try to authenticate
+ if (token != null) {
+ return authenticate(identityProviderManager, context, new AccessTokenCredential(token, context));
+ }
+ return Uni.createFrom().nullItem();
+ }
+ });
}
public Uni<ChallengeData> getChallenge(RoutingContext context) {
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java
index 31fa15fbf75..0e6b4911dba 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java
@@ -80,32 +80,38 @@ public Uni<Boolean> apply(Permission permission) {
public Uni<SecurityIdentity> authenticate(RoutingContext context,
IdentityProviderManager identityProviderManager) {
+ return resolver.resolveConfig(context).chain(new Function<OidcTenantConfig, Uni<? extends SecurityIdentity>>() {
+ @Override
+ public Uni<? extends SecurityIdentity> apply(OidcTenantConfig oidcTenantConfig) {
+
+ final Cookie sessionCookie = context.request().getCookie(getSessionCookieName(oidcTenantConfig));
+
+ // if session already established, try to re-authenticate
+ if (sessionCookie != null) {
+ Uni<TenantConfigContext> resolvedContext = resolver.resolveContext(context);
+ return resolvedContext.onItem()
+ .transformToUni(new Function<TenantConfigContext, Uni<? extends SecurityIdentity>>() {
+ @Override
+ public Uni<SecurityIdentity> apply(TenantConfigContext tenantContext) {
+ return reAuthenticate(sessionCookie, context, identityProviderManager, tenantContext);
+ }
+ });
+ }
- final Cookie sessionCookie = context.request().getCookie(getSessionCookieName(resolver.resolveConfig(context)));
-
- // if session already established, try to re-authenticate
- if (sessionCookie != null) {
- Uni<TenantConfigContext> resolvedContext = resolver.resolveContext(context);
- return resolvedContext.onItem()
- .transformToUni(new Function<TenantConfigContext, Uni<? extends SecurityIdentity>>() {
- @Override
- public Uni<SecurityIdentity> apply(TenantConfigContext tenantContext) {
- return reAuthenticate(sessionCookie, context, identityProviderManager, tenantContext);
- }
- });
- }
-
- final String code = context.request().getParam("code");
- if (code == null) {
- return Uni.createFrom().optional(Optional.empty());
- }
+ final String code = context.request().getParam("code");
+ if (code == null) {
+ return Uni.createFrom().optional(Optional.empty());
+ }
- // start a new session by starting the code flow dance
- Uni<TenantConfigContext> resolvedContext = resolver.resolveContext(context);
- return resolvedContext.onItem().transformToUni(new Function<TenantConfigContext, Uni<? extends SecurityIdentity>>() {
- @Override
- public Uni<SecurityIdentity> apply(TenantConfigContext tenantContext) {
- return performCodeFlow(identityProviderManager, context, tenantContext, code);
+ // start a new session by starting the code flow dance
+ Uni<TenantConfigContext> resolvedContext = resolver.resolveContext(context);
+ return resolvedContext.onItem()
+ .transformToUni(new Function<TenantConfigContext, Uni<? extends SecurityIdentity>>() {
+ @Override
+ public Uni<SecurityIdentity> apply(TenantConfigContext tenantContext) {
+ return performCodeFlow(identityProviderManager, context, tenantContext, code);
+ }
+ });
}
});
}
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/DefaultTenantConfigResolver.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/DefaultTenantConfigResolver.java
index 63b944d558f..660b05aa28b 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/DefaultTenantConfigResolver.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/DefaultTenantConfigResolver.java
@@ -1,5 +1,9 @@
package io.quarkus.oidc.runtime;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.event.Event;
@@ -15,7 +19,10 @@
import io.quarkus.oidc.TenantConfigResolver;
import io.quarkus.oidc.TenantResolver;
import io.quarkus.oidc.TokenStateManager;
+import io.quarkus.runtime.BlockingOperationControl;
+import io.quarkus.runtime.ExecutorRecorder;
import io.smallrye.mutiny.Uni;
+import io.smallrye.mutiny.subscription.UniEmitter;
import io.vertx.ext.web.RoutingContext;
@ApplicationScoped
@@ -25,7 +32,6 @@ public class DefaultTenantConfigResolver {
private static final String CURRENT_STATIC_TENANT_ID = "static.tenant.id";
private static final String CURRENT_STATIC_TENANT_ID_NULL = "static.tenant.id.null";
private static final String CURRENT_DYNAMIC_TENANT_CONFIG = "dynamic.tenant.config";
- private static final String CURRENT_DYNAMIC_TENANT_CONFIG_NULL = "dynamic.tenant.config.null";
@Inject
Instance<TenantResolver> tenantResolver;
@@ -46,6 +52,42 @@ public class DefaultTenantConfigResolver {
@ConfigProperty(name = "quarkus.http.proxy.enable-forwarded-prefix")
boolean enableHttpForwardedPrefix;
+ private final TenantConfigResolver.TenantConfigRequestContext blockingRequestContext = new TenantConfigResolver.TenantConfigRequestContext() {
+ @Override
+ public Uni<OidcTenantConfig> runBlocking(Supplier<OidcTenantConfig> function) {
+ return Uni.createFrom().deferred(new Supplier<Uni<? extends OidcTenantConfig>>() {
+ @Override
+ public Uni<OidcTenantConfig> get() {
+ if (BlockingOperationControl.isBlockingAllowed()) {
+ try {
+ OidcTenantConfig result = function.get();
+ return Uni.createFrom().item(result);
+ } catch (Throwable t) {
+ return Uni.createFrom().failure(t);
+ }
+ } else {
+ return Uni.createFrom().emitter(new Consumer<UniEmitter<? super OidcTenantConfig>>() {
+ @Override
+ public void accept(UniEmitter<? super OidcTenantConfig> uniEmitter) {
+ ExecutorRecorder.getCurrent().execute(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ uniEmitter.complete(function.get());
+ } catch (Throwable t) {
+ uniEmitter.fail(t);
+ }
+ }
+ });
+ }
+ });
+ }
+ }
+ });
+ }
+
+ };
+
private volatile boolean securityEventObserved;
@PostConstruct
@@ -61,38 +103,47 @@ public void verifyResolvers() {
}
}
- OidcTenantConfig resolveConfig(RoutingContext context) {
- OidcTenantConfig tenantConfig = getDynamicTenantConfig(context);
- if (tenantConfig == null) {
- TenantConfigContext tenant = getStaticTenantContext(context);
- if (tenant != null) {
- tenantConfig = tenant.oidcConfig;
- }
- }
- return tenantConfig;
+ Uni<OidcTenantConfig> resolveConfig(RoutingContext context) {
+ return getDynamicTenantConfig(context)
+ .map(new Function<OidcTenantConfig, OidcTenantConfig>() {
+ @Override
+ public OidcTenantConfig apply(OidcTenantConfig tenantConfig) {
+ if (tenantConfig == null) {
+ TenantConfigContext tenant = getStaticTenantContext(context);
+ if (tenant != null) {
+ tenantConfig = tenant.oidcConfig;
+ }
+ }
+ return tenantConfig;
+ }
+ });
}
Uni<TenantConfigContext> resolveContext(RoutingContext context) {
- Uni<TenantConfigContext> uniTenantContext = getDynamicTenantContext(context);
- if (uniTenantContext != null) {
- return uniTenantContext;
- }
- TenantConfigContext tenantContext = getStaticTenantContext(context);
- if (tenantContext != null && !tenantContext.ready) {
-
- // check if it the connection has already been created
- TenantConfigContext readyTenantContext = tenantConfigBean.getDynamicTenantsConfig()
- .get(tenantContext.oidcConfig.tenantId.get());
- if (readyTenantContext == null) {
- LOG.debugf("Tenant '%s' is not initialized yet, trying to create OIDC connection now",
- tenantContext.oidcConfig.tenantId.get());
- return tenantConfigBean.getTenantConfigContextFactory().apply(tenantContext.oidcConfig);
- } else {
- tenantContext = readyTenantContext;
- }
- }
+ return getDynamicTenantContext(context).chain(new Function<TenantConfigContext, Uni<? extends TenantConfigContext>>() {
+ @Override
+ public Uni<? extends TenantConfigContext> apply(TenantConfigContext tenantConfigContext) {
+ if (tenantConfigContext != null) {
+ return Uni.createFrom().item(tenantConfigContext);
+ }
+ TenantConfigContext tenantContext = getStaticTenantContext(context);
+ if (tenantContext != null && !tenantContext.ready) {
+
+ // check if it the connection has already been created
+ TenantConfigContext readyTenantContext = tenantConfigBean.getDynamicTenantsConfig()
+ .get(tenantContext.oidcConfig.tenantId.get());
+ if (readyTenantContext == null) {
+ LOG.debugf("Tenant '%s' is not initialized yet, trying to create OIDC connection now",
+ tenantContext.oidcConfig.tenantId.get());
+ return tenantConfigBean.getTenantConfigContextFactory().apply(tenantContext.oidcConfig);
+ } else {
+ tenantContext = readyTenantContext;
+ }
+ }
- return Uni.createFrom().item(tenantContext);
+ return Uni.createFrom().item(tenantContext);
+ }
+ });
}
private TenantConfigContext getStaticTenantContext(RoutingContext context) {
@@ -139,38 +190,40 @@ TokenStateManager getTokenStateManager() {
return tokenStateManager.get();
}
- private OidcTenantConfig getDynamicTenantConfig(RoutingContext context) {
- OidcTenantConfig oidcConfig = null;
+ private Uni<OidcTenantConfig> getDynamicTenantConfig(RoutingContext context) {
if (tenantConfigResolver.isResolvable()) {
- oidcConfig = context.get(CURRENT_DYNAMIC_TENANT_CONFIG);
- if (oidcConfig == null && context.get(CURRENT_DYNAMIC_TENANT_CONFIG_NULL) == null) {
- oidcConfig = tenantConfigResolver.get().resolve(context);
- if (oidcConfig != null) {
- context.put(CURRENT_DYNAMIC_TENANT_CONFIG, oidcConfig);
- } else {
- context.put(CURRENT_DYNAMIC_TENANT_CONFIG_NULL, true);
+ Uni<OidcTenantConfig> oidcConfig = context.get(CURRENT_DYNAMIC_TENANT_CONFIG);
+ if (oidcConfig == null) {
+ oidcConfig = tenantConfigResolver.get().resolve(context, blockingRequestContext).memoize().indefinitely();
+ if (oidcConfig == null) {
+ //shouldn't happen, but guard against it anyway
+ oidcConfig = Uni.createFrom().nullItem();
}
+ context.put(CURRENT_DYNAMIC_TENANT_CONFIG, oidcConfig);
}
+ return oidcConfig;
}
- return oidcConfig;
+ return Uni.createFrom().nullItem();
}
private Uni<TenantConfigContext> getDynamicTenantContext(RoutingContext context) {
- OidcTenantConfig tenantConfig = getDynamicTenantConfig(context);
- if (tenantConfig != null) {
- String tenantId = tenantConfig.getTenantId()
- .orElseThrow(() -> new OIDCException("Tenant configuration must have tenant id"));
- TenantConfigContext tenantContext = tenantConfigBean.getDynamicTenantsConfig().get(tenantId);
-
- if (tenantContext == null) {
- return tenantConfigBean.getTenantConfigContextFactory().apply(tenantConfig);
- } else {
- return Uni.createFrom().item(tenantContext);
+ return getDynamicTenantConfig(context).chain(new Function<OidcTenantConfig, Uni<? extends TenantConfigContext>>() {
+ @Override
+ public Uni<? extends TenantConfigContext> apply(OidcTenantConfig tenantConfig) {
+ if (tenantConfig != null) {
+ String tenantId = tenantConfig.getTenantId()
+ .orElseThrow(() -> new OIDCException("Tenant configuration must have tenant id"));
+ TenantConfigContext tenantContext = tenantConfigBean.getDynamicTenantsConfig().get(tenantId);
+ if (tenantContext == null) {
+ return tenantConfigBean.getTenantConfigContextFactory().apply(tenantConfig);
+ } else {
+ return Uni.createFrom().item(tenantContext);
+ }
+ }
+ return Uni.createFrom().nullItem();
}
- }
-
- return null;
+ });
}
boolean isEnableHttpForwardedPrefix() {
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java
index 1fdcbe9a246..78e90f34909 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java
@@ -2,6 +2,7 @@
import java.util.Collections;
import java.util.Set;
+import java.util.function.Function;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
@@ -38,30 +39,42 @@ public void init() {
@Override
public Uni<SecurityIdentity> authenticate(RoutingContext context,
IdentityProviderManager identityProviderManager) {
- OidcTenantConfig oidcConfig = resolve(context);
- if (oidcConfig.tenantEnabled == false) {
- return Uni.createFrom().nullItem();
- }
- return isWebApp(context, oidcConfig) ? codeAuth.authenticate(context, identityProviderManager)
- : bearerAuth.authenticate(context, identityProviderManager);
+ return resolve(context).chain(new Function<OidcTenantConfig, Uni<? extends SecurityIdentity>>() {
+ @Override
+ public Uni<? extends SecurityIdentity> apply(OidcTenantConfig oidcConfig) {
+ if (!oidcConfig.tenantEnabled) {
+ return Uni.createFrom().nullItem();
+ }
+ return isWebApp(context, oidcConfig) ? codeAuth.authenticate(context, identityProviderManager)
+ : bearerAuth.authenticate(context, identityProviderManager);
+ }
+ });
}
@Override
public Uni<ChallengeData> getChallenge(RoutingContext context) {
- OidcTenantConfig oidcConfig = resolve(context);
- if (oidcConfig.tenantEnabled == false) {
- return Uni.createFrom().nullItem();
- }
- return isWebApp(context, oidcConfig) ? codeAuth.getChallenge(context)
- : bearerAuth.getChallenge(context);
+ return resolve(context).chain(new Function<OidcTenantConfig, Uni<? extends ChallengeData>>() {
+ @Override
+ public Uni<? extends ChallengeData> apply(OidcTenantConfig oidcTenantConfig) {
+ if (!oidcTenantConfig.tenantEnabled) {
+ return Uni.createFrom().nullItem();
+ }
+ return isWebApp(context, oidcTenantConfig) ? codeAuth.getChallenge(context)
+ : bearerAuth.getChallenge(context);
+ }
+ });
}
- private OidcTenantConfig resolve(RoutingContext context) {
- OidcTenantConfig oidcConfig = resolver.resolveConfig(context);
- if (oidcConfig == null) {
- throw new OIDCException("Tenant configuration has not been resolved");
- }
- return oidcConfig;
+ private Uni<OidcTenantConfig> resolve(RoutingContext context) {
+ return resolver.resolveConfig(context).map(new Function<OidcTenantConfig, OidcTenantConfig>() {
+ @Override
+ public OidcTenantConfig apply(OidcTenantConfig oidcTenantConfig) {
+ if (oidcTenantConfig == null) {
+ throw new OIDCException("Tenant configuration has not been resolved");
+ }
+ return oidcTenantConfig;
+ };
+ });
}
private boolean isWebApp(RoutingContext context, OidcTenantConfig oidcConfig) {
diff --git a/integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/CustomTenantConfigResolver.java b/integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/CustomTenantConfigResolver.java
index b121053fdee..46719187af0 100644
--- a/integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/CustomTenantConfigResolver.java
+++ b/integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/CustomTenantConfigResolver.java
@@ -1,94 +1,104 @@
package io.quarkus.it.keycloak;
+import java.util.function.Supplier;
+
import javax.enterprise.context.ApplicationScoped;
import io.quarkus.oidc.OidcTenantConfig;
import io.quarkus.oidc.OidcTenantConfig.ApplicationType;
import io.quarkus.oidc.OidcTenantConfig.Roles.Source;
import io.quarkus.oidc.TenantConfigResolver;
+import io.smallrye.mutiny.Uni;
import io.vertx.ext.web.RoutingContext;
@ApplicationScoped
public class CustomTenantConfigResolver implements TenantConfigResolver {
+
@Override
- public OidcTenantConfig resolve(RoutingContext context) {
- // Make sure this resolver is called only once during a given request
- if (context.get("dynamic_config_resolved") != null) {
- throw new RuntimeException();
- }
- context.put("dynamic_config_resolved", "true");
+ public Uni<OidcTenantConfig> resolve(RoutingContext context, TenantConfigRequestContext requestContext) {
+ return requestContext.runBlocking(new Supplier<OidcTenantConfig>() {
+ @Override
+ public OidcTenantConfig get() {
+
+ // Make sure this resolver is called only once during a given request
+ if (context.get("dynamic_config_resolved") != null) {
+ throw new RuntimeException();
+ }
+ context.put("dynamic_config_resolved", "true");
- String path = context.request().path();
- String tenantId = path.split("/")[2];
- if ("tenant-d".equals(tenantId)) {
- OidcTenantConfig config = new OidcTenantConfig();
- config.setTenantId("tenant-d");
- config.setAuthServerUrl(getIssuerUrl() + "/realms/quarkus-d");
- config.setClientId("quarkus-d");
- config.getCredentials().setSecret("secret");
- config.getToken().setIssuer(getIssuerUrl() + "/realms/quarkus-d");
- config.getAuthentication().setUserInfoRequired(true);
- return config;
- } else if ("tenant-oidc".equals(tenantId)) {
- OidcTenantConfig config = new OidcTenantConfig();
- config.setTenantId("tenant-oidc");
- String uri = context.request().absoluteURI();
- String authServerUri = path.contains("tenant-opaque")
- ? uri.replace("/tenant-opaque/tenant-oidc/api/user", "/oidc")
- : uri.replace("/tenant/tenant-oidc/api/user", "/oidc");
- config.setAuthServerUrl(authServerUri);
- config.setClientId("client");
- return config;
- } else if ("tenant-oidc-no-discovery".equals(tenantId)) {
- OidcTenantConfig config = new OidcTenantConfig();
- config.setTenantId("tenant-oidc-no-discovery");
- String uri = context.request().absoluteURI();
- String authServerUri = uri.replace("/tenant/tenant-oidc-no-discovery/api/user", "/oidc");
- config.setAuthServerUrl(authServerUri);
- config.setDiscoveryEnabled(false);
- config.setJwksPath("jwks");
- config.setClientId("client");
- return config;
- } else if ("tenant-oidc-no-introspection".equals(tenantId)) {
- OidcTenantConfig config = new OidcTenantConfig();
- config.setTenantId("tenant-oidc-no-introspection");
- String uri = context.request().absoluteURI();
- String authServerUri = uri.replace("/tenant/tenant-oidc-no-introspection/api/user", "/oidc");
- config.setAuthServerUrl(authServerUri);
- config.token.setAllowJwtIntrospection(false);
- config.setClientId("client");
- return config;
- } else if ("tenant-oidc-introspection-only".equals(tenantId)) {
- OidcTenantConfig config = new OidcTenantConfig();
- config.setTenantId("tenant-oidc-introspection-only");
- String uri = context.request().absoluteURI();
- String authServerUri = uri.replace("/tenant/tenant-oidc-introspection-only/api/user", "/oidc");
- config.setAuthServerUrl(authServerUri);
- config.setDiscoveryEnabled(false);
- config.setIntrospectionPath("introspect");
- config.setClientId("client");
- return config;
- } else if ("tenant-oidc-no-opaque-token".equals(tenantId)) {
- OidcTenantConfig config = new OidcTenantConfig();
- config.setTenantId("tenant-oidc-no-opaque-token");
- String uri = context.request().absoluteURI();
- String authServerUri = uri.replace("/tenant-opaque/tenant-oidc-no-opaque-token/api/user", "/oidc");
- config.setAuthServerUrl(authServerUri);
- config.token.setAllowOpaqueTokenIntrospection(false);
- config.setClientId("client");
- return config;
- } else if ("tenant-web-app-dynamic".equals(tenantId)) {
- OidcTenantConfig config = new OidcTenantConfig();
- config.setTenantId("tenant-web-app-dynamic");
- config.setAuthServerUrl(getIssuerUrl() + "/realms/quarkus-webapp");
- config.setClientId("quarkus-app-webapp");
- config.getCredentials().setSecret("secret");
- config.getAuthentication().setUserInfoRequired(true);
- config.getRoles().setSource(Source.userinfo);
- config.setApplicationType(ApplicationType.WEB_APP);
- return config;
- }
- return null;
+ String path = context.request().path();
+ String tenantId = path.split("/")[2];
+ if ("tenant-d".equals(tenantId)) {
+ OidcTenantConfig config = new OidcTenantConfig();
+ config.setTenantId("tenant-d");
+ config.setAuthServerUrl(getIssuerUrl() + "/realms/quarkus-d");
+ config.setClientId("quarkus-d");
+ config.getCredentials().setSecret("secret");
+ config.getToken().setIssuer(getIssuerUrl() + "/realms/quarkus-d");
+ config.getAuthentication().setUserInfoRequired(true);
+ return config;
+ } else if ("tenant-oidc".equals(tenantId)) {
+ OidcTenantConfig config = new OidcTenantConfig();
+ config.setTenantId("tenant-oidc");
+ String uri = context.request().absoluteURI();
+ String authServerUri = path.contains("tenant-opaque")
+ ? uri.replace("/tenant-opaque/tenant-oidc/api/user", "/oidc")
+ : uri.replace("/tenant/tenant-oidc/api/user", "/oidc");
+ config.setAuthServerUrl(authServerUri);
+ config.setClientId("client");
+ return config;
+ } else if ("tenant-oidc-no-discovery".equals(tenantId)) {
+ OidcTenantConfig config = new OidcTenantConfig();
+ config.setTenantId("tenant-oidc-no-discovery");
+ String uri = context.request().absoluteURI();
+ String authServerUri = uri.replace("/tenant/tenant-oidc-no-discovery/api/user", "/oidc");
+ config.setAuthServerUrl(authServerUri);
+ config.setDiscoveryEnabled(false);
+ config.setJwksPath("jwks");
+ config.setClientId("client");
+ return config;
+ } else if ("tenant-oidc-no-introspection".equals(tenantId)) {
+ OidcTenantConfig config = new OidcTenantConfig();
+ config.setTenantId("tenant-oidc-no-introspection");
+ String uri = context.request().absoluteURI();
+ String authServerUri = uri.replace("/tenant/tenant-oidc-no-introspection/api/user", "/oidc");
+ config.setAuthServerUrl(authServerUri);
+ config.token.setAllowJwtIntrospection(false);
+ config.setClientId("client");
+ return config;
+ } else if ("tenant-oidc-introspection-only".equals(tenantId)) {
+ OidcTenantConfig config = new OidcTenantConfig();
+ config.setTenantId("tenant-oidc-introspection-only");
+ String uri = context.request().absoluteURI();
+ String authServerUri = uri.replace("/tenant/tenant-oidc-introspection-only/api/user", "/oidc");
+ config.setAuthServerUrl(authServerUri);
+ config.setDiscoveryEnabled(false);
+ config.setIntrospectionPath("introspect");
+ config.setClientId("client");
+ return config;
+ } else if ("tenant-oidc-no-opaque-token".equals(tenantId)) {
+ OidcTenantConfig config = new OidcTenantConfig();
+ config.setTenantId("tenant-oidc-no-opaque-token");
+ String uri = context.request().absoluteURI();
+ String authServerUri = uri.replace("/tenant-opaque/tenant-oidc-no-opaque-token/api/user", "/oidc");
+ config.setAuthServerUrl(authServerUri);
+ config.token.setAllowOpaqueTokenIntrospection(false);
+ config.setClientId("client");
+ return config;
+ } else if ("tenant-web-app-dynamic".equals(tenantId)) {
+ OidcTenantConfig config = new OidcTenantConfig();
+ config.setTenantId("tenant-web-app-dynamic");
+ config.setAuthServerUrl(getIssuerUrl() + "/realms/quarkus-webapp");
+ config.setClientId("quarkus-app-webapp");
+ config.getCredentials().setSecret("secret");
+ config.getAuthentication().setUserInfoRequired(true);
+ config.getRoles().setSource(Source.userinfo);
+ config.setApplicationType(ApplicationType.WEB_APP);
+ return config;
+ }
+ return null;
+ }
+ });
}
private String getIssuerUrl() { | ['integration-tests/oidc-tenancy/src/main/java/io/quarkus/it/keycloak/CustomTenantConfigResolver.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/BearerAuthenticationMechanism.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcAuthenticationMechanism.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/TenantConfigResolver.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/DefaultTenantConfigResolver.java'] | {'.java': 6} | 6 | 6 | 0 | 0 | 6 | 17,909,402 | 3,482,131 | 459,201 | 4,760 | 16,760 | 2,959 | 312 | 5 | 12,926 | 471 | 3,043 | 144 | 1 | 1 | 2021-08-20T03:57: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 |
2,670 | quarkusio/quarkus/19522/19509 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19509 | https://github.com/quarkusio/quarkus/pull/19522 | https://github.com/quarkusio/quarkus/pull/19522 | 1 | fixes | Unpredictable "Shutdown in progress" exception for code in dev mode | ### Describe the bug
We found, that sometimes our test runs fail with "java.lang.IllegalStateException: Shutdown in progress" exceptions. It appears randomly([1],[2],[3]) but it looks like more demanding tasks tend to provoke this behaviour more often.
[1] https://github.com/quarkus-qe/quarkus-startstop/pull/102/checks?check_run_id=3220458632
[2] https://github.com/quarkus-qe/quarkus-startstop/runs/3297343795?check_suite_focus=true
[3] https://github.com/quarkus-qe/quarkus-startstop/runs/3206345439?check_suite_focus=true
### Expected behavior
Code finishes successfully of fails predictably.
### Actual behavior
There is an exception, with stacktraces like that:
```
2021-08-02 12:13:05,272 INFO [io.quarkus] (Quarkus Main Thread) code-with-quarkus stopped in 0.007s
Press [space] to restart, [e] to edit command line args (currently ''), [r] to resume testing, [h] for more options>
2021-08-02 12:13:05,298 ERROR [io.qua.boo.cla.QuarkusClassLoader] (Quarkus Shutdown Thread) Failed to run close task: java.lang.IllegalStateException: Shutdown in progress
at java.base/java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82)
at java.base/java.lang.Runtime.removeShutdownHook(Runtime.java:244)
at io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor$2.run(DevServicesDatasourceProcessor.java:169)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.close(QuarkusClassLoader.java:551)
at io.quarkus.bootstrap.app.CuratedApplication.close(CuratedApplication.java:362)
at io.quarkus.deployment.dev.IsolatedDevModeMain.close(IsolatedDevModeMain.java:327)
at io.quarkus.deployment.dev.IsolatedDevModeMain$5.run(IsolatedDevModeMain.java:441)
at java.base/java.lang.Thread.run(Thread.java:829)
Press [space] to restart, [e] to edit command line args (currently ''), [h] for more options>
2021-08-02 12:13:05,299 ERROR [io.qua.boo.cla.QuarkusClassLoader] (Quarkus Shutdown Thread) Failed to run close task: java.lang.IllegalStateException: Shutdown in progress
at java.base/java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82)
at java.base/java.lang.Runtime.removeShutdownHook(Runtime.java:244)
at io.quarkus.mongodb.deployment.DevServicesMongoProcessor$2.run(DevServicesMongoProcessor.java:132)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.close(QuarkusClassLoader.java:551)
at io.quarkus.bootstrap.app.CuratedApplication.close(CuratedApplication.java:362)
at io.quarkus.deployment.dev.IsolatedDevModeMain.close(IsolatedDevModeMain.java:327)
at io.quarkus.deployment.dev.IsolatedDevModeMain$5.run(IsolatedDevModeMain.java:441)
at java.base/java.lang.Thread.run(Thread.java:829)
```
### How to Reproduce?
1) Download examples from code.quarkus.io(the more extensions included, the better)
2) Run mvn quarkus:dev on this code
3) Repeat a lot(this bug cannot be reproduced robustly, probably due to data race)
### Output of `uname -a` or `ver`
ubuntu-20.04
### Output of `java -version`
11.0.11
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1.0.Final, 2.1.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
### Additional information
A look at the offending code gives us some "peculiarities":
1) All shutdown hooks can be registered twice due to race condition.
2) The shutdown task is being added both:
2.1 As a closing task to the parent classloader
2.2 As a shutdown hook to the VM
3) Parent classloader removes the shutdown hook from the VM as a part of it's closing.
According to documentation of the Runtime class, "Once the shutdown sequence has begun it is impossible to register a new shutdown hook or de-register a previously-registered hook. Attempting either of these operations will cause an IllegalStateException to be thrown". Since we observe an IllegalStateException, I assume the situation goes like that:
1) Code registers the shutdown hook for the VM and for the classloader
2) VM's shutdown and close() method of parent classloader happen at the roughly the same time.
3) Classloader stops all databases and tries to remove a shutdown hook from the VM(not exactly in this order, because of peculiarity 1)
4) Since the VM is in the middle of the shutdown process, an attempt to remove the shutdown hook fails.
This code can be found in several files, it looks like it was first introduced into DevServicesDatasourceProcessor and then copied all over the devservices codebase. Affected files:
DevServicesDatasourceProcessor
DevServicesApicurioRegistryProcessor
DevServicesMongoProcessor
KeycloakDevServicesProcessor
DevServicesVaultProcessor
Registration of close task:
- https://github.com/quarkusio/quarkus/blame/main/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java#L163
- https://github.com/quarkusio/quarkus/blame/main/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java#L165
CC @stuartwdouglas | 0fe4312c225d35c0a048986770b0dd31bfb49de6 | b6b1de095314b61273510ad8aae9baecb83eb2df | https://github.com/quarkusio/quarkus/compare/0fe4312c225d35c0a048986770b0dd31bfb49de6...b6b1de095314b61273510ad8aae9baecb83eb2df | diff --git a/extensions/apicurio-registry-avro/deployment/src/main/java/io/quarkus/apicurio/registry/avro/DevServicesApicurioRegistryProcessor.java b/extensions/apicurio-registry-avro/deployment/src/main/java/io/quarkus/apicurio/registry/avro/DevServicesApicurioRegistryProcessor.java
index 5fa11139635..1147572ecc9 100644
--- a/extensions/apicurio-registry-avro/deployment/src/main/java/io/quarkus/apicurio/registry/avro/DevServicesApicurioRegistryProcessor.java
+++ b/extensions/apicurio-registry-avro/deployment/src/main/java/io/quarkus/apicurio/registry/avro/DevServicesApicurioRegistryProcessor.java
@@ -102,14 +102,6 @@ public void run() {
};
QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask);
- Thread closeHookThread = new Thread(closeTask, "Apicurio Registry container shutdown thread");
- Runtime.getRuntime().addShutdownHook(closeHookThread);
- ((QuarkusClassLoader) cl.parent()).addCloseTask(new Runnable() {
- @Override
- public void run() {
- Runtime.getRuntime().removeShutdownHook(closeHookThread);
- }
- });
}
}
diff --git a/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java b/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java
index ca64741b09e..0881c793693 100644
--- a/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java
+++ b/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java
@@ -161,14 +161,6 @@ public void run() {
};
QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask);
- Thread closeHookThread = new Thread(closeTask, "Database shutdown thread");
- Runtime.getRuntime().addShutdownHook(closeHookThread);
- ((QuarkusClassLoader) cl.parent()).addCloseTask(new Runnable() {
- @Override
- public void run() {
- Runtime.getRuntime().removeShutdownHook(closeHookThread);
- }
- });
}
databases = closeableList;
cachedProperties = propertiesMap;
diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/DevServicesKafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/DevServicesKafkaProcessor.java
index 30e46fcd314..34415afe512 100644
--- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/DevServicesKafkaProcessor.java
+++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/DevServicesKafkaProcessor.java
@@ -111,9 +111,6 @@ public DevServicesKafkaBrokerBuildItem startKafkaDevService(
};
QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask);
- Thread closeHookThread = new Thread(closeTask, "Kafka container shutdown thread");
- Runtime.getRuntime().addShutdownHook(closeHookThread);
- ((QuarkusClassLoader) cl.parent()).addCloseTask(() -> Runtime.getRuntime().removeShutdownHook(closeHookThread));
}
cfg = configuration;
diff --git a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/DevServicesMongoProcessor.java b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/DevServicesMongoProcessor.java
index 24b8183673f..1564f2fbbf3 100644
--- a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/DevServicesMongoProcessor.java
+++ b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/DevServicesMongoProcessor.java
@@ -117,14 +117,6 @@ public void run() {
};
QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask);
- Thread closeHookThread = new Thread(closeTask, "Mongo container shutdown thread");
- Runtime.getRuntime().addShutdownHook(closeHookThread);
- ((QuarkusClassLoader) cl.parent()).addCloseTask(new Runnable() {
- @Override
- public void run() {
- Runtime.getRuntime().removeShutdownHook(closeHookThread);
- }
- });
}
closeables = currentCloseables;
capturedProperties = currentCapturedProperties;
diff --git a/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java b/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java
index 3e053fb9290..74791296bc7 100644
--- a/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java
+++ b/extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java
@@ -160,14 +160,6 @@ public void run() {
};
QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask);
- Thread closeHookThread = new Thread(closeTask, "Keycloak container shutdown thread");
- Runtime.getRuntime().addShutdownHook(closeHookThread);
- ((QuarkusClassLoader) cl.parent()).addCloseTask(new Runnable() {
- @Override
- public void run() {
- Runtime.getRuntime().removeShutdownHook(closeHookThread);
- }
- });
}
capturedKeycloakUrl = startResult.url + "/auth";
diff --git a/extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java b/extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java
index 8d55ad11c6e..52a73e09abf 100644
--- a/extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java
+++ b/extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java
@@ -117,9 +117,6 @@ public void startRedisContainers(LaunchModeBuildItem launchMode,
};
QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask);
- Thread closeHookThread = new Thread(closeTask, "Redis container shutdown thread");
- Runtime.getRuntime().addShutdownHook(closeHookThread);
- ((QuarkusClassLoader) cl.parent()).addCloseTask(() -> Runtime.getRuntime().removeShutdownHook(closeHookThread));
}
}
diff --git a/extensions/smallrye-reactive-messaging-amqp/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/amqp/deployment/DevServicesAmqpProcessor.java b/extensions/smallrye-reactive-messaging-amqp/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/amqp/deployment/DevServicesAmqpProcessor.java
index 4dd81decd3c..5031d9c77c8 100644
--- a/extensions/smallrye-reactive-messaging-amqp/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/amqp/deployment/DevServicesAmqpProcessor.java
+++ b/extensions/smallrye-reactive-messaging-amqp/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/amqp/deployment/DevServicesAmqpProcessor.java
@@ -107,9 +107,6 @@ public DevServicesAmqpBrokerBuildItem startAmqpDevService(
};
QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask);
- Thread closeHookThread = new Thread(closeTask, "AMQP container shutdown thread");
- Runtime.getRuntime().addShutdownHook(closeHookThread);
- ((QuarkusClassLoader) cl.parent()).addCloseTask(() -> Runtime.getRuntime().removeShutdownHook(closeHookThread));
}
cfg = configuration;
return artemis;
diff --git a/extensions/vault/deployment/src/main/java/io/quarkus/vault/deployment/DevServicesVaultProcessor.java b/extensions/vault/deployment/src/main/java/io/quarkus/vault/deployment/DevServicesVaultProcessor.java
index a76c25835fe..0d897b7f310 100644
--- a/extensions/vault/deployment/src/main/java/io/quarkus/vault/deployment/DevServicesVaultProcessor.java
+++ b/extensions/vault/deployment/src/main/java/io/quarkus/vault/deployment/DevServicesVaultProcessor.java
@@ -93,14 +93,6 @@ public void run() {
};
QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
((QuarkusClassLoader) cl.parent()).addCloseTask(closeTask);
- Thread closeHookThread = new Thread(closeTask, "Vault container shutdown thread");
- Runtime.getRuntime().addShutdownHook(closeHookThread);
- ((QuarkusClassLoader) cl.parent()).addCloseTask(new Runnable() {
- @Override
- public void run() {
- Runtime.getRuntime().removeShutdownHook(closeHookThread);
- }
- });
}
for (Map.Entry<String, String> entry : connectionProperties.entrySet()) {
devConfig.produce(new DevServicesConfigResultBuildItem(entry.getKey(), entry.getValue()));
diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
index fba678a1b19..7daaf031e8a 100644
--- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
+++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java
@@ -338,6 +338,7 @@ public Thread newThread(Runnable r) {
.setTest(true)
.build()
.bootstrap();
+ shutdownTasks.add(curatedApplication::close);
}
if (curatedApplication.getAppModel().getUserDependencies().isEmpty()) {
@@ -1260,7 +1261,11 @@ public void close() {
ConfigProviderResolver.setInstance(null);
}
}
- Runtime.getRuntime().removeShutdownHook(shutdownHook);
+ try {
+ Runtime.getRuntime().removeShutdownHook(shutdownHook);
+ } catch (Throwable t) {
+ //won't work if we are already shutting down
+ }
}
}
} | ['extensions/oidc/deployment/src/main/java/io/quarkus/oidc/deployment/devservices/keycloak/KeycloakDevServicesProcessor.java', 'extensions/redis-client/deployment/src/main/java/io/quarkus/redis/client/deployment/DevServicesRedisProcessor.java', 'extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/DevServicesKafkaProcessor.java', 'test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusTestExtension.java', 'extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/DevServicesMongoProcessor.java', 'extensions/smallrye-reactive-messaging-amqp/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/amqp/deployment/DevServicesAmqpProcessor.java', 'extensions/vault/deployment/src/main/java/io/quarkus/vault/deployment/DevServicesVaultProcessor.java', 'extensions/apicurio-registry-avro/deployment/src/main/java/io/quarkus/apicurio/registry/avro/DevServicesApicurioRegistryProcessor.java', 'extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java'] | {'.java': 9} | 9 | 9 | 0 | 0 | 9 | 17,862,754 | 3,472,972 | 458,128 | 4,751 | 2,974 | 515 | 49 | 8 | 5,220 | 485 | 1,298 | 95 | 5 | 1 | 2021-08-20T02: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 |
2,672 | quarkusio/quarkus/19496/19480 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19480 | https://github.com/quarkusio/quarkus/pull/19496 | https://github.com/quarkusio/quarkus/pull/19496 | 1 | fix | Warning about deprecated `quarkus.resteasy.metrics.enabled` is printed even when replacement setting is already used | ### Describe the bug
On every dev mode start of my application, I get this warning:
```
2021-08-18 14:26:23,873 WARN [io.qua.sma.met.dep.SmallRyeMetricsProcessor] (build-42) `quarkus.resteasy.metrics.enabled` is deprecated and will be removed in a future version. Use `quarkus.smallrye-metrics.jaxrs.enabled` to enable metrics for REST endpoints using the smallrye-metrics extension
```
This warning is not right, my configuration specifies only the new property:
```
quarkus.smallrye-metrics.jaxrs.enabled=true
```
### Expected behavior
No warning should be printed in this case, since I already use the new setting.
### Actual behavior
Listening for transport dt_socket at address: 5005
2021-08-18 14:26:23,873 WARN [io.qua.sma.met.dep.SmallRyeMetricsProcessor] (build-42) `quarkus.resteasy.metrics.enabled` is deprecated and will be removed in a future version. Use `quarkus.smallrye-metrics.jaxrs.enabled` to enable metrics for REST endpoints using the smallrye-metrics extension
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2021-08-18 14:26:26,396 INFO [io.quarkus] (Quarkus Main Thread) resteasy-multipart-size 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.1.2.Final) started in 3.240s. Listening on: http://localhost:8080
2021-08-18 14:26:26,399 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-08-18 14:26:26,401 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-metrics]
### How to Reproduce?
1. Download the reproducer:
[resteasy-multipart-size.zip](https://github.com/quarkusio/quarkus/files/7007186/resteasy-multipart-size.zip)
2. mvn quarkus:dev
3. look at the console output
### Output of `uname -a` or `ver`
MSYS_NT-10.0 NANB7NLNVP2 2.10.0(0.325/5/3) 2018-06-13 23:34 x86_64 Msys
### Output of `java -version`
openjdk version "16.0.1" 2021-04-20 OpenJDK Runtime Environment Zulu16.30+15-CA (build 16.0.1+9) OpenJDK 64-Bit Server VM Zulu16.30+15-CA (build 16.0.1+9, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d) Maven home: C:\\eclipse\\tools\\apache-maven\\bin\\.. Java version: 16.0.1, vendor: Azul Systems, Inc., runtime: C:\\eclipse\\tools\\java\\16 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
### Additional information
_No response_ | 0770982b22a5596a878051a22f938991200b73d1 | 6b70e67b982aa0b1e4746d8ffed12a7e51645bfd | https://github.com/quarkusio/quarkus/compare/0770982b22a5596a878051a22f938991200b73d1...6b70e67b982aa0b1e4746d8ffed12a7e51645bfd | diff --git a/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java b/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
index ed472ecaf1e..e6e19e00900 100755
--- a/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
+++ b/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
@@ -147,11 +147,12 @@ static final class ResteasyConfig {
* See <a href=
* "https://github.com/eclipse/microprofile-metrics/blob/2.3.x/spec/src/main/asciidoc/required-metrics.adoc#optional-rest">MicroProfile
* Metrics: Optional REST metrics</a>.
- * <p>
- * Deprecated. Use {@code quarkus.smallrye-metrics.jaxrs.enabled}.
+ *
+ * @deprecated Use {@code quarkus.smallrye-metrics.jaxrs.enabled} instead.
*/
- @ConfigItem(name = "metrics.enabled", defaultValue = "false")
- public boolean metricsEnabled;
+ @Deprecated(forRemoval = true)
+ @ConfigItem(name = "metrics.enabled")
+ public Optional<Boolean> metricsEnabled;
/**
* Ignore all explicit JAX-RS {@link Application} classes.
diff --git a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java
index d86b4d39fc0..f9252e5b0b3 100644
--- a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java
+++ b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java
@@ -32,7 +32,7 @@ static class RestMetricsEnabled implements BooleanSupplier {
SmallRyeMetricsProcessor.SmallRyeMetricsConfig smConfig;
public boolean getAsBoolean() {
- boolean resteasyConfigEnabled = ConfigProvider.getConfig().getOptionalValue(RESTEASY_CONFIG_PROPERTY, boolean.class)
+ boolean resteasyConfigEnabled = ConfigProvider.getConfig().getOptionalValue(RESTEASY_CONFIG_PROPERTY, Boolean.class)
.orElse(false);
return smConfig.extensionsEnabled && (smConfig.jaxrsEnabled || resteasyConfigEnabled);
}
@@ -73,7 +73,7 @@ void enableMetrics(Optional<MetricsCapabilityBuildItem> metricsCapabilityBuildIt
}
private void warnIfDeprecatedResteasyPropertiesPresent() {
- if (ConfigProvider.getConfig().getOptionalValue(RESTEASY_CONFIG_PROPERTY, boolean.class).isPresent()) {
+ if (ConfigProvider.getConfig().getOptionalValue(RESTEASY_CONFIG_PROPERTY, Boolean.class).isPresent()) {
SmallRyeMetricsProcessor.LOGGER.warn(
"`quarkus.resteasy.metrics.enabled` is deprecated and will be removed in a future version. "
+ "Use `quarkus.smallrye-metrics.jaxrs.enabled` to enable metrics for REST endpoints " | ['extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java', 'extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/JaxRsMetricsProcessor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,863,509 | 3,473,107 | 458,138 | 4,751 | 920 | 194 | 13 | 2 | 2,724 | 326 | 902 | 59 | 2 | 2 | 2021-08-19T08:53: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 |
2,682 | quarkusio/quarkus/19324/19323 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19323 | https://github.com/quarkusio/quarkus/pull/19324 | https://github.com/quarkusio/quarkus/pull/19324 | 1 | fixes | Degredation in Dev mode startup time for project using quarkus-spring-jpa extension | ### Describe the bug
Time to first request has degraded for dev mode startup between 1.11.7.Final and 2.1.1.Final for projects that include a lot of extensions (i.e. many classes) that also include `quarkus-spring-data-jpa`
Start times reported by the console;
1.11.7.Final | 2.1.1.Final
-- | --
3.954s. | 5.804s.
3.923s. | 6.397s.
3.949s. | 6.408s.
4.054s. | 5.780s.
4.111s. | 5.980s.
This also impacts time to first response in dev mode. The issue is caused by an inefficient scan of Jandex indexed classes while searching for classes annotated with `org.springframework.data.repository.NoRepositoryBean`
Between 1.11.7.Final and 2.1.1.Final, this scan has become more costly and therefore start times have regressed.
[profiles-cpu.zip](https://github.com/quarkusio/quarkus/files/6963547/profiles-cpu.zip)
### Expected behavior
_No response_
### Actual behavior
Dev mode start time degrades are more classes are added to the classpath
### How to Reproduce?
**2.1.1.Final**
generate app by running the following command:
`mvn io.quarkus:quarkus-maven-plugin:2.1.1.Final:create -DprojectGroupId=my-groupId -DprojectArtifactId=app-generated-skeleton -DprojectVersion=1.0.0-SNAPSHOT -DpackageName=org.my.group -DplatformArtifactId=quarkus-bom -DplatformVersion=2.1.1.Final -Dextensions=agroal,config-yaml,core,hibernate-orm,hibernate-orm-panache,hibernate-validator,jackson,jaxb,jdbc-mysql,jdbc-postgresql,jsonb,jsonp,kafka-client,logging-json,narayana-jta,oidc,quarkus-quartz,reactive-pg-client,rest-client,rest-client-jaxb,resteasy,resteasy-jackson,resteasy-jaxb,resteasy-jsonb,scheduler,spring-boot-properties,smallrye-reactive-streams-operators,spring-data-jpa,spring-di,spring-security,spring-web,undertow,vertx,vertx-web,grpc,cache,micrometer,quarkus-openshift-client`
And then
`mvn clean quarkus:dev -Dquarkus.kafka.devservices.enabled=false -Dquarkus.keycloak.devservices.enabled=false`
**1.11.7.Final**
`mvn io.quarkus:quarkus-maven-plugin:1.11.7.Final:create -DprojectGroupId=my-groupId -DprojectArtifactId=app-generated-skeleton -DprojectVersion=1.0.0-SNAPSHOT -DpackageName=org.my.group -DplatformArtifactId=quarkus-bom -DplatformVersion=1.11.7.Final -Dextensions=agroal,config-yaml,core,hibernate-orm,hibernate-orm-panache,hibernate-validator,jackson,jaxb,jdbc-mysql,jdbc-postgresql,jsonb,jsonp,kafka-client,logging-json,narayana-jta,quarkus-quartz,reactive-pg-client,rest-client,rest-client-jaxb,resteasy,resteasy-jackson,resteasy-jaxb,resteasy-jsonb,scheduler,spring-boot-properties,smallrye-reactive-streams-operators,spring-data-jpa,spring-di,spring-security,spring-web,undertow,vertx,vertx-web,grpc,cache,micrometer,quarkus-openshift-client`
And then:
`mvn clean quarkus:dev -Dquarkus.log.console.json=false`
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | cde75bce7ad3d3d8a3111aaddd1d5e69366a9451 | 1b56fa839ecfcfc6fac98e8691eb65965f945e84 | https://github.com/quarkusio/quarkus/compare/cde75bce7ad3d3d8a3111aaddd1d5e69366a9451...1b56fa839ecfcfc6fac98e8691eb65965f945e84 | diff --git a/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/SpringDataJPAProcessor.java b/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/SpringDataJPAProcessor.java
index a41cfc8bfda..7ccfbb56485 100644
--- a/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/SpringDataJPAProcessor.java
+++ b/extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/SpringDataJPAProcessor.java
@@ -10,11 +10,13 @@
import java.util.List;
import java.util.Set;
import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationTarget;
+import org.jboss.jandex.AnnotationTarget.Kind;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
@@ -232,20 +234,11 @@ private List<ClassInfo> getAllInterfacesExtending(Collection<DotName> targets, I
}
private Collection<DotName> getAllNoRepositoryBeanInterfaces(IndexView index) {
- Set<DotName> result = new HashSet<>();
- Collection<ClassInfo> knownClasses = index.getKnownClasses();
- for (ClassInfo clazz : knownClasses) {
- if (!Modifier.isInterface(clazz.flags())) {
- continue;
- }
- boolean found = false;
- for (ClassInfo classInfo : knownClasses) {
- if (classInfo.classAnnotation(DotNames.SPRING_DATA_NO_REPOSITORY_BEAN) != null) {
- result.add(classInfo.name());
- }
- }
- }
- return result;
+ return index.getAnnotations(DotNames.SPRING_DATA_NO_REPOSITORY_BEAN).stream()
+ .filter(ai -> ai.target().kind() == Kind.CLASS)
+ .filter(ai -> Modifier.isInterface(ai.target().asClass().flags()))
+ .map(ai -> ai.target().asClass().name())
+ .collect(Collectors.toSet());
}
// generate a concrete class that will be used by Arc to resolve injection points | ['extensions/spring-data-jpa/deployment/src/main/java/io/quarkus/spring/data/deployment/SpringDataJPAProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,800,989 | 3,460,813 | 456,610 | 4,737 | 1,002 | 194 | 21 | 1 | 3,118 | 222 | 948 | 75 | 1 | 0 | 2021-08-10T18:09: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 |
2,673 | quarkusio/quarkus/19490/19471 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19471 | https://github.com/quarkusio/quarkus/pull/19490 | https://github.com/quarkusio/quarkus/pull/19490 | 1 | fixes | SimpleQuarkusRestTestCase#testFormMap sometimes fails with NPE | See the run for this PR: https://github.com/quarkusio/quarkus/pull/19463
```
2021-08-17T19:37:29.9850663Z 2021-08-17 19:37:29,957 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /simple/form-map failed, error id: e3672c38-a3f4-4013-876e-bdeec84f42f8-2: java.lang.NullPointerException
2021-08-17T19:37:29.9853878Z at org.jboss.resteasy.reactive.server.injection.ContextProducers.getTarget(ContextProducers.java:108)
2021-08-17T19:37:29.9857459Z at org.jboss.resteasy.reactive.server.injection.ContextProducers.resourceInfo(ContextProducers.java:90)
2021-08-17T19:37:29.9861602Z at org.jboss.resteasy.reactive.server.injection.ContextProducers_ProducerMethod_resourceInfo_be7f5503a87442251cde9fbc1d406fb350a529f0_Bean.create(ContextProducers_ProducerMethod_resourceInfo_be7f5503a87442251cde9fbc1d406fb350a529f0_Bean.zig:163)
2021-08-17T19:37:29.9866116Z at org.jboss.resteasy.reactive.server.injection.ContextProducers_ProducerMethod_resourceInfo_be7f5503a87442251cde9fbc1d406fb350a529f0_Bean.create(ContextProducers_ProducerMethod_resourceInfo_be7f5503a87442251cde9fbc1d406fb350a529f0_Bean.zig:194)
2021-08-17T19:37:29.9869160Z at io.quarkus.arc.impl.RequestContext.getIfActive(RequestContext.java:68)
2021-08-17T19:37:29.9870910Z at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:33)
2021-08-17T19:37:29.9874045Z at org.jboss.resteasy.reactive.server.injection.ContextProducers_ProducerMethod_resourceInfo_be7f5503a87442251cde9fbc1d406fb350a529f0_ClientProxy.arc$delegate(ContextProducers_ProducerMethod_resourceInfo_be7f5503a87442251cde9fbc1d406fb350a529f0_ClientProxy.zig:60)
2021-08-17T19:37:29.9879272Z at org.jboss.resteasy.reactive.server.injection.ContextProducers_ProducerMethod_resourceInfo_be7f5503a87442251cde9fbc1d406fb350a529f0_ClientProxy.getResourceMethod(ContextProducers_ProducerMethod_resourceInfo_be7f5503a87442251cde9fbc1d406fb350a529f0_ClientProxy.zig:135)
2021-08-17T19:37:29.9884187Z at io.quarkus.resteasy.reactive.server.test.simple.ResourceInfoInjectingFilter.filter(ResourceInfoInjectingFilter.java:19)
2021-08-17T19:37:29.9888838Z at org.jboss.resteasy.reactive.server.handlers.ResourceRequestFilterHandler.handle(ResourceRequestFilterHandler.java:40)
2021-08-17T19:37:29.9893747Z at org.jboss.resteasy.reactive.server.handlers.ResourceRequestFilterHandler.handle(ResourceRequestFilterHandler.java:8)
2021-08-17T19:37:29.9898151Z at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:133)
2021-08-17T19:37:29.9971999Z at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:538)
2021-08-17T19:37:29.9974080Z at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
2021-08-17T19:37:29.9976066Z at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
2021-08-17T19:37:29.9977965Z at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
2021-08-17T19:37:29.9980149Z at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
2021-08-17T19:37:29.9982705Z at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
2021-08-17T19:37:29.9984394Z at java.base/java.lang.Thread.run(Thread.java:829)
``` | 8017b6e9fa723f56b2aece7b2da7966c7e689961 | b361dbe92322bf8e70ae70afb28a07a99689be8c | https://github.com/quarkusio/quarkus/compare/8017b6e9fa723f56b2aece7b2da7966c7e689961...b361dbe92322bf8e70ae70afb28a07a99689be8c | diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java
index 5af64f58d38..d84d27bb11b 100644
--- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java
+++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java
@@ -125,6 +125,8 @@ public void run() {
//if this is a blocking target we don't activate for the initial non-blocking part
//unless there are pre-mapping filters as these may require CDI
boolean disasociateRequestScope = false;
+ boolean aborted = false;
+ Executor exec = null;
try {
while (position < handlers.length) {
int pos = position;
@@ -132,7 +134,6 @@ public void run() {
try {
handlers[pos].handle((T) this);
if (suspended) {
- Executor exec = null;
synchronized (this) {
if (isRequestScopeManagementRequired()) {
if (requestScopeActivated) {
@@ -151,40 +152,29 @@ public void run() {
exec = this.executor;
// prevent future suspensions from re-submitting the task
this.executor = null;
+ return;
} else if (suspended) {
running = false;
processingSuspended = true;
return;
}
}
- if (exec != null) {
- //outside sync block
- exec.execute(this);
- processingSuspended = true;
- return;
- }
}
} catch (Throwable t) {
- boolean over = handlers == abortHandlerChain;
+ aborted = handlers == abortHandlerChain;
if (t instanceof PreserveTargetException) {
handleException(t.getCause(), true);
} else {
handleException(t);
}
- if (over) {
- running = false;
- return;
- }
}
}
- running = false;
} catch (Throwable t) {
handleUnrecoverableError(t);
- running = false;
} finally {
// we need to make sure we don't close the underlying stream in the event loop if the task
// has been offloaded to the executor
- if (position == handlers.length && !processingSuspended) {
+ if ((position == handlers.length && !processingSuspended) || aborted) {
close();
} else {
if (disasociateRequestScope) {
@@ -193,6 +183,13 @@ public void run() {
}
beginAsyncProcessing();
}
+ synchronized (this) {
+ running = false;
+ }
+ if (exec != null) {
+ //outside sync block
+ exec.execute(this);
+ }
}
}
| ['independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/core/AbstractResteasyReactiveContext.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,862,132 | 3,472,835 | 458,107 | 4,750 | 1,101 | 162 | 27 | 1 | 3,351 | 81 | 1,133 | 24 | 1 | 1 | 2021-08-19T03:46:07 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,674 | quarkusio/quarkus/19475/19434 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19434 | https://github.com/quarkusio/quarkus/pull/19475 | https://github.com/quarkusio/quarkus/pull/19475 | 1 | fix | Setting quarkus.resteasy.path not reflected in OpenAPI or Swagger | ### Describe the bug
When I set the "quarkus.resteast.path" it works making API calls directly but does not get reflected in the OpenAPI or Swagger.
Using @ApplicationPath and setting eash @Path looks to work.
### Expected behavior
OpenAPI and Swagger reflect the path set in the application properties.
### Actual behavior
RESTful calls works but OpenAPI and Swagger do not reflect the path. From Swagger invoking an endpoint gives a 404.
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 1742e206dae65e7310bf97216f2005e79ec20195 | f319f7fc4cad7f6d699e808dc9ad42a91d6a42ef | https://github.com/quarkusio/quarkus/compare/1742e206dae65e7310bf97216f2005e79ec20195...f319f7fc4cad7f6d699e808dc9ad42a91d6a42ef | 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 2a96133a559..276e9e3619c 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
@@ -496,17 +496,22 @@ private OpenAPI generateAnnotationModel(IndexView indexView, Capabilities capabi
OpenApiConfig openApiConfig = new OpenApiConfigImpl(config);
List<AnnotationScannerExtension> extensions = new ArrayList<>();
+
// Add the RESTEasy extension if the capability is present
+ String defaultPath = httpRootPathBuildItem.getRootPath();
if (capabilities.isPresent(Capability.RESTEASY)) {
extensions.add(new RESTEasyExtension(indexView));
+ if (resteasyJaxrsConfig.isPresent()) {
+ defaultPath = resteasyJaxrsConfig.get().getRootPath();
+ }
+ } else if (capabilities.isPresent(Capability.RESTEASY_REACTIVE)) {
+ extensions.add(new RESTEasyExtension(indexView));
+ Optional<String> maybePath = config.getOptionalValue("quarkus.resteasy-reactive.path", String.class);
+ if (maybePath.isPresent()) {
+ defaultPath = maybePath.get();
+ }
}
- String defaultPath;
- if (resteasyJaxrsConfig.isPresent()) {
- defaultPath = resteasyJaxrsConfig.get().getRootPath();
- } else {
- defaultPath = httpRootPathBuildItem.getRootPath();
- }
if (defaultPath != null && !"/".equals(defaultPath)) {
extensions.add(new CustomPathExtension(defaultPath));
} | ['extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,865,728 | 3,473,519 | 458,199 | 4,751 | 804 | 163 | 17 | 1 | 820 | 128 | 190 | 41 | 0 | 0 | 2021-08-18T09:36:00 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,675 | quarkusio/quarkus/19440/19045 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19045 | https://github.com/quarkusio/quarkus/pull/19440 | https://github.com/quarkusio/quarkus/pull/19440 | 1 | fix | Kafka JMX registration causes issues with continuous testing | ### Describe the bug
Enable continuous testing + test output with kafka-avro-schema-quickstart and you get the following:
```
2021-07-28 13:09:35,398 WARN [org.apa.kaf.com.uti.AppInfoParser] (Test runner thread) Error registering AppInfo mbean: javax.management.InstanceAlreadyExistsException: kafka.producer:type=app-info,id=kafka-producer-movies
at java.management/com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:436)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1855)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:955)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:890)
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:320)
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
at org.apache.kafka.common.utils.AppInfoParser.registerAppInfo(AppInfoParser.java:64)
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:434)
at org.apache.kafka.clients.producer.KafkaProducer.<init>(KafkaProducer.java:291)
at io.smallrye.reactive.messaging.kafka.impl.ReactiveKafkaProducer.<init>(ReactiveKafkaProducer.java:66)
at io.smallrye.reactive.messaging.kafka.impl.ReactiveKafkaProducer.<init>(ReactiveKafkaProducer.java:43)
at io.smallrye.reactive.messaging.kafka.impl.KafkaSink.<init>(KafkaSink.java:76)
at io.smallrye.reactive.messaging.kafka.KafkaConnector.getSubscriberBuilder(KafkaConnector.java:227)
at io.smallrye.reactive.messaging.kafka.KafkaConnector_ClientProxy.getSubscriberBuilder(KafkaConnector_ClientProxy.zig:416)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.createSubscriberBuilder(ConfiguredChannelFactory.java:207)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.register(ConfiguredChannelFactory.java:164)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory.initialize(ConfiguredChannelFactory.java:125)
at io.smallrye.reactive.messaging.impl.ConfiguredChannelFactory_ClientProxy.initialize(ConfiguredChannelFactory_ClientProxy.zig:237)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at io.smallrye.reactive.messaging.extension.MediatorManager.start(MediatorManager.java:189)
at io.smallrye.reactive.messaging.extension.MediatorManager_ClientProxy.start(MediatorManager_ClientProxy.zig:268)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:41)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_4e8937813d9e8faff65c3c07f88fa96615b70e70.notify(SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_4e8937813d9e8faff65c3c07f88fa96615b70e70.zig:129)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:307)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:289)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:70)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:128)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:97)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(LifecycleEventsBuildStep$startupEvent1144526294.zig:87)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(LifecycleEventsBuildStep$startupEvent1144526294.zig:40)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:645)
```
I think we need to use different client ids for the tests somehow.
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 89463784c6ca424eac7215fc262a580bf58b846f | 843d1db33b64613a803c16c57b9aafa9f0b3acb9 | https://github.com/quarkusio/quarkus/compare/89463784c6ca424eac7215fc262a580bf58b846f...843d1db33b64613a803c16c57b9aafa9f0b3acb9 | diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java
index 836fdb584a9..f62f9632a81 100644
--- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java
+++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java
@@ -27,6 +27,7 @@
import io.quarkus.deployment.builditem.RunTimeConfigurationDefaultBuildItem;
import io.quarkus.deployment.builditem.RuntimeConfigSetupCompleteBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
import io.quarkus.smallrye.reactivemessaging.kafka.ReactiveMessagingKafkaConfig;
import io.vertx.kafka.client.consumer.impl.KafkaReadStreamImpl;
@@ -49,6 +50,16 @@ public void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
.build());
}
+ @BuildStep
+ public void ignoreDuplicateJmxRegistrationInDevAndTestModes(LaunchModeBuildItem launchMode,
+ BuildProducer<LogCleanupFilterBuildItem> log) {
+ if (launchMode.getLaunchMode().isDevOrTest()) {
+ log.produce(new LogCleanupFilterBuildItem(
+ "org.apache.kafka.common.utils.AppInfoParser",
+ "Error registering AppInfo mbean"));
+ }
+ }
+
/**
* Handles the serializer/deserializer detection and whether or not the graceful shutdown should be used in dev mode.
*/ | ['extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,843,495 | 3,469,263 | 457,639 | 4,745 | 497 | 103 | 11 | 1 | 4,721 | 178 | 1,103 | 79 | 0 | 1 | 2021-08-17T06:38: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 |
2,676 | quarkusio/quarkus/19403/19392 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19392 | https://github.com/quarkusio/quarkus/pull/19403 | https://github.com/quarkusio/quarkus/pull/19403 | 1 | fixes | Dev mode freezes when quitting and console log colors are switched off | ### Describe the bug
That is a very strange bug and I'm not sure, if I got it right:
If you
- disable console log colors with `quarkus.log.console.color=false`,
- start the application in dev mode,
- wait for Quarkus to come up,
- press `q` for termination the application,
- then the application hangs/freezes: The shell does not return to the promt and cpu usage rises.
### Expected behavior
After pressing `q` in dev mode, the application should terminate.
### Actual behavior
If console log coloring is disabled, pressing `q` in dev mode seems to run into some endless loop.
### How to Reproduce?
Steps to reproduce:
1. Bootstrap the Getting Started project: `mvn io.quarkus:quarkus-maven-plugin:2.1.2.Final:create` using all defaults.
2. Add `quarkus.log.console.color=false` to `application.properties`,
3. Start application in dev mode: `mvn clean quarkus:dev` (the `clean` seems to have some influence; without it, the problem does not appear *every* time ...)
4. Wait for Quarkus to initialize.
5. Press `q`
### Output of `uname -a` or `ver`
Windows 10 Pro
### Output of `java -version`
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9.1+1, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1
### Additional information
_No response_ | d62cef5bfffff133b55f8275fda358ea2484f7a1 | dfc8834cb48df9b008429577cb2b1e4ebde18d5a | https://github.com/quarkusio/quarkus/compare/d62cef5bfffff133b55f8275fda358ea2484f7a1...dfc8834cb48df9b008429577cb2b1e4ebde18d5a | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java b/core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java
index c5aa2f85b85..e7b734ba2ea 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java
@@ -66,7 +66,7 @@ public AeshConsole(Connection connection) {
public void run() {
connection.close();
}
- }, "Console Shutdown Hoot"));
+ }, "Console Shutdown Hook"));
}
private void updatePromptOnChange(StringBuilder buffer, int newLines) {
@@ -294,8 +294,15 @@ public void write(String s) {
return;
}
if (closed) {
- connection.write(s);
- return;
+ // we need to guard against Aesh logging since the connection.write call, in certain error conditions,
+ // can lead to a logger message write, which can trigger an infinite loop
+ IN_WRITE.set(true);
+ try {
+ connection.write(s);
+ return;
+ } finally {
+ IN_WRITE.set(false);
+ }
}
if (lastColorCode != null) {
s = lastColorCode + s; | ['core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,807,531 | 3,462,003 | 456,734 | 4,738 | 528 | 90 | 13 | 1 | 1,435 | 217 | 384 | 53 | 0 | 0 | 2021-08-15T07:20:43 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,677 | quarkusio/quarkus/19400/19381 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19381 | https://github.com/quarkusio/quarkus/pull/19400 | https://github.com/quarkusio/quarkus/pull/19400 | 1 | fixes | QuarkusDelayedHandler prints an error and throws a log message away even if the queue was compacted | ### Describe the bug
When the delayed log writer queue fills up and a compaction of the queue happens if the queue has space the method still returns and the logged message is lost no matter the log level.
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
Possible fix is removing the return statement that happens even if the compact was successful.
```java
@Override
protected void doPublish(final ExtLogRecord record) {
// If activated just delegate
if (activated) {
publishToNestedHandlers(record);
super.doPublish(record);
} else {
synchronized (this) {
// Check one more time to see if we've been activated before queuing the messages
if (activated || buildTimeLoggingActivated) {
publishToNestedHandlers(record);
super.doPublish(record);
} else {
// drop everything below the discard level
// this is not ideal, but we can run out of memory otherwise
// this only happens if we end up with more than 4k log messages before activation
if (record.getLevel().intValue() <= discardLevel) {
return;
}
// Determine whether the queue was overrun
if (logRecords.size() >= queueLimit) {
compactQueue();
reportError(
"The delayed handler's queue was overrun and log record(s) were lost. Did you forget to configure logging?",
null, ErrorManager.WRITE_FAILURE);
if (logRecords.size() >= queueLimit) {
//still too full, nothing we can do
return;
}
}
// Determine if we need to calculate the caller information before we queue the record
if (isCallerCalculationRequired()) {
// prepare record to move to another thread
record.copyAll();
} else {
// Disable the caller calculation since it's been determined we won't be using it
record.disableCallerCalculation();
// Copy the MDC over
record.copyMdc();
}
lowestInQueue = Integer.min(record.getLevel().intValue(), lowestInQueue);
logRecords.addLast(record);
}
}
}
}
``` | d62cef5bfffff133b55f8275fda358ea2484f7a1 | c039d16f3a702f681df0f55f972e1bce329fb5ca | https://github.com/quarkusio/quarkus/compare/d62cef5bfffff133b55f8275fda358ea2484f7a1...c039d16f3a702f681df0f55f972e1bce329fb5ca | diff --git a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/QuarkusDelayedHandler.java b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/QuarkusDelayedHandler.java
index 3d76d98d1e4..68e308b980e 100644
--- a/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/QuarkusDelayedHandler.java
+++ b/independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/QuarkusDelayedHandler.java
@@ -95,7 +95,6 @@ protected void doPublish(final ExtLogRecord record) {
//still too full, nothing we can do
return;
}
- return;
}
// Determine if we need to calculate the caller information before we queue the record
if (isCallerCalculationRequired()) { | ['independent-projects/bootstrap/runner/src/main/java/io/quarkus/bootstrap/logging/QuarkusDelayedHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,807,531 | 3,462,003 | 456,734 | 4,738 | 32 | 3 | 1 | 1 | 3,091 | 320 | 542 | 88 | 0 | 1 | 2021-08-14T12:37:17 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,678 | quarkusio/quarkus/19357/19341 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19341 | https://github.com/quarkusio/quarkus/pull/19357 | https://github.com/quarkusio/quarkus/pull/19357 | 1 | fixes | Reactive rest client doesn't support resource locator and subresource | ### Describe the bug
When I try to use resource locator with subresource an AbstractMethodError will be thrown.
### Expected behavior
Reactive rest client will support resource locators and subresources like [here](https://github.com/stuartwdouglas/quarkus/blob/4f1b3b688a6752b51daa743b5a5b10f7e805bcc7/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/subresource/SubResourceTest.java#L28).
### Actual behavior
AbstractMethodError will be thrown.
### How to Reproduce?
[Reproducer](https://github.com/mkonzal/quarkus-reactive-resource-locator-subresource.git)
GET service/sub/xyz
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
openjdk version "11.0.9.1" 2020-11-04 LTS OpenJDK Runtime Environment 18.9 (build 11.0.9.1+1-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.9.1+1-LTS, mixed mode)
### GraalVM version (if different from Java)
N/A
### Quarkus version or git rev
2.1.1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
### Additional information
_No response_ | 701fd3ee8299b5241e70da041b02cec820545186 | 236586c7619e4a1be938afa809a19f90a85120c9 | https://github.com/quarkusio/quarkus/compare/701fd3ee8299b5241e70da041b02cec820545186...236586c7619e4a1be938afa809a19f90a85120c9 | diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java
index 78f3f96305a..8e1ecbdb16b 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java
@@ -423,6 +423,8 @@ private boolean isRestMethod(MethodInfo method) {
if (annotation.target().kind() == AnnotationTarget.Kind.METHOD
&& BUILTIN_HTTP_ANNOTATIONS_TO_METHOD.containsKey(annotation.name())) {
return true;
+ } else if (annotation.name().equals(ResteasyReactiveDotNames.PATH)) {
+ return true;
}
}
return false;
diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/subresource/SubResourceTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/subresource/SubResourceTest.java
index 186ccc348e9..586e096a482 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/subresource/SubResourceTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/subresource/SubResourceTest.java
@@ -17,6 +17,7 @@
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.eclipse.microprofile.rest.client.annotation.ClientHeaderParam;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
+import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
@@ -35,6 +36,16 @@ public class SubResourceTest {
@TestHTTPResource
URI baseUri;
+ @RestClient
+ RootClient injectedClient;
+
+ @Test
+ void testInjectedClient() {
+ // should result in sending GET /path/rt/mthd/simple
+ String result = injectedClient.sub("rt", "mthd").simpleGet();
+ assertThat(result).isEqualTo("rt/mthd/simple");
+ }
+
@Test
void shouldPassParamsToSubResource() {
// should result in sending GET /path/rt/mthd/simple
@@ -62,7 +73,7 @@ void shouldDoMultiplePosts() {
}
@Path("/path/{rootParam}")
- @RegisterRestClient
+ @RegisterRestClient(baseUri = "http://localhost:8081")
@Consumes("text/plain")
@Produces("text/plain")
@ClientHeaderParam(name = "fromRoot", value = "headerValue") | ['extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/subresource/SubResourceTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,800,556 | 3,460,729 | 456,601 | 4,737 | 112 | 24 | 2 | 1 | 1,160 | 115 | 356 | 41 | 2 | 0 | 2021-08-12T04:58:28 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,680 | quarkusio/quarkus/19336/19195 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19195 | https://github.com/quarkusio/quarkus/pull/19336 | https://github.com/quarkusio/quarkus/pull/19336 | 1 | fixes | Infinispan client cannot find `SaslServerFactory` in native mode | Testing the latest Camel Quarkus Infinispan SNAPSHOT with the latest Quarkus Infinispan SNAPSHOT reveals an error in native mode. Seems that Infinispan itests in Quarkus do not use authentication, so maybe this has gone unnoticed since the upgrade to GraalVM 21.2.0.
The client configuration used in the Camel Infinispan itest is [here](https://github.com/apache/camel-quarkus/blob/quarkus-main/integration-tests/infinispan/src/test/java/org/apache/camel/quarkus/component/infinispan/InfinispanServerTestResource.java#L60-L66).
I guess there's a typo in the `IllegalStateException` message, 'now' instead of 'not', which makes things kinda confusing.
```
2021-08-03 09:29:57,789 WARN [io.net.cha.ChannelInitializer] (HotRod-client-async-pool-1-4) Failed to initialize a channel. Closing: [id: 0xa7565909]: java.lang.IllegalStateException: SaslClientFactory implementation now found
at org.infinispan.client.hotrod.impl.transport.netty.ChannelInitializer.getSaslClientFactory(ChannelInitializer.java:203)
at org.infinispan.client.hotrod.impl.transport.netty.ChannelInitializer.initAuthentication(ChannelInitializer.java:162)
at org.infinispan.client.hotrod.impl.transport.netty.ChannelInitializer.initChannel(ChannelInitializer.java:80)
at io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129)
at io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112)
at io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:938)
at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:609)
at io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46)
at io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1463)
at io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1115)
at io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:650)
at io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:514)
at io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:429)
at io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:486)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:567)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
``` | 57d1dae99a635b32951d7e1594f0969fc61dceb1 | 5443e823851db86ef071bf9eecfce0c207008117 | https://github.com/quarkusio/quarkus/compare/57d1dae99a635b32951d7e1594f0969fc61dceb1...5443e823851db86ef071bf9eecfce0c207008117 | diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java
index 6196debd6de..5c19dd18bdd 100644
--- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java
+++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java
@@ -51,6 +51,7 @@
import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageSecurityProviderBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.infinispan.client.runtime.InfinispanClientBuildTimeConfig;
import io.quarkus.infinispan.client.runtime.InfinispanClientProducer;
@@ -62,6 +63,7 @@ class InfinispanClientProcessor {
private static final String META_INF = "META-INF";
private static final String HOTROD_CLIENT_PROPERTIES = META_INF + File.separator + "hotrod-client.properties";
private static final String PROTO_EXTENSION = ".proto";
+ private static final String SASL_SECURITY_PROVIDER = "com.sun.security.sasl.Provider";
/**
* The Infinispan client build time configuration.
@@ -76,6 +78,7 @@ InfinispanPropertiesBuildItem setup(ApplicationArchivesBuildItem applicationArch
BuildProducer<FeatureBuildItem> feature,
BuildProducer<AdditionalBeanBuildItem> additionalBeans,
BuildProducer<ExtensionSslNativeSupportBuildItem> sslNativeSupport,
+ BuildProducer<NativeImageSecurityProviderBuildItem> nativeImageSecurityProviders,
BuildProducer<NativeImageConfigBuildItem> nativeImageConfig,
CombinedIndexBuildItem applicationIndexBuildItem) throws ClassNotFoundException, IOException {
@@ -86,6 +89,7 @@ InfinispanPropertiesBuildItem setup(ApplicationArchivesBuildItem applicationArch
// Enable SSL support by default
sslNativeSupport.produce(new ExtensionSslNativeSupportBuildItem(Feature.INFINISPAN_CLIENT));
+ nativeImageSecurityProviders.produce(new NativeImageSecurityProviderBuildItem(SASL_SECURITY_PROVIDER));
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(HOTROD_CLIENT_PROPERTIES);
Properties properties; | ['extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,800,845 | 3,460,789 | 456,603 | 4,737 | 389 | 72 | 4 | 1 | 3,149 | 138 | 684 | 33 | 1 | 1 | 2021-08-11T09:30:49 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,681 | quarkusio/quarkus/19333/19317 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/19317 | https://github.com/quarkusio/quarkus/pull/19333 | https://github.com/quarkusio/quarkus/pull/19333 | 1 | fixes | Resteasy Reactive: Headers manipulated in ServerRequestFilter are not injected properly into rest method | ### Describe the bug
When modifying or create a new header in a @ServerRequestFilter annotated method (with or without preMatching = true) does not have an effect on method paramteres injected with `@RestHeader` or `@HeaderParam`.
E.g. for a method like
```
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello(
@RestHeader("new-header") String newHeader,
@RestHeader(HttpHeaders.USER_AGENT) String userAgent,
HttpHeaders httpHeaders
) { ... }
```
you will get the original header for the user agent field, no matter what you set to the headers via `ContainerRequestContext.getHeaders().putSingle()` in the `@ServerRequestFilter` annotated method.
However, the modified headers are available in the `HttpHeaders` object you can inject into the method.
### Expected behavior
The injected headers should reflect the modified values.
### Actual behavior
The injected headers contain the original request headers instead of the modified ones, which are only available from the `HttpHeaders` object.
### How to Reproduce?
Reproducer:
[2021-08-10_resteasy-reactive-modify-headers.zip](https://github.com/quarkusio/quarkus/files/6961865/2021-08-10_resteasy-reactive-modify-headers.zip)
1. Download and unzip
2. Start quarkus with `./gradlew quarkusDev`
3. Go to http://localhost:8080/hello
4. You will get a response listing the injected header value as well as the value available from the `HttpHeaders` object. I'd expect them to be the same.
5. Classes `NewHeaderCreatingRequestFilter` and `UserAgentRequestFilter` create a new header and modifiy the user agent header respectively.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.1.1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 0d33b51c95474c512db8eb4fcaa98a8d0c889df8 | db91a0386e0abf5cf8348fa8995e6ae42ca72d41 | https://github.com/quarkusio/quarkus/compare/0d33b51c95474c512db8eb4fcaa98a8d0c889df8...db91a0386e0abf5cf8348fa8995e6ae42ca72d41 | diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestResource.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestResource.java
index c1469854c42..e847095bb96 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestResource.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestResource.java
@@ -33,6 +33,7 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.Providers;
+import org.jboss.resteasy.reactive.RestHeader;
import org.jboss.resteasy.reactive.server.SimpleResourceInfo;
import io.quarkus.runtime.BlockingOperationControl;
@@ -138,8 +139,8 @@ public Response filters(@Context Providers providers) {
@GET
@Path("filters")
- public Response filters(@Context HttpHeaders headers) {
- return Response.ok().header("filter-request", headers.getHeaderString("filter-request")).build();
+ public Response filters(@Context HttpHeaders headers, @RestHeader("filter-request") String header) {
+ return Response.ok().header("filter-request", header).build();
}
@GET
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java
index f7cd8e532f0..0b699f4ace7 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java
@@ -10,6 +10,7 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Deque;
import java.util.LinkedList;
import java.util.List;
@@ -781,10 +782,22 @@ public void initPathSegments() {
@Override
public Object getHeader(String name, boolean single) {
- if (single)
- return serverRequest().getRequestHeader(name);
- // empty collections must not be turned to null
- return serverRequest().getAllRequestHeaders(name);
+ if (httpHeaders == null) {
+ if (single)
+ return serverRequest().getRequestHeader(name);
+ // empty collections must not be turned to null
+ return serverRequest().getAllRequestHeaders(name);
+ } else {
+ if (single)
+ return httpHeaders.getMutableHeaders().getFirst(name);
+ // empty collections must not be turned to null
+ List<String> list = httpHeaders.getMutableHeaders().get(name);
+ if (list == null) {
+ return Collections.emptyList();
+ } else {
+ return list;
+ }
+ }
}
@Override | ['independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/ResteasyReactiveRequestContext.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/simple/SimpleQuarkusRestResource.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,800,845 | 3,460,789 | 456,603 | 4,737 | 890 | 156 | 21 | 1 | 1,960 | 250 | 476 | 62 | 2 | 1 | 2021-08-11T02:40:39 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,706 | quarkusio/quarkus/18630/18503 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18503 | https://github.com/quarkusio/quarkus/pull/18630 | https://github.com/quarkusio/quarkus/pull/18630 | 1 | fix | CORS is broken with Quarkus and http2 | ## Describe the bug
Duplicate access-control* headers with http 2. Browsers do not allow these and so connections fail.
### Expected behavior
Single access-control* headers for each type matching the Quarkus CORS configuration. Works as expected with http 1.1
### Actual behavior
Duplicate access-control* headers with http 2. There should only be a single header of each type returned.
With http1/1:
```
[user@localhost test]$ curl -v -H "Origin: http://google.com" http://localhost:8080/q/openapi
* Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 8080 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /q/openapi HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.61.1
> Accept: */*
> Origin: http://google.com
>
< HTTP/1.1 200 OK
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Methods: GET, HEAD, OPTIONS
< Access-Control-Max-Age: 86400
< Access-Control-Allow-Headers: Content-Type, Authorization
< Content-Type: application/yaml;charset=UTF-8
< content-length: 7494
```
With http2:
```bash
[user@localhost test]$ curl -v -H "Origin: http://google.com" --http2-prior-knowledge http://localhost:8080/q/openapi
* Trying ::1...
* TCP_NODELAY set
* connect to ::1 port 8080 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.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 0x56116f1a64c0)
> GET /q/openapi HTTP/2
> Host: localhost:8080
> User-Agent: curl/7.61.1
> Accept: */*
> Origin: http://google.com
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 100)!
< HTTP/2 200
< access-control-allow-origin: http://google.com
< access-control-allow-credentials: true
< access-control-allow-origin: *
< access-control-allow-credentials: true
< access-control-allow-methods: GET, HEAD, OPTIONS
< access-control-max-age: 86400
< access-control-allow-headers: Content-Type, Authorization
< content-type: application/yaml;charset=UTF-8
< content-length: 7494
```
`access-control-allow-origin`, `access-control-allow-credentials` are both duplicated.
In curl I am forcing unencrypted http2 (h2c) since this is how my cloud load balancer connects to the Quarkus service. There should be no need for any extra headers to be added.
Although I'm showing an example here with openapi, the problem shows on all endpoints.
## Environment (please complete the following information):
```
# Enable cross-origin requests.
quarkus.http.cors=true
quarkus.http.cors.origins=*
quarkus.http.cors.methods=*
quarkus.http.cors.access-control-max-age=24H
quarkus.http.cors.access-control-allow-credentials=true
```
### Output of `uname -a` or `ver`
### Output of `java -version`
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.11+9-LTS, mixed mode, sharing)
### GraalVM version (if different from Java)
N/A occurs in both Java build and native image.
### Quarkus version or git rev
2.0.1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 6.9
| 3455456d517e16a8733ada7851c31d619acbaf20 | 123a8985da8425b833c893c58691421f16410f54 | https://github.com/quarkusio/quarkus/compare/3455456d517e16a8733ada7851c31d619acbaf20...123a8985da8425b833c893c58691421f16410f54 | diff --git a/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiHandler.java b/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiHandler.java
index 17490611311..c83b162277b 100644
--- a/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiHandler.java
+++ b/extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiHandler.java
@@ -1,16 +1,16 @@
package io.quarkus.smallrye.openapi.runtime;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import io.quarkus.arc.Arc;
import io.smallrye.openapi.runtime.io.Format;
import io.vertx.core.Handler;
+import io.vertx.core.MultiMap;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
+import io.vertx.core.http.impl.headers.HeadersMultiMap;
import io.vertx.ext.web.RoutingContext;
/**
@@ -21,14 +21,14 @@ public class OpenApiHandler implements Handler<RoutingContext> {
private volatile OpenApiDocumentService openApiDocumentService;
private static final String ALLOWED_METHODS = "GET, HEAD, OPTIONS";
private static final String QUERY_PARAM_FORMAT = "format";
- private static final Map<String, String> RESPONSE_HEADERS = new HashMap<>();
+ private static final MultiMap RESPONSE_HEADERS = new HeadersMultiMap();
static {
- RESPONSE_HEADERS.put("Access-Control-Allow-Origin", "*");
- RESPONSE_HEADERS.put("Access-Control-Allow-Credentials", "true");
- RESPONSE_HEADERS.put("Access-Control-Allow-Methods", ALLOWED_METHODS);
- RESPONSE_HEADERS.put("Access-Control-Allow-Headers", "Content-Type, Authorization");
- RESPONSE_HEADERS.put("Access-Control-Max-Age", "86400");
+ RESPONSE_HEADERS.add("access-control-allow-origin", "*");
+ RESPONSE_HEADERS.add("access-control-allow-credentials", "true");
+ RESPONSE_HEADERS.add("access-control-allow-methods", ALLOWED_METHODS);
+ RESPONSE_HEADERS.add("access-control-allow-headers", "Content-Type, Authorization");
+ RESPONSE_HEADERS.add("access-control-max-age", "86400");
}
@Override | ['extensions/smallrye-openapi/runtime/src/main/java/io/quarkus/smallrye/openapi/runtime/OpenApiHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,443,367 | 3,391,173 | 448,074 | 4,666 | 1,061 | 207 | 16 | 1 | 3,416 | 416 | 960 | 100 | 7 | 3 | 2021-07-12T18: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 |
2,707 | quarkusio/quarkus/18625/18391 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18391 | https://github.com/quarkusio/quarkus/pull/18625 | https://github.com/quarkusio/quarkus/pull/18625 | 1 | resolves | Quarkus CLI test are run even if `--no-tests` is specified | ## Describe the bug
When building using the CLI with command `quarkus build --no-tests` the tests are still executed.
### Expected behavior
No tests should be run
### Actual behavior
Tests are run
## To Reproduce
Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).
Or attach an archive containing the reproducer to the issue.
Steps to reproduce the behavior:
1. `quarkus create app -a bug-reproducer`
2. `cd bug-reproducer`
3. `quarkus build --no-tests`
### Configuration
### Screenshots
(If applicable, add screenshots to help explain your problem.)
## Environment (please complete the following information):
### Output of `uname -a` or `ver`
Darwin tqvarnst-mac 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
### Output of `java -version`
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)
### GraalVM version (if different from Java)
### Quarkus version or git rev
2.0.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Quarkus CLI
```
> quarkus --version
Client Version 2.0.0.Final
```
## Additional context
(Add any other context about the problem here.)
| 67aa11451e71ac22beee86182bbc11a9633f7c97 | fef11c4141d8b6dad4ac888b4f221978691ef51f | https://github.com/quarkusio/quarkus/compare/67aa11451e71ac22beee86182bbc11a9633f7c97...fef11c4141d8b6dad4ac888b4f221978691ef51f | diff --git a/devtools/cli/src/main/java/io/quarkus/cli/Build.java b/devtools/cli/src/main/java/io/quarkus/cli/Build.java
index 15968b8d693..bb0f29dbaa1 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/Build.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/Build.java
@@ -64,10 +64,7 @@ void dryRunBuild(CommandLine.Help help, BuildTool buildTool, BuildSystemRunner.B
@Override
public String toString() {
- return "Build [clean=" + buildOptions.clean
- + ", buildNative=" + buildOptions.buildNative
- + ", offline=" + buildOptions.offline
- + ", runTests=" + buildOptions.runTests
+ return "Build [buildOptions=" + buildOptions
+ ", properties=" + propertiesOptions.properties
+ ", output=" + output
+ ", params=" + params + "]";
diff --git a/devtools/cli/src/main/java/io/quarkus/cli/build/JBangRunner.java b/devtools/cli/src/main/java/io/quarkus/cli/build/JBangRunner.java
index 8fea16b1df3..592b3483818 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/build/JBangRunner.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/build/JBangRunner.java
@@ -82,7 +82,12 @@ public BuildCommandArgs prepareBuild(BuildOptions buildOptions, RunModeOption ru
if (buildOptions.buildNative) {
args.add("--native");
}
+ if (buildOptions.clean) {
+ args.add("--fresh");
+ }
+
args.add("build");
+ args.addAll(flattenMappedProperties(propertiesOptions.properties));
args.addAll(params);
args.add(getMainPath());
return prependExecutable(args);
diff --git a/devtools/cli/src/main/java/io/quarkus/cli/common/BuildOptions.java b/devtools/cli/src/main/java/io/quarkus/cli/common/BuildOptions.java
index 7aa0807587b..c67fd0598d6 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/common/BuildOptions.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/common/BuildOptions.java
@@ -13,10 +13,17 @@ public class BuildOptions {
@CommandLine.Option(order = 5, names = { "--offline" }, description = "Work offline.", defaultValue = "false")
public boolean offline = false;
- @CommandLine.Option(order = 6, names = { "--tests" }, description = "Run tests.", negatable = true)
- public boolean runTests = true;
+ @CommandLine.Option(order = 6, names = {
+ "--no-tests" }, description = "Run tests.", negatable = true, defaultValue = "false")
+ public boolean skipTests = false;
public boolean skipTests() {
- return !runTests;
+ return skipTests;
+ }
+
+ @Override
+ public String toString() {
+ return "BuildOptions [buildNative=" + buildNative + ", clean=" + clean + ", offline=" + offline + ", skipTests="
+ + skipTests + "]";
}
}
diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliDriver.java b/devtools/cli/src/test/java/io/quarkus/cli/CliDriver.java
index d7c30449ce7..6c487e42948 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/CliDriver.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/CliDriver.java
@@ -306,11 +306,12 @@ public static Result invokeExtensionRemoveNonexistent(Path projectRoot) throws E
}
public static Result invokeValidateDryRunBuild(Path projectRoot) throws Exception {
- Result result = execute(projectRoot, "build", "-e", "-B", "--clean", "--dryrun",
+ Result result = execute(projectRoot, "build", "-e", "-B", "--dryrun",
"-Dproperty=value1", "-Dproperty2=value2");
Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode,
"Expected OK return code. Result:\\n" + result);
- System.out.println(result.stdout);
+ Assertions.assertTrue(result.stdout.contains("Command line"),
+ "--dry-run should echo command line");
return result;
}
diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliNonProjectTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliNonProjectTest.java
index 100136eae4c..51e2792d7d1 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/CliNonProjectTest.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/CliNonProjectTest.java
@@ -58,7 +58,6 @@ public void testBuildOutsideOfProject() throws Exception {
CliDriver.Result result = CliDriver.execute(workspaceRoot, "build", "-e");
Assertions.assertEquals(CommandLine.ExitCode.USAGE, result.exitCode,
"'quarkus build' should fail outside of a quarkus project directory:\\n" + result);
- System.out.println(result);
}
@Test
@@ -66,7 +65,6 @@ public void testDevOutsideOfProject() throws Exception {
CliDriver.Result result = CliDriver.execute(workspaceRoot, "dev", "-e");
Assertions.assertEquals(CommandLine.ExitCode.USAGE, result.exitCode,
"'quarkus dev' should fail outside of a quarkus project directory:\\n" + result);
- System.out.println(result);
}
@Test
diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java
index 6ad76fc1160..6c05469a152 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java
@@ -179,6 +179,47 @@ public void testExtensionList() throws Exception {
"Expected OK return code. Result:\\n" + result);
}
+ @Test
+ public void testBuildOptions() throws Exception {
+ CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "app", "--gradle", "-e", "-B", "--verbose");
+ Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode, "Expected OK return code." + result);
+
+ // 1 --clean --tests --native --offline
+ result = CliDriver.execute(project, "build", "-e", "-B", "--dry-run",
+ "--clean", "--tests", "--native", "--offline");
+
+ Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode,
+ "Expected OK return code. Result:\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains(" clean"),
+ "gradle command should specify 'clean'\\n" + result);
+
+ Assertions.assertFalse(result.stdout.contains("-x test"),
+ "gradle command should not specify '-x test'\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains("-Dquarkus.package.type=native"),
+ "gradle command should specify -Dquarkus.package.type=native\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains("--offline"),
+ "gradle command should specify --offline\\n" + result);
+
+ // 2 --no-clean --no-tests
+ result = CliDriver.execute(project, "build", "-e", "-B", "--dry-run",
+ "--no-clean", "--no-tests");
+
+ Assertions.assertFalse(result.stdout.contains(" clean"),
+ "gradle command should not specify 'clean'\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains("-x test"),
+ "gradle command should specify '-x test'\\n" + result);
+
+ Assertions.assertFalse(result.stdout.contains("native"),
+ "gradle command should not specify native\\n" + result);
+
+ Assertions.assertFalse(result.stdout.contains("offline"),
+ "gradle command should not specify offline\\n" + result);
+ }
+
@Test
public void testCreateArgPassthrough() throws Exception {
Path nested = workspaceRoot.resolve("cli-nested");
diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java
index 0361777ead3..18550990654 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java
@@ -45,6 +45,8 @@ public void testCreateAppDefaults() throws Exception {
"Generated source should reference resteasy. Found:\\n" + source);
result = CliDriver.invokeValidateDryRunBuild(project);
+ Assertions.assertTrue(result.stdout.contains("-Dproperty=value1 -Dproperty2=value2"),
+ "result should contain '-Dproperty=value1 -Dproperty2=value2':\\n" + result.stdout);
CliDriver.invokeValidateBuild(project);
}
@@ -113,6 +115,45 @@ public void testCreateCliDefaults() throws Exception {
"Expected OK return code. Result:\\n" + result);
}
+ @Test
+ public void testBuildOptions() throws Exception {
+ CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "app", "--jbang", "-e", "-B", "--verbose");
+ Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode, "Expected OK return code." + result);
+
+ // 1 --clean --tests --native --offline
+ result = CliDriver.execute(project, "build", "-e", "-B", "--dry-run",
+ "--clean", "--tests", "--native", "--offline");
+
+ Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode,
+ "Expected OK return code. Result:\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains("--fresh"),
+ "jbang command should specify '--fresh'\\n" + result);
+
+ // presently no support for --tests or --no-tests
+
+ Assertions.assertTrue(result.stdout.contains("--native"),
+ "jbang command should specify --native\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains("--offline"),
+ "jbang command should specify --offline\\n" + result);
+
+ // 2 --no-clean --no-tests
+ result = CliDriver.execute(project, "build", "-e", "-B", "--dry-run",
+ "--no-clean", "--no-tests");
+
+ Assertions.assertFalse(result.stdout.contains("--fresh"),
+ "jbang command should not specify '--fresh'\\n" + result);
+
+ // presently no support for --tests or --no-tests
+
+ Assertions.assertFalse(result.stdout.contains("native"),
+ "jbang command should not specify native\\n" + result);
+
+ Assertions.assertFalse(result.stdout.contains("offline"),
+ "jbang command should not specify offline\\n" + result);
+ }
+
void validateBasicIdentifiers(Path project, String group, String artifact, String version) throws Exception {
Assertions.assertTrue(project.resolve("README.md").toFile().exists(),
"README.md should exist: " + project.resolve("README.md").toAbsolutePath().toString());
diff --git a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectMavenTest.java b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectMavenTest.java
index 44796ca824f..284ccbc3863 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectMavenTest.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectMavenTest.java
@@ -114,6 +114,50 @@ public void testExtensionList() throws Exception {
"Expected error return code. Result:\\n" + result);
}
+ @Test
+ public void testBuildOptions() throws Exception {
+ CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "app", "-e", "-B", "--verbose");
+ Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode, "Expected OK return code." + result);
+
+ // 1 --clean --tests --native --offline
+ result = CliDriver.execute(project, "build", "-e", "-B", "--dry-run",
+ "--clean", "--tests", "--native", "--offline");
+ Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode,
+ "Expected OK return code. Result:\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains(" clean"),
+ "mvn command should specify 'clean'\\n" + result);
+
+ Assertions.assertFalse(result.stdout.contains("-DskipTests"),
+ "mvn command should not specify -DskipTests\\n" + result);
+ Assertions.assertFalse(result.stdout.contains("-Dmaven.test.skip=true"),
+ "mvn command should not specify -Dmaven.test.skip=true\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains("-Dnative"),
+ "mvn command should specify -Dnative\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains("--offline"),
+ "mvn command should specify --offline\\n" + result);
+
+ // 2 --no-clean --no-tests
+ result = CliDriver.execute(project, "build", "-e", "-B", "--dry-run",
+ "--no-clean", "--no-tests");
+
+ Assertions.assertFalse(result.stdout.contains(" clean"),
+ "mvn command should not specify 'clean'\\n" + result);
+
+ Assertions.assertTrue(result.stdout.contains("-DskipTests"),
+ "mvn command should specify -DskipTests\\n" + result);
+ Assertions.assertTrue(result.stdout.contains("-Dmaven.test.skip=true"),
+ "mvn command should specify -Dmaven.test.skip=true\\n" + result);
+
+ Assertions.assertFalse(result.stdout.contains("-Dnative"),
+ "mvn command should not specify -Dnative\\n" + result);
+
+ Assertions.assertFalse(result.stdout.contains("--offline"),
+ "mvn command should not specify --offline\\n" + result);
+ }
+
@Test
public void testCreateCliDefaults() throws Exception {
CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "cli", "-e", "-B", "--verbose"); | ['devtools/cli/src/main/java/io/quarkus/cli/Build.java', 'devtools/cli/src/main/java/io/quarkus/cli/build/JBangRunner.java', 'devtools/cli/src/test/java/io/quarkus/cli/CliNonProjectTest.java', 'devtools/cli/src/test/java/io/quarkus/cli/CliProjectMavenTest.java', 'devtools/cli/src/test/java/io/quarkus/cli/CliProjectJBangTest.java', 'devtools/cli/src/main/java/io/quarkus/cli/common/BuildOptions.java', 'devtools/cli/src/test/java/io/quarkus/cli/CliDriver.java', 'devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java'] | {'.java': 8} | 8 | 8 | 0 | 0 | 8 | 17,441,514 | 3,390,855 | 448,034 | 4,666 | 1,032 | 222 | 23 | 3 | 1,405 | 192 | 416 | 52 | 0 | 1 | 2021-07-12T15:42:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,708 | quarkusio/quarkus/18600/18598 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18598 | https://github.com/quarkusio/quarkus/pull/18600 | https://github.com/quarkusio/quarkus/pull/18600 | 1 | fixes | Extension quarkus-vertx-graphql interferes with extension quarkus-resteasy-multipart | ## Describe the bug
After upgrading to Quarks 2.0 I discovered an issue with my application that uses the extensions quarkus-vertx-graphql and quarkus-resteasy-multipart. While running my application in devmode if I perform a multipart form data post to a JAX-RS endpoint none of the parts are received by the JAX-RS endpoint. If i remove the quarkus-vertx-graphql dependency from my application it works fine. The application also works fine in production mode when I directly run the quarkus-run.jar.
### Expected behavior
The multipart form parameter parts are available regardless of what mode the Quarkus application is run in or if the quarkus-vertx-graphql extensions is included in the application.
### Actual behavior
The request reaches the endpoint but no parts are available.
## To Reproduce
Reproducer: https://github.com/aaronanderson/quarkus-multipart
I experimented with the 2.0.1.Final version of the VertxGraphqlProcessor class and if I comment out this line and build the extension it fixes the issue:
https://github.com/quarkusio/quarkus/blob/9e0736c5091bc34791ceffe6b760f111af0b63bf/extensions/vertx-graphql/deployment/src/main/java/io/quarkus/vertx/graphql/deployment/VertxGraphqlProcessor.java#L84
I am not sure what the RequireBodyHandlerBuildItem does or why it would affect the multipart extension. I did confirm it is required for the vertx-graphql extension to work.
Steps to reproduce the behavior:
1. Check out the reproducer build and run it.
2. Remove the quarkus-vertx-graphql or modify the VertxGraphqlProcessor class as mentioned above to successfully run the test.
## Environment (please complete the following information):
### Output of `java -version`
```
java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment Corretto-16.0.1.9.1 (build 16.0.1+9)
OpenJDK 64-Bit Server VM Corretto-16.0.1.9.1 (build 16.0.1+9, mixed mode, sharing)
```
### Quarkus version or git rev
2.0.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
mvn -version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /home/xxxx/apache-maven-3.8.1
Java version: 16.0.1, vendor: Amazon.com Inc., runtime: /home/xxxx/jdk-16
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.13.0-051300-generic", arch: "amd64", family: "unix"
## Additional context
(Add any other context about the problem here.)
| c04f968d7aada70a93be6335756187c74955a9d0 | 22a495cb91bedb95ab76346bf7ce0d67702d9524 | https://github.com/quarkusio/quarkus/compare/c04f968d7aada70a93be6335756187c74955a9d0...22a495cb91bedb95ab76346bf7ce0d67702d9524 | diff --git a/extensions/vertx-graphql/deployment/src/main/java/io/quarkus/vertx/graphql/deployment/VertxGraphqlProcessor.java b/extensions/vertx-graphql/deployment/src/main/java/io/quarkus/vertx/graphql/deployment/VertxGraphqlProcessor.java
index 3f19e383ca7..febf834c992 100644
--- a/extensions/vertx-graphql/deployment/src/main/java/io/quarkus/vertx/graphql/deployment/VertxGraphqlProcessor.java
+++ b/extensions/vertx-graphql/deployment/src/main/java/io/quarkus/vertx/graphql/deployment/VertxGraphqlProcessor.java
@@ -16,8 +16,8 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.runtime.configuration.ConfigurationException;
import io.quarkus.vertx.graphql.runtime.VertxGraphqlRecorder;
+import io.quarkus.vertx.http.deployment.BodyHandlerBuildItem;
import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem;
-import io.quarkus.vertx.http.deployment.RequireBodyHandlerBuildItem;
import io.quarkus.vertx.http.deployment.RouteBuildItem;
import io.quarkus.vertx.http.deployment.WebsocketSubProtocolsBuildItem;
import io.vertx.core.Handler;
@@ -48,13 +48,13 @@ List<ReflectiveClassBuildItem> registerForReflection() {
}
@BuildStep
- @Record(ExecutionTime.STATIC_INIT)
+ @Record(ExecutionTime.RUNTIME_INIT)
void registerVertxGraphqlUI(VertxGraphqlRecorder recorder,
BuildProducer<NativeImageResourceDirectoryBuildItem> nativeResourcesProducer, VertxGraphqlConfig config,
LaunchModeBuildItem launchMode,
NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem,
BuildProducer<RouteBuildItem> routes,
- BuildProducer<RequireBodyHandlerBuildItem> body) {
+ BodyHandlerBuildItem bodyHandler) {
boolean includeVertxGraphqlUi = launchMode.getLaunchMode().isDevOrTest() || config.ui.alwaysInclude;
if (!includeVertxGraphqlUi) {
@@ -77,11 +77,9 @@ void registerVertxGraphqlUI(VertxGraphqlRecorder recorder,
.build());
routes.produce(
nonApplicationRootPathBuildItem.routeBuilder()
- .route(path + "/*")
+ .routeFunction(path + "/*", recorder.routeFunction(bodyHandler.getHandler()))
.handler(handler)
.build());
- // Body handler required in Vert.x 4, to avoid DDOS attack.
- body.produce(new RequireBodyHandlerBuildItem());
nativeResourcesProducer.produce(new NativeImageResourceDirectoryBuildItem("io/vertx/ext/web/handler/graphiql"));
}
diff --git a/extensions/vertx-graphql/runtime/src/main/java/io/quarkus/vertx/graphql/runtime/VertxGraphqlRecorder.java b/extensions/vertx-graphql/runtime/src/main/java/io/quarkus/vertx/graphql/runtime/VertxGraphqlRecorder.java
index 1ed8d191ceb..79e2fea1c95 100644
--- a/extensions/vertx-graphql/runtime/src/main/java/io/quarkus/vertx/graphql/runtime/VertxGraphqlRecorder.java
+++ b/extensions/vertx-graphql/runtime/src/main/java/io/quarkus/vertx/graphql/runtime/VertxGraphqlRecorder.java
@@ -1,8 +1,11 @@
package io.quarkus.vertx.graphql.runtime;
+import java.util.function.Consumer;
+
import io.quarkus.runtime.annotations.Recorder;
import io.vertx.core.Handler;
import io.vertx.core.http.HttpHeaders;
+import io.vertx.ext.web.Route;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.handler.graphql.GraphiQLHandler;
import io.vertx.ext.web.handler.graphql.GraphiQLHandlerOptions;
@@ -32,4 +35,14 @@ public void handle(RoutingContext event) {
}
};
}
+
+ public Consumer<Route> routeFunction(Handler<RoutingContext> bodyHandler) {
+ return new Consumer<Route>() {
+ @Override
+ public void accept(Route route) {
+ route.handler(bodyHandler);
+ }
+ };
+ }
+
} | ['extensions/vertx-graphql/runtime/src/main/java/io/quarkus/vertx/graphql/runtime/VertxGraphqlRecorder.java', 'extensions/vertx-graphql/deployment/src/main/java/io/quarkus/vertx/graphql/deployment/VertxGraphqlProcessor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 17,438,030 | 3,390,240 | 447,965 | 4,666 | 945 | 185 | 23 | 2 | 2,469 | 307 | 682 | 50 | 2 | 1 | 2021-07-12T07:22:45 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,742 | quarkusio/quarkus/17689/17592 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17592 | https://github.com/quarkusio/quarkus/pull/17689 | https://github.com/quarkusio/quarkus/pull/17689 | 1 | fixes | re-augmentation causes information to get lost in 2.0.0.CR2 | ## Describe the bug
Some of the generated code in `/quarkus-app/quarkus/generated-bytecode.jar` gets lost if the project is re-augmented after the build.
### Expected behavior
I can run re-augmentation any number of time and will always get the original if no build time properties have changed.
### Actual behavior
The augmentation output after re-augmentation is reduced and leads to a different runtime behavior.
## To Reproduce
* Checkout `https://github.com/renegrob/reproducer-base/tree/reaugmentation-issue`
* build project with `./gradlew clean :app:quarkusBuild -Dquarkus.package.type=mutable-jar`
* Copy the augmentation output in `app/build/quarkus-app/quarkus/` away.
* Run re-augmentation without changing the configuation: `java -jar -Dquarkus.launch.rebuild=true app/build/quarkus-app/quarkus-run.jar`
If you compare the initial augmentation output and the one after re-augmentation you notice that:
* open-api-doc is empty after re-augmentation: `reproducer-base/app/build/quarkus-app/quarkus/generated-bytecode.jar!/META-INF/quarkus-generated-openapi-doc.YAML`
(See also https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/2.2E0.2E0.2ECR2.20NullPointerExceptions.20after.20Reagumentation)
Link to a small reproducer (preferably a Maven project if the issue is not Gradle-specific).
https://github.com/renegrob/reproducer-base/tree/reaugmentation-issue
Or attach an archive containing the reproducer to the issue.
## Environment (please complete the following information):
### Output of `uname -a` or `ver`
`Linux automatix 5.8.0-53-generic #60~20.04.1-Ubuntu`
### Output of `java -version`
```
openjdk version "11.0.11" 2021-04-20 LTS
OpenJDK Runtime Environment Zulu11.48+21-CA (build 11.0.11+9-LTS)
OpenJDK 64-Bit Server VM Zulu11.48+21-CA (build 11.0.11+9-LTS, mixed mode)
```
### GraalVM version (if different from Java)
n/a
### Quarkus version or git rev
`2.0.0.CR2`
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
```
------------------------------------------------------------
Gradle 6.5.1
------------------------------------------------------------
Build time: 2020-06-30 06:32:47 UTC
Revision: 66bc713f7169626a7f0134bf452abde51550ea0a
Kotlin: 1.3.72
Groovy: 2.5.11
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 11.0.11 (Azul Systems, Inc. 11.0.11+9-LTS)
OS: Linux 5.8.0-53-generic amd64
```
## Additional context
n/a
| 2c069ce845d44be11da03d97303b3c528c20d841 | 2e28b511505d7fb819cff006e923eed6fc85122e | https://github.com/quarkusio/quarkus/compare/2c069ce845d44be11da03d97303b3c528c20d841...2e28b511505d7fb819cff006e923eed6fc85122e | diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppModel.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppModel.java
index 453258db877..67983300d10 100644
--- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppModel.java
+++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppModel.java
@@ -16,6 +16,8 @@
/**
* A representation of the Quarkus dependency model for a given application.
*
+ * Changes made to this class should also be reflected in {@link PersistentAppModel}
+ *
* @author Alexey Loubyansky
*/
public class AppModel implements Serializable {
diff --git a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java
index 203276a5731..8d027a545b4 100644
--- a/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java
+++ b/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java
@@ -29,6 +29,7 @@ public class PersistentAppModel implements Serializable {
private Set<AppArtifactKey> lesserPriorityArtifacts;
private Set<AppArtifactKey> localProjectArtifacts;
private Map<String, String> platformProperties;
+ private Map<String, CapabilityContract> capabilitiesContracts;
private String userProvidersDirectory;
public PersistentAppModel(String baseName, Map<AppArtifactKey, List<String>> paths, AppModel appModel,
@@ -54,6 +55,7 @@ public PersistentAppModel(String baseName, Map<AppArtifactKey, List<String>> pat
parentFirstArtifacts = new HashSet<>(appModel.getParentFirstArtifacts());
runnerParentFirstArtifacts = new HashSet<>(appModel.getRunnerParentFirstArtifacts());
lesserPriorityArtifacts = new HashSet<>(appModel.getLesserPriorityArtifacts());
+ capabilitiesContracts = new HashMap<>(appModel.getCapabilityContracts());
}
public String getUserProvidersDirectory() {
@@ -85,6 +87,7 @@ public AppModel getAppModel(Path root) {
for (AppArtifactKey i : localProjectArtifacts) {
model.addLocalProjectArtifact(i);
}
+ model.setCapabilitiesContracts(capabilitiesContracts);
final PlatformImportsImpl pi = new PlatformImportsImpl();
pi.setPlatformProperties(platformProperties);
model.setPlatformImports(pi); | ['independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/PersistentAppModel.java', 'independent-projects/bootstrap/app-model/src/main/java/io/quarkus/bootstrap/model/AppModel.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 16,738,185 | 3,252,928 | 430,509 | 4,535 | 303 | 51 | 5 | 2 | 2,531 | 258 | 720 | 63 | 3 | 2 | 2021-06-04T06:52:10 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,733 | quarkusio/quarkus/17895/17893 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17893 | https://github.com/quarkusio/quarkus/pull/17895 | https://github.com/quarkusio/quarkus/pull/17895 | 1 | fixes | MongoDB BSON types are not in the Jandex index | ## Describe the bug
When building Quarkus application that using `mongodb-client` and `mongodb-panache` extentions, ReflectiveHierarchyStep grumbles:
```
[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:
- org.bson.types.ObjectId (source: <unknown>)
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
Create a sample application:
```
mvn io.quarkus:quarkus-maven-plugin:1.13.7.Final:create \\
-DprojectGroupId=org.acme \\
-DprojectArtifactId=getting-started \\
-Dextensions=resteasy,mongodb-client,mongodb-panache
```
Add sample entity:
```java
package org.acme;
import io.quarkus.mongodb.panache.MongoEntity;
@MongoEntity
public class SampleEntity {
}
```
Add sample repository:
```java
package org.acme;
import javax.enterprise.context.ApplicationScoped;
import io.quarkus.mongodb.panache.PanacheMongoRepository;
@ApplicationScoped
public class SampleRepository implements PanacheMongoRepository<SampleEntity> {
}
```
Build project and observe mentioned message:
```
mvn clean package -DskipTests
```
## Environment
```
$ uname -a
Darwin mbp 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
$ mvn --version
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /opt/local/share/java/maven3
Java version: 11.0.11, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/openjdk11/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "11.4", arch: "x86_64", family: "mac"
```
### Quarkus version or git rev
`1.13.7.Final`, also tried build from main branch:
```
$ git describe --all --tags --always --long
heads/main-0-gfc31727672
```
## Additional info
To resolve issue already tried to add `org.mongodb:bson` to `quarkus.index-dependency`.
The problem here is that all classes within bson library is added to Jandex index, including all CodecProvider's. This causes MongoClientProcessor to register all internal codec providers again, and fail on many of this that does not have default no-arg constructor.
The better solution is to add BuildStep in mongodb-client extention, that should explicitly add only org.bson.types.* classes to Jandex index. I'll try to provide PR with fix for this issue.
| 47ccea85d4a934ec916dad0c2d1a0f7aa8a64c3a | 431516215d6566ce00aa21b5ec38f9ce8fd5b9d9 | https://github.com/quarkusio/quarkus/compare/47ccea85d4a934ec916dad0c2d1a0f7aa8a64c3a...431516215d6566ce00aa21b5ec38f9ce8fd5b9d9 | diff --git a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java
index 7e1076053a7..8e39a69b417 100644
--- a/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java
+++ b/extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java
@@ -45,6 +45,7 @@
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.annotations.Weak;
+import io.quarkus.deployment.builditem.AdditionalIndexedClassesBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
@@ -68,6 +69,23 @@ public class MongoClientProcessor {
private static final DotName MONGO_CLIENT = DotName.createSimple(MongoClient.class.getName());
private static final DotName REACTIVE_MONGO_CLIENT = DotName.createSimple(ReactiveMongoClient.class.getName());
+ @BuildStep
+ AdditionalIndexedClassesBuildItem includeBsonTypesToIndex() {
+ return new AdditionalIndexedClassesBuildItem(
+ "org.bson.types.BasicBSONList",
+ "org.bson.types.Binary",
+ "org.bson.types.BSONTimestamp",
+ "org.bson.types.Code",
+ "org.bson.types.CodeWithScope",
+ "org.bson.types.CodeWScope",
+ "org.bson.types.Decimal128",
+ "org.bson.types.MaxKey",
+ "org.bson.types.MinKey",
+ "org.bson.types.ObjectId",
+ "org.bson.types.StringRangeSet",
+ "org.bson.types.Symbol");
+ }
+
@BuildStep
CodecProviderBuildItem collectCodecProviders(CombinedIndexBuildItem indexBuildItem) {
Collection<ClassInfo> codecProviderClasses = indexBuildItem.getIndex() | ['extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 16,879,477 | 3,279,867 | 434,319 | 4,571 | 763 | 156 | 18 | 1 | 2,829 | 317 | 771 | 86 | 0 | 7 | 2021-06-14T16:33: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 |
2,736 | quarkusio/quarkus/17823/17667 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17667 | https://github.com/quarkusio/quarkus/pull/17823 | https://github.com/quarkusio/quarkus/pull/17823 | 1 | fixes | GraphQL handler blows up if request contains newline breaks | ## Describe the bug
When an incoming GraphQL query contains newline characters, the JSON parser that parses it blows up.
### Expected behavior
Request with newlines is parsed, the newlines ignored
### Actual behavior
The request processing blows up on something like
```
javax.json.stream.JsonParsingException: Unexpected char 10 at (line no=1, column no=19, offset=18)
```
where the "char 10" is a newline character
| d7ad0a109da2e53225228b17b524b10889fb1792 | a2a0ac4731d58d45d62daca2211547d550e4a86a | https://github.com/quarkusio/quarkus/compare/d7ad0a109da2e53225228b17b524b10889fb1792...a2a0ac4731d58d45d62daca2211547d550e4a86a | diff --git a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java
index eeb0b5b1c11..cb5b0ae464c 100644
--- a/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java
+++ b/extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java
@@ -152,6 +152,28 @@ public void testGenerics() {
"{\\"data\\":{\\"generics\\":{\\"message\\":\\"I know it\\"}}}"));
}
+ /**
+ * Send a query in JSON that contains raw unescaped line breaks and tabs inside the "query" string,
+ * which technically is forbidden by the JSON spec, but we want to seamlessly support
+ * queries from Java text blocks, for example, which preserve line breaks and tab characters.
+ */
+ @Test
+ public void testQueryWithNewlinesAndTabs() {
+ String foosRequest = "{\\"query\\": \\"query myquery { \\n generics { \\n \\t message } } \\"}";
+
+ RestAssured.given().when()
+ .accept(MEDIATYPE_JSON)
+ .contentType(MEDIATYPE_JSON)
+ .body(foosRequest)
+ .post("/graphql")
+ .then()
+ .assertThat()
+ .statusCode(200)
+ .and()
+ .body(CoreMatchers.containsString(
+ "{\\"data\\":{\\"generics\\":{\\"message\\":\\"I know it\\"}}}"));
+ }
+
@Test
public void testContext() {
String query = getPayload("{context}");
diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java
index 215dec4994b..99af8227e95 100644
--- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java
+++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java
@@ -118,7 +118,7 @@ private void handleGet(HttpServerResponse response, RoutingContext ctx) {
private JsonObject getJsonObjectFromQueryParameters(RoutingContext ctx) throws UnsupportedEncodingException {
JsonObjectBuilder input = Json.createObjectBuilder();
// Query
- String query = readQueryParameter(ctx, QUERY);
+ String query = stripNewlinesAndTabs(readQueryParameter(ctx, QUERY));
if (query != null && !query.isEmpty()) {
input.add(QUERY, URLDecoder.decode(query, "UTF8"));
}
@@ -129,14 +129,14 @@ private JsonObject getJsonObjectFromQueryParameters(RoutingContext ctx) throws U
}
// Variables
- String variables = readQueryParameter(ctx, VARIABLES);
+ String variables = stripNewlinesAndTabs(readQueryParameter(ctx, VARIABLES));
if (variables != null && !variables.isEmpty()) {
JsonObject jsonObject = toJsonObject(URLDecoder.decode(variables, "UTF8"));
input.add(VARIABLES, jsonObject);
}
// Extensions
- String extensions = readQueryParameter(ctx, EXTENSIONS);
+ String extensions = stripNewlinesAndTabs(readQueryParameter(ctx, EXTENSIONS));
if (extensions != null && !extensions.isEmpty()) {
JsonObject jsonObject = toJsonObject(URLDecoder.decode(extensions, "UTF8"));
input.add(EXTENSIONS, jsonObject);
@@ -148,7 +148,8 @@ private JsonObject getJsonObjectFromQueryParameters(RoutingContext ctx) throws U
private JsonObject getJsonObjectFromBody(RoutingContext ctx) throws IOException {
String contentType = readContentType(ctx);
- String body = readBody(ctx);
+ String body = stripNewlinesAndTabs(readBody(ctx));
+
// If the content type is application/graphql, the query is in the body
if (contentType != null && contentType.startsWith(APPLICATION_GRAPHQL)) {
JsonObjectBuilder input = Json.createObjectBuilder();
@@ -188,6 +189,22 @@ private String readQueryParameter(RoutingContext ctx, String parameterName) {
return null;
}
+ /**
+ * Strip away unescaped tabs and line breaks from the incoming JSON document so that it can be
+ * successfully parsed by a JSON parser.
+ * This does NOT remove properly escaped \\n and \\t inside the document, just the raw characters (ASCII
+ * values 9 and 10). Technically, this is not compliant with the JSON spec,
+ * but we want to seamlessly support queries from Java text blocks, for example,
+ * which preserve line breaks and tab characters.
+ */
+ private String stripNewlinesAndTabs(String input) {
+ if (input == null || input.isEmpty()) {
+ return input;
+ }
+ return input.replaceAll("\\\\n", " ")
+ .replaceAll("\\\\t", " ");
+ }
+
private boolean hasQueryParameters(RoutingContext ctx) {
return hasQueryParameter(ctx, QUERY) || hasQueryParameter(ctx, OPERATION_NAME) || hasQueryParameter(ctx, VARIABLES)
|| hasQueryParameter(ctx, EXTENSIONS); | ['extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java', 'extensions/smallrye-graphql/deployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 16,867,685 | 3,277,560 | 433,987 | 4,570 | 1,271 | 260 | 25 | 1 | 431 | 62 | 95 | 13 | 0 | 1 | 2021-06-10T07:57:02 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,737 | quarkusio/quarkus/17798/17618 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17618 | https://github.com/quarkusio/quarkus/pull/17798 | https://github.com/quarkusio/quarkus/pull/17798 | 1 | fixes | Live Coding (Regression): Warnings when the changing code contains `@ConfigProperty` | ## Describe the bug
Using DEV mode and live coding activated, given my resource as:
```
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.eclipse.microprofile.config.inject.ConfigProperty;
@Path("/hello")
public class GreetingResource {
public static final String PROPERTY = "custom.property.name";
@ConfigProperty(name = PROPERTY)
String name;
@GET
@Produces(MediaType.TEXT_PLAIN)
public String sayHello() {
return "Hello, I'm " + name;
}
}
```
When I run my Quarkus app in DEV mode: `mvn quarkus:dev`.
And update anything in the GreetingResource, for example, from "Hello" to "Hi", the console prints the following warnings when the changes are detected:
```
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2021-06-02 07:49:13,913 INFO [io.quarkus] (Quarkus Main Thread) getting-started 1.0.0-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 1.485s. Listening on: http://localhost:8080
2021-06-02 07:49:13,936 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-06-02 07:49:13,937 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy, smallrye-context-propagation]
2021-06-02 07:49:29,055 INFO [io.qua.dep.dev.RuntimeUpdatesProcessor] (vert.x-worker-thread-0) Changed source files detected, recompiling GreetingResource.java
2021-06-02 07:49:29,478 WARN [io.qua.dep.dev.JavaCompilationProvider] (vert.x-worker-thread-0) unknown enum constant org.osgi.annotation.bundle.Requirement.Resolution.OPTIONAL
reason: class file for org.osgi.annotation.bundle.Requirement$Resolution not found, line -1 in [unknown source]
2021-06-02 07:49:29,480 WARN [io.qua.dep.dev.JavaCompilationProvider] (vert.x-worker-thread-0) unknown enum constant org.osgi.annotation.bundle.Requirement.Resolution.OPTIONAL
reason: class file for org.osgi.annotation.bundle.Requirement$Resolution not found, line -1 in [unknown source]
2021-06-02 07:49:29,480 WARN [io.qua.dep.dev.JavaCompilationProvider] (vert.x-worker-thread-0) unknown enum constant org.osgi.annotation.bundle.Requirement.Resolution.OPTIONAL
reason: class file for org.osgi.annotation.bundle.Requirement$Resolution not found, line -1 in [unknown source]
2021-06-02 07:49:29,488 INFO [io.quarkus] (Quarkus Main Thread) getting-started stopped in 0.003s
```
The warnings are unexpected as far I can tell.
Moreover, no warnings are thrown if we don't use the `@ConfigProperty` annotation.
## Environment (please complete the following information):
### GraalVM version (if different from Java)
### Quarkus version or git rev
2.X and 999-SNAPSHOT
## Additional context
These warnings were not printed using the Quarkus version 1.13.6.Final.
| 599c6f048c54c1e6d58181029c90de3315c0b3e5 | deba854cda5525cb6d46c386185eb9f1225922c8 | https://github.com/quarkusio/quarkus/compare/599c6f048c54c1e6d58181029c90de3315c0b3e5...deba854cda5525cb6d46c386185eb9f1225922c8 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/JavaCompilationProvider.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/JavaCompilationProvider.java
index 2346fba5cbf..487a874b6f9 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/JavaCompilationProvider.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/JavaCompilationProvider.java
@@ -34,6 +34,7 @@ public class JavaCompilationProvider implements CompilationProvider {
// -parameters is used to generate metadata for reflection on method parameters
// this is useful when people using debuggers against their hot-reloaded app
private static final Set<String> COMPILER_OPTIONS = new HashSet<>(Arrays.asList("-g", "-parameters"));
+ private static final Set<String> IGNORE_NAMESPACES = new HashSet<>(Collections.singletonList("org.osgi"));
JavaCompiler compiler;
StandardJavaFileManager fileManager;
@@ -74,17 +75,10 @@ public void compile(Set<File> filesToCompile, Context context) {
throw new RuntimeException("Compilation failed" + diagnostics.getDiagnostics());
}
- for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
- log.logf(diagnostic.getKind() == Diagnostic.Kind.ERROR ? Logger.Level.ERROR : Logger.Level.WARN,
- "%s, line %d in %s", diagnostic.getMessage(null), diagnostic.getLineNumber(),
- diagnostic.getSource() == null ? "[unknown source]" : diagnostic.getSource().getName());
- }
+ logDiagnostics(diagnostics);
+
if (!fileManagerDiagnostics.getDiagnostics().isEmpty()) {
- for (Diagnostic<? extends JavaFileObject> diagnostic : fileManagerDiagnostics.getDiagnostics()) {
- log.logf(diagnostic.getKind() == Diagnostic.Kind.ERROR ? Logger.Level.ERROR : Logger.Level.WARN,
- "%s, line %d in %s", diagnostic.getMessage(null), diagnostic.getLineNumber(),
- diagnostic.getSource() == null ? "[unknown source]" : diagnostic.getSource().getName());
- }
+ logDiagnostics(fileManagerDiagnostics);
fileManager.close();
fileManagerDiagnostics = null;
fileManager = null;
@@ -117,6 +111,28 @@ public void close() throws IOException {
}
}
+ private void logDiagnostics(final DiagnosticCollector<JavaFileObject> diagnostics) {
+ for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics.getDiagnostics()) {
+ Logger.Level level = diagnostic.getKind() == Diagnostic.Kind.ERROR ? Logger.Level.ERROR : Logger.Level.WARN;
+ String message = diagnostic.getMessage(null);
+ if (level.equals(Logger.Level.WARN) && ignoreWarningForNamespace(message)) {
+ continue;
+ }
+
+ log.logf(level, "%s, line %d in %s", message, diagnostic.getLineNumber(),
+ diagnostic.getSource() == null ? "[unknown source]" : diagnostic.getSource().getName());
+ }
+ }
+
+ private static boolean ignoreWarningForNamespace(String message) {
+ for (String ignoreNamespace : IGNORE_NAMESPACES) {
+ if (message.contains(ignoreNamespace)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
static class RuntimeUpdatesClassVisitor extends ClassVisitor {
private final PathsCollection sourcePaths;
private final String classesPath; | ['core/deployment/src/main/java/io/quarkus/deployment/dev/JavaCompilationProvider.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 16,865,684 | 3,277,185 | 433,934 | 4,570 | 2,127 | 375 | 36 | 1 | 2,928 | 314 | 804 | 60 | 1 | 2 | 2021-06-09T11:55:50 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,738 | quarkusio/quarkus/17794/17793 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17793 | https://github.com/quarkusio/quarkus/pull/17794 | https://github.com/quarkusio/quarkus/pull/17794 | 1 | fixes | quarkus:dev continuous testing stuck | ## Describe the bug
running mvn quarkus:dev on https://github.com/michalszynkiewicz/todos-with-rr-and-grpc results in:
```
[/tmp/todos]$ mvn clean quarkus:dev
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------------< com.example:todos >--------------------------
[INFO] Building todos 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ todos ---
[INFO] Deleting /tmp/todos/target
[INFO]
[INFO] --- quarkus-maven-plugin:999-SNAPSHOT:dev (default-cli) @ todos ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 14 source files to /tmp/todos/target/classes
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /tmp/todos/src/test/resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /tmp/todos/target/test-classes
Listening for transport dt_socket at address: 5005
2021-06-09 12:40:04,470 INFO [org.tes.doc.DockerClientProviderStrategy] (build-52) Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
2021-06-09 12:40:04,696 INFO [org.tes.doc.DockerClientProviderStrategy] (build-52) Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
2021-06-09 12:40:04,697 INFO [org.tes.DockerClientFactory] (build-52) Docker host IP address is localhost
2021-06-09 12:40:04,716 INFO [org.tes.DockerClientFactory] (build-52) Connected to docker:
Server Version: 20.10.7
API Version: 1.41
Operating System: Fedora 34 (KDE Plasma)
Total Memory: 64294 MB
2021-06-09 12:40:04,718 INFO [org.tes.uti.ImageNameSubstitutor] (build-52) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
2021-06-09 12:40:04,734 INFO [org.tes.uti.RegistryAuthLocator] (build-52) Failure when attempting to lookup auth config. Please ignore if you don't have images in an authenticated registry. Details: (dockerImageName: testcontainers/ryuk:0.3.1, configFile: /home/michal/.docker/config.json. Falling back to docker-java default behaviour. Exception message: /home/michal/.docker/config.json (Nie ma takiego pliku ani katalogu)
2021-06-09 12:40:05,402 INFO [org.tes.DockerClientFactory] (build-52) Ryuk started - will monitor and terminate Testcontainers containers on JVM exit
2021-06-09 12:40:05,402 INFO [org.tes.DockerClientFactory] (build-52) Checking the system...
2021-06-09 12:40:05,403 INFO [org.tes.DockerClientFactory] (build-52) ✔︎ Docker server version should be at least 1.6.0
2021-06-09 12:40:05,457 INFO [org.tes.DockerClientFactory] (build-52) ✔︎ Docker environment should have more than 2GB free disk space
2021-06-09 12:40:05,478 INFO [🐳 .2]] (build-52) Creating container for image: postgres:13.2
2021-06-09 12:40:05,624 INFO [🐳 .2]] (build-52) Starting container with ID: ae25f45c88c1731bb38188a980210e9e377555351b12f4d063751b5743cdf19a
2021-06-09 12:40:06,080 INFO [🐳 .2]] (build-52) Container postgres:13.2 is starting: ae25f45c88c1731bb38188a980210e9e377555351b12f4d063751b5743cdf19a
2021-06-09 12:40:10,245 INFO [🐳 .2]] (build-52) Container postgres:13.2 started in PT4.787415S
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2021-06-09 12:40:10,722 INFO [io.qua.grp.run.GrpcServerRecorder] (Quarkus Main Thread) Registering gRPC reflection service
2021-06-09 12:40:10,762 INFO [io.qua.grp.run.GrpcServerRecorder] (vert.x-eventloop-thread-0) gRPC Server started on 0.0.0.0:9000 [SSL enabled: false]
2021-06-09 12:40:10,808 INFO [org.hib.rea.pro.imp.ReactiveIntegrator] (JPA Startup Thread: default-reactive) HRX000001: Hibernate Reactive Preview
2021-06-09 12:40:10,882 WARN [io.ver.sql.imp.SocketConnectionBase] (vert.x-eventloop-thread-1) Backend notice: severity='NOTICE', code='00000', message='table "todo" does not exist, skipping', detail='null', hint='null', position='null', internalPosition='null', internalQuery='null', where='null', file='tablecmds.c', line='1217', routine='DropErrorMsgNonExistent', schema='null', table='null', column='null', dataType='null', constraint='null'
2021-06-09 12:40:10,883 WARN [io.ver.sql.imp.SocketConnectionBase] (vert.x-eventloop-thread-1) Backend notice: severity='NOTICE', code='00000', message='sequence "hibernate_sequence" does not exist, skipping', detail='null', hint='null', position='null', internalPosition='null', internalQuery='null', where='null', file='tablecmds.c', line='1217', routine='DropErrorMsgNonExistent', schema='null', table='null', column='null', dataType='null', constraint='null'
2021-06-09 12:40:10,886 WARN [io.ver.sql.imp.SocketConnectionBase] (vert.x-eventloop-thread-1) Backend notice: severity='NOTICE', code='00000', message='table "todo" does not exist, skipping', detail='null', hint='null', position='null', internalPosition='null', internalQuery='null', where='null', file='tablecmds.c', line='1217', routine='DropErrorMsgNonExistent', schema='null', table='null', column='null', dataType='null', constraint='null'
2021-06-09 12:40:10,886 WARN [io.ver.sql.imp.SocketConnectionBase] (vert.x-eventloop-thread-1) Backend notice: severity='NOTICE', code='00000', message='sequence "hibernate_sequence" does not exist, skipping', detail='null', hint='null', position='null', internalPosition='null', internalQuery='null', where='null', file='tablecmds.c', line='1217', routine='DropErrorMsgNonExistent', schema='null', table='null', column='null', dataType='null', constraint='null'
2021-06-09 12:40:10,929 INFO [io.quarkus] (Quarkus Main Thread) todos 1.0.0-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 6.858s. Listening on: http://localhost:8080
2021-06-09 12:40:10,930 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-06-09 12:40:10,930 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, grpc-server, hibernate-orm, hibernate-reactive, hibernate-reactive-panache, reactive-pg-client, resteasy-reactive, resteasy-reactive-jackson, sma2021-06-09 12:42:58,694 WARN [io.ver.cor.imp.BlockedThreadChecker] (vertx-blocked-thread-checker) Thread Thread[vert.x-worker-thread-0,5,main] has been blocked for 60281 ms, time limit is 60000 ms: io.vertx.core.VertxException: Thread blocked
at io.quarkus.deployment.dev.testing.TestSupport.pause(TestSupport.java:198)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:360)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:350)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:64)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$2.handle(VertxHttpHotReplacementSetup.java:54)
at io.vertx.core.impl.ContextImpl.lambda$null$0(ContextImpl.java:160)
at io.vertx.core.impl.ContextImpl$$Lambda$853/0x0000000800989840.handle(Unknown Source)
at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:96)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:158)
at io.vertx.core.impl.ContextImpl$$Lambda$852/0x0000000800989040.run(Unknown Source)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at [email protected]/java.lang.Thread.run(Thread.java:834)
```
The error message is repeated for a long time, I quit waiting after 5 minutes. | 599c6f048c54c1e6d58181029c90de3315c0b3e5 | 3b20d40928af4bd3ca2e80aeec72cbd8f2facd5b | https://github.com/quarkusio/quarkus/compare/599c6f048c54c1e6d58181029c90de3315c0b3e5...3b20d40928af4bd3ca2e80aeec72cbd8f2facd5b | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
index 7dd54e179f5..84c5b9cca19 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java
@@ -194,15 +194,17 @@ public TestRunResults getTestRunResults() {
return testRunResults;
}
- public synchronized void pause() {
- if (started) {
- testRunner.pause();
+ public void pause() {
+ TestRunner tr = this.testRunner;
+ if (tr != null) {
+ tr.pause();
}
}
- public synchronized void resume() {
- if (started) {
- testRunner.resume();
+ public void resume() {
+ TestRunner tr = this.testRunner;
+ if (tr != null) {
+ tr.resume();
}
}
| ['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestSupport.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 16,865,684 | 3,277,185 | 433,934 | 4,570 | 439 | 90 | 14 | 1 | 8,385 | 650 | 2,473 | 76 | 2 | 1 | 2021-06-09T11:00: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 |
2,739 | quarkusio/quarkus/17763/17724 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17724 | https://github.com/quarkusio/quarkus/pull/17763 | https://github.com/quarkusio/quarkus/pull/17763 | 1 | resolves | Scheduler is not triggered or triggered 2 times randomly with native image | ## Describe the bug
Randomly, scheduler is not triggered or triggered 2 times with native image
This behavior is not observed in "jvm mode"
### Expected behavior
Scheduler should trigger 1 time and doesn't miss any trigger event with native image
## To Reproduce
https://github.com/jmpdev34/reproducer-scheduler-native
Steps to reproduce the behavior:
The reproducer should schedule every second based on a cron expression.
When the scheduler method is fired, a log with the datetime is printed
If the scheduler triggers 2 times, a log is printed : 'Already triggered ..."
1. Build a native image of the reproducer project
2. Start runner
3. Wait for a "Already triggered' log and verify if a second hasn't been triggered
Note : if none "Already triggered" log appears, try to shutdown et re-start the runner and/or start another activity on the computer (IT tests on a project for example)
### Configuration
```properties
# Add your application.properties here, if applicable.
reproducer.scheduler.cron=0/1 * * ? * *
```
## Environment (please complete the following information):
### Output of `uname -a` or `ver`
Linux 344910zx2006 4.15.0-142-generic #146-Ubuntu SMP Tue Apr 13 01:11:19 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "11.0.9" 2020-10-20
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.9+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.9+11, mixed mode)
### GraalVM version (if different from Java)
graalvm-ce-java11-20.1.0
### Quarkus version or git rev
1.11.5.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
maven version 3.6.3
| 59852b2d39142236b3297b9042d80a61287fbb6e | ab144e268aa246a11f192a6fa56d053111e81ddb | https://github.com/quarkusio/quarkus/compare/59852b2d39142236b3297b9042d80a61287fbb6e...ab144e268aa246a11f192a6fa56d053111e81ddb | diff --git a/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java b/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java
index 0d3e85c1db9..b82838afa88 100644
--- a/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java
+++ b/extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java
@@ -45,7 +45,7 @@
@Singleton
public class SimpleScheduler implements Scheduler {
- private static final Logger LOGGER = Logger.getLogger(SimpleScheduler.class);
+ private static final Logger LOG = Logger.getLogger(SimpleScheduler.class);
// milliseconds
private static final long CHECK_PERIOD = 1000L;
@@ -65,10 +65,10 @@ public SimpleScheduler(SchedulerContext context, SchedulerRuntimeConfig schedule
if (!schedulerRuntimeConfig.enabled) {
this.scheduledExecutor = null;
- LOGGER.info("Simple scheduler is disabled by config property and will not be started");
+ LOG.info("Simple scheduler is disabled by config property and will not be started");
} else if (context.getScheduledMethods().isEmpty()) {
this.scheduledExecutor = null;
- LOGGER.info("No scheduled business methods found - Simple scheduler will not be started");
+ LOG.info("No scheduled business methods found - Simple scheduler will not be started");
} else {
this.scheduledExecutor = new JBossScheduledThreadPoolExecutor(1, new Runnable() {
@Override
@@ -118,16 +118,17 @@ void stop() {
scheduledExecutor.shutdownNow();
}
} catch (Exception e) {
- LOGGER.warn("Unable to shutdown the scheduler executor", e);
+ LOG.warn("Unable to shutdown the scheduler executor", e);
}
}
void checkTriggers() {
if (!running) {
- LOGGER.trace("Skip all triggers - scheduler paused");
+ LOG.trace("Skip all triggers - scheduler paused");
return;
}
ZonedDateTime now = ZonedDateTime.now();
+ LOG.tracef("Check triggers at %s", now);
for (ScheduledTask task : scheduledTasks) {
task.execute(now, executor);
}
@@ -136,7 +137,7 @@ void checkTriggers() {
@Override
public void pause() {
if (!enabled) {
- LOGGER.warn("Scheduler is disabled and cannot be paused");
+ LOG.warn("Scheduler is disabled and cannot be paused");
} else {
running = false;
}
@@ -146,7 +147,7 @@ public void pause() {
public void pause(String identity) {
Objects.requireNonNull(identity, "Cannot pause - identity is null");
if (identity.isEmpty()) {
- LOGGER.warn("Cannot pause - identity is empty");
+ LOG.warn("Cannot pause - identity is empty");
return;
}
String parsedIdentity = SchedulerUtils.lookUpPropertyValue(identity);
@@ -161,7 +162,7 @@ public void pause(String identity) {
@Override
public void resume() {
if (!enabled) {
- LOGGER.warn("Scheduler is disabled and cannot be resumed");
+ LOG.warn("Scheduler is disabled and cannot be resumed");
} else {
running = true;
}
@@ -171,7 +172,7 @@ public void resume() {
public void resume(String identity) {
Objects.requireNonNull(identity, "Cannot resume - identity is null");
if (identity.isEmpty()) {
- LOGGER.warn("Cannot resume - identity is empty");
+ LOG.warn("Cannot resume - identity is empty");
return;
}
String parsedIdentity = SchedulerUtils.lookUpPropertyValue(identity);
@@ -250,13 +251,12 @@ public void run() {
try {
invoker.invoke(new SimpleScheduledExecution(now, scheduledFireTime, trigger));
} catch (Throwable t) {
- LOGGER.errorf(t, "Error occured while executing task for trigger %s", trigger);
+ LOG.errorf(t, "Error occured while executing task for trigger %s", trigger);
}
}
});
- LOGGER.debugf("Executing scheduled task for trigger %s", trigger);
} catch (RejectedExecutionException e) {
- LOGGER.warnf("Rejected execution of a scheduled task for trigger %s", trigger);
+ LOG.warnf("Rejected execution of a scheduled task for trigger %s", trigger);
}
}
}
@@ -268,6 +268,7 @@ static abstract class SimpleTrigger implements Trigger {
private final String id;
private volatile boolean running;
protected final ZonedDateTime start;
+ protected volatile ZonedDateTime lastFireTime;
public SimpleTrigger(String id, ZonedDateTime start) {
this.id = id;
@@ -298,8 +299,8 @@ public synchronized void setRunning(boolean running) {
static class IntervalTrigger extends SimpleTrigger {
+ // milliseconds
private final long interval;
- private volatile ZonedDateTime lastFireTime;
public IntervalTrigger(String id, ZonedDateTime start, long interval) {
super(id, start);
@@ -316,9 +317,11 @@ ZonedDateTime evaluate(ZonedDateTime now) {
lastFireTime = now.truncatedTo(ChronoUnit.SECONDS);
return now;
}
- if (ChronoUnit.MILLIS.between(lastFireTime, now) >= interval) {
+ long diff = ChronoUnit.MILLIS.between(lastFireTime, now);
+ if (diff >= interval) {
ZonedDateTime scheduledFireTime = lastFireTime.plus(Duration.ofMillis(interval));
lastFireTime = now.truncatedTo(ChronoUnit.SECONDS);
+ LOG.tracef("%s fired, diff=%s ms", this, diff);
return scheduledFireTime;
}
return null;
@@ -345,9 +348,6 @@ public String toString() {
static class CronTrigger extends SimpleTrigger {
- // microseconds
- private static final long DIFF_THRESHOLD = CHECK_PERIOD * 1000;
-
private final Cron cron;
private final ExecutionTime executionTime;
@@ -355,6 +355,7 @@ public CronTrigger(String id, ZonedDateTime start, Cron cron) {
super(id, start);
this.cron = cron;
this.executionTime = ExecutionTime.forCron(cron);
+ this.lastFireTime = ZonedDateTime.now();
}
@Override
@@ -373,17 +374,13 @@ ZonedDateTime evaluate(ZonedDateTime now) {
if (now.isBefore(start)) {
return null;
}
- Optional<ZonedDateTime> lastFireTime = executionTime.lastExecution(now);
- if (lastFireTime.isPresent()) {
- ZonedDateTime trunc = lastFireTime.get().truncatedTo(ChronoUnit.SECONDS);
- if (now.isBefore(trunc)) {
- return null;
- }
- // Use microseconds precision to workaround incompatibility between jdk8 and jdk9+
- long diff = ChronoUnit.MICROS.between(trunc, now);
- if (diff <= DIFF_THRESHOLD) {
- LOGGER.debugf("%s fired, diff=%s μs", this, diff);
- return trunc;
+ Optional<ZonedDateTime> lastExecution = executionTime.lastExecution(now);
+ if (lastExecution.isPresent()) {
+ ZonedDateTime lastTruncated = lastExecution.get().truncatedTo(ChronoUnit.SECONDS);
+ if (now.isAfter(lastTruncated) && lastFireTime.isBefore(lastTruncated)) {
+ LOG.tracef("%s fired, last=", this, lastTruncated);
+ lastFireTime = now;
+ return lastTruncated;
}
}
return null; | ['extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 16,801,208 | 3,264,663 | 432,281 | 4,540 | 3,591 | 670 | 53 | 1 | 1,687 | 243 | 447 | 47 | 1 | 1 | 2021-06-08T10:03:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,740 | quarkusio/quarkus/17719/17717 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17717 | https://github.com/quarkusio/quarkus/pull/17719 | https://github.com/quarkusio/quarkus/pull/17719 | 1 | fixes | Continuous testing quarkus:test goal requires @QuarkusTest annotation | ## Describe the bug
Maven's quarkus:test goal seems to require at least one @QuarkusTest annotated test to run the tests. If no test is annotated, they don't run. If at least one is annotated, all tests run.
The quarkus:dev goal runs all the tests even without any annotation.
### Expected behavior
mvn quarkus:test runs the same tests as mvn quarkus:dev and they don't necessarily require @QuarkusTest.
### Actual behavior
mvn quarkus:test only runs tests if at least one is annotated with @QuarkusTest
## To Reproduce
Reproducer https://github.com/kwakiutlCS/vigilant-funicular
Steps to reproduce the behavior:
1. run mvn quarkus:test (hangs)
2. run mvn quarkus:dev and run tests (succeeds)
3. add a second test file with @QuarkusTest (go back 1 commit) and run mvn quarkus:test (succeeds)
### Quarkus version or git rev
Quarkus 2.0.0.CR3
## Additional context
Sometimes besides hanging a log message appears
INFO [org.jun.pla.lau.cor.EngineDiscoveryOrchestrator] (Test runner thread) 0 containers and XX tests were Unknown
where XX is the number of tests
| c8cd44aad6e1fb8989f154ae264ce2dda742c07e | caecd6ffa4ecae76c294d0369c6eeb3db083076c | https://github.com/quarkusio/quarkus/compare/c8cd44aad6e1fb8989f154ae264ce2dda742c07e...caecd6ffa4ecae76c294d0369c6eeb3db083076c | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestHandler.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestHandler.java
index 84ca23784f7..c810bbb68ce 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestHandler.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestHandler.java
@@ -3,11 +3,12 @@
import java.util.function.BiConsumer;
import io.quarkus.builder.BuildResult;
+import io.quarkus.dev.console.QuarkusConsole;
public class TestHandler implements BiConsumer<Object, BuildResult> {
@Override
public void accept(Object o, BuildResult buildResult) {
+ QuarkusConsole.start();
TestSupport.instance().get().start();
-
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestTracingProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestTracingProcessor.java
index a267151241f..502a21101d3 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestTracingProcessor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestTracingProcessor.java
@@ -44,6 +44,7 @@ LogCleanupFilterBuildItem handle() {
}
@BuildStep(onlyIf = IsDevelopment.class)
+ @Produce(TestSetupBuildItem.class)
void setupConsole(TestConfig config, BuildProducer<TestListenerBuildItem> testListenerBuildItemBuildProducer) {
if (!TestSupport.instance().isPresent() || config.continuousTesting == TestConfig.Mode.DISABLED
|| config.flatClassPath) { | ['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestTracingProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestHandler.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 16,739,532 | 3,253,171 | 430,526 | 4,534 | 120 | 29 | 4 | 2 | 1,094 | 159 | 297 | 28 | 1 | 0 | 2021-06-06T23:56: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 |
2,741 | quarkusio/quarkus/17716/17706 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17706 | https://github.com/quarkusio/quarkus/pull/17716 | https://github.com/quarkusio/quarkus/pull/17716 | 1 | close | 2.0.0.CR3 gradle `quarkus-generated-sources` in wrong place | ## Describe the bug
Building project with gradle with version 2.0.0.CR3 creates `quarkus-generated-sources` and `quarkus-test-generated-sources` empty directories at the module level. I believe they must be created under `build` directory
### Expected behavior
All build directories appear under `build` directory
### Actual behavior
Empty directories appear after `./gradlew clean build`
## To Reproduce
Steps to reproduce the behavior:
1. Checkout this repo - https://github.com/Shohou/quarkus-liquibase-bug (nevermind the name, created for #17523)
2. in master branch run `./gradlew clean build`
3. Check under `db` directory. Two new empty directories appear there
4. Same under `quark` module
| 9d38a3bf636fdd6ebf3e0852d2e2fd708bdc07d2 | d8fd0b974b89a36018995475a44f40fa04dcdd55 | https://github.com/quarkusio/quarkus/compare/9d38a3bf636fdd6ebf3e0852d2e2fd708bdc07d2...d8fd0b974b89a36018995475a44f40fa04dcdd55 | diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
index f1a8c420e5b..68c30b0de12 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
@@ -217,11 +217,7 @@ public void execute(Task test) {
tasks.withType(Test.class).whenTaskAdded(configureTestTask::accept);
SourceSet generatedSourceSet = sourceSets.create(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
- generatedSourceSet.getOutput()
- .dir(QuarkusGenerateCode.QUARKUS_GENERATED_SOURCES);
SourceSet generatedTestSourceSet = sourceSets.create(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);
- generatedTestSourceSet.getOutput()
- .dir(QuarkusGenerateCode.QUARKUS_TEST_GENERATED_SOURCES);
// Register the quarkus-generated-code
for (String provider : QuarkusGenerateCode.CODE_GENERATION_PROVIDER) {
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java
index e34da5d08d7..cb291cb5c6c 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java
@@ -20,7 +20,7 @@
import org.gradle.api.plugins.JavaPluginConvention;
import org.gradle.api.tasks.CompileClasspath;
import org.gradle.api.tasks.InputFiles;
-import org.gradle.api.tasks.OutputDirectories;
+import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.TaskAction;
@@ -78,10 +78,10 @@ public Set<File> getInputDirectory() {
return inputDirectories;
}
- @OutputDirectories
- public FileCollection getGeneratedOutputDirectory() {
+ @OutputDirectory
+ public File getGeneratedOutputDirectory() {
final String generatedSourceSetName = test ? QUARKUS_TEST_GENERATED_SOURCES : QUARKUS_GENERATED_SOURCES;
- return QuarkusGradleUtils.getSourceSet(getProject(), generatedSourceSetName).getOutput().getDirs();
+ return QuarkusGradleUtils.getSourceSet(getProject(), generatedSourceSetName).getJava().getOutputDir();
}
@TaskAction | ['devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java', 'devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 16,739,816 | 3,253,223 | 430,530 | 4,534 | 744 | 144 | 12 | 2 | 718 | 94 | 171 | 17 | 1 | 0 | 2021-06-06T18:14:46 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,743 | quarkusio/quarkus/17685/17527 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17527 | https://github.com/quarkusio/quarkus/pull/17685 | https://github.com/quarkusio/quarkus/pull/17685 | 1 | fixes | Overriding SecurityContext doesn't work with quarkus-resteasy-reactive, but works with quarkus-resteasy | ## Describe the bug
I use AWS cognito to get a JWT token. I have the following code to override quarkus ContainerRequestContext's security context with my own with additional attributes from Cognito
`@PreMatching
public class SecurityFilter implements ContainerRequestFilter {
@Inject
AuthenticationContextImpl authCtx;
@Override
public void filter(ContainerRequestContext requestContext) {
String authHeader = requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);
AUser user = new AUser(xxxxx);
requestContext.setSecurityContext(new SecurityContext() {
@Override
public Principal getUserPrincipal() {
return new Principal() {
@Override
public String getName() {
return user.getName();
}
};
}
@Override
public boolean isUserInRole(String r) {
return user.getGroups().contains(r);
}
@Override
public boolean isSecure() {
return true;
}
@Override
public String getAuthenticationScheme() {
return "basic";
}
public XXXUser getUser(){
return user;
}
});
}`
This works fine when I use quarkus-resteasy dependency
`
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
`
but throws the following exception when I use quarkus-rest-easy-reactive dependency
`2021-05-21 23:27:43,564 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-1) HTTP Request to /interests failed, error id: f5b561bd-c844-45cc-80b0-dbc4077409b9-1: javax.enterprise.inject.UnsatisfiedResolutionException: No bean found for required type [interface io.quarkus.security.identity.CurrentIdentityAssociation] and qualifiers [[]]
at io.quarkus.arc.impl.InstanceImpl.bean(InstanceImpl.java:175)
at io.quarkus.arc.impl.InstanceImpl.getInternal(InstanceImpl.java:196)
at io.quarkus.arc.impl.InstanceImpl.get(InstanceImpl.java:93)
at io.quarkus.resteasy.reactive.server.runtime.security.SecurityContextOverrideHandler.updateIdentity(SecurityContextOverrideHandler.java:46)
at io.quarkus.resteasy.reactive.server.runtime.security.SecurityContextOverrideHandler.handle(SecurityContextOverrideHandler.java:41)
at io.quarkus.resteasy.reactive.server.runtime.security.SecurityContextOverrideHandler.handle(SecurityContextOverrideHandler.java:25)`
### Expected behavior
Overriding SecurityContext through a filter shouldn't break quarkus-reactive
### Actual behavior
Breaks quarkus-reactive
## Additional context
@geoand asked to open this issue https://stackoverflow.com/questions/67644917/quarkus-overriding-securitycontext-doesnt-work-with-quarkus-resteasy-reactive
| 5f7622e96017a5e8d3b00f6744cb46cc594ca7c3 | cf92218e162251b34d69b1aa03723682d8cb7ba4 | https://github.com/quarkusio/quarkus/compare/5f7622e96017a5e8d3b00f6744cb46cc594ca7c3...cf92218e162251b34d69b1aa03723682d8cb7ba4 | diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/SecurityContextOverrideHandler.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/SecurityContextOverrideHandler.java
index f9e6b49835e..d50d96a7a40 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/SecurityContextOverrideHandler.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/SecurityContextOverrideHandler.java
@@ -8,7 +8,6 @@
import java.util.Set;
import java.util.function.Function;
-import javax.enterprise.inject.spi.CDI;
import javax.ws.rs.core.SecurityContext;
import org.jboss.resteasy.reactive.server.core.ResteasyReactiveRequestContext;
@@ -16,6 +15,7 @@
import org.jboss.resteasy.reactive.server.spi.ServerRestHandler;
import io.quarkus.arc.Arc;
+import io.quarkus.arc.InjectableInstance;
import io.quarkus.resteasy.reactive.server.runtime.ResteasyReactiveSecurityContext;
import io.quarkus.security.credential.Credential;
import io.quarkus.security.identity.CurrentIdentityAssociation;
@@ -24,8 +24,7 @@
public class SecurityContextOverrideHandler implements ServerRestHandler {
- private volatile SecurityIdentity securityIdentity;
- private volatile CurrentIdentityAssociation currentIdentityAssociation;
+ private volatile InjectableInstance<CurrentIdentityAssociation> currentIdentityAssociation;
@Override
public void handle(ResteasyReactiveRequestContext requestContext) throws Exception {
@@ -43,83 +42,78 @@ public void handle(ResteasyReactiveRequestContext requestContext) throws Excepti
private void updateIdentity(ResteasyReactiveRequestContext requestContext, SecurityContext modified) {
requestContext.requireCDIRequestScope();
- CurrentIdentityAssociation currentIdentityAssociation = Arc.container().select(CurrentIdentityAssociation.class).get();
- Uni<SecurityIdentity> oldIdentity = currentIdentityAssociation.getDeferredIdentity();
- currentIdentityAssociation.setIdentity(oldIdentity.map(new Function<SecurityIdentity, SecurityIdentity>() {
- @Override
- public SecurityIdentity apply(SecurityIdentity old) {
- Set<Credential> oldCredentials = old.getCredentials();
- Map<String, Object> oldAttributes = old.getAttributes();
- return new SecurityIdentity() {
- @Override
- public Principal getPrincipal() {
- return modified.getUserPrincipal();
- }
-
- @Override
- public boolean isAnonymous() {
- return modified.getUserPrincipal() == null;
- }
-
- @Override
- public Set<String> getRoles() {
- throw new UnsupportedOperationException(
- "retrieving all roles not supported when JAX-RS security context has been replaced");
- }
-
- @Override
- public boolean hasRole(String role) {
- return modified.isUserInRole(role);
- }
-
- @Override
- public <T extends Credential> T getCredential(Class<T> credentialType) {
- for (Credential cred : getCredentials()) {
- if (credentialType.isAssignableFrom(cred.getClass())) {
- return (T) cred;
+ InjectableInstance<CurrentIdentityAssociation> instance = getCurrentIdentityAssociation();
+ if (instance.isResolvable()) {
+ CurrentIdentityAssociation currentIdentityAssociation = instance.get();
+ Uni<SecurityIdentity> oldIdentity = currentIdentityAssociation.getDeferredIdentity();
+ currentIdentityAssociation.setIdentity(oldIdentity.map(new Function<SecurityIdentity, SecurityIdentity>() {
+ @Override
+ public SecurityIdentity apply(SecurityIdentity old) {
+ Set<Credential> oldCredentials = old.getCredentials();
+ Map<String, Object> oldAttributes = old.getAttributes();
+ return new SecurityIdentity() {
+ @Override
+ public Principal getPrincipal() {
+ return modified.getUserPrincipal();
+ }
+
+ @Override
+ public boolean isAnonymous() {
+ return modified.getUserPrincipal() == null;
+ }
+
+ @Override
+ public Set<String> getRoles() {
+ throw new UnsupportedOperationException(
+ "retrieving all roles not supported when JAX-RS security context has been replaced");
+ }
+
+ @Override
+ public boolean hasRole(String role) {
+ return modified.isUserInRole(role);
+ }
+
+ @Override
+ public <T extends Credential> T getCredential(Class<T> credentialType) {
+ for (Credential cred : getCredentials()) {
+ if (credentialType.isAssignableFrom(cred.getClass())) {
+ return (T) cred;
+ }
}
+ return null;
}
- return null;
- }
-
- @Override
- public Set<Credential> getCredentials() {
- return oldCredentials;
- }
-
- @Override
- public <T> T getAttribute(String name) {
- return (T) oldAttributes.get(name);
- }
-
- @Override
- public Map<String, Object> getAttributes() {
- return oldAttributes;
- }
-
- @Override
- public Uni<Boolean> checkPermission(Permission permission) {
- return Uni.createFrom().nullItem();
- }
- };
- }
- }));
- }
- private CurrentIdentityAssociation getCurrentIdentityAssociation() {
- CurrentIdentityAssociation identityAssociation = this.currentIdentityAssociation;
- if (identityAssociation == null) {
- return this.currentIdentityAssociation = CDI.current().select(CurrentIdentityAssociation.class).get();
+ @Override
+ public Set<Credential> getCredentials() {
+ return oldCredentials;
+ }
+
+ @Override
+ public <T> T getAttribute(String name) {
+ return (T) oldAttributes.get(name);
+ }
+
+ @Override
+ public Map<String, Object> getAttributes() {
+ return oldAttributes;
+ }
+
+ @Override
+ public Uni<Boolean> checkPermission(Permission permission) {
+ return Uni.createFrom().nullItem();
+ }
+ };
+ }
+ }));
}
- return identityAssociation;
}
- private SecurityIdentity getSecurityIdentity() {
- SecurityIdentity identity = this.securityIdentity;
- if (identity == null) {
- return this.securityIdentity = CDI.current().select(SecurityIdentity.class).get();
+ private InjectableInstance<CurrentIdentityAssociation> getCurrentIdentityAssociation() {
+ InjectableInstance<CurrentIdentityAssociation> identityAssociation = this.currentIdentityAssociation;
+ if (identityAssociation == null) {
+ return this.currentIdentityAssociation = Arc.container().select(CurrentIdentityAssociation.class);
}
- return identity;
+ return identityAssociation;
}
public static class Customizer implements HandlerChainCustomizer { | ['extensions/resteasy-reactive/quarkus-resteasy-reactive/runtime/src/main/java/io/quarkus/resteasy/reactive/server/runtime/security/SecurityContextOverrideHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 16,738,185 | 3,252,928 | 430,509 | 4,535 | 6,846 | 958 | 140 | 1 | 3,023 | 199 | 618 | 78 | 1 | 0 | 2021-06-03T23:30:02 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,709 | quarkusio/quarkus/18578/18577 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/18577 | https://github.com/quarkusio/quarkus/pull/18578 | https://github.com/quarkusio/quarkus/pull/18578 | 1 | fixes | DevServices crashes immediately on Fedora | ## Describe the bug
Any attempt to start a test on Fedora results in this exception, since #18505 :
```
Build failure: Build failed due to errors
[error]: Build step io.quarkus.datasource.deployment.devservices.DevServicesDatasourceProcessor#launchDatabases threw an exception: java.lang.IllegalArgumentException: port out of range:-1
at java.base/java.net.InetSocketAddress.checkPort(InetSocketAddress.java:143)
at java.base/java.net.InetSocketAddress.<init>(InetSocketAddress.java:188)
at java.base/java.net.Socket.<init>(Socket.java:232)
at io.quarkus.deployment.IsDockerWorking.getAsBoolean(IsDockerWorking.java:43)
```
The problem is that I have the `DOCKER_HOST` variable pointing to a unix socket: `unix:/run/user/1000/podman/podman.sock`; this is quite common among Fedora / RHEL users.
Podman otherwise works fine, so I'd prefer if the return of this method was `true` - not sure what do to. Perhaps just skip this check if `DOCKER_HOST` starts with `unix:` ? | ba955f2a3f65e626a58f251fb9e4c94dd4602b3f | 7dc747585bb44462a91325c0fd568b090c62e0bd | https://github.com/quarkusio/quarkus/compare/ba955f2a3f65e626a58f251fb9e4c94dd4602b3f...7dc747585bb44462a91325c0fd568b090c62e0bd | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java b/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java
index 3a92377f1bf..1fce4a2260d 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java
@@ -37,7 +37,7 @@ public boolean getAsBoolean() {
//so we just see if the DOCKER_HOST is set and we can connect to it
//we can't actually verify it is docker listening on the other end
String dockerHost = System.getenv("DOCKER_HOST");
- if (dockerHost != null) {
+ if (dockerHost != null && !dockerHost.startsWith("unix:")) {
try {
URI url = new URI(dockerHost);
try (Socket s = new Socket(url.getHost(), url.getPort())) { | ['core/deployment/src/main/java/io/quarkus/deployment/IsDockerWorking.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 17,429,391 | 3,388,692 | 447,774 | 4,663 | 104 | 26 | 2 | 1 | 993 | 104 | 233 | 16 | 0 | 1 | 2021-07-09T17:05:58 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,744 | quarkusio/quarkus/17663/17234 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17234 | https://github.com/quarkusio/quarkus/pull/17663 | https://github.com/quarkusio/quarkus/pull/17663 | 1 | fixes | Building native images with quarkus-opentelemetry extension throw a Random/SplittableRandom initialized error at build time | ## Describe the bug
QuarkusVersion: Upstream
Extensions: quarkus-opentelemetry, quarkus-opentelemetry-exporter-jaeger
Reproducer: https://github.com/quarkus-qe/beefy-scenarios
Command: `mvn clean verify -Dnative -pl 300-quarkus-vertx-webClient -Pnative -DskipTests`
Error at native build time:
```
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected. To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace: Object was reached by
reading field io.grpc.internal.RetriableStream.random
```
Similar issue ref: https://github.com/quarkusio/quarkus/issues/14904
If we remove open telemetry extension, then the native build works as expected.
| 577f3ac64974b382efd77a345041b1178dd6fe60 | 2ece816729c5484c422ad701d5e07c53f80ed585 | https://github.com/quarkusio/quarkus/compare/577f3ac64974b382efd77a345041b1178dd6fe60...2ece816729c5484c422ad701d5e07c53f80ed585 | diff --git a/extensions/grpc-common/deployment/src/main/java/io/quarkus/grpc/common/deployment/GrpcCommonProcessor.java b/extensions/grpc-common/deployment/src/main/java/io/quarkus/grpc/common/deployment/GrpcCommonProcessor.java
index ebff9fee027..31d637e0535 100644
--- a/extensions/grpc-common/deployment/src/main/java/io/quarkus/grpc/common/deployment/GrpcCommonProcessor.java
+++ b/extensions/grpc-common/deployment/src/main/java/io/quarkus/grpc/common/deployment/GrpcCommonProcessor.java
@@ -58,7 +58,8 @@ NativeImageConfigBuildItem nativeImageConfiguration() {
// if they were not marked as runtime initialized:
.addRuntimeInitializedClass("io.grpc.netty.Utils")
.addRuntimeInitializedClass("io.grpc.netty.NettyServerBuilder")
- .addRuntimeInitializedClass("io.grpc.netty.NettyChannelBuilder");
+ .addRuntimeInitializedClass("io.grpc.netty.NettyChannelBuilder")
+ .addRuntimeInitializedClass("io.grpc.internal.RetriableStream");
return builder.build();
}
| ['extensions/grpc-common/deployment/src/main/java/io/quarkus/grpc/common/deployment/GrpcCommonProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 16,723,215 | 3,249,947 | 430,111 | 4,531 | 246 | 45 | 3 | 1 | 1,232 | 136 | 275 | 19 | 2 | 1 | 2021-06-03T09:40:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,745 | quarkusio/quarkus/17660/17657 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17657 | https://github.com/quarkusio/quarkus/pull/17660 | https://github.com/quarkusio/quarkus/pull/17660 | 1 | fixes | Using Vert.x Auth, Native image build failures on GraalVM 21.1 with Random/SplittableRandom initialized at build time | ## Describe the bug
Using the following Vert.x auth dependency:
```
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-auth-jwt</artifactId>
</dependency>
```
I'm aware that other community dependencies might not be working on Native, but unless we should provide workarounds for users to issues like this.
And then using the `io.vertx.ext.auth.jwt.JWTAuth`, for example:
```
@ApplicationScoped
public class JWTHandler {
@Inject
JWTAuth jwt;
public void createJwt(final RoutingContext context) {
String name = context.request().getParam("name");
context.response()
.putHeader("Content-Type", "application/json")
.end(new JsonObject().put("jwt", jwt.generateToken(defaultClaims(name, "admin"))).encode());
}
}
```
This fails to build on Native because JWTAuth uses `io.vertx.ext.auth.impl.jose.JWT` which contains a Random static field:
```
07:46:15,797 INFO [org.jbo.threads] JBoss Threads version 3.4.0.Final
[302-quarkus-vertx-jwt-1.0.0-SNAPSHOT-runner:25] (clinit): 806,08 ms, 3,80 GB
[302-quarkus-vertx-jwt-1.0.0-SNAPSHOT-runner:25] (typeflow): 28.646,08 ms, 3,80 GB
[302-quarkus-vertx-jwt-1.0.0-SNAPSHOT-runner:25] (objects): 38.354,78 ms, 3,80 GB
[302-quarkus-vertx-jwt-1.0.0-SNAPSHOT-runner:25] (features): 1.552,30 ms, 3,80 GB
[302-quarkus-vertx-jwt-1.0.0-SNAPSHOT-runner:25] analysis: 71.517,59 ms, 3,80 GB
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected. To see how this object got instantiated use --trace-object-instantiation=java.util.Random. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace:
at parsing io.vertx.ext.auth.impl.jose.JWT.sign(JWT.java:337)
Call path from entry point to io.vertx.ext.auth.impl.jose.JWT.sign(JsonObject, JWTOptions):
at io.vertx.ext.auth.impl.jose.JWT.sign(JWT.java:318)
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.generateToken(JWTAuthProviderImpl.java:179)
at io.vertx.ext.auth.jwt.impl.JWTAuthProviderImpl.generateToken(JWTAuthProviderImpl.java:184)
at io.quarkus.qe.vertx.web.handlers.JWTHandler.createJwt(JWTHandler.java:25)
at io.quarkus.qe.vertx.web.handlers.JWTHandler_ClientProxy.createJwt(JWTHandler_ClientProxy.zig:149)
at io.quarkus.qe.vertx.web.Application.lambda$onStart$8(Application.java:81)
at io.quarkus.qe.vertx.web.Application$$Lambda$1228/0x00000007c16f4040.handle(Unknown Source)
at io.vertx.core.impl.WorkerContext.lambda$execute$2(WorkerContext.java:103)
at io.vertx.core.impl.WorkerContext$$Lambda$1340/0x00000007c1729840.run(Unknown Source)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
```
This is when using GraalVM 21.1, but it worked fine using GraalVM 21.0.
## To Reproduce
Steps to reproduce the behavior:
1. `git clone https://github.com/Sgitario/beefy-scenarios`
2. cd beefy-scenarios
3. git checkout reproducer_17653
4. cd 302-quarkus-vertx-jwt
4. mvn clean verify -Dnative -Dquarkus.native.container-build=true -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-native-image:21.1-java11
## Environment (please complete the following information):
### GraalVM version (if different from Java)
21.1
### Quarkus version or git rev
999-SNAPSHOT (2.x)
| 577f3ac64974b382efd77a345041b1178dd6fe60 | 7e7acd82e008cbd39719754c2841524be46420ce | https://github.com/quarkusio/quarkus/compare/577f3ac64974b382efd77a345041b1178dd6fe60...7e7acd82e008cbd39719754c2841524be46420ce | diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java
index 73256e4db97..f2b3ce5928e 100644
--- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java
+++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java
@@ -299,8 +299,10 @@ void openSocket(ApplicationStartBuildItem start,
}
@BuildStep
- RuntimeInitializedClassBuildItem configureNativeCompilation() {
- return new RuntimeInitializedClassBuildItem("io.vertx.ext.web.handler.sockjs.impl.XhrTransport");
+ void configureNativeCompilation(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitializedClasses) {
+ runtimeInitializedClasses
+ .produce(new RuntimeInitializedClassBuildItem("io.vertx.ext.web.handler.sockjs.impl.XhrTransport"));
+ runtimeInitializedClasses.produce(new RuntimeInitializedClassBuildItem("io.vertx.ext.auth.impl.jose.JWT"));
}
/** | ['extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/VertxHttpProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 16,723,215 | 3,249,947 | 430,111 | 4,531 | 559 | 100 | 6 | 1 | 4,045 | 319 | 1,096 | 76 | 1 | 3 | 2021-06-03T08:54: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 |
Subsets and Splits