id
int64 0
10.2k
| text_id
stringlengths 17
67
| repo_owner
stringclasses 232
values | repo_name
stringclasses 295
values | issue_url
stringlengths 39
89
| pull_url
stringlengths 37
87
| comment_url
stringlengths 37
94
| links_count
int64 1
2
| link_keyword
stringclasses 12
values | issue_title
stringlengths 7
197
| issue_body
stringlengths 45
21.3k
| base_sha
stringlengths 40
40
| head_sha
stringlengths 40
40
| diff_url
stringlengths 120
170
| diff
stringlengths 478
132k
| changed_files
stringlengths 47
2.6k
| changed_files_exts
stringclasses 22
values | changed_files_count
int64 1
22
| java_changed_files_count
int64 1
22
| kt_changed_files_count
int64 0
0
| py_changed_files_count
int64 0
0
| code_changed_files_count
int64 1
22
| repo_symbols_count
int64 32.6k
242M
| repo_tokens_count
int64 6.59k
49.2M
| repo_lines_count
int64 992
6.2M
| repo_files_without_tests_count
int64 12
28.1k
| changed_symbols_count
int64 0
36.1k
| changed_tokens_count
int64 0
6.5k
| changed_lines_count
int64 0
561
| changed_files_without_tests_count
int64 1
17
| issue_symbols_count
int64 45
21.3k
| issue_words_count
int64 2
1.39k
| issue_tokens_count
int64 13
4.47k
| issue_lines_count
int64 1
325
| issue_links_count
int64 0
19
| issue_code_blocks_count
int64 0
31
| pull_create_at
timestamp[s] | repo_stars
int64 10
44.3k
| repo_language
stringclasses 8
values | repo_languages
stringclasses 296
values | repo_license
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,422 | quarkusio/quarkus/25666/25580 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25580 | https://github.com/quarkusio/quarkus/pull/25666 | https://github.com/quarkusio/quarkus/pull/25666 | 1 | fix | Commas in Headers with AWS Lambda | ### Describe the bug
When you are dealing with headers that can have commas in their value, such as Access-Control-Request-Headers, the Lambda Handler seems to interpret them as different header values which causes CORS to not work correctly.
### Expected behavior
When executing the curl
```
curl http://localhost:8080/hello -X OPTIONS -H 'Origin: http://example.com' -H 'Access-Control-Request-Headers: bar,foo' -v
```
the following header is returned
```
access-control-allow-headers: bar,foo
```
### Actual behavior
The following header is returned
```
access-control-allow-headers: bar
```
### How to Reproduce?
1. Generate a new quarkus project with "AWS Lambda HTTP" and "RestEasy Classic Jackson" extension
2. Add the following lines to the application.properties:
```
quarkus.http.cors=true
quarkus.http.cors.origins=http://example.com
```
3. Run ./mvnw quarkus:dev
4. Execute the curls given above
5. Uncomment the "quarkus-amazon-lambda-http" in the `pom.xml` to see the expected behaviour
### Output of `uname -a` or `ver`
Linux [REMOVED] 5.13.0-40-generic #45~20.04.1-Ubuntu SMP Mon Apr 4 09:38:31 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "14.0.2" 2020-07-14
### GraalVM version (if different from Java)
N/A, the issue can be reproduced without GraalVM
### Quarkus version or git rev
2.9.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4
### Additional information
Event though the reproduction steps do not include deployment to Lambda, I have observed the same behavior with a different project also when it was deployed to AWS Lambda
In the `io.quarkus.vertx.http.runtime.cors.CORSFilter` class, only the first header value is retrieved in this line:
```
final String requestedHeaders = request.getHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS);
```
But in the `io.quarkus.amazon.lambda.http.LambdaHttpHandler`, the string parts separated by comma are stored as different header values:
```
for (String val : header.getValue().split(","))
nettyRequest.headers().add(header.getKey(), val);
```
This is probably necessary because the API Gateway will send multiple header values separated with comma and there is no way to reconstruct the original request from the API Gateway's event. Maybe it would be an acceptable solution to have the CORSFilter expect multiple header values | d417333d7c55000d0d3988810457e71b0bb6d09f | bf1ff79002189d148ff1e0631cf1efec834aa152 | https://github.com/quarkusio/quarkus/compare/d417333d7c55000d0d3988810457e71b0bb6d09f...bf1ff79002189d148ff1e0631cf1efec834aa152 | 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 dea92dbf76d..d407f0c3747 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
@@ -9,10 +9,12 @@
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.CompletableFuture;
import org.jboss.logging.Logger;
@@ -47,8 +49,13 @@ public class LambdaHttpHandler implements RequestHandler<APIGatewayV2HTTPEvent,
private static final int BUFFER_SIZE = 8096;
private static final Headers errorHeaders = new Headers();
+
+ // comma headers for headers that have comma in value and we don't want to split it up into
+ // multiple headers
+ private static final Set<String> commaHeaders = new HashSet();
static {
errorHeaders.putSingle("Content-Type", "application/json");
+ commaHeaders.add("access-control-request-headers");
}
public APIGatewayV2HTTPResponse handleRequest(APIGatewayV2HTTPEvent request, Context context) {
@@ -182,8 +189,14 @@ httpMethod, ofNullable(request.getRawQueryString())
if (request.getHeaders() != null) { //apparently this can be null if no headers are sent
for (Map.Entry<String, String> header : request.getHeaders().entrySet()) {
if (header.getValue() != null) {
- for (String val : header.getValue().split(","))
- nettyRequest.headers().add(header.getKey(), val);
+ // Some header values have commas in them and we don't want to
+ // split them up into multiple header values.
+ if (commaHeaders.contains(header.getKey().toLowerCase(Locale.ROOT))) {
+ nettyRequest.headers().add(header.getKey(), header.getValue());
+ } else {
+ for (String val : header.getValue().split(","))
+ nettyRequest.headers().add(header.getKey(), val);
+ }
}
}
}
diff --git a/integration-tests/amazon-lambda-http/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java b/integration-tests/amazon-lambda-http/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java
index 754f52d36f4..36a740f406d 100644
--- a/integration-tests/amazon-lambda-http/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java
+++ b/integration-tests/amazon-lambda-http/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java
@@ -3,6 +3,7 @@
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
@@ -14,6 +15,15 @@
@Path("/hello")
public class GreetingResource {
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ @Path("comma")
+ public String comma(@HeaderParam("Access-Control-Request-Headers") String access) {
+ if (access == null || !access.contains(","))
+ throw new RuntimeException("should have comma");
+ return "ok";
+ }
+
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
diff --git a/integration-tests/amazon-lambda-http/src/test/java/io/quarkus/it/amazon/lambda/AmazonLambdaSimpleTestCase.java b/integration-tests/amazon-lambda-http/src/test/java/io/quarkus/it/amazon/lambda/AmazonLambdaSimpleTestCase.java
index dfc91d8cb9c..7fa451af996 100644
--- a/integration-tests/amazon-lambda-http/src/test/java/io/quarkus/it/amazon/lambda/AmazonLambdaSimpleTestCase.java
+++ b/integration-tests/amazon-lambda-http/src/test/java/io/quarkus/it/amazon/lambda/AmazonLambdaSimpleTestCase.java
@@ -22,6 +22,16 @@
@QuarkusTest
public class AmazonLambdaSimpleTestCase {
+ @Test
+ public void testComma() throws Exception {
+ given()
+ .when()
+ .header("Access-Control-Request-Headers", "foo, bar, yello")
+ .get("/hello/comma")
+ .then()
+ .statusCode(200);
+ }
+
@Test
public void testContext() throws Exception {
given() | ['integration-tests/amazon-lambda-http/src/main/java/io/quarkus/it/amazon/lambda/GreetingResource.java', 'extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java', 'integration-tests/amazon-lambda-http/src/test/java/io/quarkus/it/amazon/lambda/AmazonLambdaSimpleTestCase.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 20,623,540 | 3,989,245 | 523,939 | 5,019 | 983 | 169 | 17 | 1 | 2,443 | 323 | 606 | 69 | 3 | 6 | 1970-01-01T00:27:32 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,421 | quarkusio/quarkus/25790/25788 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25788 | https://github.com/quarkusio/quarkus/pull/25790 | https://github.com/quarkusio/quarkus/pull/25790 | 1 | fixes | Gradle `quarkusBuild` fails with `ZipFile invalid LOC header` in `SmallRyeOpenApiProcessor` | ### Describe the bug
A repeated `./gradlew quarkusBuild` runs into the following exception from the `SmallRyeOpenApiProcessor`.
In this case, the openapi classes and spec files are pulled from a dependency and are not located in the Gradle project.
```
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor#build threw an exception: java.io.UncheckedIOException: java.util.zip.ZipException: ZipFile invalid LOC header (bad signature)
at io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor.addStaticModelIfExist(SmallRyeOpenApiProcessor.java:893)
at io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor.findStaticModels(SmallRyeOpenApiProcessor.java:840)
at io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor.generateStaticModel(SmallRyeOpenApiProcessor.java:774)
at io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor.build(SmallRyeOpenApiProcessor.java:671)
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$3.execute(ExtensionLoader.java:925)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.util.zip.ZipException: ZipFile invalid LOC header (bad signature)
at java.base/java.util.zip.ZipFile$ZipFileInputStream.initDataOffset(ZipFile.java:1023)
at java.base/java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:1033)
at java.base/java.util.zip.ZipFile$ZipFileInflaterInputStream.fill(ZipFile.java:483)
at java.base/java.util.zip.InflaterInputStream.read(InflaterInputStream.java:159)
at java.base/java.io.FilterInputStream.read(FilterInputStream.java:133)
at java.base/java.io.InputStream.readNBytes(InputStream.java:396)
at java.base/java.io.InputStream.readAllBytes(InputStream.java:333)
at io.quarkus.deployment.util.IoUtil.readBytes(IoUtil.java:18)
at io.quarkus.smallrye.openapi.deployment.SmallRyeOpenApiProcessor.addStaticModelIfExist(SmallRyeOpenApiProcessor.java:888)
... 14 more
```
This consistently happens in [this PR](https://github.com/projectnessie/nessie/pull/4274), which can serve as a reproducer:
```
$ ./gradlew :ser:quar-ser:quarkusBuild
$ echo "" > model/src/main/resources/META-INF/openapi.yaml
$ ./gradlew :ser:quar-ser:quarkusBuild
```
### 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.9.1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 7.4.2
### Additional information
_No response_ | 976ffa21392105954a1314a9835ad5b2887b9996 | 633647848a286c0d0933d7f263ce4f13dc953030 | https://github.com/quarkusio/quarkus/compare/976ffa21392105954a1314a9835ad5b2887b9996...633647848a286c0d0933d7f263ce4f13dc953030 | 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 c87ed39582d..25122586b01 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
@@ -8,6 +8,7 @@
import java.io.UncheckedIOException;
import java.lang.reflect.Modifier;
import java.net.URL;
+import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -855,7 +856,7 @@ private List<Result> findStaticModels(SmallRyeOpenApiConfig openApiConfig, List<
addStaticModelIfExist(results, ignorePatterns, possibleModelFile);
}
} catch (IOException ioe) {
- ioe.printStackTrace();
+ throw new UncheckedIOException("An error occured while processing " + path, ioe);
}
}
}
@@ -881,16 +882,19 @@ private void addStaticModelIfExist(List<Result> results, List<Pattern> ignorePat
while (urls.hasMoreElements()) {
URL url = urls.nextElement();
// Check if we should ignore
- if (!shouldIgnore(ignorePatterns, url.toString())) {
+ String urlAsString = url.toString();
+ if (!shouldIgnore(ignorePatterns, urlAsString)) {
// Add as static model
- try (InputStream inputStream = url.openStream()) {
+ URLConnection con = url.openConnection();
+ con.setUseCaches(false);
+ try (InputStream inputStream = con.getInputStream()) {
if (inputStream != null) {
byte[] contents = IoUtil.readBytes(inputStream);
results.add(new Result(format, new ByteArrayInputStream(contents)));
}
} catch (IOException ex) {
- throw new UncheckedIOException(ex);
+ throw new UncheckedIOException("An error occured while processing " + urlAsString + " for " + path, ex);
}
}
} | ['extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,703,940 | 4,004,258 | 525,372 | 5,029 | 817 | 132 | 12 | 1 | 3,648 | 216 | 881 | 80 | 1 | 2 | 1970-01-01T00:27:33 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,420 | quarkusio/quarkus/25858/25847 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25847 | https://github.com/quarkusio/quarkus/pull/25858 | https://github.com/quarkusio/quarkus/pull/25858 | 1 | fix | quarkus ext add io.quarkiverse.ngrok:quarkus-ngrok does not include version info | ### Describe the bug
running: `quarkus ext add io.quarkiverse.ngrok:quarkus-ngrok` adds only this:
```
<dependency>
<groupId>io.quarkiverse.ngrok</groupId>
<artifactId>quarkus-ngrok</artifactId>
</dependency>
```
### Expected behavior
it should have added:
```
<dependency>
<groupId>io.quarkiverse.ngrok</groupId>
<artifactId>quarkus-ngrok</artifactId>
<version>0.1.3</version>
</dependency>
```
### Actual behavior
_No response_
### How to Reproduce?
using quarkus 2.9.0 cli
### 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_ | 6df44678d6c64b01c5d5b827672fc27803b29fd2 | 70c00e9ffd6b688c2139ab8f79ab1bc64bda13d1 | https://github.com/quarkusio/quarkus/compare/6df44678d6c64b01c5d5b827672fc27803b29fd2...70c00e9ffd6b688c2139ab8f79ab1bc64bda13d1 | diff --git a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/AddExtensionsCommandHandler.java b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/AddExtensionsCommandHandler.java
index 179e5c30221..c40a36d03b1 100644
--- a/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/AddExtensionsCommandHandler.java
+++ b/independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/AddExtensionsCommandHandler.java
@@ -103,17 +103,26 @@ public ExtensionInstallPlan planInstallation(QuarkusCommandInvocation invocation
ExtensionInstallPlan.Builder builder = ExtensionInstallPlan.builder();
for (String keyword : keywords) {
int countColons = StringUtils.countMatches(keyword, ":");
- // Check if it's just groupId:artifactId
- if (countColons == 1) {
- ArtifactKey artifactKey = ArtifactKey.fromString(keyword);
- builder.addManagedExtension(new ArtifactCoords(artifactKey, null));
- continue;
- } else if (countColons > 1) {
+ if (countColons > 1) {
// it's a gav
builder.addIndependentExtension(ArtifactCoords.fromString(keyword));
continue;
}
- List<Extension> listed = listInternalExtensions(quarkusCore, keyword, catalog.getExtensions());
+ List<Extension> listed = List.of();
+ // Check if it's just groupId:artifactId
+ if (countColons == 1) {
+ ArtifactKey artifactKey = ArtifactKey.fromString(keyword);
+ for (Extension e : invocation.getExtensionsCatalog().getExtensions()) {
+ if (e.getArtifact().getKey().equals(artifactKey)) {
+ listed = List.of(e);
+ break;
+ }
+ }
+
+ //builder.addManagedExtension(new ArtifactCoords(artifactKey, null));
+ } else {
+ listed = listInternalExtensions(quarkusCore, keyword, catalog.getExtensions());
+ }
if (listed.isEmpty()) {
// No extension found for this keyword.
builder.addUnmatchedKeyword(keyword);
@@ -125,7 +134,6 @@ else if (listed.size() > 1 && !ExtensionPredicate.isPattern(keyword)) {
}
for (Extension e : listed) {
final ArtifactCoords extensionCoords = e.getArtifact();
-
boolean managed = false;
ExtensionOrigin firstPlatform = null;
ExtensionOrigin preferredOrigin = null;
diff --git a/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/project/create/ExtensionsAppearingInPlatformAndNonPlatformCatalogsTest.java b/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/project/create/ExtensionsAppearingInPlatformAndNonPlatformCatalogsTest.java
index 8ac8580def2..ea848b69967 100644
--- a/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/project/create/ExtensionsAppearingInPlatformAndNonPlatformCatalogsTest.java
+++ b/independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/project/create/ExtensionsAppearingInPlatformAndNonPlatformCatalogsTest.java
@@ -203,6 +203,20 @@ public void addExtensionAndImportMemberBom() throws Exception {
assertModel(projectDir, toPlatformBomCoords("acme-baz-bom"), expectedExtensions, "1.0.1");
}
+ @Test
+ public void addNonPlatformExtensionWithGA() throws Exception {
+ final Path projectDir = newProjectDir("add-non-platform-extension-with-ga");
+ createProject(projectDir, Arrays.asList("acme-foo"));
+
+ assertModel(projectDir, toPlatformBomCoords("acme-foo-bom"), toPlatformExtensionCoords("acme-foo"), "2.0.4");
+
+ addExtensions(projectDir, Arrays.asList("org.other:other-six-zero"));
+
+ final List<ArtifactCoords> expectedExtensions = toPlatformExtensionCoords("acme-foo");
+ expectedExtensions.add(ArtifactCoords.fromString("org.other:other-six-zero:6.0"));
+ assertModel(projectDir, toPlatformBomCoords("acme-foo-bom"), expectedExtensions, "2.0.4");
+ }
+
@Test
public void attemptCreateWithIncompatibleExtensions() throws Exception {
final Path projectDir = newProjectDir("create-with-incompatible-extensions"); | ['independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/AddExtensionsCommandHandler.java', 'independent-projects/tools/devtools-testing/src/test/java/io/quarkus/devtools/project/create/ExtensionsAppearingInPlatformAndNonPlatformCatalogsTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 20,709,757 | 4,005,455 | 525,521 | 5,031 | 1,189 | 222 | 24 | 1 | 906 | 96 | 239 | 54 | 0 | 2 | 1970-01-01T00:27:33 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,419 | quarkusio/quarkus/25888/25884 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25884 | https://github.com/quarkusio/quarkus/pull/25888 | https://github.com/quarkusio/quarkus/pull/25888 | 1 | fixes | Media type `text/xml` not working with REST Client Reactive | ### Describe the bug
I tried updating our project to use the REST Client Reactive from RESTEasy Reactive, however I can't get it to work with one of our REST Clients that uses `text/xml`. It does work fine for others that use JSON for example.
### Expected behavior
The XML in the body of the response gets successfully processed with both media type `text/xml` and `application/xml`.
### Actual behavior
The REST client fails with an exception when using `text/xml`
```
javax.ws.rs.ProcessingException: Response could not be mapped to type class org.acme.SimpleJaxbTest$Dto
at org.jboss.resteasy.reactive.client.impl.ClientReaderInterceptorContextImpl.proceed(ClientReaderInterceptorContextImpl.java:62)
at org.jboss.resteasy.reactive.client.impl.ClientSerialisers.invokeClientReader(ClientSerialisers.java:146)
at org.jboss.resteasy.reactive.client.impl.RestClientRequestContext.readEntity(RestClientRequestContext.java:182)
at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.mapToResponse(ClientResponseCompleteRestHandler.java:101)
at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.handle(ClientResponseCompleteRestHandler.java:32)
at org.jboss.resteasy.reactive.client.handlers.ClientResponseCompleteRestHandler.handle(ClientResponseCompleteRestHandler.java:28)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.invokeHandler(AbstractResteasyReactiveContext.java:219)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141)
at org.jboss.resteasy.reactive.client.impl.RestClientRequestContext$1.lambda$execute$0(RestClientRequestContext.java:276)
at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:100)
at io.vertx.core.impl.AbstractContext.dispatch(AbstractContext.java:63)
at io.vertx.core.impl.EventLoopContext.lambda$runOnContext$0(EventLoopContext.java:38)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
```
It does work fine when you create an endpoint that uses `application/xml` or when you switch back to the REST Client from RESTEasy Classic with JAXB.
### How to Reproduce?
Based on the tests I found here: https://github.com/quarkusio/quarkus/blob/main/extensions/resteasy-reactive/rest-client-reactive-jaxb/deployment/src/test/java/io/quarkus/rest/client/reactive/jaxb/test/SimpleJaxbTest.java
I made a small reproducer:
```java
package org.acme;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.junit.jupiter.api.Test;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.xml.bind.annotation.XmlRootElement;
import java.net.URI;
import java.util.Objects;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
@QuarkusTest
public class SimpleJaxbTest {
@TestHTTPResource
URI uri;
@Test
void shouldConsumeXMLEntity() {
var dto = RestClientBuilder.newBuilder().baseUri(uri).build(XmlClient.class).dto();
assertThat(dto, equalTo(new Dto("foo", "bar")));
}
@Path("/xml")
public interface XmlClient {
@GET
@Path("/dto")
@Produces(MediaType.TEXT_XML)
Dto dto();
}
@Path("/xml")
public static class XmlResource {
@GET
@Produces(MediaType.TEXT_XML)
@Path("/dto")
public Dto dto() {
return new Dto("foo", "bar");
}
}
@XmlRootElement(name = "Dto")
public static class Dto {
public String name;
public String value;
public Dto(String name, String value) {
this.name = name;
this.value = value;
}
public Dto() {
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Dto dto = (Dto) o;
return Objects.equals(name, dto.name) && Objects.equals(value, dto.value);
}
@Override
public int hashCode() {
return Objects.hash(name, value);
}
}
}
```
Extensions used:
```xml
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client-reactive-jaxb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jaxb</artifactId>
</dependency>
```
Reproducer: [Archive.zip](https://github.com/quarkusio/quarkus/files/8805564/Archive.zip)
### Output of `uname -a` or `ver`
```
Darwin Willems-MBP.i.btp34.nl 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
```
### Output of `java -version`
```
openjdk version "17.0.3" 2022-04-19 OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7) OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode, sharing)
```
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
`2.9.2.Final`
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
```
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /Users/wjglerum/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4 Java version: 17.0.3, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home Default locale: en_NL, platform encoding: US-ASCII OS name: "mac os x", version: "12.4", arch: "x86_64", family: "mac"
```
### Additional information
Did I miss any documentation here? Or is there something else needed to make this work? | c564a99a88c71d5b43feac708416705bfff9cf57 | d3b36235103675439d385f4973bb94165fc5f296 | https://github.com/quarkusio/quarkus/compare/c564a99a88c71d5b43feac708416705bfff9cf57...d3b36235103675439d385f4973bb94165fc5f296 | diff --git a/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/ValidatorMediaTypeUtil.java b/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/ValidatorMediaTypeUtil.java
index 63b90e93270..8eeede84b21 100644
--- a/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/ValidatorMediaTypeUtil.java
+++ b/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/ValidatorMediaTypeUtil.java
@@ -10,8 +10,10 @@
*/
public final class ValidatorMediaTypeUtil {
- private static final List<MediaType> SUPPORTED_MEDIA_TYPES = Arrays.asList(MediaType.APPLICATION_JSON_TYPE,
+ private static final List<MediaType> SUPPORTED_MEDIA_TYPES = Arrays.asList(
+ MediaType.APPLICATION_JSON_TYPE,
MediaType.APPLICATION_XML_TYPE,
+ MediaType.TEXT_XML_TYPE,
MediaType.TEXT_PLAIN_TYPE);
private ValidatorMediaTypeUtil() {
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/deployment/ResteasyReactiveJaxbCommonProcessor.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/deployment/ResteasyReactiveJaxbCommonProcessor.java
index 4d9d1311fb9..1f73e94c562 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/deployment/ResteasyReactiveJaxbCommonProcessor.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/deployment/ResteasyReactiveJaxbCommonProcessor.java
@@ -1,6 +1,6 @@
package io.quarkus.resteasy.reactive.jaxb.common.deployment;
-import java.util.Collections;
+import java.util.List;
import javax.ws.rs.core.MediaType;
@@ -25,8 +25,8 @@ void additionalProviders(BuildProducer<AdditionalBeanBuildItem> additionalBean,
.setUnremovable().build());
additionalReaders.produce(new MessageBodyReaderBuildItem(JaxbMessageBodyReader.class.getName(), Object.class.getName(),
- Collections.singletonList(MediaType.APPLICATION_XML)));
+ List.of(MediaType.APPLICATION_XML, MediaType.TEXT_XML)));
additionalWriters.produce(new MessageBodyWriterBuildItem(JaxbMessageBodyWriter.class.getName(), Object.class.getName(),
- Collections.singletonList(MediaType.APPLICATION_XML)));
+ List.of(MediaType.APPLICATION_XML, MediaType.TEXT_XML)));
}
}
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/runtime/serialisers/JaxbMessageBodyReader.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/runtime/serialisers/JaxbMessageBodyReader.java
index cfcf2102893..f78d995fb46 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/runtime/serialisers/JaxbMessageBodyReader.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/runtime/serialisers/JaxbMessageBodyReader.java
@@ -47,9 +47,9 @@ protected boolean isReadable(MediaType mediaType, Class<?> type) {
return false;
}
String subtype = mediaType.getSubtype();
- boolean isApplicationMediaType = "application".equals(mediaType.getType());
- return (isApplicationMediaType && "xml".equalsIgnoreCase(subtype) || subtype.endsWith("+xml"))
- || (mediaType.isWildcardSubtype() && (mediaType.isWildcardType() || isApplicationMediaType));
+ boolean isCorrectMediaType = "application".equals(mediaType.getType()) || "text".equals(mediaType.getType());
+ return (isCorrectMediaType && "xml".equalsIgnoreCase(subtype) || subtype.endsWith("+xml"))
+ || (mediaType.isWildcardSubtype() && (mediaType.isWildcardType() || isCorrectMediaType));
}
private Object doReadFrom(Class<Object> type, Type genericType, InputStream entityStream) throws IOException {
diff --git a/extensions/resteasy-reactive/rest-client-reactive-jaxb/deployment/src/test/java/io/quarkus/rest/client/reactive/jaxb/test/SimpleJaxbTest.java b/extensions/resteasy-reactive/rest-client-reactive-jaxb/deployment/src/test/java/io/quarkus/rest/client/reactive/jaxb/test/SimpleJaxbTest.java
index 54bd22dd372..5f1b32e2a05 100644
--- a/extensions/resteasy-reactive/rest-client-reactive-jaxb/deployment/src/test/java/io/quarkus/rest/client/reactive/jaxb/test/SimpleJaxbTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive-jaxb/deployment/src/test/java/io/quarkus/rest/client/reactive/jaxb/test/SimpleJaxbTest.java
@@ -9,6 +9,7 @@
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
+import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.microprofile.rest.client.RestClientBuilder;
import org.junit.jupiter.api.Test;
@@ -26,12 +27,19 @@ public class SimpleJaxbTest {
URI uri;
@Test
- void shouldConsumeJsonEntity() {
+ void shouldConsumeXMLEntity() {
var dto = RestClientBuilder.newBuilder().baseUri(uri).build(XmlClient.class)
.dto();
assertThat(dto).isEqualTo(new Dto("foo", "bar"));
}
+ @Test
+ void shouldConsumePlainXMLEntity() {
+ var dto = RestClientBuilder.newBuilder().baseUri(uri).build(XmlClient.class)
+ .plain();
+ assertThat(dto).isEqualTo(new Dto("foo", "bar"));
+ }
+
@Path("/xml")
public interface XmlClient {
@@ -39,6 +47,11 @@ public interface XmlClient {
@Path("/dto")
@Produces(MediaType.APPLICATION_XML)
Dto dto();
+
+ @GET
+ @Path("/plain")
+ @Produces(MediaType.TEXT_XML)
+ Dto plain();
}
@Path("/xml")
@@ -50,8 +63,16 @@ public static class XmlResource {
public Dto dto() {
return new Dto("foo", "bar");
}
+
+ @GET
+ @Produces(MediaType.TEXT_XML)
+ @Path("/plain")
+ public Dto plain() {
+ return new Dto("foo", "bar");
+ }
}
+ @XmlRootElement(name = "Dto")
public static class Dto {
public String name;
public String value; | ['extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/deployment/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/deployment/ResteasyReactiveJaxbCommonProcessor.java', 'extensions/resteasy-reactive/rest-client-reactive-jaxb/deployment/src/test/java/io/quarkus/rest/client/reactive/jaxb/test/SimpleJaxbTest.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb-common/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/common/runtime/serialisers/JaxbMessageBodyReader.java', 'extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/jaxrs/ValidatorMediaTypeUtil.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 20,748,761 | 4,012,935 | 526,365 | 5,037 | 1,252 | 217 | 16 | 3 | 6,553 | 476 | 1,600 | 170 | 2 | 6 | 1970-01-01T00:27: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,418 | quarkusio/quarkus/25896/25894 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25894 | https://github.com/quarkusio/quarkus/pull/25896 | https://github.com/quarkusio/quarkus/pull/25896 | 1 | fix | Panache MongoDB extension not working for multiple collections inside same transaction | ### Describe the bug
When a method annotated with @Transactional doing multiple updates or persists using different repositories, only first is using client session others are direct commit.
### Expected behavior
Should commit all changes after leave transaction method, not in middle of method
### Actual behavior
Only work for first repository, others are not using same client session.
### How to Reproduce?
1- Create 2 repositories for different entities.
2- Create a Transactional method
3- Persist both entities
4 - Check result after first persist (not persisted)
5- Check result after second persist been executed (persisted)
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
11
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.9
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | ba1107fe72237da1e16822afcf2dfb0cbf0c86e8 | b42aeb4ead534f0b97e1a523e303c28911fd1394 | https://github.com/quarkusio/quarkus/compare/ba1107fe72237da1e16822afcf2dfb0cbf0c86e8...b42aeb4ead534f0b97e1a523e303c28911fd1394 | diff --git a/extensions/panache/mongodb-panache-common/runtime/src/main/java/io/quarkus/mongodb/panache/common/runtime/MongoOperations.java b/extensions/panache/mongodb-panache-common/runtime/src/main/java/io/quarkus/mongodb/panache/common/runtime/MongoOperations.java
index ba8f60efe70..d6f446e8844 100644
--- a/extensions/panache/mongodb-panache-common/runtime/src/main/java/io/quarkus/mongodb/panache/common/runtime/MongoOperations.java
+++ b/extensions/panache/mongodb-panache-common/runtime/src/main/java/io/quarkus/mongodb/panache/common/runtime/MongoOperations.java
@@ -321,19 +321,20 @@ ClientSession getSession(Object entity) {
}
ClientSession getSession(Class<?> entityClass) {
+ ClientSession clientSession = null;
MongoEntity mongoEntity = entityClass.getAnnotation(MongoEntity.class);
InstanceHandle<TransactionSynchronizationRegistry> instance = Arc.container()
.instance(TransactionSynchronizationRegistry.class);
if (instance.isAvailable()) {
TransactionSynchronizationRegistry registry = instance.get();
if (registry.getTransactionStatus() == Status.STATUS_ACTIVE) {
- ClientSession clientSession = (ClientSession) registry.getResource(SESSION_KEY);
+ clientSession = (ClientSession) registry.getResource(SESSION_KEY);
if (clientSession == null) {
return registerClientSession(mongoEntity, registry);
}
}
}
- return null;
+ return clientSession;
}
private ClientSession registerClientSession(MongoEntity mongoEntity, | ['extensions/panache/mongodb-panache-common/runtime/src/main/java/io/quarkus/mongodb/panache/common/runtime/MongoOperations.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,739,993 | 4,011,157 | 526,166 | 5,034 | 279 | 47 | 5 | 1 | 998 | 146 | 211 | 43 | 0 | 0 | 1970-01-01T00:27: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,416 | quarkusio/quarkus/25910/25909 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25909 | https://github.com/quarkusio/quarkus/pull/25910 | https://github.com/quarkusio/quarkus/pull/25910 | 1 | fixes | Misleading error for multipart non-blocking method in resteasy-reactive | ### Describe the bug
Current implementation requires, that endpoint, which returns multipart, should be *blocking*. User is notified about it via build-time error, which says `Endpoints that produce a Multipart result can only be used on non blocking methods`.
### Expected behavior
Error message should describe behavior properly.
### Actual behavior
If endpoint annotated with both `@Produces(MediaType.MULTIPART_FORM_DATA)` and `@NonBlocking`, build fails with `Endpoints that produce a Multipart result can only be used on non blocking methods` error.
### How to Reproduce?
Add two endpoints to class:
```java
@GET
@Produces(MediaType.MULTIPART_FORM_DATA)
@Path("/download-multipart")
@Blocking //this will compile
public Uni<FileWrapper> downloadMultipartBlocking() {
FileWrapper wrapper = new FileWrapper();
wrapper.file = file;
wrapper.name = file.getName();
return Uni.createFrom().item(() -> wrapper);
}
```
and
```java
@GET
@Produces(MediaType.MULTIPART_FORM_DATA)
@Path("/download-multipart")
@NonBlocking //this will not
public Uni<FileWrapper> downloadMultipartNonBlocking() {
FileWrapper wrapper = new FileWrapper();
wrapper.file = file;
wrapper.name = file.getName();
return Uni.createFrom().item(() -> wrapper);
}
```
Build fails with the following error:
```
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.7.6.Final:build (build) on project http-rest-client-reactive: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.resteasy.reactive.server.deployment.ResteasyReactiveProcessor#setupEndpoints threw an exception: java.lang.RuntimeException: java.lang.RuntimeException: Failed to process method 'io.quarkus.ts.http.restclient.reactive.files.FileResource#downloadMultipartNonBlocking'
[ERROR] at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:294)
<...>
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.lang.RuntimeException: Failed to process method 'io.quarkus.ts.http.restclient.reactive.files.FileResource#downloadMultipartNonBlocking'
[ERROR] at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:666)
[ERROR] at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:382)
[ERROR] at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createEndpoints(EndpointIndexer.java:265)
[ERROR] ... 12 more
[ERROR] Caused by: javax.enterprise.inject.spi.DeploymentException: Endpoints that produce a Multipart result can only be used on non blocking methods. Offending method is 'io.quarkus.ts.http.restclient.reactive.files.FileResource#io.smallrye.mutiny.Uni<io.quarkus.ts.http.restclient.reactive.files.FileWrapper> downloadMultipartNonBlocking()'
[ERROR] at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:630)
[ERROR] ... 14 more
[ERROR] -> [Help 1]
```
### Output of `uname -a` or `ver`
5.17.11-300.fc36.x86_64
### Output of `java -version`
11.0.12, vendor: GraalVM Community
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.7.6.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
### Additional information
_No response_ | cf1864cc212668116e56c47949635254e60915e4 | febcd16b095c81f2885ea8d37282e924b222420b | https://github.com/quarkusio/quarkus/compare/cf1864cc212668116e56c47949635254e60915e4...febcd16b095c81f2885ea8d37282e924b222420b | diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java
index caa4e997d08..739fb79bb11 100644
--- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java
+++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java
@@ -645,7 +645,7 @@ private ResourceMethod createResourceMethod(ClassInfo currentClassInfo, ClassInf
if (returnsMultipart && !blocking) {
throw new DeploymentException(
- "Endpoints that produce a Multipart result can only be used on non blocking methods. Offending method is '"
+ "Endpoints that produce a Multipart result can only be used on blocking methods. Offending method is '"
+ currentMethodInfo.declaringClass().name() + "#" + currentMethodInfo + "'");
}
| ['independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,748,834 | 4,012,960 | 526,367 | 5,037 | 261 | 47 | 2 | 1 | 3,671 | 307 | 882 | 84 | 0 | 3 | 1970-01-01T00:27: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,415 | quarkusio/quarkus/25913/25751 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25751 | https://github.com/quarkusio/quarkus/pull/25913 | https://github.com/quarkusio/quarkus/pull/25913 | 1 | fixes | io.quarkus.qute.deployment.QuteProcessor#collectTemplates threw exception | ### Describe the bug
Sometimes I'm getting this issue when launching tests in Eclipse IDE. I can't reproduce when running tests from Maven.
```
java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.qute.deployment.QuteProcessor#collectTemplates threw an exception: java.lang.IllegalArgumentException
at jdk.zipfs/jdk.nio.zipfs.ZipPath.relativize(ZipPath.java:230)
at io.quarkus.qute.deployment.QuteProcessor.scan(QuteProcessor.java:2301)
at io.quarkus.qute.deployment.QuteProcessor.scan(QuteProcessor.java:2313)
at io.quarkus.qute.deployment.QuteProcessor.collectTemplates(QuteProcessor.java:1291)
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$3.execute(ExtensionLoader.java:925)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:632)
at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:703)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.api.extension.InvocationInterceptor.interceptTestClassConstructor(InvocationInterceptor.java:73)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:77)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeTestClassConstructor(ClassBasedTestDescriptor.java:355)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateTestClass(ClassBasedTestDescriptor.java:302)
at org.junit.jupiter.engine.descriptor.ClassTestDescriptor.instantiateTestClass(ClassTestDescriptor.java:79)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.instantiateAndPostProcessTestInstance(ClassBasedTestDescriptor.java:280)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$4(ClassBasedTestDescriptor.java:272)
at java.base/java.util.Optional.orElseGet(Optional.java:369)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$testInstancesProvider$5(ClassBasedTestDescriptor.java:271)
at org.junit.jupiter.engine.execution.TestInstancesProvider.getTestInstances(TestInstancesProvider.java:31)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$prepare$0(TestMethodTestDescriptor.java:102)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:101)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:66)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:95)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:91)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:60)
at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.qute.deployment.QuteProcessor#collectTemplates threw an exception: java.lang.IllegalArgumentException
at jdk.zipfs/jdk.nio.zipfs.ZipPath.relativize(ZipPath.java:230)
at io.quarkus.qute.deployment.QuteProcessor.scan(QuteProcessor.java:2301)
at io.quarkus.qute.deployment.QuteProcessor.scan(QuteProcessor.java:2313)
at io.quarkus.qute.deployment.QuteProcessor.collectTemplates(QuteProcessor.java:1291)
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$3.execute(ExtensionLoader.java:925)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:330)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:225)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:609)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:647)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$10(ClassBasedTestDescriptor.java:381)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:381)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:205)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:80)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
... 35 more
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.qute.deployment.QuteProcessor#collectTemplates threw an exception: java.lang.IllegalArgumentException
at jdk.zipfs/jdk.nio.zipfs.ZipPath.relativize(ZipPath.java:230)
at io.quarkus.qute.deployment.QuteProcessor.scan(QuteProcessor.java:2301)
at io.quarkus.qute.deployment.QuteProcessor.scan(QuteProcessor.java:2313)
at io.quarkus.qute.deployment.QuteProcessor.collectTemplates(QuteProcessor.java:1291)
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$3.execute(ExtensionLoader.java:925)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.builder.Execution.run(Execution.java:116)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:157)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:328)
... 46 more
Caused by: java.lang.IllegalArgumentException
at jdk.zipfs/jdk.nio.zipfs.ZipPath.relativize(ZipPath.java:230)
at io.quarkus.qute.deployment.QuteProcessor.scan(QuteProcessor.java:2301)
at io.quarkus.qute.deployment.QuteProcessor.scan(QuteProcessor.java:2313)
at io.quarkus.qute.deployment.QuteProcessor.collectTemplates(QuteProcessor.java:1291)
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$3.execute(ExtensionLoader.java:925)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
```
I'll attach a debugger to figure it out.
### 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_ | 3ff5a163633af6fc076f7ddf700a3c7c285f7b44 | 7765433c9269b43ae709760888ab8141b9a649e3 | https://github.com/quarkusio/quarkus/compare/3ff5a163633af6fc076f7ddf700a3c7c285f7b44...7765433c9269b43ae709760888ab8141b9a649e3 | 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 b330cc40c94..ce114af8a5e 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
@@ -2492,6 +2492,16 @@ private void scan(Path root, Path directory, String basePath, BuildProducer<HotD
Iterator<Path> iter = files.iterator();
while (iter.hasNext()) {
Path filePath = iter.next();
+ /*
+ * Fix for https://github.com/quarkusio/quarkus/issues/25751 where running tests in Eclipse
+ * sometimes produces `/templates/tags` (absolute) files listed for `templates` (relative)
+ * directories, so we work around this
+ */
+ if (!directory.isAbsolute()
+ && filePath.isAbsolute()
+ && filePath.getRoot() != null) {
+ filePath = filePath.getRoot().relativize(filePath);
+ }
if (Files.isRegularFile(filePath)) {
LOGGER.debugf("Found template: %s", filePath);
String templatePath = root.relativize(filePath).toString(); | ['extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,747,860 | 4,012,908 | 526,388 | 5,037 | 558 | 95 | 10 | 1 | 14,922 | 452 | 3,248 | 199 | 0 | 1 | 1970-01-01T00:27: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,412 | quarkusio/quarkus/26132/26083 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/26083 | https://github.com/quarkusio/quarkus/pull/26132 | https://github.com/quarkusio/quarkus/pull/26132 | 1 | fix | `java.lang.NoSuchMethodException: io.grpc.netty.UdsNettyChannelProvider.<init>()` on Quarkus main after grpc update | ### Describe the bug
`java.lang.NoSuchMethodException: io.grpc.netty.UdsNettyChannelProvider.<init>()` on Quarkus main after grpc update
Did some bisection locally and the PR where the troubles start is https://github.com/quarkusio/quarkus/pull/26047 CC @cescoffier
```
Jun 13, 2022 12:22:43 PM io.quarkus.runtime.ApplicationLifecycleManager run
ERROR: Failed to start application (with profile test)
java.lang.NoSuchMethodException: io.grpc.netty.UdsNettyChannelProvider.<init>()
at java.lang.Class.getConstructor0(DynamicHub.java:3585)
at java.lang.Class.getConstructor(DynamicHub.java:2271)
at io.grpc.ServiceProviders.createForHardCoded(ServiceProviders.java:136)
at io.grpc.ServiceProviders.getCandidatesViaHardCoded(ServiceProviders.java:125)
at io.grpc.InternalServiceProviders.getCandidatesViaHardCoded(InternalServiceProviders.java:63)
at io.grpc.ServiceProviders.loadAll(ServiceProviders.java:28)
at io.grpc.ManagedChannelRegistry.getDefaultRegistry(ManagedChannelRegistry.java:101)
at io.grpc.ManagedChannelProvider.provider(ManagedChannelProvider.java:43)
at io.grpc.ManagedChannelBuilder.forTarget(ManagedChannelBuilder.java:76)
at io.opentelemetry.exporter.internal.grpc.DefaultGrpcExporterBuilder.build(DefaultGrpcExporterBuilder.java:134)
at io.opentelemetry.exporter.jaeger.JaegerGrpcSpanExporterBuilder.build(JaegerGrpcSpanExporterBuilder.java:111)
at io.quarkus.opentelemetry.exporter.jaeger.runtime.JaegerRecorder.installBatchSpanProcessorForJaeger(JaegerRecorder.java:29)
at io.quarkus.deployment.steps.JaegerExporterProcessor$installBatchSpanProcessorForJaeger1237208624.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.JaegerExporterProcessor$installBatchSpanProcessorForJaeger1237208624.deploy(Unknown Source)
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:103)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:67)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:41)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:120)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
```
### Expected behavior
Application starts
### Actual behavior
Application start fails
### How to Reproduce?
- build latest Quarkus main
- clone https://github.com/quarkus-qe/beefy-scenarios
- run `mvn clean verify -pl 300-quarkus-vertx-webClient -Dnative`
### Output of `uname -a` or `ver`
macOS Monterey
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
GraalVM 22.0 Java17 / GraalVM 22.1 Java17 / GraalVM 21.3 Java11
### Quarkus version or git rev
Quarkus main
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | e644ded521df7299514d233540db97476ba702c7 | 38ce61dbef4148157e8f1a5f1f7c11656f7f202f | https://github.com/quarkusio/quarkus/compare/e644ded521df7299514d233540db97476ba702c7...38ce61dbef4148157e8f1a5f1f7c11656f7f202f | diff --git a/extensions/grpc-common/runtime/src/main/java/io/quarkus/grpc/common/runtime/graal/GrpcSubstitutions.java b/extensions/grpc-common/runtime/src/main/java/io/quarkus/grpc/common/runtime/graal/GrpcSubstitutions.java
index cc41a3a9ac4..349eb09e264 100644
--- a/extensions/grpc-common/runtime/src/main/java/io/quarkus/grpc/common/runtime/graal/GrpcSubstitutions.java
+++ b/extensions/grpc-common/runtime/src/main/java/io/quarkus/grpc/common/runtime/graal/GrpcSubstitutions.java
@@ -6,6 +6,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import java.util.ServiceConfigurationError;
import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Substitute;
@@ -15,6 +16,23 @@
@TargetClass(className = "io.grpc.ServiceProviders")
final class Target_io_grpc_ServiceProviders { // NOSONAR
+ @Substitute
+ static boolean isAndroid(ClassLoader cl) {
+ return false;
+ }
+
+ @Substitute
+ private static <T> T createForHardCoded(Class<T> klass, Class<?> rawClass) {
+ try {
+ return rawClass.asSubclass(klass).getConstructor().newInstance();
+ } catch (NoSuchMethodException | ClassCastException e) {
+ return null;
+ } catch (Throwable t) {
+ throw new ServiceConfigurationError(
+ String.format("Provider %s could not be instantiated %s", rawClass.getName(), t), t);
+ }
+ }
+
@Substitute
public static <T> List<T> loadAll(
Class<T> klass, | ['extensions/grpc-common/runtime/src/main/java/io/quarkus/grpc/common/runtime/graal/GrpcSubstitutions.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,848,351 | 4,032,058 | 528,859 | 5,057 | 636 | 131 | 18 | 1 | 2,873 | 183 | 715 | 70 | 2 | 1 | 1970-01-01T00:27:35 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,410 | quarkusio/quarkus/26357/25954 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25954 | https://github.com/quarkusio/quarkus/pull/26357 | https://github.com/quarkusio/quarkus/pull/26357 | 1 | fixes | Image generation failed. Exit code: 255 in windows 10 | ### Describe the bug
I can't do native build with graalvm
I'm execute ./mvnw package -Pnative
I try to compile native using jdbc and specifying the DB credentials in the properties file but I get an error, however this only happens when I add the dependencies
```xml
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-oracle</artifactId>
</dependency>
```
If I try to make the native compilation without these dependencies I can execute it without any problem
### Expected behavior
Run a native executable.
### Actual behavior
I'm execute ./mvnw package -Pnative and my log return this error:
```bash
C:\\Users\\andre\\IdeaProjects\\code-with-quarkus>mvnw package -Pnative
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.tmve:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- quarkus-maven-plugin:2.9.2.Final:generate-code (default) @ code-with-quarkus ---
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ code-with-quarkus ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:2.9.2.Final:generate-code-tests (default) @ code-with-quarkus ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\\Users\\andre\\IdeaProjects\\code-with-quarkus\\src\\test\\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ code-with-quarkus ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ code-with-quarkus ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.tmve.GreetingResourceTest
2022-06-03 10:15:06,888 INFO [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-06-03 10:15:07,527 WARN [io.qua.hib.orm.dep.HibernateOrmProcessor] (build-34) Hibernate ORM is disabled because no JPA entities were found
2022-06-03 10:15:10,435 INFO [io.quarkus] (main) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.9.2.Final) started in 4.712s. Listening on: http://localhost:8081
2022-06-03 10:15:10,435 INFO [io.quarkus] (main) Profile test activated.
2022-06-03 10:15:10,436 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-oracle, narayana-jta, resteasy, resteasy-jackson, smallrye-context-propagation, vertx]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.616 s - in com.tmve.GreetingResourceTest
2022-06-03 10:15:12,938 INFO [io.quarkus] (main) code-with-quarkus stopped in 0.056s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ code-with-quarkus ---
[INFO]
[INFO] --- quarkus-maven-plugin:2.9.2.Final:build (default) @ code-with-quarkus ---
[WARNING] [io.quarkus.deployment.steps.NativeImageAllowIncompleteClasspathAggregateStep] The following extensions have required native-image to allow run-time resolution of classes: {quarkus-jdbc-oracle}. This is a global requirement which might have unexpected effects on other extensions as well, and is a hint of the library needing some additional refactoring to better support GraalVM native-image. In the case of 3rd party dependencies and/or proprietary code there is not much we can do - please ask for support to your library vendor. If you incur in any problem with other Quarkus extensions, please try reproducing the problem without these extensions first.
[WARNING] [io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor] Hibernate ORM is disabled because no JPA entities were found
[INFO] [org.hibernate.Version] HHH000412: Hibernate ORM core version 5.6.9.Final
[WARNING] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Uber JAR strategy is used for native image source JAR generation on Windows. This is done for the time being to work around a current GraalVM limitation on Windows concerning the maximum command length (see https://github.com/oracle/graal/issues/2387).
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building uber jar: C:\\Users\\andre\\IdeaProjects\\code-with-quarkus\\target\\code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar\\code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from C:\\Users\\andre\\IdeaProjects\\code-with-quarkus\\target\\code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar\\code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM 22.0.0.2 Java 17 CE (Java Version 17.0.2+8-jvmci-22.0-b05)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] C:\\Program Files (x86)\\graalvm-ce-java17-22.0.0.2\\bin\\native-image.cmd -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 -H:-ParseOnce -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -J-Djava.awt.headless=true -H:FallbackThreshold=0 --allow-incomplete-classpath -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https -H:-UseServiceLoaderFeature -H:+StackTrace --exclude-config .*com\\.oracle\\.database\\.jdbc.* /META-INF/native-image/(?:native-image\\.properties|reflect-config\\.json) code-with-quarkus-1.0.0-SNAPSHOT-runner -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
The system cannot find the path specified.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 37.312 s
[INFO] Finished at: 2022-06-03T10:15:29-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.9.2.Final:build (default) on project code-with-quarkus: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 255[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:400)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:240)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:925)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
```
### How to Reproduce?
adding the jdbc and hibernate dependencies and then running mvnw package -Pnative
### Output of `uname -a` or `ver`
Windows 10
### Output of `java -version`
java version "11.0.13" 2021-10-19 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.13+10-LTS-370) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.13+10-LTS-370, mixed mode)
### GraalVM version (if different from Java)
GraalVM Updater 22.0.0.2
### Quarkus version or git rev
2.9.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\\Users\\andre\\.m2\\wrapper\\dists\\apache-maven-3.8.4-bin\\52ccbt68d252mdldqsfsn03jlf\\apache-maven-3.8.4 Java version: 17.0.2, vendor: Oracle Corporation, runtime: C:\\Program Files\\Java\\jdk-17.0.2 Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
### Additional information
The project used is the base one created from https://code.quarkus.io/ | 93a30172e0cdfae111bf85dbd4e1c109bc625e43 | 23f43c3d3be6f479f86f697888856a8c65d8136d | https://github.com/quarkusio/quarkus/compare/93a30172e0cdfae111bf85dbd4e1c109bc625e43...23f43c3d3be6f479f86f697888856a8c65d8136d | diff --git a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java
index 632df697aec..494d9ed1fec 100644
--- a/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java
+++ b/extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java
@@ -35,7 +35,8 @@
public final class OracleMetadataOverrides {
static final String DRIVER_JAR_MATCH_REGEX = ".*com\\\\.oracle\\\\.database\\\\.jdbc.*";
- static final String NATIVE_IMAGE_RESOURCE_MATCH_REGEX = "/META-INF/native-image/(?:native-image\\\\.properties|reflect-config\\\\.json)";
+ static final String NATIVE_IMAGE_RESOURCE_MATCH_REGEX = "/META-INF/native-image/native-image\\\\.properties";
+ static final String NATIVE_IMAGE_REFLECT_CONFIG_MATCH_REGEX = "/META-INF/native-image/reflect-config\\\\.json";
/**
* Should match the contents of {@literal reflect-config.json}
@@ -106,9 +107,13 @@ void runtimeInitializeDriver(BuildProducer<RuntimeInitializedClassBuildItem> run
}
@BuildStep
- ExcludeConfigBuildItem excludeOracleDirectives() {
- // Excludes both native-image.properties and reflect-config.json, which are reimplemented above
- return new ExcludeConfigBuildItem(DRIVER_JAR_MATCH_REGEX, NATIVE_IMAGE_RESOURCE_MATCH_REGEX);
+ void excludeOracleDirectives(BuildProducer<ExcludeConfigBuildItem> nativeImageExclusions) {
+ // Excludes both native-image.properties and reflect-config.json, which are reimplemented above.
+ // N.B. this could be expressed by using a single regex to match both resources,
+ // but such a regex would include a ? char, which breaks arguments parsing on Windows.
+ nativeImageExclusions.produce(new ExcludeConfigBuildItem(DRIVER_JAR_MATCH_REGEX, NATIVE_IMAGE_RESOURCE_MATCH_REGEX));
+ nativeImageExclusions
+ .produce(new ExcludeConfigBuildItem(DRIVER_JAR_MATCH_REGEX, NATIVE_IMAGE_REFLECT_CONFIG_MATCH_REGEX));
}
@BuildStep
diff --git a/extensions/jdbc/jdbc-oracle/deployment/src/test/java/io/quarkus/jdbc/oracle/deployment/RegexMatchTest.java b/extensions/jdbc/jdbc-oracle/deployment/src/test/java/io/quarkus/jdbc/oracle/deployment/RegexMatchTest.java
index 5a66b4d51b2..8bef768890a 100644
--- a/extensions/jdbc/jdbc-oracle/deployment/src/test/java/io/quarkus/jdbc/oracle/deployment/RegexMatchTest.java
+++ b/extensions/jdbc/jdbc-oracle/deployment/src/test/java/io/quarkus/jdbc/oracle/deployment/RegexMatchTest.java
@@ -26,20 +26,33 @@ public void jarRegexIsMatching() {
}
@Test
- public void resourceRegexIsMatching() {
- //We need to exclude both of these:
+ public void nativeImageResourceRegexIsMatching() {
+ //We need to exclude this one:
final String RES1 = "/META-INF/native-image/native-image.properties";
- final String RES2 = "/META-INF/native-image/reflect-config.json";
final Pattern pattern = Pattern.compile(OracleMetadataOverrides.NATIVE_IMAGE_RESOURCE_MATCH_REGEX);
Assert.assertTrue(pattern.matcher(RES1).find());
- Assert.assertTrue(pattern.matcher(RES2).find());
- //While this one should NOT be ignored:
- final String RES3 = "/META-INF/native-image/resource-config.json";
- final String RES4 = "/META-INF/native-image/jni-config.json";
+ //While these should NOT be ignored:
+ final String RES2 = "/META-INF/native-image/resource-config.json";
+ final String RES3 = "/META-INF/native-image/jni-config.json";
+ Assert.assertFalse(pattern.matcher(RES2).find());
+ Assert.assertFalse(pattern.matcher(RES3).find());
+ }
+
+ @Test
+ public void nativeImageReflectConfigRegexIsMatching() {
+ //We need to exclude this one:
+ final String RES1 = "/META-INF/native-image/reflect-config.json";
+ final Pattern pattern = Pattern.compile(OracleMetadataOverrides.NATIVE_IMAGE_REFLECT_CONFIG_MATCH_REGEX);
+
+ Assert.assertTrue(pattern.matcher(RES1).find());
+
+ //While these should NOT be ignored:
+ final String RES2 = "/META-INF/native-image/resource-config.json";
+ final String RES3 = "/META-INF/native-image/jni-config.json";
+ Assert.assertFalse(pattern.matcher(RES2).find());
Assert.assertFalse(pattern.matcher(RES3).find());
- Assert.assertFalse(pattern.matcher(RES4).find());
}
} | ['extensions/jdbc/jdbc-oracle/deployment/src/test/java/io/quarkus/jdbc/oracle/deployment/RegexMatchTest.java', 'extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 20,968,997 | 4,055,767 | 531,867 | 5,079 | 1,297 | 260 | 13 | 1 | 10,254 | 851 | 2,862 | 138 | 4 | 2 | 1970-01-01T00:27: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,409 | quarkusio/quarkus/26358/26222 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/26222 | https://github.com/quarkusio/quarkus/pull/26358 | https://github.com/quarkusio/quarkus/pull/26358 | 1 | fixes | gRPC Context propagation does not work | ### Describe the bug
We use OpenTelemetry with Quarkus version of 2.9.2 that already has a support for gRPC.
We has a gRPC server that get a request with OpenTelemetry's context and the context isn't propagated to the service's handler.
In addition, I used the `GrpcTracingServerInterceptor` interceptor and saw that the interceptor gets the context.
I think the problem is that this interceptor close the scope `scope.close()` and doesn't pass any contextual data to the handler level.
### Expected behavior
I expect to be able to use `Context.current()` inside the gRPC service's handler and get the context.
### Actual behavior
`Context.current()` returns an empty context.
### How to Reproduce?
1. Setup a gRPC service
2. Send a request with context to the service
3. Debug and look on the value of `Context.current()` inside the service's handler
### Output of `uname -a` or `ver`
Darwin ShakharArad 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
### Output of `java -version`
openjdk 14.0.2 2020-07-14 OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.2+12) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 14.0.2+12, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.9.2
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
------------------------------------------------------------ Gradle 7.3.3 ------------------------------------------------------------ Build time: 2021-12-22 12:37:54 UTC Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71 Kotlin: 1.5.31 Groovy: 3.0.9 Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021 JVM: 14.0.2 (AdoptOpenJDK 14.0.2+12) OS: Mac OS X 10.16 x86_64
### Additional information
_No response_ | 0435097fbea3f3a543b42ad4b8c0f63c7ad6ebc4 | 207504610c33f17b34a543576e78b1dc356223f4 | https://github.com/quarkusio/quarkus/compare/0435097fbea3f3a543b42ad4b8c0f63c7ad6ebc4...207504610c33f17b34a543576e78b1dc356223f4 | diff --git a/extensions/opentelemetry/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/GrpcOpenTelemetryTest.java b/extensions/opentelemetry/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/GrpcOpenTelemetryTest.java
index d615bcc31e0..696a27bc90f 100644
--- a/extensions/opentelemetry/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/GrpcOpenTelemetryTest.java
+++ b/extensions/opentelemetry/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/GrpcOpenTelemetryTest.java
@@ -1,5 +1,6 @@
package io.quarkus.opentelemetry.deployment;
+import static io.opentelemetry.api.trace.SpanKind.INTERNAL;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_PEER_IP;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_PEER_PORT;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_TRANSPORT;
@@ -7,6 +8,7 @@
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.RPC_METHOD;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.RPC_SERVICE;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.RPC_SYSTEM;
+import static io.quarkus.opentelemetry.runtime.OpenTelemetryConfig.INSTRUMENTATION_NAME;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -24,7 +26,11 @@
import io.grpc.Status;
import io.grpc.stub.StreamObserver;
+import io.opentelemetry.api.GlobalOpenTelemetry;
+import io.opentelemetry.api.common.AttributeKey;
+import io.opentelemetry.api.trace.Span;
import io.opentelemetry.api.trace.SpanKind;
+import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.extension.annotations.WithSpan;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.quarkus.grpc.GrpcClient;
@@ -67,10 +73,15 @@ void grpc() {
.await().atMost(Duration.ofSeconds(5));
assertEquals("Hello Naruto", response);
- List<SpanData> spans = spanExporter.getFinishedSpanItems(2);
- assertEquals(2, spans.size());
+ List<SpanData> spans = spanExporter.getFinishedSpanItems(3);
+ assertEquals(3, spans.size());
- SpanData server = spans.get(0);
+ SpanData internal = spans.get(0);
+ assertEquals("span.internal", internal.getName());
+ assertEquals(INTERNAL, internal.getKind());
+ assertEquals("value", internal.getAttributes().get(AttributeKey.stringKey("grpc.internal")));
+
+ SpanData server = spans.get(1);
assertEquals("helloworld.Greeter/SayHello", server.getName());
assertEquals(SpanKind.SERVER, server.getKind());
assertEquals("grpc", server.getAttributes().get(RPC_SYSTEM));
@@ -81,7 +92,7 @@ void grpc() {
assertNotNull(server.getAttributes().get(NET_PEER_PORT));
assertEquals("ip_tcp", server.getAttributes().get(NET_TRANSPORT));
- SpanData client = spans.get(1);
+ SpanData client = spans.get(2);
assertEquals("helloworld.Greeter/SayHello", client.getName());
assertEquals(SpanKind.CLIENT, client.getKind());
assertEquals("grpc", client.getAttributes().get(RPC_SYSTEM));
@@ -89,6 +100,7 @@ void grpc() {
assertEquals("SayHello", client.getAttributes().get(RPC_METHOD));
assertEquals(Status.Code.OK.value(), client.getAttributes().get(RPC_GRPC_STATUS_CODE));
+ assertEquals(internal.getTraceId(), server.getTraceId());
assertEquals(server.getTraceId(), client.getTraceId());
}
@@ -133,11 +145,12 @@ void error() {
void withCdi() {
assertEquals("Hello Naruto", helloBean.hello("Naruto"));
- List<SpanData> spans = spanExporter.getFinishedSpanItems(3);
- assertEquals(3, spans.size());
+ List<SpanData> spans = spanExporter.getFinishedSpanItems(4);
+ assertEquals(4, spans.size());
assertEquals(spans.get(0).getTraceId(), spans.get(1).getTraceId());
assertEquals(spans.get(0).getTraceId(), spans.get(2).getTraceId());
+ assertEquals(spans.get(0).getTraceId(), spans.get(3).getTraceId());
}
@GrpcService
@@ -149,6 +162,13 @@ public void sayHello(final HelloRequest request, final StreamObserver<HelloReply
return;
}
+ Tracer tracer = GlobalOpenTelemetry.getTracer(INSTRUMENTATION_NAME);
+ Span span = tracer.spanBuilder("span.internal")
+ .setSpanKind(INTERNAL)
+ .setAttribute("grpc.internal", "value")
+ .startSpan();
+ span.end();
+
responseObserver.onNext(HelloReply.newBuilder().setMessage("Hello " + request.getName()).build());
responseObserver.onCompleted();
}
diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java
index 6b054906ee8..aa63e542a40 100644
--- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java
+++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java
@@ -49,22 +49,16 @@ public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
GrpcRequest grpcRequest = GrpcRequest.client(method);
Context parentContext = Context.current();
- Context spanContext = null;
- Scope scope = null;
boolean shouldStart = instrumenter.shouldStart(parentContext, grpcRequest);
if (shouldStart) {
- spanContext = instrumenter.start(parentContext, grpcRequest);
- scope = spanContext.makeCurrent();
- }
-
- try {
- ClientCall<ReqT, RespT> clientCall = next.newCall(method, callOptions);
- return new TracingClientCall<>(clientCall, spanContext, grpcRequest);
- } finally {
- if (scope != null) {
- scope.close();
+ Context spanContext = instrumenter.start(parentContext, grpcRequest);
+ try (Scope ignored = spanContext.makeCurrent()) {
+ ClientCall<ReqT, RespT> clientCall = next.newCall(method, callOptions);
+ return new TracingClientCall<>(clientCall, spanContext, grpcRequest);
}
}
+
+ return next.newCall(method, callOptions);
}
private enum GrpcTextMapSetter implements TextMapSetter<GrpcRequest> {
diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java
index 959188539fe..9166bd10329 100644
--- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java
+++ b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java
@@ -53,22 +53,16 @@ public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(
GrpcRequest grpcRequest = GrpcRequest.server(call.getMethodDescriptor(), headers, call.getAttributes());
Context parentContext = Context.current();
- Context spanContext = null;
- Scope scope = null;
boolean shouldStart = instrumenter.shouldStart(parentContext, grpcRequest);
if (shouldStart) {
- spanContext = instrumenter.start(parentContext, grpcRequest);
- scope = spanContext.makeCurrent();
- }
-
- try {
- TracingServerCall<ReqT, RespT> tracingServerCall = new TracingServerCall<>(call, spanContext, grpcRequest);
- return new TracingServerCallListener<>(next.startCall(tracingServerCall, headers), spanContext, grpcRequest);
- } finally {
- if (scope != null) {
- scope.close();
+ Context spanContext = instrumenter.start(parentContext, grpcRequest);
+ try (Scope ignored = spanContext.makeCurrent()) {
+ TracingServerCall<ReqT, RespT> tracingServerCall = new TracingServerCall<>(call, spanContext, grpcRequest);
+ return new TracingServerCallListener<>(next.startCall(tracingServerCall, headers), spanContext, grpcRequest);
}
}
+
+ return next.startCall(call, headers);
}
private static class GrpcServerNetServerAttributesGetter extends InetSocketAddressNetServerAttributesGetter<GrpcRequest> {
@@ -116,7 +110,7 @@ protected TracingServerCallListener(final ServerCall.Listener<ReqT> delegate, fi
@Override
public void onHalfClose() {
- try {
+ try (Scope ignored = spanContext.makeCurrent()) {
super.onHalfClose();
} catch (Exception e) {
instrumenter.end(spanContext, grpcRequest, null, e);
@@ -126,18 +120,18 @@ public void onHalfClose() {
@Override
public void onCancel() {
- try {
+ try (Scope ignored = spanContext.makeCurrent()) {
super.onCancel();
+ instrumenter.end(spanContext, grpcRequest, Status.CANCELLED, null);
} catch (Exception e) {
instrumenter.end(spanContext, grpcRequest, null, e);
throw e;
}
- instrumenter.end(spanContext, grpcRequest, Status.CANCELLED, null);
}
@Override
public void onComplete() {
- try {
+ try (Scope ignored = spanContext.makeCurrent()) {
super.onComplete();
} catch (Exception e) {
instrumenter.end(spanContext, grpcRequest, null, e);
@@ -147,7 +141,7 @@ public void onComplete() {
@Override
public void onReady() {
- try {
+ try (Scope ignored = spanContext.makeCurrent()) {
super.onReady();
} catch (Exception e) {
instrumenter.end(spanContext, grpcRequest, null, e); | ['extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingClientInterceptor.java', 'extensions/opentelemetry/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/GrpcOpenTelemetryTest.java', 'extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/grpc/GrpcTracingServerInterceptor.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 21,962,484 | 4,300,596 | 560,411 | 5,229 | 2,334 | 461 | 46 | 2 | 1,903 | 249 | 538 | 45 | 0 | 0 | 1970-01-01T00:27: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,408 | quarkusio/quarkus/26373/26318 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/26318 | https://github.com/quarkusio/quarkus/pull/26373 | https://github.com/quarkusio/quarkus/pull/26373 | 1 | fix | Combination of quarkus-resteasy,quarkus-spring-data-rest ends with "Cannot generate HAL endpoints" | ### Describe the bug
Combination of `quarkus-resteasy,quarkus-spring-data-rest` ends with "Cannot generate HAL endpoints"
HAL was introduced in https://github.com/quarkusio/quarkus/pull/25396/files by @Sgitario
```
2022-06-23 15:16:56,114 INFO [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-06-23 15:16:56,160 WARN [io.qua.agr.dep.AgroalProcessor] (build-32) The Agroal dependency is present but no JDBC datasources have been defined.
2022-06-23 15:16:56,320 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2022-06-23 15:16:56,487 INFO [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-06-23 15:16:56,678 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.resteasy.links.deployment.LinksProcessor#addHalSupport threw an exception: java.lang.IllegalStateException: Cannot generate HAL endpoints without either 'quarkus-resteasy-jsonb' or 'quarkus-resteasy-jackson'
at io.quarkus.resteasy.links.deployment.LinksProcessor.addHalSupport(LinksProcessor.java:20)
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$3.execute(ExtensionLoader.java:944)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:330)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:95)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:485)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:68)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:147)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:102)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:131)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.resteasy.links.deployment.LinksProcessor#addHalSupport threw an exception: java.lang.IllegalStateException: Cannot generate HAL endpoints without either 'quarkus-resteasy-jsonb' or 'quarkus-resteasy-jackson'
at io.quarkus.resteasy.links.deployment.LinksProcessor.addHalSupport(LinksProcessor.java:20)
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$3.execute(ExtensionLoader.java:944)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.builder.Execution.run(Execution.java:116)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:157)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:328)
... 9 more
Caused by: java.lang.IllegalStateException: Cannot generate HAL endpoints without either 'quarkus-resteasy-jsonb' or 'quarkus-resteasy-jackson'
at io.quarkus.resteasy.links.deployment.LinksProcessor.addHalSupport(LinksProcessor.java:20)
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$3.execute(ExtensionLoader.java:944)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
```
### Expected behavior
No error is thrown, I'm not using HAL at all.
### Actual behavior
Error when building the app
### How to Reproduce?
quarkus create app app -x quarkus-resteasy,quarkus-spring-data-rest
cd app
quarkus dev
### Output of `uname -a` or `ver`
macOS Monterey
### Output of `java -version`
Java 17
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.10.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | f94a8d042cc4e90bd83addefaed9401e929307e5 | 30790783c1800401399a4faa07e6e7d7cf922491 | https://github.com/quarkusio/quarkus/compare/f94a8d042cc4e90bd83addefaed9401e929307e5...30790783c1800401399a4faa07e6e7d7cf922491 | diff --git a/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java b/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java
index 4473273519d..0d44455ea08 100644
--- a/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java
+++ b/extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java
@@ -96,6 +96,8 @@ public class ResteasyCommonProcessor {
private static final DotName QUARKUS_JSONB_SERIALIZER = DotName
.createSimple("io.quarkus.resteasy.common.runtime.jsonb.QuarkusJsonbSerializer");
+ private static final String APPLICATION_HAL_JSON = "application/hal+json";
+
private static final String[] WILDCARD_MEDIA_TYPE_ARRAY = { MediaType.WILDCARD };
private ResteasyCommonConfig resteasyCommonConfig;
@@ -217,7 +219,8 @@ JaxrsProvidersToRegisterBuildItem setupProviders(BuildProducer<ReflectiveClassBu
boolean needJsonSupport = restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.CONSUMES)
|| restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.PRODUCES)
|| restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.RESTEASY_SSE_ELEMENT_TYPE)
- || restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.RESTEASY_PART_TYPE);
+ || restJsonSupportNeeded(indexBuildItem, ResteasyDotNames.RESTEASY_PART_TYPE)
+ || restJsonSupportNeededForHalCapability(capabilities, indexBuildItem);
if (needJsonSupport) {
LOGGER.warn(
"Quarkus detected the need of REST JSON support but you have not provided the necessary JSON " +
@@ -390,21 +393,36 @@ private void checkProperConfigAccessInProvider(AnnotationInstance instance) {
}
}
+ private boolean restJsonSupportNeededForHalCapability(Capabilities capabilities, CombinedIndexBuildItem indexBuildItem) {
+ return capabilities.isPresent(Capability.HAL)
+ && isMediaTypeFoundInAnnotation(indexBuildItem, ResteasyDotNames.PRODUCES, APPLICATION_HAL_JSON);
+ }
+
private boolean restJsonSupportNeeded(CombinedIndexBuildItem indexBuildItem, DotName mediaTypeAnnotation) {
+ return isMediaTypeFoundInAnnotation(indexBuildItem, mediaTypeAnnotation,
+ MediaType.APPLICATION_JSON, MediaType.APPLICATION_JSON_PATCH_JSON);
+ }
+
+ private boolean isMediaTypeFoundInAnnotation(CombinedIndexBuildItem indexBuildItem, DotName mediaTypeAnnotation,
+ String... mediaTypes) {
for (AnnotationInstance annotationInstance : indexBuildItem.getIndex().getAnnotations(mediaTypeAnnotation)) {
final AnnotationValue annotationValue = annotationInstance.value();
if (annotationValue == null) {
continue;
}
- List<String> mediaTypes = Collections.emptyList();
+ List<String> foundMediaTypes = Collections.emptyList();
if (annotationValue.kind() == Kind.ARRAY) {
- mediaTypes = Arrays.asList(annotationValue.asStringArray());
+ foundMediaTypes = Arrays.asList(annotationValue.asStringArray());
} else if (annotationValue.kind() == Kind.STRING) {
- mediaTypes = Collections.singletonList(annotationValue.asString());
+ foundMediaTypes = Collections.singletonList(annotationValue.asString());
+ }
+
+ for (int i = 0; i < mediaTypes.length; i++) {
+ if (foundMediaTypes.contains(mediaTypes[i])) {
+ return true;
+ }
}
- return mediaTypes.contains(MediaType.APPLICATION_JSON)
- || mediaTypes.contains(MediaType.APPLICATION_JSON_PATCH_JSON);
}
return false;
diff --git a/extensions/resteasy-classic/resteasy-links/deployment/src/main/java/io/quarkus/resteasy/links/deployment/LinksProcessor.java b/extensions/resteasy-classic/resteasy-links/deployment/src/main/java/io/quarkus/resteasy/links/deployment/LinksProcessor.java
index f972525e283..7829b37caae 100644
--- a/extensions/resteasy-classic/resteasy-links/deployment/src/main/java/io/quarkus/resteasy/links/deployment/LinksProcessor.java
+++ b/extensions/resteasy-classic/resteasy-links/deployment/src/main/java/io/quarkus/resteasy/links/deployment/LinksProcessor.java
@@ -15,12 +15,6 @@ void addHalSupport(Capabilities capabilities, BuildProducer<ResteasyJaxrsProvide
BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
boolean isHalSupported = capabilities.isPresent(Capability.HAL);
if (isHalSupported) {
- if (!capabilities.isPresent(Capability.RESTEASY_JSON_JSONB)
- && !capabilities.isPresent(Capability.RESTEASY_JSON_JACKSON)) {
- throw new IllegalStateException("Cannot generate HAL endpoints without "
- + "either 'quarkus-resteasy-jsonb' or 'quarkus-resteasy-jackson'");
- }
-
jaxRsProviders.produce(
new ResteasyJaxrsProviderBuildItem(HalServerResponseFilter.class.getName()));
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-links/deployment/src/main/java/io/quarkus/resteasy/reactive/links/deployment/LinksProcessor.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive-links/deployment/src/main/java/io/quarkus/resteasy/reactive/links/deployment/LinksProcessor.java
index 939dfdb14d2..2cdbfff1adc 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-links/deployment/src/main/java/io/quarkus/resteasy/reactive/links/deployment/LinksProcessor.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-links/deployment/src/main/java/io/quarkus/resteasy/reactive/links/deployment/LinksProcessor.java
@@ -14,6 +14,7 @@
import org.jboss.jandex.DotName;
import org.jboss.jandex.FieldInfo;
import org.jboss.jandex.IndexView;
+import org.jboss.resteasy.reactive.common.util.RestMediaType;
import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.deployment.Capabilities;
@@ -82,16 +83,25 @@ AdditionalBeanBuildItem registerRestLinksProviderProducer() {
}
@BuildStep
- void addHalSupport(Capabilities capabilities, BuildProducer<CustomContainerResponseFilterBuildItem> customResponseFilters,
- BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
+ void validateJsonNeededForHal(Capabilities capabilities,
+ ResteasyReactiveResourceMethodEntriesBuildItem resourceMethodEntriesBuildItem) {
boolean isHalSupported = capabilities.isPresent(Capability.HAL);
- if (isHalSupported) {
+ if (isHalSupported && isHalMediaTypeUsedInAnyResource(resourceMethodEntriesBuildItem.getEntries())) {
+
if (!capabilities.isPresent(Capability.RESTEASY_REACTIVE_JSON_JSONB) && !capabilities.isPresent(
Capability.RESTEASY_REACTIVE_JSON_JACKSON)) {
throw new IllegalStateException("Cannot generate HAL endpoints without "
+ "either 'quarkus-resteasy-reactive-jsonb' or 'quarkus-resteasy-reactive-jackson'");
}
+ }
+ }
+ @BuildStep
+ void addHalSupport(Capabilities capabilities,
+ BuildProducer<CustomContainerResponseFilterBuildItem> customResponseFilters,
+ BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
+ boolean isHalSupported = capabilities.isPresent(Capability.HAL);
+ if (isHalSupported) {
customResponseFilters.produce(
new CustomContainerResponseFilterBuildItem(HalServerResponseFilter.class.getName()));
@@ -99,6 +109,18 @@ void addHalSupport(Capabilities capabilities, BuildProducer<CustomContainerRespo
}
}
+ private boolean isHalMediaTypeUsedInAnyResource(List<ResteasyReactiveResourceMethodEntriesBuildItem.Entry> entries) {
+ for (ResteasyReactiveResourceMethodEntriesBuildItem.Entry entry : entries) {
+ for (String mediaType : entry.getResourceMethod().getProduces()) {
+ if (RestMediaType.APPLICATION_HAL_JSON.equals(mediaType)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
private LinksContainer getLinksContainer(ResteasyReactiveResourceMethodEntriesBuildItem resourceMethodEntriesBuildItem,
IndexView index) {
LinksContainerFactory linksContainerFactory = new LinksContainerFactory(); | ['extensions/resteasy-reactive/quarkus-resteasy-reactive-links/deployment/src/main/java/io/quarkus/resteasy/reactive/links/deployment/LinksProcessor.java', 'extensions/resteasy-classic/resteasy-common/deployment/src/main/java/io/quarkus/resteasy/common/deployment/ResteasyCommonProcessor.java', 'extensions/resteasy-classic/resteasy-links/deployment/src/main/java/io/quarkus/resteasy/links/deployment/LinksProcessor.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 20,971,584 | 4,056,200 | 531,915 | 5,079 | 3,572 | 654 | 64 | 3 | 6,365 | 340 | 1,614 | 108 | 1 | 1 | 1970-01-01T00:27: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,406 | quarkusio/quarkus/26412/26392 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/26392 | https://github.com/quarkusio/quarkus/pull/26412 | https://github.com/quarkusio/quarkus/pull/26412 | 1 | close | Gradle plugin incorrectly requires Gradle 6.1 | ### Describe the bug
The Gradle plugin checks Gradle version when starting, checking for minimum 6.1 but 7.4 is required since 2.10.0.Final
### Expected behavior
Update the test so that 7.4 is required
### Actual behavior
Test is wrong
### 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.10.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 617d484bc6827cec6c01b16f300ccacc0e798b05 | 56d7655a1298a5db71aa0c53c2c9294ed77f25d5 | https://github.com/quarkusio/quarkus/compare/617d484bc6827cec6c01b16f300ccacc0e798b05...56d7655a1298a5db71aa0c53c2c9294ed77f25d5 | diff --git a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java
index c456a82b2aa..b463445777c 100644
--- a/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java
+++ b/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java
@@ -22,6 +22,7 @@
import org.gradle.api.internal.artifacts.dependencies.DefaultDependencyArtifact;
import org.gradle.api.internal.artifacts.dependencies.DefaultExternalModuleDependency;
import org.gradle.api.plugins.JavaPlugin;
+import org.gradle.api.provider.ListProperty;
import io.quarkus.bootstrap.BootstrapConstants;
import io.quarkus.bootstrap.model.PlatformImports;
@@ -135,13 +136,15 @@ private void setUpPlatformConfiguration() {
project.getConfigurations().create(this.platformConfigurationName, configuration -> {
// Platform configuration is just implementation, filtered to platform dependencies
- configuration.getDependencies().addAllLater(project.provider(() -> project.getConfigurations()
- .getByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME)
- .getAllDependencies()
- .stream()
- .filter(dependency -> dependency instanceof ModuleDependency &&
- ToolingUtils.isEnforcedPlatform((ModuleDependency) dependency))
- .collect(Collectors.toList())));
+ ListProperty<Dependency> dependencyListProperty = project.getObjects().listProperty(Dependency.class);
+ configuration.getDependencies()
+ .addAllLater(dependencyListProperty.value(project.provider(() -> project.getConfigurations()
+ .getByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME)
+ .getAllDependencies()
+ .stream()
+ .filter(dependency -> dependency instanceof ModuleDependency &&
+ ToolingUtils.isEnforcedPlatform((ModuleDependency) dependency))
+ .collect(Collectors.toList()))));
// Configures PlatformImportsImpl once the platform configuration is resolved
configuration.getResolutionStrategy().eachDependency(d -> {
ModuleIdentifier identifier = d.getTarget().getModule();
@@ -192,7 +195,8 @@ private void setUpDeploymentConfiguration() {
project.getConfigurations().create(this.deploymentConfigurationName, configuration -> {
Configuration enforcedPlatforms = this.getPlatformConfiguration();
configuration.extendsFrom(enforcedPlatforms);
- configuration.getDependencies().addAllLater(project.provider(() -> {
+ ListProperty<Dependency> dependencyListProperty = project.getObjects().listProperty(Dependency.class);
+ configuration.getDependencies().addAllLater(dependencyListProperty.value(project.provider(() -> {
ConditionalDependenciesEnabler cdEnabler = new ConditionalDependenciesEnabler(project, mode,
enforcedPlatforms);
final Collection<ExtensionDependency> allExtensions = cdEnabler.getAllExtensions();
@@ -225,7 +229,7 @@ private void setUpDeploymentConfiguration() {
}
}
return deploymentDependencies;
- }));
+ })));
});
}
} | ['devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/dependency/ApplicationDeploymentClasspathBuilder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,977,885 | 4,057,421 | 532,074 | 5,080 | 1,675 | 229 | 22 | 1 | 611 | 95 | 162 | 39 | 0 | 0 | 1970-01-01T00:27: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,405 | quarkusio/quarkus/26449/26304 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/26304 | https://github.com/quarkusio/quarkus/pull/26449 | https://github.com/quarkusio/quarkus/pull/26449 | 1 | fixes | Can't run OpenTelemetry JDBC instrumentation with Quarkus integration tests | ### Describe the bug
I'm following the [JDBC example from the OpenTelemetry guide](https://quarkus.io/guides/opentelemetry#jdbc). When I try to integrate it and then run tests using `@QuarkusIntegrationTest` it does not work. Dev services does not adjust the jdbc URL to include the `otel` part. It seems to do that fine when running `@QuarkusTest`s.
### Expected behavior
I would expect to be able to run `@QuarkusIntegrationTests` with OpenTelemetry configured.
### Actual behavior
When running `./mvnw clean verify` with integration tests enabled & the OpenTelemetry JDBC, the Quarkus tests fail. Here is the console output.
You can clearly see from ` Executing "/Users/edeandre/.sdkman/candidates/java/17.0.3-tem/bin/java -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/Users/edeandre/Desktop/temp/opentelemetry-quickstart/target/quarkus.log -Dquarkus.log.file.enable=true -Dquarkus.datasource.password=quarkus -Dquarkus.datasource.db-kind=postgresql -Dquarkus.datasource.jdbc.url=jdbc:postgresql://localhost:51217/default?loggerLevel=OFF -Dquarkus.datasource.username=quarkus -jar /Users/edeandre/Desktop/temp/opentelemetry-quickstart/target/quarkus-app/quarkus-run.jar"` that the `quarkus.datasource.jdbc.url` does not include the `otel` part:
```
[INFO] --- maven-failsafe-plugin:3.0.0-M7:integration-test (default) @ opentelemetry-quickstart ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.opentelemetry.TracedResourceIT
15:27:48 INFO traceId=, parentId=, spanId=, sampled= [or.jb.threads] (main) JBoss Threads version 3.4.2.Final
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [or.te.do.DockerClientProviderStrategy] (build-11) Loaded org.testcontainers.dockerclient.UnixSocketClientProviderStrategy from ~/.testcontainers.properties, will try it first
15:27:49 WARN traceId=, parentId=, spanId=, sampled= [or.te.do.DockerClientProviderStrategy] (build-11) DOCKER_HOST tcp://127.0.0.1:49951 is not listening
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [or.te.do.DockerClientProviderStrategy] (build-11) Found Docker environment with local Unix socket (unix:///var/run/docker.sock)
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [or.te.DockerClientFactory] (build-11) Docker host IP address is localhost
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [or.te.DockerClientFactory] (build-11) Connected to docker:
Server Version: 20.10.16
API Version: 1.41
Operating System: Docker Desktop
Total Memory: 5939 MB
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [or.te.DockerClientFactory] (build-11) Checking the system...
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [or.te.DockerClientFactory] (build-11) ✔︎ Docker server version should be at least 1.6.0
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [or.te.ut.ImageNameSubstitutor] (build-11) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [🐳.io.2]] (build-11) Creating container for image: docker.io/postgres:14.2
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [or.te.ut.RegistryAuthLocator] (build-11) Credential helper/store (docker-credential-desktop) does not have credentials for docker.io
15:27:49 WARN traceId=, parentId=, spanId=, sampled= [🐳.io.2]] (build-11) Reuse was requested but the environment does not support the reuse of containers
To enable reuse of containers, you must set 'testcontainers.reuse.enable=true' in a file located at /Users/edeandre/.testcontainers.properties
15:27:49 INFO traceId=, parentId=, spanId=, sampled= [🐳.io.2]] (build-11) Container docker.io/postgres:14.2 is starting: 9268e329708f5772c844eee81a31de1e24857bfadb7061e4813a26450360c444
15:27:50 INFO traceId=, parentId=, spanId=, sampled= [🐳.io.2]] (build-11) Container docker.io/postgres:14.2 started in PT1.258444S
15:27:50 INFO traceId=, parentId=, spanId=, sampled= [io.qu.de.po.de.PostgresqlDevServicesProcessor] (build-11) Dev Services for PostgreSQL started.
15:27:50 INFO traceId=, parentId=, spanId=, sampled= [io.qu.da.de.de.DevServicesDatasourceProcessor] (build-11) Dev Services for the default datasource (postgresql) started.
Executing "/Users/edeandre/.sdkman/candidates/java/17.0.3-tem/bin/java -Dquarkus.http.port=8081 -Dquarkus.http.ssl-port=8444 -Dtest.url=http://localhost:8081 -Dquarkus.log.file.path=/Users/edeandre/Desktop/temp/opentelemetry-quickstart/target/quarkus.log -Dquarkus.log.file.enable=true -Dquarkus.datasource.password=quarkus -Dquarkus.datasource.db-kind=postgresql -Dquarkus.datasource.jdbc.url=jdbc:postgresql://localhost:51217/default?loggerLevel=OFF -Dquarkus.datasource.username=quarkus -jar /Users/edeandre/Desktop/temp/opentelemetry-quickstart/target/quarkus-app/quarkus-run.jar"
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
15:27:51 WARN traceId=, parentId=, spanId=, sampled= [io.ag.pool] (main) Datasource '<default>': Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
15:27:51 WARN traceId=, parentId=, spanId=, sampled= [io.ag.pool] (agroal-11) Datasource '<default>': Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
15:27:51 WARN traceId=, parentId=, spanId=, sampled= [or.hi.en.jd.en.in.JdbcEnvironmentInitiator] (JPA Startup Thread: <default>) HHH000342: Could not obtain connection to query metadata: java.sql.SQLException: Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
at io.agroal.pool.ConnectionFactory.connectionSetup(ConnectionFactory.java:242)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:226)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:535)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:516)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
15:27:51 WARN traceId=, parentId=, spanId=, sampled= [io.ag.pool] (agroal-11) Datasource '<default>': Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
15:27:51 WARN traceId=, parentId=, spanId=, sampled= [or.hi.en.jd.sp.SqlExceptionHelper] (JPA Startup Thread: <default>) SQL Error: 0, SQLState: null
15:27:51 ERROR traceId=, parentId=, spanId=, sampled= [or.hi.en.jd.sp.SqlExceptionHelper] (JPA Startup Thread: <default>) Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
15:27:51 ERROR traceId=, parentId=, spanId=, sampled= [io.qu.ru.Application] (main) Failed to start application (with profile prod): java.sql.SQLException: Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
at io.agroal.pool.ConnectionFactory.connectionSetup(ConnectionFactory.java:242)
at io.agroal.pool.ConnectionFactory.createConnection(ConnectionFactory.java:226)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:535)
at io.agroal.pool.ConnectionPool$CreateConnectionTask.call(ConnectionPool.java:516)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at io.agroal.pool.util.PriorityScheduledExecutor.beforeExecute(PriorityScheduledExecutor.java:75)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Application was not started: 2022-06-22 15:27:51,354 edeandrea-m1pro quarkus-run.jar[4225] ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.sql.SQLException: Driver does not support the provided URL: jdbc:postgresql://localhost:51217/default?loggerLevel=OFF
```
### How to Reproduce?
Reproducer:
[opentelemetry-quickstart.zip](https://github.com/quarkusio/quarkus/files/8961164/opentelemetry-quickstart.zip)
1. Unzip
2. `cd opentelemetry-quickstart`
3. `./mvnw clean verify`
### Output of `uname -a` or `ver`
Darwin edeandrea-m1pro 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64
### Output of `java -version`
```
openjdk version "17.0.3" 2022-04-19
OpenJDK Runtime Environment Temurin-17.0.3+7 (build 17.0.3+7)
OpenJDK 64-Bit Server VM Temurin-17.0.3+7 (build 17.0.3+7, mixed mode)
```
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.10.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
```
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /Users/edeandre/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4
Java version: 17.0.3, vendor: Eclipse Adoptium, runtime: /Users/edeandre/.sdkman/candidates/java/17.0.3-tem
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "12.4", arch: "aarch64", family: "mac"
```
### Additional information
_No response_ | 2ef790ccdcd04ff5c366aec17470eff16e7872dd | f61c64a40b52cef6063994465e4f21f998fe6240 | https://github.com/quarkusio/quarkus/compare/2ef790ccdcd04ff5c366aec17470eff16e7872dd...f61c64a40b52cef6063994465e4f21f998fe6240 | diff --git a/extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java b/extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java
index 8ac7144a4f9..4ce75156be6 100644
--- a/extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java
+++ b/extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java
@@ -1,11 +1,8 @@
package io.quarkus.opentelemetry.deployment.dev;
-import static io.quarkus.opentelemetry.runtime.dev.OpenTelemetryDevServicesConfigBuilder.OPENTELEMETRY_DEVSERVICES_CONFIG;
-
-import java.io.ByteArrayOutputStream;
+import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import java.util.Properties;
import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.config.ConfigValue;
@@ -14,22 +11,19 @@
import io.quarkus.deployment.IsNormal;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.GeneratedResourceBuildItem;
-import io.quarkus.deployment.builditem.RunTimeConfigBuilderBuildItem;
+import io.quarkus.deployment.builditem.DevServicesAdditionalConfigBuildItem;
import io.quarkus.deployment.dev.devservices.GlobalDevServicesConfig;
import io.quarkus.opentelemetry.deployment.OpenTelemetryEnabled;
-import io.quarkus.opentelemetry.runtime.dev.OpenTelemetryDevServicesConfigBuilder;
public class DevServicesOpenTelemetryProcessor {
@BuildStep(onlyIfNot = IsNormal.class, onlyIf = { OpenTelemetryEnabled.class, GlobalDevServicesConfig.Enabled.class })
void devServicesDatasources(
Optional<DevServicesDatasourceResultBuildItem> devServicesDatasources,
- BuildProducer<GeneratedResourceBuildItem> generatedResource,
- BuildProducer<RunTimeConfigBuilderBuildItem> runtimeConfigBuilder) throws Exception {
+ BuildProducer<DevServicesAdditionalConfigBuildItem> devServicesAdditionalConfig) {
if (devServicesDatasources.isPresent()) {
- Properties properties = new Properties();
+ Map<String, String> properties = new HashMap<>();
DevServicesDatasourceResultBuildItem.DbResult defaultDatasource = devServicesDatasources.get()
.getDefaultDatasource();
if (defaultDatasource != null) {
@@ -47,28 +41,20 @@ void devServicesDatasources(
}
// if we find a dev service datasource and the OTel driver, we rewrite the jdbc url to add the otel prefix
- for (Map.Entry<Object, Object> property : properties.entrySet()) {
- String key = (String) property.getKey();
- String value = (String) property.getValue();
+ for (Map.Entry<String, String> property : properties.entrySet()) {
+ String key = property.getKey();
+ String value = property.getValue();
if (key.endsWith(".url") && value.startsWith("jdbc:")) {
String driverKey = key.substring(0, key.length() - 4) + ".driver";
ConfigValue driverValue = ConfigProvider.getConfig().getConfigValue(driverKey);
if (driverValue.getValue() != null
&& driverValue.getValue().equals("io.opentelemetry.instrumentation.jdbc.OpenTelemetryDriver")) {
- properties.put(key, value.replaceFirst("jdbc:", "jdbc:otel:"));
+ devServicesAdditionalConfig.produce(new DevServicesAdditionalConfigBuildItem(key, key,
+ value.replaceFirst("jdbc:", "jdbc:otel:"), () -> {
+ }));
}
}
}
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- properties.store(out, null);
-
- // write the config with a slightly higher priority then runtime defaults
- // see io.quarkus.deployment.steps.ConfigGenerationBuildStep#runtimeDefaultsConfig
- generatedResource
- .produce(new GeneratedResourceBuildItem(OPENTELEMETRY_DEVSERVICES_CONFIG, out.toByteArray()));
- runtimeConfigBuilder
- .produce(new RunTimeConfigBuilderBuildItem(OpenTelemetryDevServicesConfigBuilder.class.getName()));
}
}
}
diff --git a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/dev/OpenTelemetryDevServicesConfigBuilder.java b/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/dev/OpenTelemetryDevServicesConfigBuilder.java
deleted file mode 100644
index 0895c73fdc9..00000000000
--- a/extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/dev/OpenTelemetryDevServicesConfigBuilder.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package io.quarkus.opentelemetry.runtime.dev;
-
-import java.io.IOException;
-import java.net.URL;
-
-import org.eclipse.microprofile.config.spi.ConfigSource;
-import org.eclipse.microprofile.config.spi.ConfigSourceProvider;
-
-import io.quarkus.runtime.configuration.ConfigBuilder;
-import io.smallrye.config.AbstractLocationConfigSourceLoader;
-import io.smallrye.config.PropertiesConfigSource;
-import io.smallrye.config.SmallRyeConfigBuilder;
-
-public class OpenTelemetryDevServicesConfigBuilder implements ConfigBuilder {
- public static final String OPENTELEMETRY_DEVSERVICES_CONFIG = "opentelemetry-devservices-config.properties";
-
- @Override
- public SmallRyeConfigBuilder configBuilder(final SmallRyeConfigBuilder builder) {
- builder.withSources(new DevServicesConfigSourceFactory());
- return builder;
- }
-
- private static class DevServicesConfigSourceFactory extends AbstractLocationConfigSourceLoader
- implements ConfigSourceProvider {
- @Override
- protected String[] getFileExtensions() {
- return new String[] { "properties" };
- }
-
- @Override
- protected ConfigSource loadConfigSource(final URL url, final int ordinal) throws IOException {
- return new PropertiesConfigSource(url, ordinal);
- }
-
- @Override
- public Iterable<ConfigSource> getConfigSources(final ClassLoader forClassLoader) {
- return loadConfigSources(OPENTELEMETRY_DEVSERVICES_CONFIG, Integer.MIN_VALUE + 500);
- }
- }
-} | ['extensions/opentelemetry/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/dev/OpenTelemetryDevServicesConfigBuilder.java', 'extensions/opentelemetry/opentelemetry/deployment/src/main/java/io/quarkus/opentelemetry/deployment/dev/DevServicesOpenTelemetryProcessor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 21,962,583 | 4,300,617 | 560,412 | 5,229 | 3,770 | 683 | 74 | 2 | 10,163 | 800 | 2,933 | 120 | 4 | 3 | 1970-01-01T00:27: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,404 | quarkusio/quarkus/26456/26386 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/26386 | https://github.com/quarkusio/quarkus/pull/26456 | https://github.com/quarkusio/quarkus/pull/26456 | 1 | fix | Quarkus 2.10.0 doesn't work for Simulate Amazon Lambda Deployment with SAM CLI | ### Describe the bug
With a simple app (e.g. Hello world REST API), Quarkus 2.9.2 allows me to simulate an AWS Lambda app using SAM CLI locally as below:
sam local start-api --template target/sam.jvm.yaml
But Quarkus 2.10.0 doesn't work with the error as the actual behavior. I know that Quarkus dev mode is good enough to test the function since Quarkus dev mode starts a mock AWS Lambda event server that will convert HTTP requests. But as long as we provide the sam CLI guide in our doc(https://quarkus.io/guides/amazon-lambda-http), sam local test should work too.
### Expected behavior
Start a Quarkus dev mode without an error then a developer can access the REST API to invoke the function.
### Actual behavior
I have the following error:
```
2022-06-27 17:18:36,102 ERROR [qua.ama.lam.http] (main) Request Failure: java.lang.ClassCastException: class lambdainternal.api.LambdaContext cannot be cast to class io.quarkus.amazon.lambda.runtime.AmazonLambdaContext (lambdainternal.api.LambdaContext is in unnamed module of loader 'app'; io.quarkus.amazon.lambda.runtime.AmazonLambdaContext is in unnamed module of loader lambdainternal.CustomerClassLoader @1a6c5a9e)
at io.quarkus.amazon.lambda.http.LambdaHttpHandler.handleRequest(LambdaHttpHandler.java:70)
at io.quarkus.amazon.lambda.http.LambdaHttpHandler.handleRequest(LambdaHttpHandler.java:47)
at io.quarkus.amazon.lambda.runtime.AmazonLambdaRecorder.handle(AmazonLambdaRecorder.java:85)
at io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler.handleRequest(QuarkusStreamHandler.java:58)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at lambdainternal.EventHandlerLoader$StreamMethodRequestHandler.handleRequest(EventHandlerLoader.java:375)
at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:899)
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:268)
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:206)
at lambdainternal.AWSLambda.main(AWSLambda.java:200)
END RequestId: 11f8a8d0-2db1-48b2-a39d-5e15caea30c9
REPORT RequestId: 11f8a8d0-2db1-48b2-a39d-5e15caea30c9 Init Duration: 0.16 ms Duration: 3012.45 ms Billed Duration: 3013 ms Memory Size: 512 MB Max Memory Used: 512 MB
No Content-Type given. Defaulting to 'application/json'.
2022-06-27 13:18:36 127.0.0.1 - - [27/Jun/2022 13:18:36] "GET /hello/greeting/awslocal HTTP/1.1" 500 -
```
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
Darwin Daniels-MacBook-Pro 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:22 PDT 2022; root:xnu-8020.121.3~4/RELEASE_X86_64 x86_64
### Output of `java -version`
openjdk version "11.0.10" 2021-01-19 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.10+9) OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.10+9, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.10.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4
### Additional information
_No response_ | cc52692e75dbad784eeb53fd7da135c2292e135c | 21306dbabe2e77bd99c5f71b440d9699e24d9c65 | https://github.com/quarkusio/quarkus/compare/cc52692e75dbad784eeb53fd7da135c2292e135c...21306dbabe2e77bd99c5f71b440d9699e24d9c65 | diff --git a/extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java b/extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java
index 9ee81290fab..cd6bfb7308c 100644
--- a/extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java
+++ b/extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java
@@ -56,6 +56,7 @@ public void handleHttpRequests(RoutingContext ctx) {
event.setRequestContext(new APIGatewayV2HTTPEvent.RequestContext());
event.getRequestContext().setHttp(new APIGatewayV2HTTPEvent.RequestContext.Http());
event.getRequestContext().getHttp().setMethod(ctx.request().method().name());
+ event.getRequestContext().getHttp().setSourceIp(ctx.request().connection().remoteAddress().hostAddress());
event.setRawPath(ctx.request().path());
event.setRawQueryString(ctx.request().query());
for (String header : ctx.request().headers().names()) {
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 765e31a7e29..53294384a01 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
@@ -4,7 +4,6 @@
import java.io.ByteArrayOutputStream;
import java.net.InetSocketAddress;
-import java.net.URL;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.StandardCharsets;
@@ -36,7 +35,6 @@
import io.netty.handler.codec.http.HttpVersion;
import io.netty.handler.codec.http.LastHttpContent;
import io.netty.util.ReferenceCountUtil;
-import io.quarkus.amazon.lambda.runtime.AmazonLambdaContext;
import io.quarkus.netty.runtime.virtual.VirtualClientConnection;
import io.quarkus.netty.runtime.virtual.VirtualResponseHandler;
import io.quarkus.vertx.http.runtime.QuarkusHttpHeaders;
@@ -67,7 +65,7 @@ public APIGatewayV2HTTPResponse handleRequest(APIGatewayV2HTTPEvent request, Con
}
try {
- return nettyDispatch(clientAddress, request, (AmazonLambdaContext) context);
+ return nettyDispatch(clientAddress, request, context);
} catch (Exception e) {
log.error("Request Failure", e);
APIGatewayV2HTTPResponse res = new APIGatewayV2HTTPResponse();
@@ -168,7 +166,7 @@ public void close() {
}
private APIGatewayV2HTTPResponse nettyDispatch(InetSocketAddress clientAddress, APIGatewayV2HTTPEvent request,
- AmazonLambdaContext context)
+ Context context)
throws Exception {
QuarkusHttpHeaders quarkusHeaders = new QuarkusHttpHeaders();
quarkusHeaders.setContextObject(Context.class, context);
@@ -223,12 +221,19 @@ httpMethod, ofNullable(request.getRawQueryString())
NettyResponseHandler handler = new NettyResponseHandler(request);
VirtualClientConnection connection = VirtualClientConnection.connect(handler, VertxHttpRecorder.VIRTUAL_HTTP,
clientAddress);
- if (connection.peer().remoteAddress().equals(VertxHttpRecorder.VIRTUAL_HTTP)) {
- URL requestURL = context.getRequestURL();
+ if (request.getRequestContext() != null
+ && request.getRequestContext().getHttp() != null
+ && request.getRequestContext().getHttp().getSourceIp() != null
+ && request.getRequestContext().getHttp().getSourceIp().length() > 0) {
+ int port = 443; // todo, may be bad to assume 443?
+ if (request.getHeaders() != null &&
+ request.getHeaders().get("X-Forwarded-Port") != null) {
+ port = Integer.parseInt(request.getHeaders().get("X-Forwarded-Port"));
+ }
connection.peer().attr(ConnectionBase.REMOTE_ADDRESS_OVERRIDE).set(
- SocketAddress.inetSocketAddress(requestURL.getPort(), requestURL.getHost()));
+ SocketAddress.inetSocketAddress(port,
+ request.getRequestContext().getHttp().getSourceIp()));
}
-
connection.sendMessage(nettyRequest);
connection.sendMessage(requestContent);
try {
diff --git a/extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java b/extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java
index b19ed5d533b..9b2a6e684b6 100644
--- a/extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java
+++ b/extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java
@@ -16,6 +16,7 @@
import com.fasterxml.jackson.databind.ObjectReader;
import com.fasterxml.jackson.databind.ObjectWriter;
+import io.quarkus.amazon.lambda.http.model.ApiGatewayRequestIdentity;
import io.quarkus.amazon.lambda.http.model.AwsProxyRequest;
import io.quarkus.amazon.lambda.http.model.AwsProxyRequestContext;
import io.quarkus.amazon.lambda.http.model.AwsProxyResponse;
@@ -61,6 +62,8 @@ public void handleHttpRequests(RoutingContext ctx) {
event.setRequestContext(new AwsProxyRequestContext());
event.getRequestContext().setRequestId(requestId);
event.getRequestContext().setHttpMethod(ctx.request().method().name());
+ event.getRequestContext().setIdentity(new ApiGatewayRequestIdentity());
+ event.getRequestContext().getIdentity().setSourceIp(ctx.request().connection().remoteAddress().hostAddress());
event.setHttpMethod(ctx.request().method().name());
event.setPath(ctx.request().path());
if (ctx.request().query() != null) {
diff --git a/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java b/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java
index 9a3fe62c13d..bb8c1b576e4 100644
--- a/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java
+++ b/extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java
@@ -2,7 +2,6 @@
import java.io.ByteArrayOutputStream;
import java.net.InetSocketAddress;
-import java.net.URL;
import java.net.URLEncoder;
import java.nio.channels.Channels;
import java.nio.channels.WritableByteChannel;
@@ -34,7 +33,6 @@
import io.quarkus.amazon.lambda.http.model.AwsProxyRequestContext;
import io.quarkus.amazon.lambda.http.model.AwsProxyResponse;
import io.quarkus.amazon.lambda.http.model.Headers;
-import io.quarkus.amazon.lambda.runtime.AmazonLambdaContext;
import io.quarkus.netty.runtime.virtual.VirtualClientConnection;
import io.quarkus.netty.runtime.virtual.VirtualResponseHandler;
import io.quarkus.vertx.http.runtime.QuarkusHttpHeaders;
@@ -62,7 +60,7 @@ public AwsProxyResponse handleRequest(AwsProxyRequest request, Context context)
}
try {
- return nettyDispatch(clientAddress, request, (AmazonLambdaContext) context);
+ return nettyDispatch(clientAddress, request, context);
} catch (Exception e) {
log.error("Request Failure", e);
return new AwsProxyResponse(500, errorHeaders, "{ \\"message\\": \\"Internal Server Error\\" }");
@@ -152,7 +150,7 @@ public void close() {
}
private AwsProxyResponse nettyDispatch(InetSocketAddress clientAddress, AwsProxyRequest request,
- AmazonLambdaContext context)
+ Context context)
throws Exception {
String path = request.getPath();
//log.info("---- Got lambda request: " + path);
@@ -210,10 +208,17 @@ private AwsProxyResponse nettyDispatch(InetSocketAddress clientAddress, AwsProxy
NettyResponseHandler handler = new NettyResponseHandler(request);
VirtualClientConnection connection = VirtualClientConnection.connect(handler, VertxHttpRecorder.VIRTUAL_HTTP,
clientAddress);
- if (connection.peer().remoteAddress().equals(VertxHttpRecorder.VIRTUAL_HTTP)) {
- URL requestURL = context.getRequestURL();
+ if (request.getRequestContext() != null
+ && request.getRequestContext().getIdentity() != null
+ && request.getRequestContext().getIdentity().getSourceIp() != null
+ && request.getRequestContext().getIdentity().getSourceIp().length() > 0) {
+ int port = 443; // todo, may be bad to assume 443?
+ if (request.getMultiValueHeaders() != null &&
+ request.getMultiValueHeaders().getFirst("X-Forwarded-Port") != null) {
+ port = Integer.parseInt(request.getMultiValueHeaders().getFirst("X-Forwarded-Port"));
+ }
connection.peer().attr(ConnectionBase.REMOTE_ADDRESS_OVERRIDE).set(
- SocketAddress.inetSocketAddress(requestURL.getPort(), requestURL.getHost()));
+ SocketAddress.inetSocketAddress(port, request.getRequestContext().getIdentity().getSourceIp()));
}
connection.sendMessage(nettyRequest);
diff --git a/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaContext.java b/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaContext.java
index 02b006d9024..946bcb46f3a 100644
--- a/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaContext.java
+++ b/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaContext.java
@@ -13,7 +13,6 @@
import java.io.IOException;
import java.net.HttpURLConnection;
-import java.net.URL;
import com.amazonaws.services.lambda.runtime.ClientContext;
import com.amazonaws.services.lambda.runtime.CognitoIdentity;
@@ -35,7 +34,6 @@ public class AmazonLambdaContext implements Context {
private long runtimeDeadlineMs = 0;
private final int memoryLimitInMB;
private final LambdaLogger logger;
- private final URL requestURL;
public AmazonLambdaContext(HttpURLConnection request, ObjectReader cognitoReader, ObjectReader clientCtxReader)
throws IOException {
@@ -64,7 +62,6 @@ public AmazonLambdaContext(HttpURLConnection request, ObjectReader cognitoReader
runtimeDeadlineMs = Long.valueOf(runtimeDeadline);
}
logger = LambdaRuntime.getLogger();
- requestURL = request.getURL();
}
@Override
@@ -121,8 +118,4 @@ public int getMemoryLimitInMB() {
public LambdaLogger getLogger() {
return logger;
}
-
- public URL getRequestURL() {
- return requestURL;
- }
} | ['extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AmazonLambdaContext.java', 'extensions/amazon-lambda-http/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java', 'extensions/amazon-lambda-http/http-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockHttpEventServer.java', 'extensions/amazon-lambda-rest/rest-event-server/src/main/java/io/quarkus/amazon/lambda/runtime/MockRestEventServer.java', 'extensions/amazon-lambda-rest/runtime/src/main/java/io/quarkus/amazon/lambda/http/LambdaHttpHandler.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 21,964,197 | 4,301,025 | 560,471 | 5,231 | 3,132 | 595 | 51 | 5 | 3,299 | 321 | 933 | 65 | 1 | 1 | 1970-01-01T00:27: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,403 | quarkusio/quarkus/26465/26455 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/26455 | https://github.com/quarkusio/quarkus/pull/26465 | https://github.com/quarkusio/quarkus/pull/26465 | 1 | fix | [reactive-pg-client] NullPointerException in PgPoolRecorder.java | ### Describe the bug
When migrating from `2.9.2.Final` to `2.10.1.Final` the tests for one of my applications started failing due to a NullPointerException:
```
java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:237)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:250)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:609)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:647)
... 35 more
Caused by: java.lang.NullPointerException
at io.quarkus.reactive.pg.client.runtime.PgPoolRecorder.toPgConnectOptions(PgPoolRecorder.java:193)
at io.quarkus.reactive.pg.client.runtime.PgPoolRecorder.initialize(PgPoolRecorder.java:68)
at io.quarkus.reactive.pg.client.runtime.PgPoolRecorder.configurePgPool(PgPoolRecorder.java:47)
at io.quarkus.deployment.steps.ReactivePgClientProcessor$build897843755.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.ReactivePgClientProcessor$build897843755.deploy(Unknown Source)
... 51 more
```
The cause seems to be that `dataSourceReactiveRuntimeConfig.additionalProperties` can be null, so when it hits this line it fails:
https://github.com/quarkusio/quarkus/blob/3ad7cd0ec6a2297ccda5759b5acb22741d147d37/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java#L193
### Expected behavior
The application starts up successfully.
### Actual behavior
The application fails.
### How to Reproduce?
I cannot share a reproducer at this time because the code belongs to my company and it would be difficult to recreate.
However, based on my troubleshooting the issue seems to triggered with this configuration:
```yaml
"%test":
quarkus:
datasource:
app:
db-kind: postgresql
devservices:
enabled: true
image-name: postgres:14
username: "quarkus"
password: "quarkus"
migration:
db-kind: postgresql
# This is an awkward workaround to prevent multiple instances of DevServices running.
jdbc:
url: "${quarkus.datasource.\\"app\\".jdbc.url}"
username: "quarkus"
password: "quarkus"
flyway:
migration:
# settings
```
> **Aside**: Having two separate datasources is an awkward workaround run Flyway migrations as a separate user from the standard application operations. For tests it doesn't matter.
>
> Ideally, it'd be possible to specify different credentials in the URL for reactive and JDBC, or make it so reactive/jdbc can be disabled per data source. I'll probably make a separate issue about this...)
When `PgPoolRecorder.configurePgPool` is called for the "app" datasource, `dataSourceReactiveRuntimeConfig.additionalProperties` is empty. However, when it's called for the `migration` datasource,`dataSourceReactiveRuntimeConfig.additionalProperties` is null.
The straightforward solution would be to surround this with a null check. But the fact that it's `null` in the first place may be a bug.
_Edit:_ if it's expected that `additionalProperties` can be null, the null check would need to be added to all pool recorders.
https://github.com/quarkusio/quarkus/commit/dccb8d968a1ba9e387439de187e91aca7d2053c8
### 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.10.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
3.8.5
### Additional information
_No response_ | b0ba511c5ff55652f2e3f1e55635ded6d83d2d73 | 7891b61b18e12d5a5ffaa246b87fcff81927f817 | https://github.com/quarkusio/quarkus/compare/b0ba511c5ff55652f2e3f1e55635ded6d83d2d73...7891b61b18e12d5a5ffaa246b87fcff81927f817 | diff --git a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java
index 9d6601482a5..1c07a501cf7 100644
--- a/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java
+++ b/extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java
@@ -1,6 +1,7 @@
package io.quarkus.agroal.runtime;
import java.time.Duration;
+import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;
@@ -130,18 +131,18 @@ public class DataSourceJdbcRuntimeConfig {
* validation. Setting this setting to STRICT may lead to failures in those cases.
*/
@ConfigItem
- public Optional<AgroalConnectionPoolConfiguration.TransactionRequirement> transactionRequirement;
+ public Optional<AgroalConnectionPoolConfiguration.TransactionRequirement> transactionRequirement = Optional.empty();
/**
* Other unspecified properties to be passed to the JDBC driver when creating new connections.
*/
@ConfigItem
- public Map<String, String> additionalJdbcProperties;
+ public Map<String, String> additionalJdbcProperties = Collections.emptyMap();
/**
* Enable JDBC tracing.
*/
@ConfigItem
- public DataSourceJdbcTracingRuntimeConfig tracing;
+ public DataSourceJdbcTracingRuntimeConfig tracing = new DataSourceJdbcTracingRuntimeConfig();
}
diff --git a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java
index 831a2bf172e..5a8b6480203 100644
--- a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java
+++ b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java
@@ -1,6 +1,7 @@
package io.quarkus.reactive.datasource.runtime;
import java.time.Duration;
+import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;
@@ -145,12 +146,12 @@ public class DataSourceReactiveRuntimeConfig {
* Set the pool name, used when the pool is shared among datasources, otherwise ignored.
*/
@ConfigItem
- public Optional<String> name;
+ public Optional<String> name = Optional.empty();
/**
* Other unspecified properties to be passed through the Reactive SQL Client directly to the database when new connections
* are initiated.
*/
@ConfigItem
- public Map<String, String> additionalProperties;
+ public Map<String, String> additionalProperties = Collections.emptyMap();
} | ['extensions/agroal/runtime/src/main/java/io/quarkus/agroal/runtime/DataSourceJdbcRuntimeConfig.java', 'extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 21,968,298 | 4,301,799 | 560,574 | 5,231 | 803 | 145 | 12 | 2 | 4,237 | 369 | 1,008 | 99 | 2 | 2 | 1970-01-01T00:27: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,402 | quarkusio/quarkus/26477/26476 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/26476 | https://github.com/quarkusio/quarkus/pull/26477 | https://github.com/quarkusio/quarkus/pull/26477 | 1 | closes | Using "mvn install" a second time throws "FileAlreadyExistsException: .../target/lib/../providers/.keep" | ### Describe the bug
When I run `mvn install` a second time on my project ([keycloak](https://github.com/keycloak/keycloak)), complains that the `.keep` file exists.
### Expected behavior
Run should continue.
### Actual behavior
Exception being thrown.
```
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.7.6.Final:build (default) on project keycloak-quarkus-server-app: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.pkg.steps.JarResultBuildStep#buildRunnerJar threw an exception: java.lang.IllegalStateException: java.nio.file.FileAlreadyExistsException: /***/keycloak/quarkus/server/target/lib/../providers/.keep
[ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:891)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:829)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] Caused by: java.nio.file.FileAlreadyExistsException: /home/aschwart/redhat/workspace/keycloak-pr-2/quarkus/server/target/lib/../providers/.keep
[ERROR] at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:94)
[ERROR] at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
[ERROR] at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
[ERROR] at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:219)
[ERROR] at java.base/java.nio.file.Files.newByteChannel(Files.java:371)
[ERROR] at java.base/java.nio.file.Files.createFile(Files.java:648)
[ERROR] at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildThinJar(JarResultBuildStep.java:571)
[ERROR] at io.quarkus.deployment.pkg.steps.JarResultBuildStep.buildRunnerJar(JarResultBuildStep.java:218)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR] at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:882)
[ERROR] ... 6 more
```
### How to Reproduce?
1. checkout project
2. run `mvn install`
3. run `mvn install` again
-> Exception appears
### Output of `uname -a` or `ver`
Linux fedora 5.18.7-100.fc35.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Jun 25 20:05:19 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk 11.0.13 2021-10-19 LTS
OpenJDK Runtime Environment Corretto-11.0.13.8.1 (build 11.0.13+8-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.13.8.1 (build 11.0.13+8-LTS, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.7.6.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /home/aschwart/apache-maven-3.8.4
Java version: 11.0.13, vendor: Amazon.com Inc., runtime: /home/aschwart/.jdks/corretto-11.0.13
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.18.7-100.fc35.x86_64", arch: "amd64", family: "unix"
### Additional information
PR available as a fix #26477 | 0025aff6418a09d1ae91fcfdb9d4d9c16685ac78 | 65270ab04074d0957b10c6f1db92833680344e79 | https://github.com/quarkusio/quarkus/compare/0025aff6418a09d1ae91fcfdb9d4d9c16685ac78...65270ab04074d0957b10c6f1db92833680344e79 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java
index 9486104637b..a1c9d0dbeb2 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java
@@ -567,7 +567,11 @@ private JarBuildItem buildThinJar(CurateOutcomeBuildItem curateOutcomeBuildItem,
Files.createDirectories(userProviders);
//we add this dir so that it can be copied into container images if required
//and will still be copied even if empty
- Files.createFile(userProviders.resolve(".keep"));
+ Path keepFile = userProviders.resolve(".keep");
+ if (!keepFile.toFile().exists()) {
+ // check if the file exists to avoid a FileAlreadyExistsException
+ Files.createFile(keepFile);
+ }
}
} else {
IoUtils.createOrEmptyDir(quarkus); | ['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 22,077,443 | 4,322,296 | 563,082 | 5,245 | 338 | 57 | 6 | 1 | 3,994 | 272 | 1,093 | 81 | 1 | 1 | 1970-01-01T00:27: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,431 | quarkusio/quarkus/25407/24931 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/24931 | https://github.com/quarkusio/quarkus/pull/25407 | https://github.com/quarkusio/quarkus/pull/25407 | 1 | fixes | NullPointerException with Quartz and Quarkus 2.8.0.Final when a job identity is changed | ### Describe the bug
After updating to Quarkus 2.8.0.Final, one of our scheduled tasks failed with an exception I've not seen before and that seems to be coming from Quarkus:
```
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.NullPointerException: Cannot read field "invoker" because "this.trigger" is null]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
Caused by: java.lang.NullPointerException: Cannot read field "invoker" because "this.trigger" is null
at io.quarkus.quartz.runtime.QuartzScheduler$InvokerJob.execute(QuartzScheduler.java:553)
at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)
```
Application is deployed as an uber-jar.
### Expected behavior
No NullPointerException is thrown when scheduling jobs
### Actual behavior
_No response_
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
RHEL 8 Linux
### Output of `java -version`
17.0.2
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.8.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 7.4.1
### Additional information
_No response_ | 4df39b60a0b3d132713e6d60087a1054588d4a5f | c4aa8948da8bc78aa7560a7596b1898961aea0cc | https://github.com/quarkusio/quarkus/compare/4df39b60a0b3d132713e6d60087a1054588d4a5f...c4aa8948da8bc78aa7560a7596b1898961aea0cc | diff --git a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java
index ec68f58ae00..22e65c5c55b 100644
--- a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java
+++ b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java
@@ -277,8 +277,8 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Sc
org.quartz.Trigger trigger = triggerBuilder.build();
org.quartz.Trigger oldTrigger = scheduler.getTrigger(trigger.getKey());
if (oldTrigger != null) {
- scheduler.rescheduleJob(trigger.getKey(),
- triggerBuilder.startAt(oldTrigger.getNextFireTime()).build());
+ trigger = triggerBuilder.startAt(oldTrigger.getNextFireTime()).build();
+ scheduler.rescheduleJob(trigger.getKey(), trigger);
LOGGER.debugf("Rescheduled business method %s with config %s", method.getMethodDescription(),
scheduled);
} else if (!scheduler.checkExists(jobDetail.getKey())) {
@@ -292,7 +292,8 @@ public QuartzScheduler(SchedulerContext context, QuartzSupport quartzSupport, Sc
oldTrigger = scheduler.getTrigger(new TriggerKey(identity + "_trigger", Scheduler.class.getName()));
if (oldTrigger != null) {
scheduler.deleteJob(jobDetail.getKey());
- scheduler.scheduleJob(jobDetail, triggerBuilder.startAt(oldTrigger.getNextFireTime()).build());
+ trigger = triggerBuilder.startAt(oldTrigger.getNextFireTime()).build();
+ scheduler.scheduleJob(jobDetail, trigger);
LOGGER.debugf(
"Rescheduled business method %s with config %s due to Trigger '%s' record being renamed after removal of '_trigger' suffix",
method.getMethodDescription(),
@@ -558,7 +559,7 @@ static class InvokerJob implements Job {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
- if (trigger.invoker != null) { // could be null from previous runs
+ if (trigger != null && trigger.invoker != null) { // could be null from previous runs
if (trigger.invoker.isBlocking()) {
try {
trigger.invoker.invoke(new QuartzScheduledExecution(trigger, jobExecutionContext));
@@ -579,6 +580,11 @@ public void handle(Void event) {
}
});
}
+ } else {
+ String jobName = jobExecutionContext.getJobDetail().getKey().getName();
+ LOGGER.warnf("Unable to find corresponding Quartz trigger for job %s. " +
+ "Update your Quartz table by removing all phantom jobs or make sure that there is a " +
+ "Scheduled method with the identity matching the job's name", jobName);
}
}
} | ['extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,544,834 | 3,973,681 | 521,661 | 5,009 | 1,253 | 202 | 14 | 1 | 1,404 | 148 | 346 | 51 | 0 | 1 | 1970-01-01T00:27:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,432 | quarkusio/quarkus/25401/25186 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25186 | https://github.com/quarkusio/quarkus/pull/25401 | https://github.com/quarkusio/quarkus/pull/25401 | 1 | fixes | Config quarkus.config.locations is evaluated before applying profile | ### Describe the bug
Hello,
the config `quarkus.config.locations` is evaluated before applying the profile.
~~~
quarkus.config.locations=file1.properties
%test.quarkus.config.locations=file1.properties,file2.properties
~~~
Launching tests, the "Test" profile is activated AFTER the `quarkus.config.locations` property being read. Thus `file2.properties` is not getting loaded.
But if you read the property via `@ConfigProperty(name = "quarkus.config.locations")`, the value is correct.
### Expected behavior
`%test.quarkus.config.locations` should be evaluated during tests
### Actual behavior
the default `quarkus.config.locations` property is evaluated
### How to Reproduce?
The bug is not reproducible using `@ConfigProperty(name = "quarkus.config.locations")`, that way the property is correctly read.
In order to reproduce you need to read a property declared in the not-loaded-config-file.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
17.0.1
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.8.0
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
3.8.4
### Additional information
_No response_ | 56db32ea9fd6deba7a3a7b03877971b70b85efda | dca684fff7497d27ebd53a8fcbcae35ad2b523a3 | https://github.com/quarkusio/quarkus/compare/56db32ea9fd6deba7a3a7b03877971b70b85efda...dca684fff7497d27ebd53a8fcbcae35ad2b523a3 | diff --git a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java
index 890376d39b1..5923c5c8492 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java
@@ -142,6 +142,8 @@ public ConfigSourceInterceptor getInterceptor(final ConfigSourceInterceptorConte
if (profileValue != null) {
List<String> profiles = ProfileConfigSourceInterceptor.convertProfile(profileValue.getValue());
for (String profile : profiles) {
+ relocations.put("%" + profile + "." + SMALLRYE_CONFIG_LOCATIONS,
+ "%" + profile + "." + "quarkus.config.locations");
relocations.put("%" + profile + "." + SMALLRYE_CONFIG_PROFILE_PARENT,
"%" + profile + "." + "quarkus.config.profile.parent");
} | ['core/runtime/src/main/java/io/quarkus/runtime/configuration/ConfigUtils.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,543,925 | 3,973,357 | 521,649 | 5,008 | 173 | 32 | 2 | 1 | 1,269 | 151 | 297 | 52 | 0 | 0 | 1970-01-01T00:27:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,261 | quarkusio/quarkus/30976/30965 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/30965 | https://github.com/quarkusio/quarkus/pull/30976 | https://github.com/quarkusio/quarkus/pull/30976 | 1 | fixes | JandexBeanInfoAdapter.getMetricAnnotationsThroughStereotype is not null safe | ### Describe the bug
We have a problem during the build process of our project. This problem appeared trying to bump quarkus.version from 2.13.3.Final to 2.16.1.Final.
After some debugging we found the real problem.
We have a class that uses the `@gauge` annotation, this is what triggered the `JandexBeanInfoAdapter.convert`.
During the annotation mapping process, there are other annotations found on the same class, and the annotation causing this NullPointerExpection is `edu.umd.cs.findbugs.annotations.SuppressFBWarnings`.
The NullPointer happens in this line of code:
https://github.com/quarkusio/quarkus/blob/e48aace483cf24d24b566b5786731e98351a7027/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/jandex/JandexBeanInfoAdapter.java#L71
Shouldn't it be null safe ?
```
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.smallrye.metrics.deployment.SmallRyeMetricsProcessor#registerMetricsFromAnnotatedMethods threw an exception: java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.classAnnotation(org.jboss.jandex.DotName)" because "annotationType" is null
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.getMetricAnnotationsThroughStereotype(JandexBeanInfoAdapter.java:71)
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.lambda$convert$0(JandexBeanInfoAdapter.java:55)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.convert(JandexBeanInfoAdapter.java:56)
at io.quarkus.smallrye.metrics.deployment.SmallRyeMetricsProcessor.registerMetricsFromAnnotatedMethods(SmallRyeMetricsProcessor.java:404)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.builder.Execution.run (Execution.java:123)
at io.quarkus.builder.BuildExecutionBuilder.execute (BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run (QuarkusAugmentor.java:160)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment (AugmentActionImpl.java:331)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createProductionApplication (AugmentActionImpl.java:175)
at io.quarkus.maven.BuildMojo.doExecute (BuildMojo.java:133)
at io.quarkus.maven.QuarkusBootstrapMojo.execute (QuarkusBootstrapMojo.java:154)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.classAnnotation(org.jboss.jandex.DotName)" because "annotationType" is null
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.getMetricAnnotationsThroughStereotype (JandexBeanInfoAdapter.java:71)
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.lambda$convert$0 (JandexBeanInfoAdapter.java:55)
at java.util.stream.ReferencePipeline$7$1.accept (ReferencePipeline.java:273)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining (ArrayList.java:1625)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:509)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:499)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential (ReduceOps.java:921)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect (ReferencePipeline.java:682)
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.convert (JandexBeanInfoAdapter.java:56)
at io.quarkus.smallrye.metrics.deployment.SmallRyeMetricsProcessor.registerMetricsFromAnnotatedMethods (SmallRyeMetricsProcessor.java:404)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at io.quarkus.deployment.ExtensionLoader$3.execute (ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run (BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith (ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run (EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1478)
at java.lang.Thread.run (Thread.java:833)
at org.jboss.threads.JBossThread.run (JBossThread.java:501)
```
### Expected behavior
Build succeeds.
### Actual behavior
```
Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.smallrye.metrics.deployment.SmallRyeMetricsProcessor#registerMetricsFromAnnotatedMethods threw an exception: java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.classAnnotation(org.jboss.jandex.DotName)" because "annotationType" is null
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.getMetricAnnotationsThroughStereotype(JandexBeanInfoAdapter.java:71)
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.lambda$convert$0(JandexBeanInfoAdapter.java:55)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.convert(JandexBeanInfoAdapter.java:56)
at io.quarkus.smallrye.metrics.deployment.SmallRyeMetricsProcessor.registerMetricsFromAnnotatedMethods(SmallRyeMetricsProcessor.java:404)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
at io.quarkus.builder.Execution.run (Execution.java:123)
at io.quarkus.builder.BuildExecutionBuilder.execute (BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run (QuarkusAugmentor.java:160)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment (AugmentActionImpl.java:331)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createProductionApplication (AugmentActionImpl.java:175)
at io.quarkus.maven.BuildMojo.doExecute (BuildMojo.java:133)
at io.quarkus.maven.QuarkusBootstrapMojo.execute (QuarkusBootstrapMojo.java:154)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NullPointerException: Cannot invoke "org.jboss.jandex.ClassInfo.classAnnotation(org.jboss.jandex.DotName)" because "annotationType" is null
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.getMetricAnnotationsThroughStereotype (JandexBeanInfoAdapter.java:71)
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.lambda$convert$0 (JandexBeanInfoAdapter.java:55)
at java.util.stream.ReferencePipeline$7$1.accept (ReferencePipeline.java:273)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining (ArrayList.java:1625)
at java.util.stream.AbstractPipeline.copyInto (AbstractPipeline.java:509)
at java.util.stream.AbstractPipeline.wrapAndCopyInto (AbstractPipeline.java:499)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential (ReduceOps.java:921)
at java.util.stream.AbstractPipeline.evaluate (AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect (ReferencePipeline.java:682)
at io.quarkus.smallrye.metrics.deployment.jandex.JandexBeanInfoAdapter.convert (JandexBeanInfoAdapter.java:56)
at io.quarkus.smallrye.metrics.deployment.SmallRyeMetricsProcessor.registerMetricsFromAnnotatedMethods (SmallRyeMetricsProcessor.java:404)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:568)
at io.quarkus.deployment.ExtensionLoader$3.execute (ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run (BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith (ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run (EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run (EnhancedQueueExecutor.java:1478)
at java.lang.Thread.run (Thread.java:833)
at org.jboss.threads.JBossThread.run (JBossThread.java:501)
```
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
Linux nb1099 5.15.0-58-generic #64-Ubuntu SMP Thu Jan 5 11:43:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk 17 2021-09-14 OpenJDK Runtime Environment (build 17+35-2724) OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.16.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Maven home: /home/gprado/Development/apache-maven-3.6.3 Java version: 17, vendor: Oracle Corporation, runtime: /usr/java/jdk-17 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.15.0-58-generic", arch: "amd64", family: "unix"
### Additional information
_No response_ | f39380f6aa7ad111bfcbe892a3391f8b5a40dc29 | 3cb61b796b06df8971d10915163c34376a338ba6 | https://github.com/quarkusio/quarkus/compare/f39380f6aa7ad111bfcbe892a3391f8b5a40dc29...3cb61b796b06df8971d10915163c34376a338ba6 | diff --git a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/jandex/JandexBeanInfoAdapter.java b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/jandex/JandexBeanInfoAdapter.java
index 0b4ff51813a..e33ffaf1142 100644
--- a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/jandex/JandexBeanInfoAdapter.java
+++ b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/jandex/JandexBeanInfoAdapter.java
@@ -68,7 +68,7 @@ public BeanInfo convert(ClassInfo input) {
private Stream<AnnotationInfo> getMetricAnnotationsThroughStereotype(AnnotationInstance stereotypeInstance,
IndexView indexView) {
ClassInfo annotationType = indexView.getClassByName(stereotypeInstance.name());
- if (annotationType.classAnnotation(DotNames.STEREOTYPE) != null) {
+ if (annotationType != null && annotationType.declaredAnnotation(DotNames.STEREOTYPE) != null) {
JandexAnnotationInfoAdapter adapter = new JandexAnnotationInfoAdapter(indexView);
return transformedAnnotations.getAnnotations(annotationType)
.stream() | ['extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/jandex/JandexBeanInfoAdapter.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 24,711,917 | 4,877,728 | 629,643 | 5,757 | 180 | 44 | 2 | 1 | 16,130 | 676 | 3,796 | 208 | 1 | 2 | 1970-01-01T00:27:55 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,447 | quarkusio/quarkus/24908/24739 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/24739 | https://github.com/quarkusio/quarkus/pull/24908 | https://github.com/quarkusio/quarkus/pull/24908 | 1 | fix | Quarkus unix domain socket path no longer used but placed onto 0.0.0.0 instead | ### Describe the bug
Quarkus supports listening on a unix domain socket instead of a TCP socket for the HTTP server.
The path for the socket is no longer correctly used.
Config sample:
https://quarkus.io/guides/vertx-reference#listening-to-a-unix-domain-socket
https://quarkus.io/guides/all-config#quarkus-vertx-http_quarkus.http.domain-socket
```yaml
quarkus.http.host-enabled = false
quarkus.http.domain-socket = /var/run/io.quarkus.app.socket
quarkus.http.domain-socket-enabled = true
quarkus.vertx.prefer-native-transport = true
```
After upgrading to Quarkus 2.7.5 the unix domain socket is no longer correctly placed on the selected path location. Also the default path is not used.
Quarkus startup log message prints:
`(...) Listening on: unix:0.0.0.0`
Also `netstat` shows that the domain socket is now placed on "0.0.0.0" instead of the proper path:
`unix 2 [ ACC ] STREAM LISTENING 28944 1/java 0.0.0.0`
### Expected behavior
The unix domain socket should be placed onto the correct path e.g. `/var/run/io.quarkus.app.socket`.
### Actual behavior
The unix domain socket is always placed onto `0.0.0.0`.
### How to Reproduce?
Reproducer:
Generate a fresh Quarkus project and configure it to use a unix domain socket instead of TCP for the HTTP server.
https://quarkus.io/guides/vertx-reference#listening-to-a-unix-domain-socket
### Output of `uname -a` or `ver`
Linux 6832a73e6fed 5.10.104-linuxkit #1 SMP Wed Mar 9 19:05:23 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk 17.0.2 2022-01-18 LTS
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
Quarkus 2.7.5.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.5
### Additional information
_No response_ | 56879dde70ca4efaf65dd958392afeab9156f47f | 161be3f3f56d5a43a26499e4c95576f32ed365bd | https://github.com/quarkusio/quarkus/compare/56879dde70ca4efaf65dd958392afeab9156f47f...161be3f3f56d5a43a26499e4c95576f32ed365bd | 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 4736fb1e47e..8a043ce9bc0 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
@@ -906,6 +906,8 @@ private static HttpServerOptions createDomainSocketOptions(HttpConfiguration htt
HttpServerOptions options = new HttpServerOptions();
applyCommonOptions(options, httpConfiguration, websocketSubProtocols);
+ // Override the host (0.0.0.0 by default) with the configured domain socket.
+ options.setHost(httpConfiguration.domainSocket);
return options;
}
@@ -916,14 +918,6 @@ private static void setIdleTimeout(HttpConfiguration httpConfiguration, HttpServ
options.setIdleTimeoutUnit(TimeUnit.MILLISECONDS);
}
- public void warnIfPortChanged(HttpConfiguration config, int port) {
- if (config.port != port) {
- LOGGER.errorf(
- "quarkus.http.port was specified at build time as %s however run time value is %s, Kubernetes metadata will be incorrect.",
- port, config.port);
- }
- }
-
public void addRoute(RuntimeValue<Router> router, Function<Router, Route> route, Handler<RoutingContext> handler,
HandlerType blocking) {
| ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,394,470 | 3,944,352 | 517,910 | 4,982 | 486 | 100 | 10 | 1 | 1,862 | 233 | 532 | 64 | 3 | 1 | 1970-01-01T00:27: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,446 | quarkusio/quarkus/25004/24878 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/24878 | https://github.com/quarkusio/quarkus/pull/25004 | https://github.com/quarkusio/quarkus/pull/25004 | 1 | fixes | `Unrecognized configuration key` warnings since 2.8.0.Final if using config property with list values in YAML | ### Describe the bug
```yaml
quarkus:
arc:
ignored-split-packages:
- foo.bar
```
results in a build warning in 2.8.0.Final, but not in 2.7.5.Final:
```
[INFO] --- quarkus-maven-plugin:2.8.0.Final:build (default) @ code-with-quarkus ---
[WARNING] [io.quarkus.config] Unrecognized configuration key "quarkus.arc.ignored-split-packages[0]" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 1443ms
```
### Expected behavior
No warning, the key is valid.
### Actual behavior
`Unrecognized configuration key` warning
### How to Reproduce?
[q_build-warnings.zip](https://github.com/quarkusio/quarkus/files/8466095/q_build-warnings.zip)
`mvn clean package -DskipTests`
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
17.0.2, vendor: BellSoft
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.8.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4
### Additional information
Also happens with e.g. `quarkus.qute.suffixes`.
Does not happen when using `application.properties`. | 7a246200f6987416ad741f4c70c56a575eba8794 | c6679c27a4cd54ac34bc2c56a6f5b2aa176fc071 | https://github.com/quarkusio/quarkus/compare/7a246200f6987416ad741f4c70c56a575eba8794...c6679c27a4cd54ac34bc2c56a6f5b2aa176fc071 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java
index 167849ed1c3..be3f6406bce 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java
@@ -200,9 +200,7 @@ private static void reportUnknownBuildProperties(LaunchMode launchMode, Set<Stri
// So it only reports during the build, because it is very likely that the property is available in runtime
// and, it will be caught by the RuntimeConfig and log double warnings
if (!launchMode.isDevOrTest()) {
- for (String unknownProperty : unknownBuildProperties) {
- ConfigDiagnostic.unknown(unknownProperty);
- }
+ ConfigDiagnostic.unknownProperties(new ArrayList<>(unknownBuildProperties));
}
}
| ['core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,415,783 | 3,948,656 | 518,376 | 4,985 | 233 | 34 | 4 | 1 | 1,296 | 154 | 363 | 54 | 1 | 2 | 1970-01-01T00:27: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,445 | quarkusio/quarkus/25009/24939 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/24939 | https://github.com/quarkusio/quarkus/pull/25009 | https://github.com/quarkusio/quarkus/pull/25009 | 1 | fix | Oracle Devservice fails to launch on hosts with over 100 CPU cores | ### Describe the bug
This is essentially the same issue as https://github.com/gvenzl/oci-oracle-xe/issues/64 but with _even more_ CPU cores. Since using that many cores is unreasonable anyway, and the upstream dockerfile seems to rely on an `if`-case for every CPU count, it might be better to implement a workaround along the lines of this: https://github.com/gvenzl/oci-oracle-xe/issues/64#issuecomment-1099107397
> Wouldn't docker run --cpus=2 option do the trick?
https://docs.docker.com/config/containers/resource_constraints/#configure-the-default-cfs-scheduler
Unless you really want to use more.
### Quarkus version or git rev
2.8.0
### Additional information
see https://github.com/gvenzl/oci-oracle-xe/issues/64#issuecomment-1087261618 for the error message that is currently happening on a 128 core machine. | 027fa6424dc832106696137c8f1f34407be25a24 | ce8391e557825b5139d0ee4057dc892538c3083d | https://github.com/quarkusio/quarkus/compare/027fa6424dc832106696137c8f1f34407be25a24...ce8391e557825b5139d0ee4057dc892538c3083d | diff --git a/extensions/devservices/oracle/src/main/java/io/quarkus/devservices/oracle/deployment/OracleDevServicesProcessor.java b/extensions/devservices/oracle/src/main/java/io/quarkus/devservices/oracle/deployment/OracleDevServicesProcessor.java
index 3062fe714ba..80889956024 100644
--- a/extensions/devservices/oracle/src/main/java/io/quarkus/devservices/oracle/deployment/OracleDevServicesProcessor.java
+++ b/extensions/devservices/oracle/src/main/java/io/quarkus/devservices/oracle/deployment/OracleDevServicesProcessor.java
@@ -45,6 +45,14 @@ public RunningDevServicesDatasource startDatabase(Optional<String> username, Opt
container.withUsername(username.orElse(DEFAULT_DATABASE_USER))
.withPassword(password.orElse(DEFAULT_DATABASE_PASSWORD))
.withDatabaseName(datasourceName.orElse(DEFAULT_DATABASE_NAME));
+
+ // We need to limit the maximum amount of CPUs being used by the container;
+ // otherwise the hardcoded memory configuration of the DB might not be enough to successfully boot it.
+ // See https://github.com/gvenzl/oci-oracle-xe/issues/64
+ // I choose to limit it to "2 cpus": should be more than enough for any local testing needs,
+ // and keeps things simple.
+ container.withCreateContainerCmdModifier(cmd -> cmd.getHostConfig().withNanoCPUs(2_000_000_000l));
+
additionalJdbcUrlProperties.forEach(container::withUrlParam);
container.start();
| ['extensions/devservices/oracle/src/main/java/io/quarkus/devservices/oracle/deployment/OracleDevServicesProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,415,783 | 3,948,656 | 518,376 | 4,985 | 561 | 115 | 8 | 1 | 838 | 96 | 206 | 15 | 4 | 0 | 1970-01-01T00:27: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,444 | quarkusio/quarkus/25019/24943 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/24943 | https://github.com/quarkusio/quarkus/pull/25019 | https://github.com/quarkusio/quarkus/pull/25019 | 1 | fixes | Continuous testing fails when a dependency brings in an optional dependency and a Jandex index | ### Describe the bug
When in a multi-module maven project, with a quarkus module `A` depending on a regular java module `B`. If module `B` contains both an optional dependecy (not declared by `A` too) and a Jandex index, then continuous testing fails with a `BuildException`.
It makes no difference whether the classes in `B` using the optional dependencies are used by the quarkus module or its tests.
Regular testing via maven still works correctly, though.
### Expected behavior
Continuous testing should build and execute the tests.
### Actual behavior
A `BuildException` is thrown:
```
[INFO] --- quarkus-maven-plugin:2.8.0.Final:test (default-cli) @ code-with-quarkus ---
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:resources) @ code-with-quarkus
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.8.0.Final:generate-code) @ code-with-quarkus
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile) @ code-with-quarkus
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/bnazare/Projects/quarkus-21226-reproducer/code-with-quarkus/target/classes
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:testResources) @ code-with-quarkus
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/bnazare/Projects/quarkus-21226-reproducer/code-with-quarkus/src/test/resources
[INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.8.0.Final:generate-code-tests) @ code-with-quarkus
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile) @ code-with-quarkus
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /home/bnazare/Projects/quarkus-21226-reproducer/code-with-quarkus/target/test-classes
[INFO] /home/bnazare/Projects/quarkus-21226-reproducer/code-with-quarkus/src/test/java/org/acme/NativeGreetingResourceIT.java: /home/bnazare/Projects/quarkus-21226-reproducer/code-with-quarkus/src/test/java/org/acme/NativeGreetingResourceIT.java uses or overrides a deprecated API that is marked for removal.
[INFO] /home/bnazare/Projects/quarkus-21226-reproducer/code-with-quarkus/src/test/java/org/acme/NativeGreetingResourceIT.java: Recompile with -Xlint:removal for details.
Listening for transport dt_socket at address: 5005
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2022-04-14 16:59:51,823 INFO [io.qua.test] (main) Quarkus continuous testing mode started
2022-04-14 16:59:52,032 INFO [io.qua.test] (Test runner thread) Running 1/1. Running: #JUnit Jupiter
2022-04-14 16:59:52,041 INFO [io.qua.test] (Test runner thread) Running 1/1. Running: #JUnit Jupiter
2022-04-14 16:59:52,051 INFO [io.qua.test] (Test runner thread) Running 1/1. Running: org.acme.GreetingResourceTest#GreetingResourceTest
2022-04-14 16:59:52,220 INFO [org.jbo.threads] (Test runner thread) JBoss Threads version 3.4.2.Final
2022-04-14 16:59:52,684 INFO [io.qua.test] (Test runner thread) Running 1/1. Running: org.acme.GreetingResourceTest#testHelloEndpoint()
2022-04-14 16:59:52,690 ERROR [io.qua.test] (Test runner thread) ==================== TEST REPORT #1 ====================
2022-04-14 16:59:52,691 ERROR [io.qua.test] (Test runner thread) Test GreetingResourceTest#testHelloEndpoint() failed
: java.lang.RuntimeException: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.deployment.steps.ClassTransformingBuildStep#handleClassTransformation threw an exception: java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.lang.TypeNotPresentException: Type com/itextpdf/text/DocumentException not present
at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:934)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.util.concurrent.ExecutionException: java.lang.TypeNotPresentException: Type com/itextpdf/text/DocumentException not present
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at io.quarkus.deployment.steps.ClassTransformingBuildStep.handleClassTransformation(ClassTransformingBuildStep.java:234)
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$3.execute(ExtensionLoader.java:925)
... 6 more
```
(the stack trace goes on for around 300 lines, but this is the most relevant part)
### How to Reproduce?
Reproducer: https://github.com/linkareti/quarkus-optional-dep-test-issue-reproducer
Steps to reproduce the behaviour:
1. run `mvn clean install` in the project's root
2. change to folder `code-with-quarkus`
3. run `mvn clean quarkus:test`
### Output of `uname -a` or `ver`
Linux [...] 5.16.18-200.fc35.x86_64 #1 SMP PREEMPT Mon Mar 28 14:10:07 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "11.0.14.1" 2022-02-08
OpenJDK Runtime Environment 18.9 (build 11.0.14.1+1)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.14.1+1, mixed mode, sharing)
### GraalVM version (if different from Java)
n/a
### Quarkus version or git rev
2.8.0.Final, but I've seen the issue since 2.6.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Maven home: /home/bnazare/tools/apache-maven-3.8.1
Java version: 11.0.14.1, vendor: Red Hat, Inc., runtime: /usr/lib/jvm/java-11-openjdk-11.0.14.1.1-5.fc35.x86_64
Default locale: pt_PT, platform encoding: UTF-8
OS name: "linux", version: "5.16.18-200.fc35.x86_64", arch: "amd64", family: "unix"
### Additional information
_No response_ | 122467f990ec87979f6bf56493f72291366499d0 | af5949b8f4f94ee9846388443390d92461890366 | https://github.com/quarkusio/quarkus/compare/122467f990ec87979f6bf56493f72291366499d0...af5949b8f4f94ee9846388443390d92461890366 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java
index 80a9a321498..ca5eba39618 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java
@@ -42,6 +42,8 @@ public final class BytecodeTransformerBuildItem extends MultiBuildItem {
final int classReaderOptions;
+ final boolean continueOnFailure;
+
public BytecodeTransformerBuildItem(String classToTransform,
BiFunction<String, ClassVisitor, ClassVisitor> visitorFunction) {
this(classToTransform, visitorFunction, null);
@@ -78,6 +80,7 @@ public BytecodeTransformerBuildItem(boolean eager, String classToTransform,
this.cacheable = cacheable;
this.inputTransformer = null;
this.classReaderOptions = 0;
+ this.continueOnFailure = false;
}
public BytecodeTransformerBuildItem(Builder builder) {
@@ -88,6 +91,7 @@ public BytecodeTransformerBuildItem(Builder builder) {
this.cacheable = builder.cacheable;
this.inputTransformer = builder.inputTransformer;
this.classReaderOptions = builder.classReaderOptions;
+ this.continueOnFailure = builder.continueOnFailure;
if (visitorFunction == null && inputTransformer == null) {
throw new IllegalArgumentException("One of either visitorFunction or inputTransformer must be set");
}
@@ -121,8 +125,13 @@ public BiFunction<String, byte[], byte[]> getInputTransformer() {
return inputTransformer;
}
+ public boolean isContinueOnFailure() {
+ return continueOnFailure;
+ }
+
public static class Builder {
public BiFunction<String, byte[], byte[]> inputTransformer;
+ public boolean continueOnFailure;
private String classToTransform;
private BiFunction<String, ClassVisitor, ClassVisitor> visitorFunction;
private Set<String> requireConstPoolEntry = null;
@@ -130,6 +139,11 @@ public static class Builder {
private boolean cacheable = false;
private int classReaderOptions = 0;
+ public Builder setContinueOnFailure(boolean continueOnFailure) {
+ this.continueOnFailure = continueOnFailure;
+ return this;
+ }
+
public Builder setInputTransformer(BiFunction<String, byte[], byte[]> inputTransformer) {
this.inputTransformer = inputTransformer;
return this;
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 e64c13d3d67..0d72f7a3b04 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
@@ -122,13 +122,18 @@ public void instrumentTestClasses(CombinedIndexBuildItem combinedIndexBuildItem,
for (ClassInfo clazz : combinedIndexBuildItem.getIndex().getKnownClasses()) {
String theClassName = clazz.name().toString();
if (isAppClass(theClassName)) {
- transformerProducer.produce(new BytecodeTransformerBuildItem(false, theClassName,
- new BiFunction<String, ClassVisitor, ClassVisitor>() {
- @Override
- public ClassVisitor apply(String s, ClassVisitor classVisitor) {
- return new TracingClassVisitor(classVisitor, theClassName);
- }
- }, true));
+ transformerProducer.produce(new BytecodeTransformerBuildItem.Builder().setEager(false)
+ .setClassToTransform(theClassName)
+ .setVisitorFunction(
+ new BiFunction<String, ClassVisitor, ClassVisitor>() {
+ @Override
+ public ClassVisitor apply(String s, ClassVisitor classVisitor) {
+ return new TracingClassVisitor(classVisitor, theClassName);
+ }
+ })
+ .setCacheable(true)
+ .setContinueOnFailure(true)
+ .build());
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
index d9ab5a0d55f..95517d41d08 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
@@ -125,6 +125,9 @@ public byte[] apply(String className, byte[] originalBytes) {
if (classTransformers == null) {
return originalBytes;
}
+ boolean continueOnFailure = classTransformers.stream()
+ .filter(a -> !a.isContinueOnFailure())
+ .findAny().isEmpty();
List<BiFunction<String, ClassVisitor, ClassVisitor>> visitors = classTransformers.stream()
.map(BytecodeTransformerBuildItem::getVisitorFunction).filter(Objects::nonNull)
.collect(Collectors.toList());
@@ -154,6 +157,17 @@ public byte[] apply(String className, byte[] originalBytes) {
} else {
return originalBytes;
}
+ } catch (Throwable e) {
+ if (continueOnFailure) {
+ if (log.isDebugEnabled()) {
+ log.errorf(e, "Failed to transform %s", className);
+ } else {
+ log.errorf("Failed to transform %s", className);
+ }
+ return originalBytes;
+ } else {
+ throw e;
+ }
} finally {
Thread.currentThread().setContextClassLoader(old);
}
@@ -184,6 +198,10 @@ public byte[] apply(String className, byte[] originalBytes) {
entry.getKey());
continue;
}
+
+ boolean continueOnFailure = entry.getValue().stream()
+ .filter(a -> !a.isContinueOnFailure())
+ .findAny().isEmpty();
List<BiFunction<String, ClassVisitor, ClassVisitor>> visitors = entry.getValue().stream()
.map(BytecodeTransformerBuildItem::getVisitorFunction).filter(Objects::nonNull)
.collect(Collectors.toList());
@@ -196,9 +214,9 @@ public byte[] apply(String className, byte[] originalBytes) {
public TransformedClassesBuildItem.TransformedClass call() throws Exception {
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
+ byte[] classData = classPathElement.getResource(classFileName).getData();
Thread.currentThread().setContextClassLoader(transformCl);
Set<String> constValues = constScanning.get(className);
- byte[] classData = classPathElement.getResource(classFileName).getData();
if (constValues != null && !noConstScanning.contains(className)) {
if (!ConstPoolScanner.constPoolEntryPresent(classData, constValues)) {
return null;
@@ -214,6 +232,17 @@ public TransformedClassesBuildItem.TransformedClass call() throws Exception {
transformedClassesCache.put(className, transformedClass);
}
return transformedClass;
+ } catch (Throwable e) {
+ if (continueOnFailure) {
+ if (log.isDebugEnabled()) {
+ log.errorf(e, "Failed to transform %s", className);
+ } else {
+ log.errorf("Failed to transform %s", className);
+ }
+ return null;
+ } else {
+ throw e;
+ }
} finally {
Thread.currentThread().setContextClassLoader(old);
} | ['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/TestTracingProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/builditem/BytecodeTransformerBuildItem.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 20,415,786 | 3,948,657 | 518,375 | 4,985 | 3,373 | 482 | 64 | 3 | 6,834 | 574 | 1,945 | 108 | 1 | 1 | 1970-01-01T00:27: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,254 | quarkusio/quarkus/31260/29427 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/29427 | https://github.com/quarkusio/quarkus/pull/31260 | https://github.com/quarkusio/quarkus/pull/31260 | 1 | fixes | quarkus.oidc.auth-server-url causing weird start-up failure | ### Describe the bug
adding this line makes all the difference:
`%ecom-dev.quarkus.oidc.auth-server-url=http://ecom-portal-keycloak:8080/realms/quarkus`
makes the application crash without much explanation on DEBUG log level:
```posh
exec java -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager -XX:+UseG1GC -XX:+UseStringDeduplication -XX:InitialRAMPercentage=50.0 -XX:MaxRAMPercentage=50.0 -Xss256k -Xmx512m -cp . -jar /deployments/quarkus-run.jar
Nov 22, 2022 11:04:30 PM org.hibernate.validator.internal.util.Version
INFO: HV000001: Hibernate Validator %s
Nov 22, 2022 11:04:38 PM io.quarkus.opentelemetry.runtime.tracing.LateBoundSampler
WARN: No Sampler delegate specified, no action taken.
Nov 22, 2022 11:04:48 PM io.vertx.core.net.impl.ConnectionBase
ERROR: Connection reset
java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394)
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:258)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:831)
Nov 22, 2022 11:04:48 PM io.quarkus.runtime.ApplicationLifecycleManager run
ERROR: Failed to start application (with profile ecom-dev)
java.net.SocketException: Connection reset
at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394)
at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426)
at io.netty.buffer.PooledByteBuf.setBytes(PooledByteBuf.java:258)
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1132)
at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:357)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:151)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:831)
```
The keycloak server 19.0.3 is ready and reachable:
```
/ $ curl -kv http://ecom-portal-keycloak:8080/realms/quarkus
* Trying 172.20.93.10:8080...
* Connected to ecom-portal-keycloak (172.20.93.10) port 8080 (#0)
> GET /realms/quarkus HTTP/1.1
> Host: ecom-portal-keycloak:8080
> User-Agent: curl/7.79.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< referrer-policy: no-referrer
< x-frame-options: SAMEORIGIN
< strict-transport-security: max-age=31536000; includeSubDomains
< cache-control: no-cache
< x-content-type-options: nosniff
< x-xss-protection: 1; mode=block
< content-type: application/json
< content-length: 655
< x-envoy-upstream-service-time: 92
< date: Tue, 22 Nov 2022 23:08:14 GMT
< server: envoy
<
* Connection #0 to host ecom-portal-keycloak left intact
{"realm":"quarkus","public_key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzNMrtvYNG/QBFl+wH+89/asjb+PFU5I+8c+7y1qVgR88NoG53vGKM6GJMnu22nEf24AxXiRLR6SNgiKXhYISNlONREoDJcz9J5Fupm+5MkujHyMn7wLrBTDlFVWwMyVdCTcbmSddM8CkNqMpc8M49HroxxlJLlyaQZNiUKjQVKIsxVMzP5jXfthUtR2eMLLxSyLb6TOZfVrIRouQcDdSdn4q4Oj5eaEWHUg9EH6Q3nGmbL/JnWcvTlb1wDV/LMd4AvOZYKXEuf2RrOdkmNrZ0yXGT0dCzjjRDr+GvH7xUqAw8yAkw6/LegaN8+MPb0Qd9sEnGbkAh2iNrEg+LYDnnQIDAQAB","token-service":"https://portal.ecom-dev.app.whirlpool.aws.fisv.cloud/realms/quarkus/protocol/openid-connect","account-service":"https://portal.ecom-dev.app.whirlpool.aws.fisv.cloud/realms/quarkus/account","tokens-not-before":0}/ $
```
Any ideas why such a configuration would make the application not start-up anymore?
### Expected behavior
some meaningful error log, or for it to just work.
### Actual behavior
quarkus dead, sad developer.
### 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_ | 82f63512c081eb378a69de8f5564ee7d29827ac1 | 3b578363ddae786b1e9bb57365258017ad784a3a | https://github.com/quarkusio/quarkus/compare/82f63512c081eb378a69de8f5564ee7d29827ac1...3b578363ddae786b1e9bb57365258017ad784a3a | diff --git a/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java b/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java
index 8c66e1a5a3d..c81938e0794 100644
--- a/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java
+++ b/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java
@@ -417,7 +417,7 @@ public static Uni<JsonObject> discoverMetadata(WebClient client, String authServ
if (resp.statusCode() == 200) {
return resp.bodyAsJsonObject();
} else {
- LOG.tracef("Discovery has failed, status code: %d", resp.statusCode());
+ LOG.warnf("Discovery has failed, status code: %d", resp.statusCode());
throw new OidcEndpointAccessException(resp.statusCode());
}
}).onFailure(oidcEndpointNotAvailable())
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java
index 1d809ccd5cb..f35e423cba8 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java
@@ -109,8 +109,8 @@ private TenantConfigContext createStaticTenantContext(Vertx vertx,
@Override
public TenantConfigContext apply(Throwable t) {
if (t instanceof OIDCException) {
- // OIDC server is not available yet - try to create the connection when the first request arrives
- LOG.debugf("Tenant '%s': '%s'."
+ LOG.warnf("Tenant '%s': '%s'."
+ + " OIDC server is not available yet, an attempt to connect will be made duiring the first request."
+ " Access to resources protected by this tenant may fail"
+ " if OIDC server will not become available",
tenantId, t.getMessage());
@@ -257,7 +257,7 @@ public static Optional<ProxyOptions> toProxyOptions(OidcCommonConfig.Proxy proxy
protected static OIDCException toOidcException(Throwable cause, String authServerUrl) {
final String message = OidcCommonUtils.formatConnectionErrorMessage(authServerUrl);
- LOG.debug(message);
+ LOG.warn(message);
return new OIDCException("OIDC Server is not available", cause);
}
| ['extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 24,789,708 | 4,893,145 | 631,546 | 5,783 | 618 | 117 | 8 | 2 | 5,452 | 342 | 1,623 | 116 | 4 | 2 | 1970-01-01T00:27: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,259 | quarkusio/quarkus/31016/17839 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/17839 | https://github.com/quarkusio/quarkus/pull/31016 | https://github.com/quarkusio/quarkus/pull/31016 | 1 | fixes | Invalid memory configuration for netty maxDirectMemory in native image | I thinks this only concerns native image builds.
Setting either
-XX:MaxDirectMemorySize
or
-Dio.netty.maxDirectMemory
does not work at runtime and runtime memory is incorrectly reflected in io.netty.util.internal.PlatformDependent.DIRECT_MEMORY_LIMIT
at runtime.
i think the problem is that io.netty.buffer.PooledByteBufAllocator uses io.netty.util.internal.PlatformDependent
which is not initialized during runtime but build time.
I tested this with Quarkus 1.10.5.Final, but looking at the current code of NettyProcessor shows that PlatformDependent is still not initialized at runtime, only PooledByteBufAllocator is.
| 2381d19831104ca0ff2b8946cb13afdac5c02832 | ca155cae76c7caf7d6c4bbf27e9ac22305d2dbf0 | https://github.com/quarkusio/quarkus/compare/2381d19831104ca0ff2b8946cb13afdac5c02832...ca155cae76c7caf7d6c4bbf27e9ac22305d2dbf0 | 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 069fb756162..de1471c3ae4 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
@@ -93,7 +93,8 @@ NativeImageConfigBuildItem build(
String maxOrder = calculateMaxOrder(config.allocatorMaxOrder, minMaxOrderBuildItems, false);
NativeImageConfigBuildItem.Builder builder = NativeImageConfigBuildItem.builder()
- //.addNativeImageSystemProperty("io.netty.noUnsafe", "true")
+ // disable unsafe usage to allow io.netty.internal.PlarformDependent0 to be reinitialized without issues
+ .addNativeImageSystemProperty("io.netty.noUnsafe", "true")
// Use small chunks to avoid a lot of wasted space. Default is 16mb * arenas (derived from core count)
// Since buffers are cached to threads, the malloc overhead is temporary anyway
.addNativeImageSystemProperty("io.netty.allocator.maxOrder", maxOrder)
@@ -109,6 +110,9 @@ NativeImageConfigBuildItem build(
.addRuntimeInitializedClass("io.netty.buffer.ByteBufUtil")
// The default channel id uses the process id, it should not be cached in the native image.
.addRuntimeInitializedClass("io.netty.channel.DefaultChannelId")
+ // Make sure to re-initialize platform dependent classes/values at runtime
+ .addRuntimeReinitializedClass("io.netty.util.internal.PlatformDependent")
+ .addRuntimeReinitializedClass("io.netty.util.internal.PlatformDependent0")
.addNativeImageSystemProperty("io.netty.leakDetection.level", "DISABLED");
if (QuarkusClassLoader.isClassPresentAtRuntime("io.netty.handler.codec.http.HttpObjectEncoder")) { | ['extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 24,724,974 | 4,880,274 | 629,942 | 5,759 | 550 | 103 | 6 | 1 | 642 | 72 | 136 | 15 | 0 | 0 | 1970-01-01T00:27:55 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,260 | quarkusio/quarkus/30992/30850 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/30850 | https://github.com/quarkusio/quarkus/pull/30992 | https://github.com/quarkusio/quarkus/pull/30992 | 1 | fix | java.lang.ClassCastException when upgrading from 2.16.0.Final to 2.16.1.Final | ### Describe the bug
After upgrading to Quarkus 2.16.1 this issue started to happen:
```
Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.kubernetes.deployment.KubernetesProcessor#build threw an exception: java.lang.ClassCastException: class java.util.HashMap cannot be cast to class java.lang.String (java.util.HashMap and java.lang.String are in module java.base of loader 'bootstrap')
at io.dekorate.docker.adapter.DockerBuildConfigAdapter.newBuilder(DockerBuildConfigAdapter.java:58)
at io.dekorate.docker.config.DockerBuildConfigGenerator.addPropertyConfiguration(DockerBuildConfigGenerator.java:48)
at io.dekorate.Session.lambda$addPropertyConfiguration$1(Session.java:167)
at io.dekorate.Session.addConfiguration(Session.java:183)
at io.dekorate.Session.addPropertyConfiguration(Session.java:167)
at io.quarkus.kubernetes.deployment.KubernetesProcessor.lambda$build$2(KubernetesProcessor.java:164)
at java.base/java.util.Optional.ifPresent(Optional.java:183)
at io.quarkus.kubernetes.deployment.KubernetesProcessor.build(KubernetesProcessor.java:141)
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$3.execute(ExtensionLoader.java:909)
at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
```
### Expected behavior
No issues when upgrading from 2.16.0.Final to 2.16.1.Final
### Actual behavior
This seems to be a breaking change that we would not expect to see in a minor release.
### 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_ | 4cd3e4d71111a93aecdec700a63c5b169ba396de | 0446821feb72f5e10dc583583423cb85d449673d | https://github.com/quarkusio/quarkus/compare/4cd3e4d71111a93aecdec700a63c5b169ba396de...0446821feb72f5e10dc583583423cb85d449673d | diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesConfigUtil.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesConfigUtil.java
index 085ac6b982b..e7eb1862def 100644
--- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesConfigUtil.java
+++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesConfigUtil.java
@@ -29,6 +29,8 @@
import org.jboss.logging.Logger;
import io.dekorate.utils.Strings;
+import io.quarkus.deployment.Capabilities;
+import io.quarkus.deployment.Capability;
public class KubernetesConfigUtil {
@@ -36,8 +38,10 @@ public class KubernetesConfigUtil {
private static final String QUARKUS_PREFIX = "quarkus.";
private static final Pattern QUARKUS_DEPLOY_PATTERN = Pattern.compile("quarkus\\\\.([^\\\\.]+)\\\\.deploy");
- private static final Set<String> ALLOWED_GENERATORS = new HashSet<>(
- Arrays.asList(KUBERNETES, OPENSHIFT, KNATIVE, DOCKER, S2I));
+ private static final Set<String> ALLOWED_GENERATORS = Set.of(KUBERNETES, KNATIVE, OPENSHIFT);
+ private static final Map<String, String> ALLOWED_GENERATORS_BY_CAPABILITY = Map.of(
+ DOCKER, Capability.CONTAINER_IMAGE_DOCKER,
+ S2I, Capability.CONTAINER_IMAGE_S2I);
private static final String EXPOSE_PROPERTY_NAME = "expose";
private static final String[] EXPOSABLE_GENERATORS = { OPENSHIFT, KUBERNETES };
@@ -133,7 +137,7 @@ public static boolean isDeploymentEnabled() {
*
* @return A map containing the properties.
*/
- public static Map<String, Object> toMap(PlatformConfiguration... platformConfigurations) {
+ public static Map<String, Object> toMap(Capabilities capabilities, PlatformConfiguration... platformConfigurations) {
Config config = ConfigProvider.getConfig();
Map<String, Object> result = new HashMap<>();
@@ -149,12 +153,13 @@ public static Map<String, Object> toMap(PlatformConfiguration... platformConfigu
.ifPresent(v -> quarkusPrefixed.put(DEKORATE_PREFIX + p.getConfigName() + ".version", v));
});
+ Set<String> allowedGenerators = allowedGenerators(capabilities);
Map<String, Object> unPrefixed = StreamSupport.stream(config.getPropertyNames().spliterator(), false)
- .filter(k -> ALLOWED_GENERATORS.contains(generatorName(k)))
+ .filter(k -> allowedGenerators.contains(generatorName(k)))
.filter(k -> config.getOptionalValue(k, String.class).isPresent())
.collect(Collectors.toMap(k -> DEKORATE_PREFIX + k, k -> config.getValue(k, String.class)));
- for (String generator : ALLOWED_GENERATORS) {
+ for (String generator : allowedGenerators) {
String oldKey = DEKORATE_PREFIX + generator + ".group";
String newKey = DEKORATE_PREFIX + generator + ".part-of";
if (unPrefixed.containsKey(oldKey)) {
@@ -206,6 +211,17 @@ private static void handleExpose(Config config, Map<String, Object> unPrefixed,
}
}
+ private static Set<String> allowedGenerators(Capabilities capabilities) {
+ Set<String> generators = new HashSet<>(ALLOWED_GENERATORS);
+ for (Map.Entry<String, String> generatorByCapability : ALLOWED_GENERATORS_BY_CAPABILITY.entrySet()) {
+ if (capabilities.isPresent(generatorByCapability.getValue())) {
+ generators.add(generatorByCapability.getKey());
+ }
+ }
+
+ return generators;
+ }
+
/**
* Returns the name of the generators that can handle the specified key.
*
diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
index ec65140a974..cf174966c66 100644
--- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
+++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
@@ -127,7 +127,7 @@ public void build(ApplicationInfoBuildItem applicationInfo,
throw new RuntimeException("Unable to setup environment for generating Kubernetes resources", e);
}
- Map<String, Object> config = KubernetesConfigUtil.toMap(kubernetesConfig, openshiftConfig, knativeConfig);
+ Map<String, Object> config = KubernetesConfigUtil.toMap(capabilities, kubernetesConfig, openshiftConfig, knativeConfig);
Set<String> deploymentTargets = kubernetesDeploymentTargets.getEntriesSortedByPriority().stream()
.map(DeploymentTargetEntry::getName)
.collect(Collectors.toSet()); | ['extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesConfigUtil.java', 'extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 24,313,774 | 4,787,857 | 620,018 | 5,678 | 1,794 | 369 | 28 | 2 | 2,673 | 181 | 620 | 64 | 0 | 1 | 1970-01-01T00:27:55 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,262 | quarkusio/quarkus/30964/29630 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/29630 | https://github.com/quarkusio/quarkus/pull/30964 | https://github.com/quarkusio/quarkus/pull/30964 | 1 | fixes | Changes to configmappings not being applied during hot reload | ### Describe the bug
Newly added configmappings are only available for injection after a full restart. A hot reload is not enough.
Removed configmappings result in class not found exceptions.
### Expected behavior
Configmappings work directly after a hot reload, and do not require a full restart.
### Actual behavior
Startet without the mapping, and adding it. After hot reload this exception happens:
```
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2022-12-02 06:39:52,101 INFO [io.quarkus] (Quarkus Main Thread) unremovable-configmapping 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.14.2.Final) started in 0.405s. Listening on: http://localhost:8080
2022-12-02 06:39:52,102 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-12-02 06:39:52,102 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx]
2022-12-02 06:39:52,102 INFO [io.qua.dep.dev.RuntimeUpdatesProcessor] (vert.x-worker-thread-0) Live reload total time: 1.175s
2022-12-02 06:39:52,108 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /hello failed, error id: aa2f8dcb-6516-4407-84ff-02d755799c76-1: java.lang.RuntimeException: Error injecting org.acme.AppConfig org.acme.GreetingResource.config
at org.acme.GreetingResource_Bean.create(Unknown Source)
at org.acme.GreetingResource_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:113)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:37)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:34)
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:34)
at org.acme.GreetingResource_Bean.get(Unknown Source)
at org.acme.GreetingResource_Bean.get(Unknown Source)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:476)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:489)
at io.quarkus.arc.impl.ArcContainerImpl$2.get(ArcContainerImpl.java:279)
at io.quarkus.arc.impl.ArcContainerImpl$2.get(ArcContainerImpl.java:276)
at io.quarkus.arc.runtime.BeanContainerImpl$1.create(BeanContainerImpl.java:46)
at io.quarkus.resteasy.reactive.common.runtime.ArcBeanFactory.createInstance(ArcBeanFactory.java:27)
at org.jboss.resteasy.reactive.server.handlers.InstanceHandler.handle(InstanceHandler.java:26)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:112)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.util.NoSuchElementException: SRCFG00027: Could not find a mapping for org.acme.AppConfig
at io.smallrye.config.ConfigMappings.getConfigMapping(ConfigMappings.java:101)
at io.smallrye.config.SmallRyeConfig.getConfigMapping(SmallRyeConfig.java:415)
at io.quarkus.arc.runtime.ConfigMappingCreator.create(ConfigMappingCreator.java:31)
at org.acme.AppConfig_3b122e7acaecf984e5d14008b48492761a901be1_Synthetic_Bean.create(Unknown Source)
at org.acme.AppConfig_3b122e7acaecf984e5d14008b48492761a901be1_Synthetic_Bean.get(Unknown Source)
at org.acme.AppConfig_3b122e7acaecf984e5d14008b48492761a901be1_Synthetic_Bean.get(Unknown Source)
at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:62)
... 26 more
2022-12-02 06:39:52,110 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (executor-thread-0) Request failed: java.lang.RuntimeException: Error injecting org.acme.AppConfig org.acme.GreetingResource.config
at org.acme.GreetingResource_Bean.create(Unknown Source)
at org.acme.GreetingResource_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:113)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:37)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:34)
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:34)
at org.acme.GreetingResource_Bean.get(Unknown Source)
at org.acme.GreetingResource_Bean.get(Unknown Source)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:476)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:489)
at io.quarkus.arc.impl.ArcContainerImpl$2.get(ArcContainerImpl.java:279)
at io.quarkus.arc.impl.ArcContainerImpl$2.get(ArcContainerImpl.java:276)
at io.quarkus.arc.runtime.BeanContainerImpl$1.create(BeanContainerImpl.java:46)
at io.quarkus.resteasy.reactive.common.runtime.ArcBeanFactory.createInstance(ArcBeanFactory.java:27)
at org.jboss.resteasy.reactive.server.handlers.InstanceHandler.handle(InstanceHandler.java:26)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:112)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.util.NoSuchElementException: SRCFG00027: Could not find a mapping for org.acme.AppConfig
at io.smallrye.config.ConfigMappings.getConfigMapping(ConfigMappings.java:101)
at io.smallrye.config.SmallRyeConfig.getConfigMapping(SmallRyeConfig.java:415)
at io.quarkus.arc.runtime.ConfigMappingCreator.create(ConfigMappingCreator.java:31)
at org.acme.AppConfig_3b122e7acaecf984e5d14008b48492761a901be1_Synthetic_Bean.create(Unknown Source)
at org.acme.AppConfig_3b122e7acaecf984e5d14008b48492761a901be1_Synthetic_Bean.get(Unknown Source)
at org.acme.AppConfig_3b122e7acaecf984e5d14008b48492761a901be1_Synthetic_Bean.get(Unknown Source)
at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:62)
... 26 more
```
Starting with mapping, and removing it. After hot reload this exception happens:
```
java.lang.ClassNotFoundException: org.acme.AppConfig
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:479)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:455)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:505)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:455)
at io.quarkus.runtime.configuration.ConfigUtils.addMapping(ConfigUtils.java:257)
at io.quarkus.runtime.generated.Config.readConfig(Unknown Source)
at io.quarkus.deployment.steps.RuntimeConfigSetup.deploy(Unknown Source)
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:110)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:70)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:43)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:123)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:104)
at java.base/java.lang.Thread.run(Thread.java:1589)
Resulted in: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.acme.AppConfig
at io.quarkus.runtime.configuration.ConfigUtils.addMapping(ConfigUtils.java:259)
... 13 more
Resulted in: java.lang.RuntimeException: Failed to start quarkus
... 11 more
Resulted in: io.quarkus.dev.appstate.ApplicationStartException: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:58)
at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:123)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:222)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:203)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:537)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:437)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$4.handle(VertxHttpHotReplacementSetup.java:152)
at io.quarkus.vertx.http.runtime.devmode.VertxHttpHotReplacementSetup$4.handle(VertxHttpHotReplacementSetup.java:139)
at io.vertx.core.impl.ContextBase.lambda$null$0(ContextBase.java:137)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.impl.ContextBase.lambda$executeBlocking$1(ContextBase.java:135)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 more
```
### How to Reproduce?
Reproducer:
[unremovable-configmapping.zip](https://github.com/quarkusio/quarkus/files/10138391/unremovable-configmapping.zip)
1. mvn quarkus:dev
2. Go to http://localhost:8080/hello -> no exception
3. Add a ConfigMapping Class like:
```
@ConfigMapping(prefix = "appconfig")
public interface AppConfig {
String defaultLanguage();
}
```
4. In GreetingResource, switch the commented out lines around so that the configmapping is used, and defaultLanguage() is returned in the resource
5. Go to http://localhost:8080/hello -> first exception from above
6. shut down quarkus
7. mvn quarkus:dev
8. Go to http://localhost:8080/hello -> no exception
9. Completly remove the configmapping -> Class Not found Exception
### Output of `uname -a` or `ver`
Microsoft Windows [Version 10.0.19044.2251]
### Output of `java -version`
openjdk 19 2022-09-20 OpenJDK Runtime Environment Temurin-19+36 (build 19+36) OpenJDK 64-Bit Server VM Temurin-19+36 (build 19+36, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.14.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\\eclipse\\tools\\java\\maven Java version: 17.0.4, vendor: Eclipse Adoptium, runtime: C:\\eclipse\\tools\\java\\17 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
### Additional information
_No response_ | e48aace483cf24d24b566b5786731e98351a7027 | 4cf5e3b589d6780c221a684dc1cb95e0c0354572 | https://github.com/quarkusio/quarkus/compare/e48aace483cf24d24b566b5786731e98351a7027...4cf5e3b589d6780c221a684dc1cb95e0c0354572 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java
index b841edc24ee..111b6171fdb 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java
@@ -403,11 +403,6 @@ public static final class GenerateOperation implements AutoCloseable {
clinit.invokeStaticMethod(CU_ADD_SOURCE_FACTORY_PROVIDER, buildTimeBuilder,
clinit.newInstance(RCSF_NEW, clinit.load(discoveredConfigSourceFactory)));
}
- // add mappings
- for (ConfigClassWithPrefix configMapping : staticConfigMappings) {
- clinit.invokeStaticMethod(CU_WITH_MAPPING, buildTimeBuilder,
- clinit.load(configMapping.getKlass().getName()), clinit.load(configMapping.getPrefix()));
- }
// additional config builders
ResultHandle configBuilders = clinit.newInstance(AL_NEW);
@@ -468,11 +463,12 @@ public void run() {
reinit.invokeStaticMethod(CU_ADD_SOURCE_FACTORY_PROVIDER, buildTimeBuilder,
reinit.newInstance(RCSF_NEW, reinit.load(discoveredConfigSourceFactory)));
}
- // add mappings
- for (ConfigClassWithPrefix configMapping : staticConfigMappings) {
- reinit.invokeStaticMethod(CU_WITH_MAPPING, buildTimeBuilder,
- reinit.load(configMapping.getKlass().getName()), reinit.load(configMapping.getPrefix()));
+ // additional config builders
+ ResultHandle configBuilders = reinit.newInstance(AL_NEW);
+ for (String configBuilder : staticConfigBuilders) {
+ reinit.invokeVirtualMethod(AL_ADD, configBuilders, reinit.load(configBuilder));
}
+ reinit.invokeStaticMethod(CU_CONFIG_BUILDER_LIST, buildTimeBuilder, configBuilders);
ResultHandle clinitConfig = reinit.checkCast(reinit.invokeVirtualMethod(SRCB_BUILD, buildTimeBuilder),
SmallRyeConfig.class);
@@ -555,12 +551,6 @@ public void run() {
readBootstrapConfig.invokeStaticMethod(CU_ADD_SOURCE_FACTORY_PROVIDER, bootstrapBuilder,
readBootstrapConfig.newInstance(RCSF_NEW, readBootstrapConfig.load(discoveredConfigSourceFactory)));
}
- // add bootstrap mappings
- for (ConfigClassWithPrefix configMapping : staticConfigMappings) {
- readBootstrapConfig.invokeStaticMethod(CU_WITH_MAPPING, bootstrapBuilder,
- readBootstrapConfig.load(configMapping.getKlass().getName()),
- readBootstrapConfig.load(configMapping.getPrefix()));
- }
// add bootstrap config builders
ResultHandle bootstrapConfigBuilders = readBootstrapConfig.newInstance(AL_NEW);
@@ -649,12 +639,6 @@ public void run() {
readConfig.newInstance(RCSF_NEW, readConfig.load(discoveredConfigSourceFactory)));
}
- // add mappings
- for (ConfigClassWithPrefix configMapping : runtimeConfigMappings) {
- readConfig.invokeStaticMethod(CU_WITH_MAPPING, runTimeBuilder,
- readConfig.load(configMapping.getKlass().getName()), readConfig.load(configMapping.getPrefix()));
- }
-
// additional config builders
ResultHandle configBuilders = readConfig.newInstance(AL_NEW);
for (String configBuilder : runtimeConfigBuilders) {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java
index 111a05329b9..4a9aa31c796 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java
@@ -88,6 +88,10 @@ public class ConfigGenerationBuildStep {
SmallRyeConfigBuilder.class, "withSources",
SmallRyeConfigBuilder.class, ConfigSource[].class);
+ private static final MethodDescriptor WITH_MAPPING = MethodDescriptor.ofMethod(
+ SmallRyeConfigBuilder.class, "withMapping",
+ SmallRyeConfigBuilder.class, Class.class, String.class);
+
@BuildStep
void staticInitSources(
BuildProducer<StaticInitConfigSourceProviderBuildItem> staticInitConfigSourceProviderBuildItem,
@@ -217,6 +221,33 @@ void extensionMappings(ConfigurationBuildItem configItem,
}
}
+ @BuildStep
+ void builderMappings(
+ ConfigurationBuildItem configItem,
+ List<ConfigMappingBuildItem> configMappings,
+ BuildProducer<GeneratedClassBuildItem> generatedClass,
+ BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
+ BuildProducer<StaticInitConfigBuilderBuildItem> staticInitConfigBuilder,
+ BuildProducer<RunTimeConfigBuilderBuildItem> runTimeConfigBuilder) {
+
+ // For Static Init Config
+ Set<ConfigClassWithPrefix> staticMappings = new HashSet<>();
+ staticMappings.addAll(staticSafeConfigMappings(configMappings));
+ staticMappings.addAll(configItem.getReadResult().getBuildTimeRunTimeMappings());
+ String staticInitMappingsConfigBuilder = "io.quarkus.runtime.generated.StaticInitMappingsConfigBuilder";
+ generateMappingsConfigBuilder(generatedClass, reflectiveClass, staticInitMappingsConfigBuilder, staticMappings);
+ staticInitConfigBuilder.produce(new StaticInitConfigBuilderBuildItem(staticInitMappingsConfigBuilder));
+
+ // For RunTime Config
+ Set<ConfigClassWithPrefix> runTimeMappings = new HashSet<>();
+ runTimeMappings.addAll(runtimeConfigMappings(configMappings));
+ runTimeMappings.addAll(configItem.getReadResult().getBuildTimeRunTimeMappings());
+ runTimeMappings.addAll(configItem.getReadResult().getRunTimeMappings());
+ String runTimeMappingsConfigBuilder = "io.quarkus.runtime.generated.RunTimeMappingsConfigBuilder";
+ generateMappingsConfigBuilder(generatedClass, reflectiveClass, runTimeMappingsConfigBuilder, runTimeMappings);
+ runTimeConfigBuilder.produce(new RunTimeConfigBuilderBuildItem(runTimeMappingsConfigBuilder));
+ }
+
/**
* Generate the Config class that instantiates MP Config and holds all the config objects
*/
@@ -256,6 +287,7 @@ void generateConfigClass(
staticConfigSourceFactories.addAll(staticInitConfigSourceFactories.stream()
.map(StaticInitConfigSourceFactoryBuildItem::getFactoryClassName).collect(Collectors.toSet()));
+ // TODO - duplicated now builderMappings. Still required to filter the unknown properties
Set<ConfigClassWithPrefix> staticMappings = new HashSet<>();
staticMappings.addAll(staticSafeConfigMappings(configMappings));
staticMappings.addAll(configItem.getReadResult().getBuildTimeRunTimeMappings());
@@ -484,6 +516,34 @@ private static void generateDefaultsConfigSource(
reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, false, className));
}
+ private static void generateMappingsConfigBuilder(
+ BuildProducer<GeneratedClassBuildItem> generatedClass,
+ BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
+ String className,
+ Set<ConfigClassWithPrefix> mappings) {
+
+ try (ClassCreator classCreator = ClassCreator.builder()
+ .classOutput(new GeneratedClassGizmoAdaptor(generatedClass, true))
+ .className(className)
+ .interfaces(ConfigBuilder.class)
+ .setFinal(true)
+ .build()) {
+
+ MethodCreator method = classCreator.getMethodCreator(CONFIG_BUILDER);
+ ResultHandle configBuilder = method.getMethodParam(0);
+
+ for (ConfigClassWithPrefix mapping : mappings) {
+ method.invokeVirtualMethod(WITH_MAPPING, configBuilder,
+ method.loadClass(mapping.getKlass()),
+ method.load(mapping.getPrefix()));
+ }
+
+ method.returnValue(configBuilder);
+ }
+
+ reflectiveClass.produce(new ReflectiveClassBuildItem(true, false, false, className));
+ }
+
private static Set<String> discoverService(
Class<?> serviceClass,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass) throws IOException {
diff --git a/integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/config/SecretKeysConfigTest.java b/integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/config/SecretKeysConfigTest.java
index 120c4c6da57..c299b5b3de4 100644
--- a/integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/config/SecretKeysConfigTest.java
+++ b/integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/config/SecretKeysConfigTest.java
@@ -39,7 +39,7 @@ void secrets() {
}
@ConfigMapping(prefix = "secrets.my")
- interface MappingSecret {
+ public interface MappingSecret {
String secret();
}
} | ['core/deployment/src/main/java/io/quarkus/deployment/steps/ConfigGenerationBuildStep.java', 'core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java', 'integration-tests/test-extension/extension/deployment/src/test/java/io/quarkus/config/SecretKeysConfigTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 24,711,918 | 4,877,728 | 629,643 | 5,757 | 5,024 | 885 | 86 | 2 | 12,634 | 674 | 3,305 | 191 | 5 | 3 | 1970-01-01T00:27:55 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,434 | quarkusio/quarkus/25285/25258 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25258 | https://github.com/quarkusio/quarkus/pull/25285 | https://github.com/quarkusio/quarkus/pull/25285 | 1 | fixes | RESTEasy reactive illegally restricts JAX-RSpath parameter names | ### Describe the bug
Consider the following JAX-RS resource:
```
@Produces(MediaType.APPLICATION_JSON)
@Path("/")
public class ContextNotWorking {
@GET
@Path("foo/{something-with-dash:[^a]*}")
public Response doSomething(@PathParam("something-with-dash") String param) {
return Response.noContent().build();
}
}
```
Note that path parameter _something-with-dash_. According to the Javadoc of @Path the dash is an allowed character in a parameter name. However, if you try to run this with resteasy-reactive startup fails with
```
Caused by: java.lang.IllegalArgumentException: Path '/foo/{something-with-dash:[^a]*}' of method 'org.knime.xxx.ContextNotWorking#doSomething' is not a valid expression
at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.validateMethodPath(ServerEndpointIndexer.java:226)
at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.handleAdditionalMethodProcessing(ServerEndpointIndexer.java:218)
at io.quarkus.resteasy.reactive.server.deployment.QuarkusServerEndpointIndexer.handleAdditionalMethodProcessing(QuarkusServerEndpointIndexer.java:164)
at io.quarkus.resteasy.reactive.server.deployment.QuarkusServerEndpointIndexer.handleAdditionalMethodProcessing(QuarkusServerEndpointIndexer.java:32)
at org.jboss.resteasy.reactive.common.processor.EndpointIndexer.createResourceMethod(EndpointIndexer.java:657)
... 14 more
Caused by: java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 12
(?<something-with-dash>[^a]*)$
^
at java.base/java.util.regex.Pattern.error(Pattern.java:2027)
at java.base/java.util.regex.Pattern.groupname(Pattern.java:2949)
at java.base/java.util.regex.Pattern.group0(Pattern.java:2995)
at java.base/java.util.regex.Pattern.sequence(Pattern.java:2123)
at java.base/java.util.regex.Pattern.expr(Pattern.java:2068)
at java.base/java.util.regex.Pattern.compile(Pattern.java:1782)
at java.base/java.util.regex.Pattern.<init>(Pattern.java:1428)
at java.base/java.util.regex.Pattern.compile(Pattern.java:1068)
at org.jboss.resteasy.reactive.server.mapping.URITemplate.<init>(URITemplate.java:157)
at org.jboss.resteasy.reactive.server.processor.ServerEndpointIndexer.validateMethodPath(ServerEndpointIndexer.java:223)
... 18 more
```
It seems he reactive extension does not comply with the JAX-RS specification.
The same class works fine with the non-reactive version of RESTEasy.
Patterns in Java indeed do *not* allow dashes in capture group names.
### Expected behavior
Code that is legal according to the JAX-RS specification should work in Quarkus.
### Actual behavior
Quarkus startup fails with the error above.
### How to Reproduce?
Try to run the provided JAX-RS resource class with _quarkus-resteasy-reactive_.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
17
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.8.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 813a88bbbd12687e178789f9de41df95bf253db5 | ea6206a6c48e12db5e8f781c1f0737fe06efc3e6 | https://github.com/quarkusio/quarkus/compare/813a88bbbd12687e178789f9de41df95bf253db5...ea6206a6c48e12db5e8f781c1f0737fe06efc3e6 | diff --git a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java
index a48cd45b766..18167fbeeb3 100644
--- a/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java
+++ b/independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java
@@ -303,11 +303,12 @@ public Optional<ResourceClass> createEndpoints(ClassInfo classInfo, boolean cons
private String sanitizePath(String path) {
// this simply replaces the whitespace characters (not part of a path variable) with %20
// TODO: this might have to be more complex, URL encoding maybe?
- boolean inVariable = false;
+ // zero braces indicates we are outside of a variable
+ int bracesCount = 0;
StringBuilder replaced = null;
for (int i = 0; i < path.length(); i++) {
char c = path.charAt(i);
- if ((c == ' ') && (!inVariable)) {
+ if ((c == ' ') && (bracesCount == 0)) {
if (replaced == null) {
replaced = new StringBuilder(path.length() + 2);
replaced.append(path, 0, i);
@@ -319,9 +320,9 @@ private String sanitizePath(String path) {
replaced.append(c);
}
if (c == '{') {
- inVariable = true;
+ bracesCount++;
} else if (c == '}') {
- inVariable = false;
+ bracesCount--;
}
}
if (replaced == null) {
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java
index 90d61fb86c7..d291f4ad179 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java
@@ -75,8 +75,8 @@ public RequestMatch<T> map(String path) {
break;
}
matchPos = matcher.end();
- for (String name : segment.names) {
- params[paramCount++] = URIDecoder.decodeURIComponent(matcher.group(name), false);
+ for (String group : segment.groups) {
+ params[paramCount++] = URIDecoder.decodeURIComponent(matcher.group(group), false);
}
} else if (segment.type == URITemplate.Type.LITERAL) {
//make sure the literal text is the same
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/URITemplate.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/URITemplate.java
index f46fcab7f4c..09e45a3c97b 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/URITemplate.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/URITemplate.java
@@ -8,6 +8,8 @@
public class URITemplate implements Dumpable, Comparable<URITemplate> {
+ private static final Pattern GROUP_NAME_PATTERN = Pattern.compile("^[A-Za-z][A-Za-z\\\\d]*$");
+
public final String template;
public final String stem;
@@ -65,17 +67,19 @@ public URITemplate(String template, boolean prefixMatch) {
if (sb.length() > 0) {
capGroups++;
if (i + 1 == template.length() || template.charAt(i + 1) == '/') {
- components.add(new TemplateComponent(Type.DEFAULT_REGEX, null, sb.toString(), null, null));
+ components
+ .add(new TemplateComponent(Type.DEFAULT_REGEX, null, sb.toString().trim(), null, null,
+ null));
} else {
- components.add(new TemplateComponent(Type.CUSTOM_REGEX, "[^/]+?", sb.toString(),
- null, null));
+ components.add(new TemplateComponent(Type.CUSTOM_REGEX, "[^/]+?", sb.toString().trim(),
+ null, null, null));
}
} else {
throw new IllegalArgumentException("Invalid template " + template);
}
sb.setLength(0);
} else if (c == ':') {
- name = sb.toString();
+ name = sb.toString().trim();
sb.setLength(0);
state = 2;
} else {
@@ -89,8 +93,8 @@ public URITemplate(String template, boolean prefixMatch) {
capGroups++;
complexGroups++;
components
- .add(new TemplateComponent(Type.CUSTOM_REGEX, sb.toString(), name, null,
- null));
+ .add(new TemplateComponent(Type.CUSTOM_REGEX, sb.toString().trim(), name, null,
+ null, null));
} else {
throw new IllegalArgumentException("Invalid template " + template);
}
@@ -124,30 +128,43 @@ public URITemplate(String template, boolean prefixMatch) {
//coalesce the components
//once we have a CUSTOM_REGEX everything goes out the window, so we need to turn the remainder of the
//template into a single CUSTOM_REGEX
+ List<String> groupAggregator = null;
List<String> nameAggregator = null;
StringBuilder regexAggregator = null;
Iterator<TemplateComponent> it = components.iterator();
while (it.hasNext()) {
TemplateComponent component = it.next();
+
+ if (component.type == Type.CUSTOM_REGEX && nameAggregator == null) {
+ regexAggregator = new StringBuilder();
+ groupAggregator = new ArrayList<>();
+ nameAggregator = new ArrayList<>();
+ }
+
if (nameAggregator != null) {
it.remove();
if (component.type == Type.LITERAL) {
regexAggregator.append(Pattern.quote(component.literalText));
- } else if (component.type == Type.DEFAULT_REGEX) {
- regexAggregator.append("(?<").append(component.name).append(">[^/]+?)");
- nameAggregator.add(component.name);
- } else if (component.type == Type.CUSTOM_REGEX) {
- regexAggregator.append("(?<").append(component.name).append(">").append(component.literalText.trim())
+ } else if (component.type == Type.DEFAULT_REGEX || component.type == Type.CUSTOM_REGEX) {
+ String groupName = component.name;
+ // test if the component name is a valid java groupname according to the rules outlined in java.util.Pattern#groupName
+ // Paths allow for parameter names with characters not allowed in group names. Generate a custom one in the form group + running number when the component name alone would be invalid.
+ if (!GROUP_NAME_PATTERN.matcher(component.name).matches()) {
+ groupName = "group" + groupAggregator.size();
+ }
+
+ String regex = "[^/]+?";
+
+ if (component.type == Type.CUSTOM_REGEX) {
+ regex = component.literalText.trim();
+ }
+
+ groupAggregator.add(groupName + "");
+ regexAggregator.append("(?<").append(groupName).append(">")
+ .append(regex)
.append(")");
nameAggregator.add(component.name);
}
- } else if (component.type == Type.CUSTOM_REGEX) {
- it.remove();
- regexAggregator = new StringBuilder();
- nameAggregator = new ArrayList<>();
- regexAggregator.append("(?<").append(component.name).append(">").append(component.literalText.trim())
- .append(")");
- nameAggregator.add(component.name);
}
}
if (nameAggregator != null) {
@@ -155,7 +172,7 @@ public URITemplate(String template, boolean prefixMatch) {
regexAggregator.append("$");
}
components.add(new TemplateComponent(Type.CUSTOM_REGEX, null, null, Pattern.compile(regexAggregator.toString()),
- nameAggregator.toArray(new String[0])));
+ nameAggregator.toArray(new String[0]), groupAggregator.toArray(new String[0])));
}
this.stem = stem;
this.literalCharacterCount = litChars;
@@ -174,13 +191,13 @@ private String handlePossibleStem(List<TemplateComponent> components, String ste
//all JAX-RS paths have an implicit (/.*)? at the end of them
//to technically every path has an optional implicit slash
stem = stem.substring(0, stem.length() - 1);
- components.add(new TemplateComponent(Type.LITERAL, stem, null, null, null));
- components.add(new TemplateComponent(Type.LITERAL, "/", null, null, null));
+ components.add(new TemplateComponent(Type.LITERAL, stem, null, null, null, null));
+ components.add(new TemplateComponent(Type.LITERAL, "/", null, null, null, null));
} else {
- components.add(new TemplateComponent(Type.LITERAL, literal, null, null, null));
+ components.add(new TemplateComponent(Type.LITERAL, literal, null, null, null, null));
}
} else {
- components.add(new TemplateComponent(Type.LITERAL, literal, null, null, null));
+ components.add(new TemplateComponent(Type.LITERAL, literal, null, null, null, null));
}
return stem;
}
@@ -269,14 +286,20 @@ public static class TemplateComponent implements Dumpable {
/**
* The names of all the capturing groups. Only used for CUSTOM_REGEX
*/
+ public final String[] groups;
+
+ /**
+ * The names of all the components. Only used for CUSTOM_REGEX
+ */
public final String[] names;
- public TemplateComponent(Type type, String literalText, String name, Pattern pattern, String[] names) {
+ public TemplateComponent(Type type, String literalText, String name, Pattern pattern, String[] names, String[] groups) {
this.type = type;
this.literalText = literalText;
this.name = name;
this.pattern = pattern;
this.names = names;
+ this.groups = groups;
}
@Override
diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/matching/RegexResource.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/matching/RegexResource.java
index 179200a5597..f633fc44b24 100644
--- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/matching/RegexResource.java
+++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/matching/RegexResource.java
@@ -8,8 +8,8 @@
public class RegexResource {
@GET
- @Path("/{pin:[A-Z0-9]{4}}")
- public String hello(@PathParam("pin") String name) {
+ @Path("/{ 1p-_in. : [A-Z0-9]{4} }")
+ public String hello(@PathParam("1p-_in.") String name) {
return "pin " + name;
}
| ['independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/URITemplate.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/mapping/RequestMapper.java', 'independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/matching/RegexResource.java', 'independent-projects/resteasy-reactive/common/processor/src/main/java/org/jboss/resteasy/reactive/common/processor/EndpointIndexer.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 20,485,920 | 3,961,917 | 520,106 | 4,996 | 5,501 | 956 | 84 | 3 | 3,150 | 252 | 738 | 77 | 0 | 2 | 1970-01-01T00:27:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,263 | quarkusio/quarkus/30955/30682 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/30682 | https://github.com/quarkusio/quarkus/pull/30955 | https://github.com/quarkusio/quarkus/pull/30955 | 1 | fix | PostgreSQL service binding does not get recognised by Quarkus app | ### Describe the bug
Since Quarkus 2.15, Quarkus application is unable to bind to PostgreSQL service provided by CrunchyDB.
PostgresCluster used:
```
apiVersion: postgres-operator.crunchydata.com/v1beta1
kind: PostgresCluster
metadata:
name: hippo
spec:
openshift: true
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.2-1
postgresVersion: 14
instances:
- name: instance1
dataVolumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 150Mi
backups:
pgbackrest:
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.38-0
repos:
- name: repo1
volume:
volumeClaimSpec:
accessModes:
- "ReadWriteOnce"
resources:
requests:
storage: 150Mi
```
`application.properties`:
```
quarkus.kubernetes-service-binding.services.postgresql.api-version=postgres-operator.crunchydata.com/v1beta1
quarkus.kubernetes-service-binding.services.postgresql.kind=PostgresCluster
quarkus.kubernetes-service-binding.services.postgresql.name=hippo
quarkus.datasource.db-kind=postgresql
quarkus.hibernate-orm.database.generation=drop-and-create
quarkus.hibernate-orm.sql-load-script=import.sql
quarkus.openshift.route.expose=true
quarkus.kubernetes.deployment-target=openshift
```
These settings have worked since Quarkus 2.2.
### Expected behavior
Service is bound to Quarkus application and the application launches
### Actual behavior
Quarkus fails the service binding, application misses datasource configuration and thus fails to start with
```
Model classes are defined for the default persistence unit <default> but configured datasource <default> not found: the default EntityManagerFactory will not be created. To solve this, configure the default datasource. Refer to https://quarkus.io/guides/datasource for guidance.
```
### How to Reproduce?
Reproducer is available at https://github.com/quarkus-qe/quarkus-test-suite
1. Login to OpenShift with SBO and CrunchyDB operator
2. check out https://github.com/quarkus-qe/quarkus-test-suite
3. `cd service-binding/postrgres-crunchy-classic`
4. Run the test to create the `PostgresCluster`, deploy the application and run crud operations on it: `mvn clean verify -Dopenshift`
To run with Quarkus that worked with this SB, you can run `mvn clean verify -Dopenshift -Dquarkus.platform.version=2.14.3.Final`
To manually deploy the `PostgresCluster` and the application, run the following:
```
oc apply -f ./src/test/resources/pg-cluster.yml
# wait for PostgresCluster
oc -n ${YOUR_NAMESPACE} wait --for condition=Ready --timeout=300s pods --all
# build + deploy app in OCP
mvn clean install -Dquarkus.kubernetes-client.trust-certs=true -Dquarkus.kubernetes.deploy=true
```
### Output of `uname -a` or `ver`
Linux tigris 6.1.7-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jan 18 17:11:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.5" 2022-10-18
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
since 2.15.0
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.5 (Red Hat 3.8.5-3)
### Additional information
This also fails for reactive Hibernate - for the reproducer, see https://github.com/quarkus-qe/quarkus-test-suite/tree/main/service-binding/postgresql-crunchy-reactive.
The application manages to boot there, but it fails when it tries to access the datasource with bogus URL:
```
18:29:46,010 INFO [app] 17:29:40,998 HR000057: Failed to execute statement [select todo0_.id as id1_0_0_, todo0_.completed as complete2_0_0_, todo0_.title as title3_0_0_ from Todo todo0_ where todo0_.id=$1]: could not load an entity: [io.quarkus.ts.sb.reactive.Todo#1]: java.util.concurrent.CompletionException: io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:5432
``` | 97ca0febe9ba88736e46e856f69d6320a4ab9b2c | 7db652b12c65c9da64cdc954bf45fb9d3d31f849 | https://github.com/quarkusio/quarkus/compare/97ca0febe9ba88736e46e856f69d6320a4ab9b2c...7db652b12c65c9da64cdc954bf45fb9d3d31f849 | diff --git a/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java b/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java
index 26f6f31dd35..c1285724923 100644
--- a/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java
+++ b/extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java
@@ -8,18 +8,19 @@
public abstract class DatasourceServiceBindingConfigSourceFactory
implements Function<ServiceBinding, ServiceBindingConfigSource> {
-
private static final Logger log = Logger.getLogger(DatasourceServiceBindingConfigSourceFactory.class);
private final String configSourceNamePrefix;
private final String urlPropertyName;
+ private final String prefix;
private final String urlFormat;
protected ServiceBinding serviceBinding;
private DatasourceServiceBindingConfigSourceFactory(String configSourceNamePrefix, String urlPropertyName,
- String urlFormat) {
+ String prefix, String urlFormat) {
this.configSourceNamePrefix = configSourceNamePrefix;
this.urlPropertyName = urlPropertyName;
+ this.prefix = prefix;
this.urlFormat = urlFormat;
}
@@ -47,14 +48,13 @@ private Map<String, String> getServiceBindingProperties() {
log.debugf("Property 'password' was not found for datasource of type %s", serviceBinding.getType());
}
- String jdbcURL = bindingProperties.get("jdbc-url");
- if (jdbcURL != null) {
- properties.put(urlPropertyName, jdbcURL);
+ if (configureUrlPropertyUsingKey(properties, "jdbc-url")) {
+ return properties;
+ }
+ if (configureUrlPropertyUsingKey(properties, "jdbc-uri")) {
return properties;
}
- String uri = bindingProperties.get("uri");
- if (uri != null) {
- properties.put(urlPropertyName, uri);
+ if (configureUrlPropertyUsingKey(properties, "uri")) {
return properties;
}
@@ -79,23 +79,37 @@ protected String formatUrl(String urlFormat, String type, String host, String da
return String.format(urlFormat, type, host, portPart, database);
}
+ private boolean configureUrlPropertyUsingKey(Map<String, String> properties, String key) {
+ String value = serviceBinding.getProperties().get(key);
+ if (value == null) {
+ return false;
+ } else if (value.startsWith(prefix)) {
+ properties.put(urlPropertyName, value);
+ return true;
+ }
+
+ log.warnf("The value '%s' from the property '%s' does not start with '%s'. It will be ignored.",
+ value, key, prefix);
+ return false;
+ }
+
public static class Jdbc extends DatasourceServiceBindingConfigSourceFactory {
public Jdbc() {
- super("jdbc", "quarkus.datasource.jdbc.url", "jdbc:%s://%s%s/%s");
+ this("jdbc:%s://%s%s/%s");
}
public Jdbc(String urlFormat) {
- super("jdbc", "quarkus.datasource.jdbc.url", urlFormat);
+ super("jdbc", "quarkus.datasource.jdbc.url", "jdbc:", urlFormat);
}
}
public static class Reactive extends DatasourceServiceBindingConfigSourceFactory {
public Reactive() {
- super("reactive", "quarkus.datasource.reactive.url", "%s://%s%s/%s");
+ this("%s://%s%s/%s");
}
public Reactive(String urlFormat) {
- super("reactive", "quarkus.datasource.reactive.url", urlFormat);
+ super("reactive", "quarkus.datasource.reactive.url", "", urlFormat);
}
}
} | ['extensions/kubernetes-service-binding/runtime/src/main/java/io/quarkus/kubernetes/service/binding/runtime/DatasourceServiceBindingConfigSourceFactory.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 24,712,420 | 4,877,839 | 629,660 | 5,757 | 1,752 | 382 | 38 | 1 | 4,168 | 394 | 1,093 | 114 | 4 | 5 | 1970-01-01T00:27:55 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,264 | quarkusio/quarkus/30940/30919 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/30919 | https://github.com/quarkusio/quarkus/pull/30940 | https://github.com/quarkusio/quarkus/pull/30940 | 1 | fix | Compilation to native fails, when quarkus-smallrye-openapi is included | ### Describe the bug
I have an application, which uses `quarkus-smallrye-openapi` dependency. The application works flawlessly in JVM mode, but fails during `Performing analysis` phase in Native mode. Experimenting shows, that the app fails simply when that dependency is included in pom.
### Expected behavior
App should work in both JVM and Native modes
### Actual behavior
```
[2/7] Performing analysis... [] (43.2s @ 1.13GB)
11,264 (91.32%) of 12,334 classes reachable
14,775 (57.48%) of 25,705 fields reachable
47,410 (80.62%) of 58,807 methods reachable
541 classes, 0 fields, and 0 methods registered for reflection
Error: java.util.concurrent.ExecutionException: com.oracle.svm.core.util.VMError$HostedError: java.lang.reflect.InvocationTargetException
com.oracle.graal.pointsto.util.AnalysisError: java.util.concurrent.ExecutionException: com.oracle.svm.core.util.VMError$HostedError: java.lang.reflect.InvocationTargetException
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisError.shouldNotReachHere(AnalysisError.java:173)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:66)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$postTask$12(ImageHeapScanner.java:663)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:193)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:177)
at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1395)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165)
Caused by: java.util.concurrent.ExecutionException: com.oracle.svm.core.util.VMError$HostedError: java.lang.reflect.InvocationTargetException
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:64)
... 9 more
Caused by: com.oracle.svm.core.util.VMError$HostedError: java.lang.reflect.InvocationTargetException
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:72)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.annotation.AnnotationSubstitutionField.readValue(AnnotationSubstitutionField.java:131)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ameta.AnalysisConstantReflectionProvider.readHostedFieldValue(AnalysisConstantReflectionProvider.java:123)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.readHostedFieldValue(SVMImageHeapScanner.java:122)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.createImageHeapObject(ImageHeapScanner.java:277)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$getOrCreateConstantReachableTask$2(ImageHeapScanner.java:203)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.getOrCreateConstantReachableTask(ImageHeapScanner.java:215)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.heap.SVMImageHeapScanner.getOrCreateConstantReachableTask(SVMImageHeapScanner.java:95)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.markConstantReachable(ImageHeapScanner.java:179)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.onFieldValueReachable(ImageHeapScanner.java:357)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.heap.ImageHeapScanner.lambda$createImageHeapObject$3(ImageHeapScanner.java:284)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.util.AnalysisFuture.ensureDone(AnalysisFuture.java:63)
... 9 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.annotation.AnnotationSubstitutionField.readValue(AnnotationSubstitutionField.java:114)
... 22 more
Caused by: java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract org.eclipse.microprofile.openapi.annotations.enums.SchemaType org.eclipse.microprofile.openapi.annotations.media.Schema.type() (Found data of type java.lang.String[ARRAY])
at java.base/sun.reflect.annotation.AnnotationTypeMismatchExceptionProxy.generateException(AnnotationTypeMismatchExceptionProxy.java:59)
at java.base/sun.reflect.annotation.AnnotationInvocationHandler.invoke(AnnotationInvocationHandler.java:89)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.SubstrateAnnotationInvocationHandler.invoke(SubstrateAnnotationInvocationHandler.java:52)
at jdk.proxy4/jdk.proxy4.$Proxy141.type(Unknown Source)
... 27 more
```
### How to Reproduce?
1. `git clone git@github.com:fedinskiy/quarkus-test-suite.git -b reproducer/openapi-failure`
2. `cd quarkus-test-suite/spring/spring-data`
3. `mvn clean verify -Dnative -Dquarkus.platform.version=2.16.1.Final -Pfail`
4. `mvn clean verify -Dnative -Dquarkus.platform.version=2.16.1.Final` — this compiles, but expectedly fails during test phase due to lack of `q/openapi` endpoint
### Output of `uname -a` or `ver`
6.0.18-300.fc37.x86_64
### Output of `java -version`
17.0.6, vendor: GraalVM Community
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.16.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
### Additional information
_No response_ | 25470b6decca9b6e8689d964bdba8bb4452d582a | 0bc09e788b4f40341b98e90b89c051df1e9d936c | https://github.com/quarkusio/quarkus/compare/25470b6decca9b6e8689d964bdba8bb4452d582a...0bc09e788b4f40341b98e90b89c051df1e9d936c | diff --git a/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/StandardMethodImplementor.java b/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/StandardMethodImplementor.java
index c46aadc3c26..d12d3a9eb27 100644
--- a/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/StandardMethodImplementor.java
+++ b/extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/StandardMethodImplementor.java
@@ -41,6 +41,7 @@ public abstract class StandardMethodImplementor implements MethodImplementor {
private static final String OPENAPI_RESPONSE_ANNOTATION = OPENAPI_PACKAGE + ".responses.APIResponse";
private static final String OPENAPI_CONTENT_ANNOTATION = OPENAPI_PACKAGE + ".media.Content";
private static final String OPENAPI_SCHEMA_ANNOTATION = OPENAPI_PACKAGE + ".media.Schema";
+ private static final String SCHEMA_TYPE_CLASS_NAME = "org.eclipse.microprofile.openapi.annotations.enums.SchemaType";
private static final String SCHEMA_TYPE_ARRAY = "ARRAY";
private static final String ROLES_ALLOWED_ANNOTATION = "jakarta.annotation.security.RolesAllowed";
private static final Logger LOGGER = Logger.getLogger(StandardMethodImplementor.class);
@@ -197,7 +198,7 @@ protected void addOpenApiResponseAnnotation(AnnotatedElement element, Response.S
.add("implementation", clazz);
if (isList) {
- schemaAnnotation.add("type", SCHEMA_TYPE_ARRAY);
+ schemaAnnotation.add("type", schemaTypeArray());
}
element.addAnnotation(OPENAPI_RESPONSE_ANNOTATION)
@@ -235,6 +236,11 @@ protected boolean isNotReactivePanache() {
return !capabilities.isPresent(Capability.HIBERNATE_REACTIVE);
}
+ private static Enum schemaTypeArray() {
+ Class<?> schemaTypeClass = toClass(SCHEMA_TYPE_CLASS_NAME);
+ return Enum.valueOf((Class<Enum>) schemaTypeClass, SCHEMA_TYPE_ARRAY);
+ }
+
private static Class<?> toClass(String className) {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
try { | ['extensions/panache/rest-data-panache/deployment/src/main/java/io/quarkus/rest/data/panache/deployment/methods/StandardMethodImplementor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 24,708,955 | 4,877,125 | 629,581 | 5,755 | 457 | 89 | 8 | 1 | 6,900 | 317 | 1,627 | 98 | 0 | 1 | 1970-01-01T00:27:55 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,265 | quarkusio/quarkus/30839/30806 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/30806 | https://github.com/quarkusio/quarkus/pull/30839 | https://github.com/quarkusio/quarkus/pull/30839 | 1 | closes | */* in Accept header is ignored if not listed as the first item | ### Describe the bug
see https://github.com/quarkusio/quarkus/discussions/30759#discussioncomment-4839300 for description of the bug
### Expected behavior
An `*/*` type is always recognized if present in an `Accept` header of GraphQL requests, and the request be handled normally with the default response content type (which is `application/graphql+json`)
### Actual behavior
An `*/*` type is recognized only if it's the first item in the `Accept` header, else the GraphQL endpoint returns a 406 Unacceptable 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_ | ea3d95daed88f1b2e1d07100117f5fcfb902ce95 | 4c48dec9dc7dc466aed96fb35fcc263edc619ef5 | https://github.com/quarkusio/quarkus/compare/ea3d95daed88f1b2e1d07100117f5fcfb902ce95...4c48dec9dc7dc466aed96fb35fcc263edc619ef5 | 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 127e1ed8cc7..6f8787beebb 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
@@ -223,10 +223,14 @@ private String getRequestAccept(RoutingContext ctx) {
if (isValidAcceptRequest(a.rawValue())) {
return a.rawValue();
}
+
+ if (a.rawValue().startsWith("*/*")) {
+ return DEFAULT_RESPONSE_CONTENT_TYPE;
+ }
}
// Seems like an unknown accept is passed in
String accept = ctx.request().getHeader("Accept");
- if (accept != null && !accept.isEmpty() && !accept.startsWith("*/*")) {
+ if (accept != null && !accept.isEmpty()) {
return accept;
}
} | ['extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLExecutionHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 24,724,559 | 4,877,765 | 630,117 | 5,751 | 275 | 52 | 6 | 1 | 898 | 128 | 215 | 39 | 1 | 0 | 1970-01-01T00:27:55 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,443 | quarkusio/quarkus/25035/25029 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25029 | https://github.com/quarkusio/quarkus/pull/25035 | https://github.com/quarkusio/quarkus/pull/25035 | 1 | fixes | REST Reactive Client when retried, Authorization header is multiplied by OidcClientRequestReactiveFilter | ### Describe the bug
When we have a REST Reactive Client with OidcClientRequestReactiveFilter, and we retry the requests through Mutiny, the Authorization header gets multiplied with each new retry.
This results in AWS API Gateway to immediately reject the requests with Bad Request.
Is there a configuration or something we can do to change this behaviour or is this something that needs to be fixed ?
### Expected behavior
Only a single Authorization header in the retried requests.
### Actual behavior
Authorization headers keep increasing with each retry request.
### How to Reproduce?
Given the rest client;
```
@RegisterRestClient(configKey = "my-api")
@RegisterProvider(OidcClientRequestReactiveFilter.class)
@Path("/api/v1")
public interface MyApi {
@POST
@Path("/something")
Uni<SomethingResponse> postSomething(Something body);
}
```
When;
```
myApi.postSomething(body).onFailure().retry().indefinitely();
```
Then each retry keeps appending a new Authorization header to the request.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
Java 11
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.8.1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 731abc35ccad9851c8a2e8a4c3d4e6adfed5e602 | aeb39f1797b78dcee969972de240fdc2e8f1d2be | https://github.com/quarkusio/quarkus/compare/731abc35ccad9851c8a2e8a4c3d4e6adfed5e602...aeb39f1797b78dcee969972de240fdc2e8f1d2be | diff --git a/extensions/oidc-client-reactive-filter/runtime/src/main/java/io/quarkus/oidc/client/reactive/filter/OidcClientRequestReactiveFilter.java b/extensions/oidc-client-reactive-filter/runtime/src/main/java/io/quarkus/oidc/client/reactive/filter/OidcClientRequestReactiveFilter.java
index 7508e906ecb..f7c12963d77 100644
--- a/extensions/oidc-client-reactive-filter/runtime/src/main/java/io/quarkus/oidc/client/reactive/filter/OidcClientRequestReactiveFilter.java
+++ b/extensions/oidc-client-reactive-filter/runtime/src/main/java/io/quarkus/oidc/client/reactive/filter/OidcClientRequestReactiveFilter.java
@@ -41,7 +41,8 @@ public void filter(ResteasyReactiveClientRequestContext requestContext) {
super.getTokens().subscribe().with(new Consumer<Tokens>() {
@Override
public void accept(Tokens tokens) {
- requestContext.getHeaders().add(HttpHeaders.AUTHORIZATION, BEARER_SCHEME_WITH_SPACE + tokens.getAccessToken());
+ requestContext.getHeaders().putSingle(HttpHeaders.AUTHORIZATION,
+ BEARER_SCHEME_WITH_SPACE + tokens.getAccessToken());
requestContext.resume();
}
}, new Consumer<Throwable>() { | ['extensions/oidc-client-reactive-filter/runtime/src/main/java/io/quarkus/oidc/client/reactive/filter/OidcClientRequestReactiveFilter.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,416,424 | 3,948,780 | 518,384 | 4,985 | 288 | 50 | 3 | 1 | 1,403 | 180 | 307 | 63 | 0 | 2 | 1970-01-01T00:27: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,442 | quarkusio/quarkus/25127/25123 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25123 | https://github.com/quarkusio/quarkus/pull/25127 | https://github.com/quarkusio/quarkus/pull/25127 | 1 | resolves | MP Config - programmatic lookup of "custom" type config property fails | ### Describe the bug
If there's a `Provider/Instance` injection point whose required type is not handled by the `ConfigProducer` (aka "custom type") then a synthetic bean with a wrong set of bean types is generated. The bean has the type `Provider<Foo>/Instance<Foo>` instead of `Foo`. As a result, if there's an injection point like `@ConfigProperty(name = "foo.val") Provider<Foo> foo` then `foo.get()` results in an `UnsatisfiedResolutionException`.
Note that this error only occurs if there is no regular injection point for the given custom type, i.e. no exception is thrown if there's also `@ConfigProperty(name = "foo.val") Foo foo`.
### Quarkus version or git rev
999-SNAPSHOT | cdf0738a1892c89bf8d1ef687cc46b204dfe3b4d | 0274b7a5e1502fae2bc6c1b865cc68980ff82924 | https://github.com/quarkusio/quarkus/compare/cdf0738a1892c89bf8d1ef687cc46b204dfe3b4d...0274b7a5e1502fae2bc6c1b865cc68980ff82924 | diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
index e442f72837c..53808672a5a 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java
@@ -106,7 +106,7 @@ void registerCustomConfigBeanTypes(BeanDiscoveryFinishedBuildItem beanDiscovery,
AnnotationInstance configProperty = injectionPoint.getRequiredQualifier(MP_CONFIG_PROPERTY_NAME);
if (configProperty != null) {
// Register a custom bean for injection points that are not handled by ConfigProducer
- Type injectedType = injectionPoint.getType();
+ Type injectedType = injectionPoint.getRequiredType();
if (!isHandledByProducers(injectedType)) {
customBeanTypes.add(injectedType);
}
diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java
index 0ddcf2d264d..1762af06bdf 100644
--- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java
+++ b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java
@@ -4,6 +4,7 @@
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
+import javax.inject.Provider;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jboss.shrinkwrap.api.asset.StringAsset;
@@ -17,8 +18,8 @@ public class ConfigImplicitConverterTest {
@RegisterExtension
static final QuarkusUnitTest config = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
- .addClasses(Configured.class)
- .addAsResource(new StringAsset("foo=1"), "application.properties"));
+ .addClasses(Configured.class, Foo.class, Bar.class)
+ .addAsResource(new StringAsset("foo=1\\nbar=1"), "application.properties"));
@Inject
Configured configured;
@@ -26,6 +27,7 @@ public class ConfigImplicitConverterTest {
@Test
public void testFoo() {
assertEquals("1", configured.getFooValue());
+ assertEquals("1", configured.getBarProviderValue());
}
@ApplicationScoped
@@ -35,9 +37,17 @@ static class Configured {
@ConfigProperty(name = "foo")
Foo foo;
+ @ConfigProperty(name = "bar")
+ Provider<Bar> barProvider;
+
String getFooValue() {
return foo != null ? foo.value : null;
}
+
+ String getBarProviderValue() {
+ return barProvider.get().value;
+ }
+
}
public static class Foo {
@@ -50,4 +60,14 @@ public Foo(String value) {
}
+ public static class Bar {
+
+ String value;
+
+ public Bar(String value) {
+ this.value = value;
+ }
+
+ }
+
} | ['extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/ConfigBuildStep.java', 'extensions/arc/deployment/src/test/java/io/quarkus/arc/test/config/ConfigImplicitConverterTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 20,444,984 | 3,954,265 | 519,068 | 4,989 | 133 | 20 | 2 | 1 | 697 | 102 | 168 | 9 | 0 | 0 | 1970-01-01T00:27: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,440 | quarkusio/quarkus/25166/25016 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25016 | https://github.com/quarkusio/quarkus/pull/25166 | https://github.com/quarkusio/quarkus/pull/25166 | 1 | close | CLI creates kotlin project even with explicit `--java 11 --gradle-kotlin-dsl` | ### Describe the bug
`quarkus create app --java 11 --gradle-kotlin-dsl` creates Kotlin project instead of java one:
```kotlin
plugins {
kotlin("jvm") version "1.6.10"
kotlin("plugin.allopen") version "1.6.10"
id("io.quarkus")
}
```
### Expected behavior
Gradle scripts use Kotlin DSL but java project.
### Actual behavior
Gradle scripts use Kotlin DSL with kotlin project.
### How to Reproduce?
Run `quarkus create app --java 11 --gradle-kotlin-dsl`
### Output of `uname -a` or `ver`
Linux unterwelt 5.17.1-arch1-1 #1 SMP PREEMPT Mon, 28 Mar 2022 20:55:33 +0000 x86_64 GNU/Linux
### Output of `java -version`
OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode, sharing)
### GraalVM version (if different from Java)
N/A
### Quarkus version or git rev
2.8.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
N/A
### Additional information
_No response_ | 316e5a0906c1a9c1a532c1eb02aa7540a354dffc | d95a373ea91f895f55cff04c5cc966c19782b35e | https://github.com/quarkusio/quarkus/compare/316e5a0906c1a9c1a532c1eb02aa7540a354dffc...d95a373ea91f895f55cff04c5cc966c19782b35e | diff --git a/devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java b/devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java
index 2ac56d3063b..4248ba04c6c 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java
@@ -44,7 +44,7 @@ public SourceType getSourceType(CommandSpec spec, BuildTool buildTool, Set<Strin
if (kotlin || scala) {
output.warn("JBang only supports Java. Using Java as the target language.");
}
- } else if (kotlin || BuildTool.GRADLE_KOTLIN_DSL == buildTool) {
+ } else if (kotlin) {
sourceType = SourceType.KOTLIN;
} else if (scala) {
sourceType = SourceType.SCALA;
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 ec4fe18daf7..37d84327b3f 100644
--- a/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java
+++ b/devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java
@@ -106,7 +106,7 @@ public void testCreateAppDefaults() throws Exception {
Assertions.assertTrue(project.resolve("gradlew").toFile().exists(),
"Wrapper should exist by default");
- String buildGradleContent = validateBasicIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
+ String buildGradleContent = validateBasicGradleGroovyIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
CreateProjectHelper.DEFAULT_ARTIFACT_ID,
CreateProjectHelper.DEFAULT_VERSION);
Assertions.assertTrue(buildGradleContent.contains("quarkus-resteasy"),
@@ -117,6 +117,31 @@ public void testCreateAppDefaults() throws Exception {
CliDriver.invokeValidateBuild(project);
}
+ @Test
+ public void testCreateAppDefaultsWithKotlinDSL() throws Exception {
+ CliDriver.Result result = CliDriver.execute(workspaceRoot, "create", "app", "--gradle-kotlin-dsl", "--verbose", "-e",
+ "-B");
+ Assertions.assertEquals(CommandLine.ExitCode.OK, result.exitCode, "Expected OK return code." + result);
+ Assertions.assertTrue(result.stdout.contains("SUCCESS"),
+ "Expected confirmation that the project has been created." + result);
+
+ Assertions.assertTrue(project.resolve("gradlew").toFile().exists(),
+ "Wrapper should exist by default");
+ String buildGradleContent = validateBasicGradleKotlinIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
+ CreateProjectHelper.DEFAULT_ARTIFACT_ID,
+ CreateProjectHelper.DEFAULT_VERSION);
+ Assertions.assertTrue(buildGradleContent.contains("quarkus-resteasy"),
+ "build/gradle should contain quarkus-resteasy:\\n" + buildGradleContent);
+
+ Path packagePath = wrapperRoot.resolve("src/main/java/");
+ Assertions.assertTrue(packagePath.toFile().isDirectory(),
+ "Java Source directory should exist: " + packagePath.toAbsolutePath());
+
+ CliDriver.valdiateGeneratedSourcePackage(project, "org/acme");
+
+ CliDriver.invokeValidateBuild(project);
+ }
+
@Test
public void testCreateAppOverrides() throws Exception {
Path nested = workspaceRoot.resolve("cli-nested");
@@ -140,7 +165,7 @@ public void testCreateAppOverrides() throws Exception {
Assertions.assertTrue(project.resolve("gradlew").toFile().exists(),
"Wrapper should exist by default");
- String buildGradleContent = validateBasicIdentifiers(project, "silly", "my-project", "0.1.0");
+ String buildGradleContent = validateBasicGradleGroovyIdentifiers(project, "silly", "my-project", "0.1.0");
Assertions.assertTrue(buildGradleContent.contains("quarkus-resteasy-reactive"),
"build.gradle should contain quarkus-resteasy-reactive:\\n" + buildGradleContent);
@@ -163,7 +188,7 @@ public void testCreateCliDefaults() throws Exception {
Assertions.assertTrue(project.resolve("gradlew").toFile().exists(),
"Wrapper should exist by default");
- String buildGradleContent = validateBasicIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
+ String buildGradleContent = validateBasicGradleGroovyIdentifiers(project, CreateProjectHelper.DEFAULT_GROUP_ID,
CreateProjectHelper.DEFAULT_ARTIFACT_ID,
CreateProjectHelper.DEFAULT_VERSION);
Assertions.assertFalse(buildGradleContent.contains("quarkus-resteasy"),
@@ -374,7 +399,7 @@ public void testCreateArgJava17() throws Exception {
"Java 17 should be used when specified. Found:\\n" + buildGradleContent);
}
- String validateBasicIdentifiers(Path project, String group, String artifact, String version) throws Exception {
+ String validateBasicGradleGroovyIdentifiers(Path project, String group, String artifact, String version) throws Exception {
Path buildGradle = project.resolve("build.gradle");
Assertions.assertTrue(buildGradle.toFile().exists(),
"build.gradle should exist: " + buildGradle.toAbsolutePath().toString());
@@ -394,4 +419,25 @@ String validateBasicIdentifiers(Path project, String group, String artifact, Str
return buildContent;
}
+
+ String validateBasicGradleKotlinIdentifiers(Path project, String group, String artifact, String version) throws Exception {
+ Path buildGradle = project.resolve("build.gradle.kts");
+ Assertions.assertTrue(buildGradle.toFile().exists(),
+ "build.gradle.kts should exist: " + buildGradle.toAbsolutePath().toString());
+
+ String buildContent = CliDriver.readFileAsString(project, buildGradle);
+ Assertions.assertTrue(buildContent.contains("group = \\"" + group + "\\""),
+ "build.gradle.kts should include the group id:\\n" + buildContent);
+ Assertions.assertTrue(buildContent.contains("version = \\"" + version + "\\""),
+ "build.gradle.kts should include the version:\\n" + buildContent);
+
+ Path settings = project.resolve("settings.gradle.kts");
+ Assertions.assertTrue(settings.toFile().exists(),
+ "settings.gradle.kts should exist: " + settings.toAbsolutePath().toString());
+ String settingsContent = CliDriver.readFileAsString(project, settings);
+ Assertions.assertTrue(settingsContent.contains(artifact),
+ "settings.gradle.kts should include the artifact id:\\n" + settingsContent);
+
+ return buildContent;
+ }
} | ['devtools/cli/src/main/java/io/quarkus/cli/create/TargetLanguageGroup.java', 'devtools/cli/src/test/java/io/quarkus/cli/CliProjectGradleTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 20,449,318 | 3,954,841 | 519,133 | 4,989 | 111 | 32 | 2 | 1 | 937 | 130 | 295 | 47 | 0 | 1 | 1970-01-01T00:27: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,439 | quarkusio/quarkus/25182/25178 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25178 | https://github.com/quarkusio/quarkus/pull/25182 | https://github.com/quarkusio/quarkus/pull/25182 | 1 | fixes | Log when creating cache entry on synchronous calls | ### Describe the bug
Currently there is no way to know when the cache entry is created using synchronous calls, the only log seen for synchronous calls are during the loading phase from the cache.
### Expected behavior
It would be better to log before creating cache entries in quarkus
### Actual behavior
Show "Adding entry with key [%s] into cache [%s]" msg when adding cache entry through synchronous calls
### How to Reproduce?
Use quarkus cache and hit the call for the first time, no logs are seen on cache creation.
### 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_ | 6907d73a6011abff9e2da9972ab3f5fde8e24727 | 6fc6c85321a8db21bfa7c10a2c2b0f7a09569669 | https://github.com/quarkusio/quarkus/compare/6907d73a6011abff9e2da9972ab3f5fde8e24727...6fc6c85321a8db21bfa7c10a2c2b0f7a09569669 | diff --git a/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/CacheResultInterceptor.java b/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/CacheResultInterceptor.java
index d048be69f93..722595d0f19 100644
--- a/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/CacheResultInterceptor.java
+++ b/extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/CacheResultInterceptor.java
@@ -103,6 +103,8 @@ public Uni<?> get() {
@Override
public Object apply(Object k) {
try {
+ LOGGER.debugf("Adding entry with key [%s] into cache [%s]",
+ key, binding.cacheName());
return invocationContext.proceed();
} catch (CacheException e) {
throw e; | ['extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/CacheResultInterceptor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 20,455,638 | 3,956,003 | 519,306 | 4,990 | 152 | 25 | 2 | 1 | 863 | 143 | 196 | 39 | 0 | 0 | 1970-01-01T00:27: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,438 | quarkusio/quarkus/25203/25184 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25184 | https://github.com/quarkusio/quarkus/pull/25203 | https://github.com/quarkusio/quarkus/pull/25203 | 1 | fix | `-Dquarkus.platform.version` is not honored during reload of dev mode | ### Describe the bug
Custom `-Dquarkus.platform.version` is not honored during reload of dev mode, version defined in pom.xml gets picked
I have triggered the reload by removal of `quarkus-arc` dependency from pom.xml
Dev mode was started using `mvn quarkus:dev -Dquarkus.platform.version=2.7.5.Final`
Once the change of `pom.xml` was detected I had seen a lot of downloads of 2.8.2.Final bits and then the dev mode exited saying that the version of Quarkus was changed.
```
...
Downloaded from central: https://repo.maven.apache.org/maven2/io/quarkus/quarkus-core-deployment/2.8.2.Final/quarkus-core-deployment-2.8.2.Final.jar (1.2 MB at 959 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/io/quarkus/quarkus-vertx-http-deployment/2.8.2.Final/quarkus-vertx-http-deployment-2.8.2.Final.jar (2.2 MB at 1.4 MB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/io/quarkus/quarkus-bootstrap-gradle-resolver/2.8.2.Final/quarkus-bootstrap-gradle-resolver-2.8.2.Final.jar (2.4 MB at 1.5 MB/s)
Downloading from central: https://repo.maven.apache.org/maven2/io/quarkus/platform/quarkus-bom-quarkus-platform-properties/2.8.2.Final/quarkus-bom-quarkus-platform-properties-2.8.2.Final.properties
Downloaded from central: https://repo.maven.apache.org/maven2/io/quarkus/platform/quarkus-bom-quarkus-platform-properties/2.8.2.Final/quarkus-bom-quarkus-platform-properties-2.2022-04-26 22:28:55,037 INFO [io.quarkus] (Shutdown thread) code-with-quarkus stopped in 0.024s
--
Press [:] for the terminal, [h] for more options>
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalStateException: Hot deployment of the application is not supported when updating the Quarkus version. The application needs to be stopped and dev mode started up again
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:138)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:62)
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Hot deployment of the application is not supported when updating the Quarkus version. The application needs to be stopped and dev mode started up again
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:143)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:96)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:132)
... 1 more
Caused by: java.lang.IllegalStateException: Hot deployment of the application is not supported when updating the Quarkus version. The application needs to be stopped and dev mode started up again
at io.quarkus.deployment.dev.IsolatedDevModeMain.close(IsolatedDevModeMain.java:367)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:512)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:68)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:140)
... 3 more
```
As the application in the dev mode runs using the version specified using `-Dquarkus.platform.version=` property I would expect the same version to be used after reload
### Expected behavior
Custom `-Dquarkus.platform.version` is honored during reload of dev mode
### Actual behavior
Custom `-Dquarkus.platform.version` is not honored during reload of dev mode, version defined in pom.xml gets picked
### How to Reproduce?
- download app from https://code.quarkus.io/?e=resteasy-reactive
- open pom.xml
- run `mvn quarkus:dev -Dquarkus.platform.version=2.7.5.Final`
- remove `quarkus-arc` dependency
- check the console
### Output of `uname -a` or `ver`
macOS Monterey
### Output of `java -version`
Java 17
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.8.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 871675fb8b8d0d5db4b2ba624be000760a419b41 | f900e2a726c428e983caff419446eb08f9f556c9 | https://github.com/quarkusio/quarkus/compare/871675fb8b8d0d5db4b2ba624be000760a419b41...f900e2a726c428e983caff419446eb08f9f556c9 | 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 82601628f75..212bef2d92d 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -990,7 +990,6 @@ private QuarkusDevModeLauncher newLauncher() throws Exception {
bootstrapProvider.close();
} else {
final MavenArtifactResolver.Builder resolverBuilder = MavenArtifactResolver.builder()
- .setRepositorySystem(repoSystem)
.setRemoteRepositories(repos)
.setRemoteRepositoryManager(remoteRepositoryManager)
.setWorkspaceDiscovery(true)
@@ -1002,16 +1001,18 @@ private QuarkusDevModeLauncher newLauncher() throws Exception {
boolean reinitializeMavenSession = Files.exists(appModelLocation);
if (reinitializeMavenSession) {
Files.delete(appModelLocation);
+ // we can't re-use the repo system because we want to use our interpolating model builder
+ // a use-case where it fails with the original repo system is when dev mode is launched with -Dquarkus.platform.version=xxx
+ // overriding the version of the quarkus-bom in the pom.xml
} else {
// we can re-use the original Maven session
- resolverBuilder.setRepositorySystemSession(repoSession);
+ resolverBuilder.setRepositorySystemSession(repoSession).setRepositorySystem(repoSystem);
}
appModel = new BootstrapAppModelResolver(resolverBuilder.build())
.setDevMode(true)
.setCollectReloadableDependencies(!noDeps)
- .resolveModel(new GACTV(project.getGroupId(), project.getArtifactId(), null, ArtifactCoords.TYPE_JAR,
- project.getVersion()));
+ .resolveModel(GACTV.jar(project.getGroupId(), project.getArtifactId(), project.getVersion()));
}
// serialize the app model to avoid re-resolving it in the dev process
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
index 31f965bafee..fd0475a0811 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java
@@ -259,8 +259,8 @@ private ApplicationModel doResolveModel(ArtifactCoords coords,
}
final Artifact mvnArtifact = toAetherArtifact(coords);
- List<Dependency> managedDeps = Collections.emptyList();
- List<RemoteRepository> managedRepos = Collections.emptyList();
+ List<Dependency> managedDeps = List.of();
+ List<RemoteRepository> managedRepos = List.of();
if (managingProject != null) {
final ArtifactDescriptorResult managingDescr = mvn.resolveDescriptor(toAetherArtifact(managingProject));
managedDeps = managingDescr.getManagedDependencies();
@@ -271,14 +271,14 @@ private ApplicationModel doResolveModel(ArtifactCoords coords,
final List<String> excludedScopes;
if (test) {
- excludedScopes = Collections.emptyList();
+ excludedScopes = List.of();
} else if (devmode) {
- excludedScopes = Collections.singletonList("test");
+ excludedScopes = List.of("test");
} else {
excludedScopes = List.of("provided", "test");
}
- DependencyNode resolvedDeps = mvn.resolveManagedDependencies(mvnArtifact,
+ final DependencyNode resolvedDeps = mvn.resolveManagedDependencies(mvnArtifact,
directMvnDeps, managedDeps, managedRepos, excludedScopes.toArray(new String[0])).getRoot();
ArtifactDescriptorResult appArtifactDescr = mvn.resolveDescriptor(toAetherArtifact(appArtifact));
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelResolver.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelResolver.java
index 979ad84c416..086c8e5a278 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelResolver.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelResolver.java
@@ -1,6 +1,7 @@
package io.quarkus.bootstrap.resolver.maven;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;
+import io.quarkus.maven.dependency.ArtifactCoords;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
@@ -203,7 +204,7 @@ public ModelSource resolveModel(final Dependency dependency)
throws UnresolvableModelException {
try {
final Artifact artifact = new DefaultArtifact(dependency.getGroupId(), dependency.getArtifactId(), "",
- "pom", dependency.getVersion());
+ ArtifactCoords.TYPE_POM, dependency.getVersion());
final VersionRangeRequest versionRangeRequest = new VersionRangeRequest(artifact, repositories, context);
versionRangeRequest.setTrace(trace);
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java
index 3a3d39bc40d..2b25e09de8b 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java
@@ -3,6 +3,7 @@
import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalWorkspace;
import io.quarkus.bootstrap.resolver.maven.workspace.ModelUtils;
+import io.quarkus.maven.dependency.ArtifactCoords;
import java.io.File;
import java.io.IOException;
import java.util.HashSet;
@@ -40,7 +41,7 @@ public ModelBuildingResult build(ModelBuildingRequest request) throws ModelBuild
final Model requestModel = getModel(request);
if (requestModel != null) {
final Artifact artifact = new DefaultArtifact(ModelUtils.getGroupId(requestModel), requestModel.getArtifactId(),
- null, "pom",
+ null, ArtifactCoords.TYPE_POM,
ModelUtils.getVersion(requestModel));
if (workspace.findArtifact(artifact) != null) {
final ModelBuildingResult result = workspace
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
index f425202e472..ff9825075ef 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
@@ -408,7 +408,9 @@ private String resolveElementValue(String elementValue) {
if (elementValue == null || elementValue.isEmpty() || !(elementValue.startsWith("${") && elementValue.endsWith("}"))) {
return elementValue;
}
- return rawModel.getProperties().getProperty(elementValue.substring(2, elementValue.length() - 1), elementValue);
+ final String propName = elementValue.substring(2, elementValue.length() - 1);
+ String v = System.getProperty(propName);
+ return v == null ? rawModel.getProperties().getProperty(propName, elementValue) : v;
}
private DefaultArtifactSources processJarPluginExecutionConfig(Object config, boolean test) {
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
index 3b38e304b43..94522979413 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
@@ -109,7 +109,7 @@ public File findArtifact(Artifact artifact) {
if (ArtifactCoords.TYPE_POM.equals(artifact.getExtension())) {
final File pom = lp.getRawModel().getPomFile();
// if the pom exists we should also check whether the main artifact can also be resolved from the workspace
- if (pom.exists() && ("pom".equals(lp.getRawModel().getPackaging())
+ if (pom.exists() && (ArtifactCoords.TYPE_POM.equals(lp.getRawModel().getPackaging())
|| mvnCtx != null && mvnCtx.isPreferPomsFromWorkspace()
|| Files.exists(lp.getOutputDir())
|| emptyJarOutput(lp, artifact) != null)) { | ['independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java', 'independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapModelResolver.java', 'independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenModelBuilder.java', 'independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java', 'independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/BootstrapAppModelResolver.java', 'devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java'] | {'.java': 6} | 6 | 6 | 0 | 0 | 6 | 20,455,638 | 3,956,003 | 519,306 | 4,990 | 2,326 | 444 | 31 | 6 | 4,182 | 373 | 1,077 | 78 | 6 | 1 | 1970-01-01T00:27:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,437 | quarkusio/quarkus/25226/25225 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25225 | https://github.com/quarkusio/quarkus/pull/25226 | https://github.com/quarkusio/quarkus/pull/25226 | 1 | fixes | `Forwarded` header is not parsed as expected | ### Describe the bug
According to [RFC7239](https://www.rfc-editor.org/rfc/rfc7239#section-4), the `Forwarded` header can have a comma-separated list of values. It is used to indicate the string of proxies (including the client that initiated the request).
The ForwardedParser class splits this header by comma and later considers only the first element. This element will be the one that will determine each property of the request (protocol, host, etc). This is not the expected behavior as it will discard the remaining information in the header, as you will see in the next sections.
### Expected behavior
When a client does a HTTP request with the following header, `Forwarded: by=proxy;for=backend:4444,for=backend2:5555;host=somehost;proto=https`, the quarkus server must consider `host` and `proto` properties defined by the header.
### Actual behavior
The properties `host` and `proto` are not considered, and eventually discarded.
### How to Reproduce?
```
@Test
public void testForwardedForWithSequenceOfProxies() {
assertThat(RestAssured.get("/forward").asString()).startsWith("http|");
RestAssured.given()
.header("Forwarded", "by=proxy;for=backend:4444,for=backend2:5555;host=somehost;proto=https")
.get("/forward")
.then()
.body(Matchers.equalTo("https|somehost|backend:4444"));
}
```
### Output of `uname -a` or `ver`
Darwin dibss-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64
### Output of `java -version`
openjdk version "11.0.15" 2022-04-19 OpenJDK Runtime Environment Temurin-11.0.15+10 (build 11.0.15+10) OpenJDK 64-Bit Server VM Temurin-11.0.15+10 (build 11.0.15+10, mixed mode)
### 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`)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
### Additional information
_No response_ | ad1a40dd4520bfe94249b094c43f1147d5d00224 | b67f5bfca37f7295fdfe8168293f7c9604192d16 | https://github.com/quarkusio/quarkus/compare/ad1a40dd4520bfe94249b094c43f1147d5d00224...b67f5bfca37f7295fdfe8168293f7c9604192d16 | diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java
index eab3ac1503c..9fc8a8b841d 100644
--- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java
+++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java
@@ -30,4 +30,36 @@ public void test() {
.body(Matchers.equalTo("https|somehost|backend:4444"));
}
+ @Test
+ public void testForwardedForWithSequenceOfProxies() {
+ assertThat(RestAssured.get("/forward").asString()).startsWith("http|");
+
+ RestAssured.given()
+ .header("Forwarded", "by=proxy;for=backend:4444,for=backend2:5555;host=somehost;proto=https")
+ .get("/forward")
+ .then()
+ .body(Matchers.equalTo("https|somehost|backend:4444"));
+ }
+
+ @Test
+ public void testForwardedWithSequenceOfProxiesIncludingIpv6Address() {
+ assertThat(RestAssured.get("/forward").asString()).startsWith("http|");
+
+ RestAssured.given()
+ .header("Forwarded", "by=proxy;for=\\"[2001:db8:cafe::17]:47011\\",for=backend:4444;host=somehost;proto=https")
+ .get("/forward")
+ .then()
+ .body(Matchers.equalTo("https|somehost|[2001:db8:cafe::17]:47011"));
+ }
+
+ @Test
+ public void testForwardedForWithIpv6Address2() {
+ assertThat(RestAssured.get("/forward").asString()).startsWith("http|");
+
+ RestAssured.given()
+ .header("Forwarded", "by=proxy;for=\\"[2001:db8:cafe::17]:47011\\",for=backend:4444;host=somehost;proto=https")
+ .get("/forward")
+ .then()
+ .body(Matchers.equalTo("https|somehost|[2001:db8:cafe::17]:47011"));
+ }
}
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java
index aab3cabcb6d..3755c618715 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java
@@ -110,19 +110,18 @@ private void calculate() {
String forwarded = delegate.getHeader(FORWARDED);
if (forwardingProxyOptions.allowForwarded && forwarded != null) {
- String forwardedToUse = forwarded.split(",")[0];
- Matcher matcher = FORWARDED_PROTO_PATTERN.matcher(forwardedToUse);
+ Matcher matcher = FORWARDED_PROTO_PATTERN.matcher(forwarded);
if (matcher.find()) {
scheme = (matcher.group(1).trim());
port = -1;
}
- matcher = FORWARDED_HOST_PATTERN.matcher(forwardedToUse);
+ matcher = FORWARDED_HOST_PATTERN.matcher(forwarded);
if (matcher.find()) {
setHostAndPort(matcher.group(1).trim(), port);
}
- matcher = FORWARDED_FOR_PATTERN.matcher(forwardedToUse);
+ matcher = FORWARDED_FOR_PATTERN.matcher(forwarded);
if (matcher.find()) {
remoteAddress = parseFor(matcher.group(1).trim(), remoteAddress.port());
} | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/ForwardedParser.java', 'extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/ForwardedHeaderTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 20,457,985 | 3,956,496 | 519,333 | 4,989 | 488 | 92 | 7 | 1 | 2,095 | 234 | 583 | 55 | 1 | 1 | 1970-01-01T00:27:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,436 | quarkusio/quarkus/25234/25221 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25221 | https://github.com/quarkusio/quarkus/pull/25234 | https://github.com/quarkusio/quarkus/pull/25234 | 1 | fixes | Missing `quarkus.oidc.tls.key-store-provider` and `quarkus.oidc.tls.trust-store-provider` properties on OIDC extension | ### Describe the bug
I would like to use OIDC with mtls over FIPS.
The certificates that I am thinking to use are `BCFIPSJSSE` (BouncyCastleJsseProvider) as we do in other [modules](https://quarkus.io/guides/security-customization#bouncy-castle-jsse-fips). The problem that I have is that there is no `quarkus.oidc.tls.key-store-provider` / `quarkus.oidc.tls.trust-store-provider`.
application.properties
```
quarkus.http.auth.permission.authenticated.paths=/*
quarkus.http.auth.permission.authenticated.policy=authenticated
quarkus.oidc.token.lifespan-grace=5
quarkus.oidc.token.principal-claim=email
quarkus.oidc.token.issuer=${quarkus.oidc.auth-server-url}
quarkus.oidc.tls.verification=certificate-validation
quarkus.oidc.tls.key-store-file=client-bcfips-keystore.jks
#quarkus.oidc.tls.key-store-file=client-keystore.jks
quarkus.oidc.tls.key-store-file-type=BCFKS
quarkus.oidc.tls.key-store-password=password
quarkus.oidc.tls.trust-store-file=client-bcfips-truststore.jks
#quarkus.oidc.tls.trust-store-file=client-truststore.jks
quarkus.oidc.tls.trust-store-file-type=BCFKS
quarkus.oidc.tls.trust-store-password=password
```
OIDC configuration doc ref: https://quarkus.io/guides/all-config#quarkus-oidc_quarkus-oidc-openid-connect
The issue that I am trying to avoid is something like:
```
Caused by: java.security.KeyStoreException: BCFKS not found
```
| 6037ecb413810d545309aea07ffd678ee253cc3e | d6edfd558851785cd987d1fd9073b0cbd88f6ad6 | https://github.com/quarkusio/quarkus/compare/6037ecb413810d545309aea07ffd678ee253cc3e...d6edfd558851785cd987d1fd9073b0cbd88f6ad6 | diff --git a/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonConfig.java b/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonConfig.java
index c8512c4ae35..12a109c3e9f 100644
--- a/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonConfig.java
+++ b/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonConfig.java
@@ -439,6 +439,14 @@ public enum Verification {
@ConfigItem
public Optional<String> keyStoreFileType = Optional.empty();
+ /**
+ * An optional parameter to specify a provider of the key store file. If not given, the provider is automatically
+ * detected
+ * based on the key store file type.
+ */
+ @ConfigItem
+ public Optional<String> keyStoreProvider;
+
/**
* A parameter to specify the password of the key store file. If not given, the default ("password") is used.
*/
@@ -484,6 +492,14 @@ public enum Verification {
@ConfigItem
public Optional<String> trustStoreFileType = Optional.empty();
+ /**
+ * An optional parameter to specify a provider of the trust store file. If not given, the provider is automatically
+ * detected
+ * based on the trust store file type.
+ */
+ @ConfigItem
+ public Optional<String> trustStoreProvider;
+
public Optional<Verification> getVerification() {
return verification;
}
@@ -516,6 +532,22 @@ public void setTrustStoreCertAlias(String trustStoreCertAlias) {
this.trustStoreCertAlias = Optional.of(trustStoreCertAlias);
}
+ public Optional<String> getKeyStoreProvider() {
+ return keyStoreProvider;
+ }
+
+ public void setKeyStoreProvider(String keyStoreProvider) {
+ this.keyStoreProvider = Optional.of(keyStoreProvider);
+ }
+
+ public Optional<String> getTrustStoreProvider() {
+ return trustStoreProvider;
+ }
+
+ public void setTrustStoreProvider(String trustStoreProvider) {
+ this.trustStoreProvider = Optional.of(trustStoreProvider);
+ }
+
}
@ConfigGroup
diff --git a/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java b/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java
index 744dcc9e6e1..5ad51f3bc1e 100644
--- a/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java
+++ b/extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java
@@ -131,7 +131,8 @@ public static void setHttpClientOptions(OidcCommonConfig oidcConfig, TlsConfig t
.setPassword(oidcConfig.tls.getTrustStorePassword().orElse("password"))
.setAlias(oidcConfig.tls.getTrustStoreCertAlias().orElse(null))
.setValue(io.vertx.core.buffer.Buffer.buffer(trustStoreData))
- .setType(getStoreType(oidcConfig.tls.trustStoreFileType, oidcConfig.tls.trustStoreFile.get()));
+ .setType(getStoreType(oidcConfig.tls.trustStoreFileType, oidcConfig.tls.trustStoreFile.get()))
+ .setProvider(oidcConfig.tls.trustStoreProvider.orElse(null));
options.setTrustOptions(trustStoreOptions);
if (Verification.CERTIFICATE_VALIDATION == oidcConfig.tls.verification.orElse(Verification.REQUIRED)) {
options.setVerifyHost(false);
@@ -150,7 +151,8 @@ public static void setHttpClientOptions(OidcCommonConfig oidcConfig, TlsConfig t
.setAlias(oidcConfig.tls.keyStoreKeyAlias.orElse(null))
.setAliasPassword(oidcConfig.tls.keyStoreKeyPassword.orElse(null))
.setValue(io.vertx.core.buffer.Buffer.buffer(keyStoreData))
- .setType(getStoreType(oidcConfig.tls.keyStoreFileType, oidcConfig.tls.keyStoreFile.get()));
+ .setType(getStoreType(oidcConfig.tls.keyStoreFileType, oidcConfig.tls.keyStoreFile.get()))
+ .setProvider(oidcConfig.tls.keyStoreProvider.orElse(null));
options.setKeyCertOptions(keyStoreOptions);
} catch (IOException ex) { | ['extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java', 'extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonConfig.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 20,458,581 | 3,956,611 | 519,353 | 4,989 | 1,756 | 350 | 38 | 2 | 1,400 | 85 | 420 | 33 | 2 | 2 | 1970-01-01T00:27:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,435 | quarkusio/quarkus/25260/25257 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/25257 | https://github.com/quarkusio/quarkus/pull/25260 | https://github.com/quarkusio/quarkus/pull/25260 | 1 | fixes | Quarkus 2.9.0.CR1: Async Scheduled methods have unsafe sub-context | ### Describe the bug
When using an async `@Scheduled` method returning a void or using Kotlin coroutines, the provided sub-context seems to be unsafe and throws an error when e.g. using hibernate reactive with it.
E.g. using a code like
```
class TestScheduler(private val testDao: TestDao) {
@Scheduled(every = "5s")
fun every5s(): Uni<Void> {
return testDao.getEntity(UUID.randomUUID()).replaceWithVoid()
}
}
@ApplicationScoped
class TestDao(private val sessionFactory: Mutiny.SessionFactory) {
fun getEntity(id: UUID): Uni<TestEntity?> = sessionFactory.withTransaction { s, _ ->
s.find(TestEntity::class.java, id)
}
}
```
ends in a crash like
```
2022-04-29 15:32:05,016 ERROR [io.qua.sch.com.run.StatusEmitterInvoker] (vert.x-eventloop-thread-0) Error occured while executing task for trigger IntervalTrigger [id=1_org.acme.TestScheduler_ScheduledInvoker_every5s_c56c24f01b03a432de6e9b18de0f5a7dfbc05db8, interval=5000]: java.lang.IllegalStateException: The current operation requires a safe (isolated) Vert.x sub-context, but the current context hasn't been flagged as such. You can still use Hibernate Reactive, you just need to avoid using the methods which implicitly require accessing the stateful context, such as MutinySessionFactory#withTransaction and #withSession.
at io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle.checkIsSafe(VertxContextSafetyToggle.java:80)
at io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle.validateContextIfExists(VertxContextSafetyToggle.java:63)
at io.quarkus.hibernate.reactive.runtime.customized.CheckingVertxContext.get(CheckingVertxContext.java:46)
at org.hibernate.reactive.mutiny.impl.MutinySessionFactoryImpl.withSession(MutinySessionFactoryImpl.java:189)
at org.hibernate.reactive.mutiny.impl.MutinySessionFactoryImpl.withTransaction(MutinySessionFactoryImpl.java:261)
at org.acme.db.TestDao.getEntity(TestDao.kt:12)
at org.acme.db.TestDao_Subclass.getEntity$$superforward1(Unknown Source)
at org.acme.db.TestDao_Subclass$$function$$1.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.arc.runtime.devconsole.InvocationInterceptor.proceed(InvocationInterceptor.java:62)
```
### Expected behavior
@Scheduled should have a safe context that can be used with hibernate reactive.
### Actual behavior
It crashes
### How to Reproduce?
1. Download reproducer project and unzip:
[2022-04-29_scheduler-unsafe.zip](https://github.com/quarkusio/quarkus/files/8591125/2022-04-29_scheduler-unsafe.zip)
2. run the included `docker-compose.yml` to set up a local postgres container.
3. run with `./gradlew quarkusDev`
4. check the log for the crash
### 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.9.0.CR1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
gradle
### Additional information
_No response_ | 55521fb0253744239c11557d23dd575533d8fe42 | cc4aef5dd9eb7a451f5488568fe62dc70fa575bc | https://github.com/quarkusio/quarkus/compare/55521fb0253744239c11557d23dd575533d8fe42...cc4aef5dd9eb7a451f5488568fe62dc70fa575bc | diff --git a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java
index d04ae8ab00a..ec68f58ae00 100644
--- a/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java
+++ b/extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java
@@ -73,7 +73,9 @@
import io.quarkus.scheduler.common.runtime.StatusEmitterInvoker;
import io.quarkus.scheduler.common.runtime.util.SchedulerUtils;
import io.quarkus.scheduler.runtime.SchedulerRuntimeConfig;
+import io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle;
import io.smallrye.common.vertx.VertxContext;
+import io.vertx.core.Context;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
@@ -555,20 +557,22 @@ static class InvokerJob implements Job {
}
@Override
- public void execute(JobExecutionContext context) throws JobExecutionException {
+ public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
if (trigger.invoker != null) { // could be null from previous runs
if (trigger.invoker.isBlocking()) {
try {
- trigger.invoker.invoke(new QuartzScheduledExecution(trigger, context));
+ trigger.invoker.invoke(new QuartzScheduledExecution(trigger, jobExecutionContext));
} catch (Exception e) {
throw new JobExecutionException(e);
}
} else {
- VertxContext.getOrCreateDuplicatedContext(vertx).runOnContext(new Handler<Void>() {
+ Context context = VertxContext.getOrCreateDuplicatedContext(vertx);
+ VertxContextSafetyToggle.setContextSafe(context, true);
+ context.runOnContext(new Handler<Void>() {
@Override
public void handle(Void event) {
try {
- trigger.invoker.invoke(new QuartzScheduledExecution(trigger, context));
+ trigger.invoker.invoke(new QuartzScheduledExecution(trigger, jobExecutionContext));
} catch (Exception e) {
// already logged by the StatusEmitterInvoker
}
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 15adc72b52b..40a2bf2af9d 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
@@ -51,6 +51,7 @@
import io.quarkus.scheduler.common.runtime.SkipPredicateInvoker;
import io.quarkus.scheduler.common.runtime.StatusEmitterInvoker;
import io.quarkus.scheduler.common.runtime.util.SchedulerUtils;
+import io.quarkus.vertx.core.runtime.context.VertxContextSafetyToggle;
import io.smallrye.common.vertx.VertxContext;
import io.vertx.core.Context;
import io.vertx.core.Handler;
@@ -319,6 +320,7 @@ public void run() {
}
} else {
Context context = VertxContext.getOrCreateDuplicatedContext(vertx);
+ VertxContextSafetyToggle.setContextSafe(context, true);
context.runOnContext(new Handler<Void>() {
@Override
public void handle(Void event) { | ['extensions/quartz/runtime/src/main/java/io/quarkus/quartz/runtime/QuartzScheduler.java', 'extensions/scheduler/runtime/src/main/java/io/quarkus/scheduler/runtime/SimpleScheduler.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 20,459,647 | 3,956,817 | 519,385 | 4,989 | 1,203 | 190 | 14 | 2 | 3,122 | 274 | 768 | 80 | 1 | 2 | 1970-01-01T00:27:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,215 | quarkusio/quarkus/32679/32663 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32663 | https://github.com/quarkusio/quarkus/pull/32679 | https://github.com/quarkusio/quarkus/pull/32679 | 1 | fixes | infov impacts local variable type | ### Describe the bug
I propose here a very specific problem, but, unfortunately, during a POC of a team to see if Quarkus could replace Spring Boot, the trust of the team on Quarkus is impacted.
**Log.infov with more than 1 variable related to a Kafka record, seems to change the type of a local variable in specific context.**
The specific context is:
- the first line is a Uni not initialized explicitly (no = null for example), but the result would be the same with a CompletionStage.
- a Log.infov is used with 2 variables related to a Kafka record
It means:
```
@Incoming("prices")
public Uni<Void> consume(ConsumerRecord<String, String> msg) {
Uni<Void> result; // result = null will work, or even if Instant now = Instant.now(); if before this line
Instant now = Instant.now();
Log.infov("infov seems changing now into a long, {0} - {1}", msg.topic(), msg.offset());
// Log.infov("infov seems changing now into a long, {0}", msg.topic()); will work
methodThatGetAnInstant(now);
result = Uni.createFrom().voidItem();
return result;
}
private void methodThatGetAnInstant(Instant instant) {
Log.info("What a wonderfull method.");
}
```
### Expected behavior
We would expect mvn quarkus:dev starts the service without errors.
### Actual behavior
We have an error on mvn quarkus:dev
```
2023-04-15 11:16:11,240 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (Aesh InputStream Reader) Failed to start quarkus: io.quarkus.dev.appstate.ApplicationStartException: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:58)
at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:123)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:222)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:203)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:543)
at io.quarkus.deployment.console.ConsoleStateManager.forceRestart(ConsoleStateManager.java:141)
at io.quarkus.deployment.console.ConsoleStateManager.lambda$installBuiltins$0(ConsoleStateManager.java:98)
at io.quarkus.deployment.console.ConsoleStateManager$1.accept(ConsoleStateManager.java:73)
at io.quarkus.deployment.console.ConsoleStateManager$1.accept(ConsoleStateManager.java:46)
at io.quarkus.deployment.console.AeshConsole.lambda$setup$1(AeshConsole.java:275)
at org.aesh.terminal.EventDecoder.accept(EventDecoder.java:118)
at org.aesh.terminal.EventDecoder.accept(EventDecoder.java:31)
at org.aesh.terminal.io.Decoder.write(Decoder.java:133)
at org.aesh.readline.tty.terminal.TerminalConnection.openBlocking(TerminalConnection.java:216)
at org.aesh.readline.tty.terminal.TerminalConnection.openBlocking(TerminalConnection.java:203)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
at io.quarkus.runtime.Application.start(Application.java:101)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:111)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
at io.quarkus.runner.GeneratedMain.main(Unknown Source)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:104)
... 1 more
Caused by: jakarta.enterprise.inject.spi.DefinitionException: java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
legros/emmanuel/KafkaConsumer.consume(Lorg/apache/kafka/clients/consumer/ConsumerRecord;)Lio/smallrye/mutiny/Uni; @52: invokevirtual
Reason:
Type 'java/lang/Long' (current frame, stack[1]) is not assignable to 'java/time/Instant'
Current Frame:
bci: @52
flags: { }
locals: { 'legros/emmanuel/KafkaConsumer', 'org/apache/kafka/clients/consumer/ConsumerRecord', 'java/lang/Long', top, top, 'java/lang/String', top, 'java/lang/String' }
stack: { 'legros/emmanuel/KafkaConsumer', 'java/lang/Long' }
Bytecode:
0000000: b800 074d 120d 2bb6 000f b800 15b2 005f
0000010: 5b57 b600 6212 212b b600 232b b600 0fb8
0000020: 0015 4d3a 053a 07b2 005f 1907 1905 2cb6
0000030: 0063 2a2c b600 2ab8 0030 b600 363a 0819
0000040: 08b0
at io.smallrye.reactive.messaging.providers.extension.MediatorManager.createMediator(MediatorManager.java:199)
at io.smallrye.reactive.messaging.providers.extension.MediatorManager_ClientProxy.createMediator(Unknown Source)
at io.smallrye.reactive.messaging.providers.wiring.Wiring$SubscriberMediatorComponent.materialize(Wiring.java:626)
at io.smallrye.reactive.messaging.providers.wiring.Graph.lambda$materialize$10(Graph.java:100)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at io.smallrye.reactive.messaging.providers.wiring.Graph.materialize(Graph.java:99)
at io.smallrye.reactive.messaging.providers.extension.MediatorManager.start(MediatorManager.java:219)
at io.smallrye.reactive.messaging.providers.extension.MediatorManager_ClientProxy.start(Unknown Source)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle.onApplicationStart(SmallRyeReactiveMessagingLifecycle.java:52)
at io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle_Observer_onApplicationStart_68e7b57eb97cb75d597c5b816682366e888d0d9b.notify(Unknown Source)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:344)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:326)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:82)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:151)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:102)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
... 13 more
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
legros/emmanuel/KafkaConsumer.consume(Lorg/apache/kafka/clients/consumer/ConsumerRecord;)Lio/smallrye/mutiny/Uni; @52: invokevirtual
Reason:
Type 'java/lang/Long' (current frame, stack[1]) is not assignable to 'java/time/Instant'
Current Frame:
bci: @52
flags: { }
locals: { 'legros/emmanuel/KafkaConsumer', 'org/apache/kafka/clients/consumer/ConsumerRecord', 'java/lang/Long', top, top, 'java/lang/String', top, 'java/lang/String' }
stack: { 'legros/emmanuel/KafkaConsumer', 'java/lang/Long' }
Bytecode:
0000000: b800 074d 120d 2bb6 000f b800 15b2 005f
0000010: 5b57 b600 6212 212b b600 232b b600 0fb8
0000020: 0015 4d3a 053a 07b2 005f 1907 1905 2cb6
0000030: 0063 2a2c b600 2ab8 0030 b600 363a 0819
0000040: 08b0
at legros.emmanuel.KafkaConsumer_Bean.proxy(Unknown Source)
at legros.emmanuel.KafkaConsumer_Bean.get(Unknown Source)
at legros.emmanuel.KafkaConsumer_Bean.get(Unknown Source)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:477)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:490)
at io.quarkus.arc.impl.BeanManagerImpl.getReference(BeanManagerImpl.java:63)
at io.smallrye.reactive.messaging.providers.extension.MediatorManager.createMediator(MediatorManager.java:176)
... 29 more
```
### How to Reproduce?
I think that the description of the bug already explains how to reproduce it, but to make it simple, I propose you more comments on the following code -> https://github.com/legrosmanu/quarkus-infov-issue/blob/main/src/main/java/legros/emmanuel/KafkaConsumer.java
On this project, you can do a mvn:quarkus to get the error.
You'll have the same issue with Quarkus 2.6 or 3.0
### Output of `uname -a` or `ver`
Darwin **** 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 21:00:17 PST 2023; root:xnu-8796.101.5~3/RELEASE_X86_64 x86_64
### Output of `java -version`
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10) OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.0.CR2
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8) Maven home: /usr/local/Cellar/maven/3.9.1/libexec Java version: 17.0.6, vendor: Eclipse Adoptium, runtime: /Users/manu/.sdkman/candidates/java/17.0.6-tem Default locale: fr_FR, platform encoding: UTF-8 OS name: "mac os x", version: "13.3", arch: "x86_64", family: "mac"
### Additional information
_No response_ | c5be7ba7efbce88b86097bbcbaf1fedad44259eb | f7fb2411d467dfbc1d2afae4f4472f9702146f27 | https://github.com/quarkusio/quarkus/compare/c5be7ba7efbce88b86097bbcbaf1fedad44259eb...f7fb2411d467dfbc1d2afae4f4472f9702146f27 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java
index 897a6ae01de..3aa4d051272 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java
@@ -137,7 +137,7 @@ public void visitMethodInsn(int opcode, String owner, String name, String descri
locals = new int[numArgs];
for (int i = numArgs - 1; i >= 0; i--) {
locals[i] = newLocal(argTypes[i]);
- super.visitVarInsn(argTypes[i].getOpcode(Opcodes.ISTORE), locals[i]);
+ visitor.visitVarInsn(argTypes[i].getOpcode(Opcodes.ISTORE), locals[i]);
}
}
@@ -162,7 +162,7 @@ public void visitMethodInsn(int opcode, String owner, String name, String descri
// stack: [logger arg1 arg2 arg3] locals: {l1 = arg4}
// stack: [logger arg1 arg2 arg3 arg4] locals: {}
for (int i = 0; i < numArgs; i++) {
- super.visitVarInsn(argTypes[i].getOpcode(Opcodes.ILOAD), locals[i]);
+ visitor.visitVarInsn(argTypes[i].getOpcode(Opcodes.ILOAD), locals[i]);
}
}
diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java
index a3bed8f6723..13d7133aafb 100644
--- a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java
+++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java
@@ -40,4 +40,12 @@ public void doSomething() {
Log.error("Hello Error", error);
}
+ // https://github.com/quarkusio/quarkus/issues/32663
+ public void reproduceStackDisciplineIssue() {
+ String result;
+ String now = "now";
+
+ Log.infov("{0} {1}", "number", 42);
+ Log.info("string " + now);
+ }
}
diff --git a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java
index 075b1dec002..7e6ee43c4f3 100644
--- a/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java
+++ b/integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java
@@ -40,7 +40,9 @@ public class LoggingWithPanacheTest {
"[ERROR] four: foo | bar | baz | quux",
"[WARN] foo | bar | baz | quux: io.quarkus.logging.NoStackTraceTestException",
"[ERROR] Hello Error: io.quarkus.logging.NoStackTraceTestException",
- "[INFO] Hi!");
+ "[INFO] Hi!",
+ "[INFO] number 42",
+ "[INFO] string now");
});
@Inject
@@ -50,5 +52,7 @@ public class LoggingWithPanacheTest {
public void test() {
bean.doSomething();
new LoggingEntity().something();
+
+ bean.reproduceStackDisciplineIssue();
}
} | ['integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingWithPanacheTest.java', 'core/deployment/src/main/java/io/quarkus/deployment/logging/LoggingWithPanacheProcessor.java', 'integration-tests/logging-panache/src/test/java/io/quarkus/logging/LoggingBean.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,283,998 | 5,184,706 | 668,913 | 6,198 | 397 | 68 | 4 | 1 | 9,705 | 691 | 2,597 | 173 | 1 | 2 | 1970-01-01T00:28:01 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,074 | quarkusio/quarkus/9019/8984 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8984 | https://github.com/quarkusio/quarkus/pull/9019 | https://github.com/quarkusio/quarkus/pull/9019 | 1 | fixes | Liquibase still detects multiple changelogs despite upgrade to 1.4.1 | **Describe the bug**
Copied from previous ticket #8400 :
During startup of quarkus dev mode, Liquibase tries to parse the configured (yaml) file containing the changeLog, this fails due to 2 such files being found in the classpath. This error does not occur in normal mode (running the runner jar).
**Expected behavior**
Liquibase only finds one changeLog file and parses it.
**Actual behavior**
```
File: Found 2 files that match db/changeLog.xml
at io.quarkus.liquibase.runtime.LiquibaseRecorder.doStartActions(LiquibaseRecorder.java:82)
at io.quarkus.deployment.steps.LiquibaseProcessor$configureRuntimeProperties31.deploy_0(LiquibaseProcessor$configureRuntimeProperties31.zig:98)
at io.quarkus.deployment.steps.LiquibaseProcessor$configureRuntimeProperties31.deploy(LiquibaseProcessor$configureRuntimeProperties31.zig:36)
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:182)
at io.quarkus.runtime.Application.start(Application.java:89)
at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:90)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:61)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
at io.quarkus.runtime.Quarkus.run(Quarkus.java:106)
at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:99)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: liquibase.exception.ChangeLogParseException: Error Reading Migration File: Found 2 files that match db/changeLog.xml
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:118)
at liquibase.parser.core.xml.AbstractChangeLogParser.parse(AbstractChangeLogParser.java:15)
at liquibase.Liquibase.getDatabaseChangeLog(Liquibase.java:217)
at liquibase.Liquibase.validate(Liquibase.java:1559)
at io.quarkus.liquibase.runtime.LiquibaseRecorder.validate(LiquibaseRecorder.java:124)
at io.quarkus.liquibase.runtime.LiquibaseRecorder.doStartActions(LiquibaseRecorder.java:66)
... 15 more
Caused by: java.io.IOException: Found 2 files that match db/changeLog.xml
at liquibase.util.StreamUtil.singleInputStream(StreamUtil.java:206)
at liquibase.parser.core.xml.XMLChangeLogSAXParser.parseToNode(XMLChangeLogSAXParser.java:71)
... 20 more
```
**To Reproduce**
Steps to reproduce the behavior:
1. clone https://github.com/gastaldi/liquibase-gradle-bug
2. change gradle.properties from 999-snapshot to 1.4.1.Final
3. ./gradlew quarkusDev
**Configuration**
```properties
# Add your application.properties here, if applicable.
#Gradle properties
#Mon Apr 06 13:51:25 GMT 2020
quarkusPluginVersion=1.4.1.Final
quarkusPlatformArtifactId=quarkus-bom
quarkusPlatformGroupId=io.quarkus
quarkusPlatformVersion=1.4.1.Final
#application.properties
quarkus.liquibase.change-log=db/changeLog.xml
quarkus.liquibase.migrate-at-start=true
quarkus.liquibase.validate-on-migrate=true
quarkus.datasource.db-kind=h2
quarkus.datasource.jdbc.url=jdbc:h2:mem:test
quarkus.datasource.jdbc.max-size=8
quarkus.datasource.jdbc.min-size=2
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Darwin kaluza.broadband 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64`
- Output of `java -version`: `openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07)
OpenJDK 64-Bit Server VM GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07, mixed mode, sharing)`
- GraalVM version (if different from Java):
- Quarkus version or git rev: 1.4.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------
Build time: 2020-03-24 19:52:07 UTC
Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60
Kotlin: 1.3.70
Groovy: 2.5.10
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 11.0.6 (Oracle Corporation 11.0.6+9-jvmci-19.3-b07)
OS: Mac OS X 10.15.1 x86_64
```
**Additional context**
(Add any other context about the problem here.)
| ba698f2476f4117e00a16e8d8201e252cb1b08f3 | 258fccc5ea48dc63de9df732de06de44c66d903e | https://github.com/quarkusio/quarkus/compare/ba698f2476f4117e00a16e8d8201e252cb1b08f3...258fccc5ea48dc63de9df732de06de44c66d903e | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java
index b391fd6b164..fbdbb315a04 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java
@@ -193,6 +193,7 @@ public static class ModuleInfo implements Serializable {
private final Set<String> sourcePaths;
private final String classesPath;
private final String resourcePath;
+ private final String resourcesOutputPath;
public ModuleInfo(
String name,
@@ -200,11 +201,22 @@ public ModuleInfo(
Set<String> sourcePaths,
String classesPath,
String resourcePath) {
+ this(name, projectDirectory, sourcePaths, classesPath, resourcePath, classesPath);
+ }
+
+ public ModuleInfo(
+ String name,
+ String projectDirectory,
+ Set<String> sourcePaths,
+ String classesPath,
+ String resourcePath,
+ String resourceOutputPath) {
this.name = name;
this.projectDirectory = projectDirectory;
this.sourcePaths = sourcePaths == null ? new HashSet<>() : new HashSet<>(sourcePaths);
this.classesPath = classesPath;
this.resourcePath = resourcePath;
+ this.resourcesOutputPath = resourceOutputPath;
}
public String getName() {
@@ -230,6 +242,10 @@ public String getClassesPath() {
public String getResourcePath() {
return resourcePath;
}
+
+ public String getResourcesOutputPath() {
+ return resourcesOutputPath;
+ }
}
public boolean isEnablePreview() {
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
index bd012f6f83a..c35479ee3a0 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
@@ -103,7 +103,10 @@ public void start() throws Exception {
if (i.getClassesPath() != null) {
Path classesPath = Paths.get(i.getClassesPath());
bootstrapBuilder.addAdditionalApplicationArchive(new AdditionalDependency(classesPath, true, false));
-
+ }
+ if (i.getResourcesOutputPath() != null && !i.getResourcesOutputPath().equals(i.getClassesPath())) {
+ Path resourceOutputPath = Paths.get(i.getResourcesOutputPath());
+ bootstrapBuilder.addAdditionalApplicationArchive(new AdditionalDependency(resourceOutputPath, true, false));
}
}
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java
index d56d4cd767f..6f3c4dba583 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java
@@ -302,8 +302,10 @@ Set<String> checkForFileChange() {
m -> Collections.newSetFromMap(new ConcurrentHashMap<>()));
boolean doCopy = true;
String rootPath = module.getResourcePath();
+ String outputPath = module.getResourcesOutputPath();
if (rootPath == null) {
rootPath = module.getClassesPath();
+ outputPath = rootPath;
doCopy = false;
}
if (rootPath == null) {
@@ -313,7 +315,7 @@ Set<String> checkForFileChange() {
if (!Files.exists(root) || !Files.isReadable(root)) {
continue;
}
- Path classesDir = Paths.get(module.getClassesPath());
+ Path outputDir = Paths.get(outputPath);
//copy all modified non hot deployment files over
if (doCopy) {
try {
@@ -323,7 +325,7 @@ Set<String> checkForFileChange() {
walk.forEach(path -> {
try {
Path relative = root.relativize(path);
- Path target = classesDir.resolve(relative);
+ Path target = outputDir.resolve(relative);
seen.remove(target);
if (!watchedFileTimestamps.containsKey(path)) {
moduleResources.add(target);
@@ -366,7 +368,7 @@ Set<String> checkForFileChange() {
ret.add(path);
log.infof("File change detected: %s", file);
if (doCopy && !Files.isDirectory(file)) {
- Path target = classesDir.resolve(path);
+ Path target = outputDir.resolve(path);
byte[] data = Files.readAllBytes(file);
try (FileOutputStream out = new FileOutputStream(target.toFile())) {
out.write(data);
@@ -379,7 +381,7 @@ Set<String> checkForFileChange() {
}
} else {
watchedFileTimestamps.put(file, 0L);
- Path target = classesDir.resolve(path);
+ Path target = outputDir.resolve(path);
try {
FileUtil.deleteDirectory(target);
} catch (IOException e) {
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
index e0a821c223b..be20f6db36c 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
@@ -13,6 +13,7 @@
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -259,14 +260,6 @@ public void startDev() {
wiringClassesDirectory.mkdirs();
addToClassPaths(classPathManifest, context, wiringClassesDirectory);
- StringBuilder resources = new StringBuilder();
- for (File file : extension.resourcesDir()) {
- if (resources.length() > 0) {
- resources.append(File.pathSeparator);
- }
- resources.append(file.getAbsolutePath());
- }
-
final Set<AppArtifactKey> projectDependencies = new HashSet<>();
addSelfWithLocalDeps(project, context, new HashSet<>(), projectDependencies);
@@ -390,12 +383,18 @@ private void addLocalProject(Project project, DevModeContext context, Set<AppArt
}
String resourcePaths = mainSourceSet.getResources().getSourceDirectories().getSingleFile().getAbsolutePath(); //TODO: multiple resource directories
+ final String classesDir = QuarkusGradleUtils.getClassesDir(mainSourceSet, project.getBuildDir());
+ final String resourcesOutputPath = Files.exists(Paths.get(resourcePaths))
+ ? mainSourceSet.getOutput().getResourcesDir().getAbsolutePath()
+ : classesDir;
+
DevModeContext.ModuleInfo wsModuleInfo = new DevModeContext.ModuleInfo(
project.getName(),
project.getProjectDir().getAbsolutePath(),
sourcePaths,
- QuarkusGradleUtils.getClassesDir(mainSourceSet, project.getBuildDir()),
- resourcePaths);
+ classesDir,
+ resourcePaths,
+ resourcesOutputPath);
context.getModules().add(wsModuleInfo);
| ['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeContext.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/RuntimeUpdatesProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 8,565,528 | 1,664,580 | 222,396 | 2,362 | 2,456 | 390 | 50 | 4 | 4,946 | 339 | 1,338 | 95 | 1 | 3 | 1970-01-01T00:26: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,065 | quarkusio/quarkus/9229/9227 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9227 | https://github.com/quarkusio/quarkus/pull/9229 | https://github.com/quarkusio/quarkus/pull/9229 | 1 | fixes | @Inject with @Named causing the AWS Lambda bootstrap failure | **Describe the bug**
I am getting Lambda Bootstrap Error when using **@Inject and @Named** on RequestHandler
**Expected behavior**
The CDI injection & Lambda functionality should work as described in the documentation.
**Actual behavior**
Bootstrap error and Lambda function doesn't work
```text
{
"errorMessage": "Quarkus bootstrap failed.\\njava.lang.RuntimeException: Failed to start quarkus\\n\\tat io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:208)\\n\\tat io.quarkus.runtime.Application.start(Application.java:89)\\n\\tat io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler.<clinit>(QuarkusStreamHandler.java:39)\\n\\tat java.base/java.lang.Class.forName0(Native Method)\\n\\tat java.base/java.lang.Class.forName(Unknown Source)\\n\\tat lambdainternal.HandlerInfo.fromString(HandlerInfo.java:31)\\n\\tat lambdainternal.AWSLambda.findUserMethods(AWSLambda.java:77)\\n\\tat lambdainternal.AWSLambda.startRuntime(AWSLambda.java:196)\\n\\tat lambdainternal.AWSLambda.startRuntime(AWSLambda.java:162)\\n\\tat lambdainternal.AWSLambda.main(AWSLambda.java:157)\\nCaused by: java.lang.RuntimeException: Unable to find handler class with name test make sure there is a handler class in the deployment with the correct @Named annotation\\n\\tat io.quarkus.amazon.lambda.runtime.AmazonLambdaRecorder.chooseHandlerClass(AmazonLambdaRecorder.java:105)\\n\\tat io.quarkus.deployment.steps.AmazonLambdaProcessor$recordHandlerClass16.deploy_0(AmazonLambdaProcessor$recordHandlerClass16.zig:210)\\n\\tat io.quarkus.deployment.steps.AmazonLambdaProcessor$recordHandlerClass16.deploy(AmazonLambdaProcessor$recordHandlerClass16.zig:229)\\n\\tat io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:139)\\n\\t... 9 more\\n",
"errorType": "java.io.IOException",
"stackTrace": [
"io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler.handleRequest(QuarkusStreamHandler.java:56)",
"java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
"java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)",
"java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)",
"java.base/java.lang.reflect.Method.invoke(Unknown Source)"
]
}
```
**To Reproduce**
Steps to reproduce the behavior:
1. Create a AWS lambda project using Quakus maven architype
2. Create two classes like below
```java
@ApplicationScoped
@Slf4j
public class CDIConfig {
private final String prop1;
@Inject
public CDIConfig(
@ConfigProperty(name = "test.prop1") final String prop1) {
this.prop1 = prop1;
}
@Produces
@Singleton
@Named("prop1")
public String prop1() {
log.info("Bean Creation:{}", prop1);
return prop1;
}
}
```
```java
@Named("test")
@Slf4j
public class TestLambda implements RequestHandler<InputObject, OutputObject> {
@Inject
ProcessingService service;
@Inject
@Named("prop1")
String prop1;
@Override
public OutputObject handleRequest(final InputObject input, final Context context) {
log.info("Prop1 in lambda:{}", prop1);
return service.process(input).setRequestId(context.getAwsRequestId());
}
}
```
3. mvn clean package and deploy the function to aws and run the test to see the error
**Configuration**
```properties
quarkus.lambda.handler=test
test.prop1=${GREETINGS:Hello}
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: macos
- Output of `java -version`: openjdk version "11.0.6" 2020-01-14
- GraalVM version (if different from Java): OpenJDK 64-Bit Server VM GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07, mixed mode, sharing)
- Quarkus version or git rev: OpenJDK 64-Bit Server VM GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07, mixed mode, sharing)
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): mvn
**Additional context**
(Add any other context about the problem here.)
| d273ad73add077e7a3529b0a8900a8fdf391b979 | 033908064ba544dd6064436f6d6f6010e4f1c777 | https://github.com/quarkusio/quarkus/compare/d273ad73add077e7a3529b0a8900a8fdf391b979...033908064ba544dd6064436f6d6f6010e4f1c777 | diff --git a/extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java b/extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java
index 1ddd2c0db2f..b45b49f7104 100644
--- a/extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java
+++ b/extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java
@@ -102,9 +102,9 @@ List<AmazonLambdaBuildItem> discover(CombinedIndexBuildItem combinedIndexBuildIt
reflectiveClassBuildItemBuildProducer.produce(new ReflectiveClassBuildItem(true, false, lambda));
String cdiName = null;
- List<AnnotationInstance> named = info.annotations().get(NAMED);
- if (named != null && !named.isEmpty()) {
- cdiName = named.get(0).value().asString();
+ AnnotationInstance named = info.classAnnotation(NAMED);
+ if (named != null) {
+ cdiName = named.value().asString();
}
ClassInfo current = info; | ['extensions/amazon-lambda/deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,841,112 | 1,720,034 | 229,601 | 2,447 | 346 | 70 | 6 | 1 | 4,135 | 323 | 1,041 | 97 | 0 | 4 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,066 | quarkusio/quarkus/9215/9196 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9196 | https://github.com/quarkusio/quarkus/pull/9215 | https://github.com/quarkusio/quarkus/pull/9215 | 1 | fixes | Gelf handler chunking messages | **Describe the bug**
The gelf handler chunking the messages exceeding 8192 bytes, any meaning full java stack trace exceed this limits. Once messages are chunked Fluentd gelf input plugin rejects the chunked message because of unknown format and log statement never reach elasticsearch
**Expected behavior**
Allow users to configure the maximumMessageSize
```quarkus.log.handler.gelf.maximumMessageSize=2000000```
**Actual behavior**
Message chunking and loss of log statements
**To Reproduce**
Steps to reproduce the behavior:
1. Configure Gelf logging in quarkus
2. Create a log message size greater than 8192 bytes
3. Notice the log statement chunking and underlying log aggregation rejecting the chunked messages (In this case EFK)
**Configuration**
```properties
# Add your application.properties here, if applicable.
quarkus.log.handler.gelf.enabled=true
quarkus.log.handler.gelf.host=${GELF_HOST:localhost}
quarkus.log.handler.gelf.port=${GELF_PORT:12201}
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: amazon linux 2
- Output of `java -version`: 11.0.6" 2020-01-14
- GraalVM version (if different from Java): GraalVM CE 19.3.1
- Quarkus version or git rev: 1.4.2-Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): mvn
**Additional context**
JBOSS logmanager JSON logging is outstanding, please support socket appender in addition to existing console, file. So that we can push the logs directly to fluentd tcp source.
| 574bdfb887547a7967e7f896903ec1181ea51b6a | 5f6eeaf8b57529efcedf09f67b46cc506fb14757 | https://github.com/quarkusio/quarkus/compare/574bdfb887547a7967e7f896903ec1181ea51b6a...5f6eeaf8b57529efcedf09f67b46cc506fb14757 | diff --git a/extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfConfig.java b/extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfConfig.java
index c1b329d0399..acd10968d4a 100644
--- a/extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfConfig.java
+++ b/extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfConfig.java
@@ -98,4 +98,11 @@ public class GelfConfig {
*/
@ConfigItem
public boolean includeFullMdc;
+
+ /**
+ * Maximum message size (in bytes).
+ * If the message size is exceeded, the appender will submit the message in multiple chunks.
+ */
+ @ConfigItem(defaultValue = "8192")
+ public int maximumMessageSize;
}
diff --git a/extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfLogHandlerRecorder.java b/extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfLogHandlerRecorder.java
index 0c845cb03eb..97c1ac6e3cf 100644
--- a/extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfLogHandlerRecorder.java
+++ b/extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfLogHandlerRecorder.java
@@ -29,6 +29,7 @@ public RuntimeValue<Optional<Handler>> initializeHandler(final GelfConfig config
handler.setHost(config.host);
handler.setPort(config.port);
handler.setLevel(config.level);
+ handler.setMaximumMessageSize(config.maximumMessageSize);
// handle additional fields
if (!config.additionalField.isEmpty()) { | ['extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfConfig.java', 'extensions/logging-gelf/runtime/src/main/java/io/quarkus/logging/gelf/GelfLogHandlerRecorder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 8,846,260 | 1,720,785 | 229,664 | 2,445 | 300 | 63 | 8 | 2 | 1,634 | 207 | 395 | 39 | 0 | 2 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,067 | quarkusio/quarkus/9199/9188 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9188 | https://github.com/quarkusio/quarkus/pull/9199 | https://github.com/quarkusio/quarkus/pull/9199 | 1 | fixes | Check whether or not a thread is already blocking before submiting tasks to Quarkus executor | **Describe the bug**
When a Vert.x route is already executing blocking code, some extensions that use Quarkus executor (e.g.: `quarkus-resteasy`) dispatch tasks without checking whether or not the thread is already blocking.
**Expected behavior**
When not running in the event loop, the Quarkus executor (and extensions) should just execute code without starting a new worker thread.
**Actual behavior**
Quarkus executor (and extensions) is starting new worker threads to execute code that is already blocking.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a Vert.x `io.quarkus.vertx.http.runtime.filters.Filter` and make this filter execute the next handler as blocking (e.g.: `context.vertx().executeBlocking`)
2. Create a JAX-RS resource
3. Send a request to the JAX-Resource and check that the current thread is a worker thread from Quarkus executor and not a Vert.x worker thread
**Environment (please complete the following information):**
- Quarkus version or git rev: 999-SNAPSHOT | 69bb79d2530b3a193a206329cc3dd5c482874898 | 94416b5e054199a1b343cb10ab6a4fd3f5800fbc | https://github.com/quarkusio/quarkus/compare/69bb79d2530b3a193a206329cc3dd5c482874898...94416b5e054199a1b343cb10ab6a4fd3f5800fbc | 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 5c4fbc9ce6b..6f3b6ffd96e 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
@@ -19,6 +19,7 @@
import io.quarkus.arc.ManagedContext;
import io.quarkus.arc.runtime.BeanContainer;
+import io.quarkus.runtime.BlockingOperationControl;
import io.quarkus.security.identity.CurrentIdentityAssociation;
import io.quarkus.vertx.http.runtime.CurrentVertxRequest;
import io.quarkus.vertx.http.runtime.VertxInputStream;
@@ -79,17 +80,25 @@ public void handle(RoutingContext request) {
request.fail(e);
return;
}
-
- executor.execute(new Runnable() {
- @Override
- public void run() {
- try {
- dispatch(request, is, new VertxBlockingOutput(request.request()));
- } catch (Throwable e) {
- request.fail(e);
- }
+ if (BlockingOperationControl.isBlockingAllowed()) {
+ try {
+ dispatch(request, is, new VertxBlockingOutput(request.request()));
+ } catch (Throwable e) {
+ request.fail(e);
}
- });
+ } else {
+ executor.execute(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ dispatch(request, is, new VertxBlockingOutput(request.request()));
+ } catch (Throwable e) {
+ request.fail(e);
+ }
+ }
+ });
+ }
+
}
private void dispatch(RoutingContext routingContext, InputStream is, VertxOutput output) { | ['extensions/resteasy/runtime/src/main/java/io/quarkus/resteasy/runtime/standalone/VertxRequestHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,784,744 | 1,708,293 | 228,008 | 2,433 | 1,017 | 162 | 29 | 1 | 1,025 | 142 | 224 | 18 | 0 | 0 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,068 | quarkusio/quarkus/9169/9168 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9168 | https://github.com/quarkusio/quarkus/pull/9169 | https://github.com/quarkusio/quarkus/pull/9169 | 1 | fixes | list-extensions goal fails with NPE when dependency without scope in dependencyManagement | **Describe the bug**
[This line in BuildFileMojoBase](https://github.com/quarkusio/quarkus/blob/1.4.2.Final/devtools/maven/src/main/java/io/quarkus/maven/BuildFileMojoBase.java#L83) can fail with a NPE because it expects a dependency from `dependencyManagement` to always have a `scope`.
```
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.4.2.Final:list-extensions (default-cli) on project middleware-root: Execution default-cli of goal io.quarkus:quarkus-maven-plugin:1.4.2.Final:list-extensions failed.: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:1.4.2.Final:list-extensions (default-cli) on project middleware-root: Execution default-cli of goal io.quarkus:quarkus-maven-plugin:1.4.2.Final:list-extensions failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal io.quarkus:quarkus-maven-plugin:1.4.2.Final:list-extensions failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:148)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NullPointerException
at io.quarkus.maven.BuildFileMojoBase.execute (BuildFileMojoBase.java:83)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
```
**Expected behavior**
No NPE. Dependencies in `depenendencyManagement` _without_ a scope are perfectly valid Maven-wise.
**Actual behavior**
NPE due to `equals` without null-check.
**To Reproduce**
1. add `dependency` without `<scope>` to `dependencyManagement`
2. `mvn list-extensions`
**Configuration**
n/a
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
```MINGW64_NT-10.0-18363 W4DEUMSY9003463 3.0.7-338.x86_64 2019-11-21 23:07 UTC x86_64 Msys```
- Output of `java -version`:
```
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)
```
- GraalVM version (if different from Java): n/a
- Quarkus version or git rev: `1.4.2.Final`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): `Apache Maven 3.6.3`
| 7da0ec2a6619d2cc5b45d4d23eab5c77273fd20e | d9524020db8b91472d4179290460eca9593bcbed | https://github.com/quarkusio/quarkus/compare/7da0ec2a6619d2cc5b45d4d23eab5c77273fd20e...d9524020db8b91472d4179290460eca9593bcbed | diff --git a/devtools/maven/src/main/java/io/quarkus/maven/BuildFileMojoBase.java b/devtools/maven/src/main/java/io/quarkus/maven/BuildFileMojoBase.java
index f425aaf7406..940c4e75bc1 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/BuildFileMojoBase.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/BuildFileMojoBase.java
@@ -80,7 +80,8 @@ public void execute() throws MojoExecutionException {
final List<Artifact> descrArtifactList = new ArrayList<>(2);
for (Dependency dep : mvnBuild.getManagedDependencies()) {
- if (!dep.getScope().equals("import") && !dep.getType().equals("pom")) {
+ if ((dep.getScope() == null || !dep.getScope().equals("import"))
+ && (dep.getType() == null || !dep.getType().equals("pom"))) {
continue;
}
// We don't know which BOM is the platform one, so we are trying every BOM here | ['devtools/maven/src/main/java/io/quarkus/maven/BuildFileMojoBase.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,778,049 | 1,707,044 | 227,814 | 2,432 | 269 | 60 | 3 | 1 | 7,739 | 387 | 1,915 | 102 | 1 | 3 | 1970-01-01T00:26: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,069 | quarkusio/quarkus/9160/9159 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9159 | https://github.com/quarkusio/quarkus/pull/9160 | https://github.com/quarkusio/quarkus/pull/9160 | 1 | fixes | Jaeger tracing not working in native mode with "remote" sampler type | With a remote sampler, you get
```
Exception in thread "Timer-0" java.lang.RuntimeException: Unable to invoke no-args constructor for class io.jaegertracing.internal.samplers.http.SamplingStrategyResponse. Registering an InstanceCreator with Gson for this type may fix this problem.
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:226)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:210)
at com.google.gson.Gson.fromJson(Gson.java:888)
at com.google.gson.Gson.fromJson(Gson.java:853)
at com.google.gson.Gson.fromJson(Gson.java:802)
at com.google.gson.Gson.fromJson(Gson.java:774)
at io.jaegertracing.internal.samplers.HttpSamplingManager.parseJson(HttpSamplingManager.java:49)
at io.jaegertracing.internal.samplers.HttpSamplingManager.getSamplingStrategy(HttpSamplingManager.java:68)
at io.jaegertracing.internal.samplers.RemoteControlledSampler.updateSampler(RemoteControlledSampler.java:88)
at io.jaegertracing.internal.samplers.RemoteControlledSampler$1.run(RemoteControlledSampler.java:70)
at java.util.TimerThread.mainLoop(Timer.java:556)
at java.util.TimerThread.run(Timer.java:506)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:497)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
Caused by: java.lang.IllegalArgumentException: Class io.jaegertracing.internal.samplers.http.SamplingStrategyResponse is instantiated reflectively but was never registered. Register the class by using org.graalvm.nativeimage.hosted.RuntimeReflection
at com.oracle.svm.core.genscavenge.graal.AllocationSnippets.checkDynamicHub(AllocationSnippets.java:153)
at java.lang.reflect.Method.invoke(Method.java:566)
at com.google.gson.internal.UnsafeAllocator$1.newInstance(UnsafeAllocator.java:50)
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:223)
... 13 more
``` | 35ed807cd06174c6bf991849e31a4e7f8cda9ab9 | 05b50415da3b6e383cfd74f69673f28e1faa1e02 | https://github.com/quarkusio/quarkus/compare/35ed807cd06174c6bf991849e31a4e7f8cda9ab9...05b50415da3b6e383cfd74f69673f28e1faa1e02 | diff --git a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java b/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java
index c49036d7b3f..ddb853661ae 100644
--- a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java
+++ b/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java
@@ -13,6 +13,7 @@
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.jaeger.runtime.JaegerBuildTimeConfig;
import io.quarkus.jaeger.runtime.JaegerConfig;
import io.quarkus.jaeger.runtime.JaegerDeploymentRecorder;
@@ -50,6 +51,15 @@ public void build(BuildProducer<FeatureBuildItem> feature) {
feature.produce(new FeatureBuildItem(FeatureBuildItem.JAEGER));
}
+ @BuildStep
+ public void reflectiveClasses(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+ reflectiveClasses.produce(ReflectiveClassBuildItem
+ .builder("io.jaegertracing.internal.samplers.http.SamplingStrategyResponse",
+ "io.jaegertracing.internal.samplers.http.ProbabilisticSamplingStrategy")
+ .finalFieldsWritable(true)
+ .build());
+ }
+
private void produceMetrics(BuildProducer<MetricBuildItem> producer) {
producer.produce(
metric("jaeger_tracer_baggage_restrictions_updates", MetricType.COUNTER, null, new Tag("result", "err"))); | ['extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,785,409 | 1,708,461 | 228,022 | 2,433 | 522 | 104 | 10 | 1 | 2,022 | 90 | 447 | 24 | 0 | 1 | 1970-01-01T00:26: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,070 | quarkusio/quarkus/9116/9146 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9146 | https://github.com/quarkusio/quarkus/pull/9116 | https://github.com/quarkusio/quarkus/pull/9116 | 1 | fixes | maven-quarkus-plugin fails if base dir is /something/ and project has parent pom | **Describe the bug**
maven-quarkus-plugin fails on build stage if base dir is /something/ and project has parent pom.
It fails with a null pointer exception.
This is problematic becase the project builds nicelly and then it fails on our pipeline, once we try to build the project inside a container...
Full stack:
`[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.4.2.Final:build (default) on project wfm-core: Failed to build quarkus application: NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.quarkus:quarkus-maven-plugin:1.4.2.Final:build (default) on project wfm-core: Failed to build quarkus application
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to build quarkus application
at io.quarkus.maven.BuildMojo.execute (BuildMojo.java:207)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NullPointerException
at io.quarkus.bootstrap.resolver.maven.workspace.LocalProject.loadRootModel (LocalProject.java:139)
at io.quarkus.bootstrap.resolver.maven.workspace.LocalProject.loadWorkspace (LocalProject.java:93)
at io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext.resolveCurrentProject (BootstrapMavenContext.java:245)
at io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext.<init> (BootstrapMavenContext.java:150)
at io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver.<init> (MavenArtifactResolver.java:104)
at io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver.<init> (MavenArtifactResolver.java:53)
at io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver$Builder.build (MavenArtifactResolver.java:89)
at io.quarkus.maven.BuildMojo.execute (BuildMojo.java:166)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
`
If you increase the folder depth to something like /bla/something/, it works.
Looks like this piece of code is not properly protected:
io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java:139
` pomXml = pomXml.getParent().getParent().resolve(POM_XML);`
This seems to be another, of several bugs, were the .getParent() is not properly handled. Probably a deeper validation on this would be nice.
**Expected behavior**
Build on any path of the computer.
**Actual behavior**
Build is aborted
**To Reproduce**
Steps to reproduce the behavior:
1. Creata a project with a parent pom coming from the maven repo
2. create a docker file based on docker-maven-base:3.6.3-jdk-11 to build your project and locate the project on a folder like /app
3. run mvn --settings settings.xml clean install
4. execute a docker build
**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`:
(Container) Linux 7278367b9fa5 5.4.0-28-generic #32-Ubuntu SMP Wed Apr 22 17:40:10 UTC 2020 x86_64 GNU/Linux
--
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/share/maven
Java version: 11.0.6, vendor: Oracle Corporation, runtime: /usr/local/openjdk-11
Default locale: en, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-28-generic", arch: "amd64", family: "unix"
**Additional context**
(Add any other context about the problem here.)
| 3f811b6817e873ebb3936a9bd508c4e078cce870 | 1ddf9dde72ab784dbf972f4b298432c56f94e7dc | https://github.com/quarkusio/quarkus/compare/3f811b6817e873ebb3936a9bd508c4e078cce870...1ddf9dde72ab784dbf972f4b298432c56f94e7dc | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
index 24bd7cf98c4..3aa55e21e0d 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
@@ -125,7 +125,7 @@ private static LocalProject load(LocalWorkspace workspace, LocalProject parent,
private static Model loadRootModel(Path pomXml) throws BootstrapException {
Model model = null;
- while (Files.exists(pomXml)) {
+ while (pomXml != null && Files.exists(pomXml)) {
model = readModel(pomXml);
final Parent parent = model.getParent();
if (parent != null
@@ -136,7 +136,8 @@ private static Model loadRootModel(Path pomXml) throws BootstrapException {
pomXml = pomXml.resolve(POM_XML);
}
} else {
- pomXml = pomXml.getParent().getParent().resolve(POM_XML);
+ final Path parentDir = pomXml.getParent().getParent();
+ pomXml = parentDir == null ? null : parentDir.resolve(POM_XML);
}
}
return model; | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,614,966 | 1,674,272 | 223,677 | 2,371 | 325 | 71 | 5 | 1 | 9,028 | 529 | 2,155 | 132 | 0 | 1 | 1970-01-01T00:26: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,071 | quarkusio/quarkus/9105/9050 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9050 | https://github.com/quarkusio/quarkus/pull/9105 | https://github.com/quarkusio/quarkus/pull/9105 | 1 | fixes | @Produces fails for classes without default constructor | **Describe the bug**
I want to create a bean of a class that has no default constructor and requires some properties to be injected into it. However, since it isn't prepared for CDI, I create a producer class and method to create it with the appropriate values for the properties.
With Quarkus dev, this works just fine. However, when I build the code with `gradlew build` and let it run in a docker container for testing, it fails with `java.lang.NoSuchMethodError: ... method 'void <init>()' not found`. It seems the producer class/method is ignored and ARC tries to instantiate the object itself.
I suspect that this also happens with beans having a default constructor. But then it might not be easy to detect that your producer was ignored. However, I haven't tested that.
This happens with Quarkus 1.4.1.Final and the current master. With Quarkus 1.3.2.Final I get the following error when running quarkus dev or compiling the project:
```
Caused by: javax.enterprise.inject.spi.DefinitionException: Return type of a producer method for normal scoped beans must declare a non-private constructor with no parameters: PRODUCER METHOD bean [types=[java.lang.Object, com.akamai.netstorage.NetStorage], qualifiers=[@Default, @Any], target=com.akamai.netstorage.NetStorage produceNetStorage(), declaringBean=org.acme.MyProducer]
```
Which makes no sense to me. Why would the result of a producer method need to have a default constructor? I'm constructing it for Quarkus, it should not call the default constructor itself.
**Expected behavior**
The producer is used.
**Actual behavior**
The producer is ignored.
**To Reproduce**
Steps to reproduce the behavior:
1. Download reproducer project and unzip it.
[produces-for-non-default-constructor.zip](https://github.com/quarkusio/quarkus/files/4575185/produces-for-non-default-constructor.zip)
2. In the directory run `./gradlew clean quarkusDev` and open localhost:8080/hello in your browser. You should see something like `hello com.akamai.netstorage.NetStorage@26819cc`
3. Compile the project with `./gradlew build` and run the resulting jar. Open the url localhost:8080/hello again. Now you see the following error in the log
```
2020-05-04 14:21:18,306 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /hello failed, error id: 7ed965f0-4c84-4be5-9e87-818f67f360c8-1: java.lang.NoSuchMethodError: com.akamai.netstorage.NetStorage: method 'void <init>()' not found
at org.acme.MyProducer_ProducerMethod_produceNetStorage_fa2b9b6d18193aaccf98f59e0885e6a21da609e4_ClientProxy.<init>(MyProducer_ProducerMethod_produceNetStorage_fa2b9b6d18193aaccf98f59e0885e6a21da609e4_ClientProxy.zig:414)
at org.acme.MyProducer_ProducerMethod_produceNetStorage_fa2b9b6d18193aaccf98f59e0885e6a21da609e4_Bean.proxy(MyProducer_ProducerMethod_produceNetStorage_fa2b9b6d18193aaccf98f59e0885e6a21da609e4_Bean.zig:94)
at org.acme.MyProducer_ProducerMethod_produceNetStorage_fa2b9b6d18193aaccf98f59e0885e6a21da609e4_Bean.get(MyProducer_ProducerMethod_produceNetStorage_fa2b9b6d18193aaccf98f59e0885e6a21da609e4_Bean.zig:115)
at org.acme.MyProducer_ProducerMethod_produceNetStorage_fa2b9b6d18193aaccf98f59e0885e6a21da609e4_Bean.get(MyProducer_ProducerMethod_produceNetStorage_fa2b9b6d18193aaccf98f59e0885e6a21da609e4_Bean.zig:41)
at org.acme.Example2Resource_Bean.create(Example2Resource_Bean.zig:109)
at org.acme.Example2Resource_Bean.create(Example2Resource_Bean.zig:312)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:79)
at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
at org.acme.Example2Resource_ClientProxy.arc$delegate(Example2Resource_ClientProxy.zig:181)
at org.acme.Example2Resource_ClientProxy.arc_contextualInstance(Example2Resource_ClientProxy.zig:228)
at io.quarkus.arc.runtime.ClientProxyUnwrapper.apply(ClientProxyUnwrapper.java:11)
at io.quarkus.resteasy.common.runtime.ResteasyInjectorFactoryRecorder$1.apply(ResteasyInjectorFactoryRecorder.java:22)
at io.quarkus.resteasy.common.runtime.QuarkusInjectorFactory$UnwrappingPropertyInjector.inject(QuarkusInjectorFactory.java:71)
at org.jboss.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:79)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:368)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:67)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:488)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:259)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:160)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:163)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:245)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:123)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.access$000(VertxRequestHandler.java:36)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:87)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
```
**Configuration**
See reproducer.
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Windows 10
- Java 11
- Quarkus
- 1.3.2.Final (throws error on build)
- 1.4.1.Final and master (fail during runtime after build but work in quarkusDev)
| 8994a854ee483cb6d35649f931d39f2f62baab43 | 4883b984b9743006c12e3022a3ffc562d79c45c3 | https://github.com/quarkusio/quarkus/compare/8994a854ee483cb6d35649f931d39f2f62baab43...4883b984b9743006c12e3022a3ffc562d79c45c3 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
index ad9d811713e..f4c19ae3713 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java
@@ -131,12 +131,13 @@ public BuildResult run() throws Exception {
rootBuilder.setArchiveLocation(root);
} else {
rootBuilder.setArchiveLocation(effectiveModel.getAppArtifact().getPaths().iterator().next());
+
+ effectiveModel.getAppArtifact().getPaths().forEach(p -> {
+ if (!p.equals(root)) {
+ rootBuilder.addArchiveRoot(p);
+ }
+ });
}
- effectiveModel.getAppArtifact().getPaths().forEach(p -> {
- if (!p.equals(root)) {
- rootBuilder.addArchiveRoot(p);
- }
- });
rootBuilder.setExcludedFromIndexing(excludedFromIndexing);
BuildChain chain = chainBuilder.build();
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
index bfc393a1b08..cdbeb0c0572 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java
@@ -1,6 +1,5 @@
package io.quarkus.deployment.steps;
-import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
@@ -23,7 +22,8 @@
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
-import io.quarkus.deployment.ApplicationArchive;
+import io.quarkus.bootstrap.classloading.ClassPathElement;
+import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.deployment.QuarkusClassWriter;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.ApplicationArchivesBuildItem;
@@ -55,6 +55,7 @@ TransformedClassesBuildItem handleClassTransformation(List<BytecodeTransformerBu
.addAll(i.getRequireConstPoolEntry());
}
}
+ QuarkusClassLoader cl = (QuarkusClassLoader) Thread.currentThread().getContextClassLoader();
Map<String, Path> transformedToArchive = new ConcurrentHashMap<>();
// now copy all the contents to the runner jar
// we also record if any additional archives needed transformation
@@ -66,46 +67,46 @@ TransformedClassesBuildItem handleClassTransformation(List<BytecodeTransformerBu
for (Map.Entry<String, List<BiFunction<String, ClassVisitor, ClassVisitor>>> entry : bytecodeTransformers
.entrySet()) {
String className = entry.getKey();
- Set<String> constValues = constScanning.get(className);
- ApplicationArchive archive = appArchives.containingArchive(entry.getKey());
- if (archive != null) {
+ String classFileName = className.replace(".", "/") + ".class";
+ List<ClassPathElement> archives = cl.getElementsWithResource(classFileName);
+ if (!archives.isEmpty()) {
+ ClassPathElement classPathElement = archives.get(0);
+ Path jar = classPathElement.getRoot();
+ if (jar == null) {
+ log.warnf("Cannot transform %s as it's containing application archive could not be found.",
+ entry.getKey());
+ continue;
+ }
List<BiFunction<String, ClassVisitor, ClassVisitor>> visitors = entry.getValue();
- String classFileName = className.replace(".", "/") + ".class";
- archive.processEntry(classFileName, (classFile, jar) -> {
- transformedToArchive.put(classFileName, jar);
- transformed.add(executorPool.submit(new Callable<TransformedClassesBuildItem.TransformedClass>() {
- @Override
- public TransformedClassesBuildItem.TransformedClass call() throws Exception {
- ClassLoader old = Thread.currentThread().getContextClassLoader();
- try {
- Thread.currentThread().setContextClassLoader(transformCl);
- if (Files.size(classFile) > Integer.MAX_VALUE) {
- throw new RuntimeException(
- "Can't process class files larger than Integer.MAX_VALUE bytes");
+ transformedToArchive.put(classFileName, jar);
+ transformed.add(executorPool.submit(new Callable<TransformedClassesBuildItem.TransformedClass>() {
+ @Override
+ public TransformedClassesBuildItem.TransformedClass call() throws Exception {
+ ClassLoader old = Thread.currentThread().getContextClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(transformCl);
+ byte[] classData = classPathElement.getResource(classFileName).getData();
+ Set<String> constValues = constScanning.get(className);
+ if (constValues != null && !noConstScanning.contains(className)) {
+ if (!ConstPoolScanner.constPoolEntryPresent(classData, constValues)) {
+ return null;
}
- byte[] classData = Files.readAllBytes(classFile);
-
- if (constValues != null && !noConstScanning.contains(className)) {
- if (!ConstPoolScanner.constPoolEntryPresent(classData, constValues)) {
- return null;
- }
- }
- ClassReader cr = new ClassReader(classData);
- ClassWriter writer = new QuarkusClassWriter(cr,
- ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
- ClassVisitor visitor = writer;
- for (BiFunction<String, ClassVisitor, ClassVisitor> i : visitors) {
- visitor = i.apply(className, visitor);
- }
- cr.accept(visitor, 0);
- return new TransformedClassesBuildItem.TransformedClass(writer.toByteArray(),
- classFileName);
- } finally {
- Thread.currentThread().setContextClassLoader(old);
}
+ ClassReader cr = new ClassReader(classData);
+ ClassWriter writer = new QuarkusClassWriter(cr,
+ ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
+ ClassVisitor visitor = writer;
+ for (BiFunction<String, ClassVisitor, ClassVisitor> i : visitors) {
+ visitor = i.apply(className, visitor);
+ }
+ cr.accept(visitor, 0);
+ return new TransformedClassesBuildItem.TransformedClass(writer.toByteArray(),
+ classFileName);
+ } finally {
+ Thread.currentThread().setContextClassLoader(old);
}
- }));
- });
+ }
+ }));
} else {
log.warnf("Cannot transform %s as it's containing application archive could not be found.",
entry.getKey());
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java
index 7247d1f658f..251ea050b9c 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java
@@ -15,6 +15,12 @@
*/
public interface ClassPathElement extends Closeable {
+ /**
+ *
+ * @return The element root, or null if not applicable
+ */
+ Path getRoot();
+
/**
* Loads a resource from the class path element, or null if it does not exist.
*
@@ -46,6 +52,11 @@ static ClassPathElement fromPath(Path path) {
}
static ClassPathElement EMPTY = new ClassPathElement() {
+ @Override
+ public Path getRoot() {
+ return null;
+ }
+
@Override
public ClassPathResource getResource(String name) {
return null;
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
index 80c2cdb86e1..f2f13173380 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
@@ -29,6 +29,11 @@ public DirectoryClassPathElement(Path root) {
this.root = root;
}
+ @Override
+ public Path getRoot() {
+ return root;
+ }
+
@Override
public ClassPathResource getResource(String name) {
Path file = root.resolve(name);
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java
index a559b3188c4..687ee5a0df3 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java
@@ -32,18 +32,25 @@ public class JarClassPathElement implements ClassPathElement {
private static final Logger log = Logger.getLogger(JarClassPathElement.class);
private final File file;
private final URL jarPath;
+ private final Path root;
private JarFile jarFile;
private boolean closed;
public JarClassPathElement(Path root) {
try {
jarPath = root.toUri().toURL();
+ this.root = root;
jarFile = new JarFile(file = root.toFile());
} catch (IOException e) {
throw new UncheckedIOException("Error while reading file as JAR: " + root, e);
}
}
+ @Override
+ public Path getRoot() {
+ return root;
+ }
+
@Override
public synchronized ClassPathResource getResource(String name) {
return withJarFile(new Function<JarFile, ClassPathResource>() {
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
index b6769276f91..94c5baa2a79 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java
@@ -7,6 +7,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
+import java.nio.file.Path;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
@@ -40,6 +41,11 @@ public void reset(Map<String, byte[]> resources) {
this.resources = newResources;
}
+ @Override
+ public Path getRoot() {
+ return null;
+ }
+
@Override
public ClassPathResource getResource(String name) {
byte[] res = resources.get(name);
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
index 0fb4bef3829..791ba274471 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
@@ -398,6 +398,17 @@ private void definePackage(String name, ClassPathElement classPathElement) {
}
}
+ private String getPackageNameFromClassName(String className) {
+ final int index = className.lastIndexOf('.');
+ if (index == -1) {
+ // we return null here since in this case no package is defined
+ // this is same behavior as Package.getPackage(clazz) exhibits
+ // when the class is in the default package
+ return null;
+ }
+ return className.substring(0, index);
+ }
+
public List<ClassPathElement> getElementsWithResource(String name) {
List<ClassPathElement> ret = new ArrayList<>();
if (parent instanceof QuarkusClassLoader) {
@@ -411,17 +422,6 @@ public List<ClassPathElement> getElementsWithResource(String name) {
return ret;
}
- private String getPackageNameFromClassName(String className) {
- final int index = className.lastIndexOf('.');
- if (index == -1) {
- // we return null here since in this case no package is defined
- // this is same behavior as Package.getPackage(clazz) exhibits
- // when the class is in the default package
- return null;
- }
- return className.substring(0, index);
- }
-
private byte[] handleTransform(String name, byte[] bytes,
List<BiFunction<String, ClassVisitor, ClassVisitor>> transformers,
Map<String, Predicate<byte[]>> transformerPredicates) { | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java', 'core/deployment/src/main/java/io/quarkus/deployment/QuarkusAugmentor.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassPathElement.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/JarClassPathElement.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/MemoryClassPathElement.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java', 'core/deployment/src/main/java/io/quarkus/deployment/steps/ClassTransformingBuildStep.java'] | {'.java': 7} | 7 | 7 | 0 | 0 | 7 | 8,691,580 | 1,689,471 | 225,525 | 2,391 | 7,337 | 1,105 | 139 | 7 | 7,008 | 439 | 1,809 | 83 | 1 | 2 | 1970-01-01T00:26: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,073 | quarkusio/quarkus/9022/9013 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9013 | https://github.com/quarkusio/quarkus/pull/9022 | https://github.com/quarkusio/quarkus/pull/9022 | 1 | fixes | maven plugin build fails when .mvn directory exists in directory enclosing project directory | Per [Zulip discussion](https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/mvn.20package.20failing.20in.201.2E4.2Ex), attempting `mvn package` on a project whose parent directory has a `.mvn` directory, but no `pom.xml` will fail.
The [attached file](https://github.com/quarkusio/quarkus/files/4564988/outer.zip) demonstrates a trivial project in such a directory structure. | c974e59b7d6d524e154bb8643933a80d7747806f | 63a42df56c42f115abe8d52adabf8a43ea29fcc3 | https://github.com/quarkusio/quarkus/compare/c974e59b7d6d524e154bb8643933a80d7747806f...63a42df56c42f115abe8d52adabf8a43ea29fcc3 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
index e3ced3095f4..24e7759b7b4 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
@@ -720,6 +720,12 @@ public Path getRootProjectBaseDir() {
return null;
}
}
- return Paths.get(rootBaseDir);
+ final Path rootProjectBaseDirPath = Paths.get(rootBaseDir);
+ // if the root project dir set by the Maven process (through the env variable) doesn't have a pom.xml
+ // then it probably isn't relevant
+ if (!Files.exists(rootProjectBaseDirPath.resolve("pom.xml"))) {
+ return null;
+ }
+ return rootProjectBaseDirPath;
}
} | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,566,025 | 1,664,684 | 222,410 | 2,362 | 413 | 88 | 8 | 1 | 391 | 33 | 114 | 3 | 2 | 0 | 1970-01-01T00:26: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,075 | quarkusio/quarkus/8998/8985 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8985 | https://github.com/quarkusio/quarkus/pull/8998 | https://github.com/quarkusio/quarkus/pull/8998 | 1 | fixes | mongodb+srv protocol no more working on dev mode since Quarkus 1.3 with Java 11 | **Describe the bug**
SInce Quarkus 1.3, using a MongoDB connection String with `mongodb+srv` didn't work anymore on dev mode.
This work fine when launching the JAR file (native mode didn't works for `mongo+srv`).
This work fine with Quarkus 1.2.
This is a Java 11 and later only issue on dev mode.
Adding the right export to the JVM do the trick but we normally didn't need to as using the JAR file works : `--add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming`
**Actual behavior**
It fails with the following stacktrace:
```
Caused by: com.mongodb.MongoClientException: Unable to support mongodb+srv// style connections as the 'com.sun.jndi.dns.DnsContextFactory' class is not available in this JRE. A JNDI context is required for resolving SRV records.
at com.mongodb.internal.dns.DefaultDnsResolver.createDnsDirContext(DefaultDnsResolver.java:152)
at com.mongodb.internal.dns.DefaultDnsResolver.resolveAdditionalQueryParametersFromTxtRecords(DefaultDnsResolver.java:112)
at com.mongodb.ConnectionString.<init>(ConnectionString.java:382)
at io.quarkus.mongodb.runtime.AbstractMongoClientProducer.createMongoConfiguration(AbstractMongoClientProducer.java:240)
at io.quarkus.mongodb.runtime.AbstractMongoClientProducer.createMongoClient(AbstractMongoClientProducer.java:87)
at io.quarkus.mongodb.runtime.MongoClientProducer.createDefaultMongoClient(MongoClientProducer.zig:37)
at io.quarkus.mongodb.runtime.MongoClientProducer_ProducerMethod_createDefaultMongoClient_e88f14bf92aae40841e4b513ac764f8acd21873d_Bean.create(MongoClientProducer_ProducerMethod_createDefaultMongoClient_e88f14bf92aae40841e4b513ac764f8acd21873d_Bean.zig:138)
at io.quarkus.mongodb.runtime.MongoClientProducer_ProducerMethod_createDefaultMongoClient_e88f14bf92aae40841e4b513ac764f8acd21873d_Bean.create(MongoClientProducer_ProducerMethod_createDefaultMongoClient_e88f14bf92aae40841e4b513ac764f8acd21873d_Bean.zig:77)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:80)
at io.quarkus.arc.impl.ComputingCache$CacheFunction.lambda$apply$0(ComputingCache.java:99)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.getValue(ComputingCache.java:41)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:25)
at io.quarkus.mongodb.runtime.MongoClientProducer_ProducerMethod_createDefaultMongoClient_e88f14bf92aae40841e4b513ac764f8acd21873d_ClientProxy.arc$delegate(MongoClientProducer_ProducerMethod_createDefaultMongoClient_e88f14bf92aae40841e4b513ac764f8acd21873d_ClientProxy.zig:264)
at io.quarkus.mongodb.runtime.MongoClientProducer_ProducerMethod_createDefaultMongoClient_e88f14bf92aae40841e4b513ac764f8acd21873d_ClientProxy.getDatabase(MongoClientProducer_ProducerMethod_createDefaultMongoClient_e88f14bf92aae40841e4b513ac764f8acd21873d_ClientProxy.zig:104)
at org.acme.rest.json.FruitService.getCollection(FruitService.java:44)
at org.acme.rest.json.FruitService.list(FruitService.java:20)
at org.acme.rest.json.FruitService_ClientProxy.list(FruitService_ClientProxy.zig:51)
at org.acme.rest.json.FruitResource.list(FruitResource.java:21)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:621)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:487)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:437)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:439)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:400)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:374)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:67)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:488)
... 20 more
Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: com.sun.jndi.dns.DnsContextFactory [Root exception is java.lang.IllegalAccessException: class javax.naming.spi.NamingManager (in module java.naming) cannot access class com.sun.jndi.dns.DnsContextFactory (in module jdk.naming.dns) because module jdk.naming.dns does not export com.sun.jndi.dns to module java.naming]
at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:719)
at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
at java.naming/javax.naming.InitialContext.<init>(InitialContext.java:208)
at java.naming/javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:101)
at com.mongodb.internal.dns.DefaultDnsResolver.createDnsDirContext(DefaultDnsResolver.java:150)
... 53 more
Caused by: java.lang.IllegalAccessException: class javax.naming.spi.NamingManager (in module java.naming) cannot access class com.sun.jndi.dns.DnsContextFactory (in module jdk.naming.dns) because module jdk.naming.dns does not export com.sun.jndi.dns to module java.naming
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
at java.base/jdk.internal.reflect.Reflection.ensureMemberAccess(Reflection.java:99)
at java.base/java.lang.Class.newInstance(Class.java:579)
at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:716)
... 58 more
```
**To Reproduce**
The issue can be reproduced easily on the `mongodb-client` integration test:
- Use Java 11
- Update `application.properties` with the following connection String :
```
quarkus.mongodb.connection-string=mongodb+srv://sarah:connor@toto.tata.titi.com/test?retryWrites=true&w=majority
```
- Launch the application in dev mode: `mvn quarkus:dev`
- Access the endpoint: `curl localhost:8080/books`
Of course, this cluster didn't exist ;) but the test fails before connecting to it.
| 06b631ea423a35d3dd971ae084879ecc8220c85e | 2b35b7aac966b9a730074e8b48778794983ab794 | https://github.com/quarkusio/quarkus/compare/06b631ea423a35d3dd971ae084879ecc8220c85e...2b35b7aac966b9a730074e8b48778794983ab794 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
index e2a0164082f..da14e314d16 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java
@@ -4,6 +4,7 @@
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.security.ProtectionDomain;
import java.util.ArrayList;
@@ -73,13 +74,28 @@ public class QuarkusClassLoader extends ClassLoader implements Closeable {
private volatile ClassLoader transformerClassLoader;
private volatile ClassLoaderState state;
+ static final ClassLoader PLATFORM_CLASS_LOADER;
+
+ static {
+ ClassLoader cl = null;
+ try {
+ cl = (ClassLoader) ClassLoader.class.getDeclaredMethod("getPlatformClassLoader").invoke(null);
+ } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+
+ }
+ PLATFORM_CLASS_LOADER = cl;
+ }
+
private QuarkusClassLoader(Builder builder) {
//we need the parent to be null
//as MP has super broken class loading where it attempts to resolve stuff from the parent
//will hopefully be fixed in 1.4
//e.g. https://github.com/eclipse/microprofile-config/issues/390
//e.g. https://github.com/eclipse/microprofile-reactive-streams-operators/pull/130
- super(null);
+ //to further complicate things we also have https://github.com/quarkusio/quarkus/issues/8985
+ //where getParent must work to load JDK services on JDK9+
+ //to get around this we pass in the platform ClassLoader, if it exists
+ super(PLATFORM_CLASS_LOADER);
this.name = builder.name;
this.elements = builder.elements;
this.bytecodeTransformers = builder.bytecodeTransformers; | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,563,691 | 1,664,308 | 222,408 | 2,361 | 743 | 147 | 18 | 1 | 6,695 | 329 | 1,654 | 77 | 0 | 2 | 1970-01-01T00:26: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,076 | quarkusio/quarkus/8931/8920 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8920 | https://github.com/quarkusio/quarkus/pull/8931 | https://github.com/quarkusio/quarkus/pull/8931 | 1 | fixes | Exception when using a custom registered microprofile converter | **Describe the bug**
It is possible to have configuration in application.properties / application.yaml that you don't want to convert to a String but a object of some type. Via org.eclipse.microprofile.config.spi.Converter it is possible to register such a Converter.
If we now run the test annotated with @QuarkusTest we get an exception.
**Expected behavior**
No exception should occur and the properties should be correctly converted to the required object.
**Actual behavior**
The following exception is thrown :
```
java.util.ServiceConfigurationError: org.eclipse.microprofile.config.spi.Converter: com.ennovativesolutions.converter.LocationConverter not a subtype
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1236)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1264)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1299)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1384)
at java.base/java.lang.Iterable.forEach(Iterable.java:74)
at io.smallrye.config.SmallRyeConfigBuilder.discoverConverters(SmallRyeConfigBuilder.java:87)
at io.smallrye.config.SmallRyeConfigBuilder.build(SmallRyeConfigBuilder.java:184)
at io.quarkus.runtime.configuration.QuarkusConfigFactory.getConfigFor(QuarkusConfigFactory.java:33)
at io.smallrye.config.SmallRyeConfigProviderResolver.getConfig(SmallRyeConfigProviderResolver.java:86)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:168)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:245)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:130)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:52)
at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:131)
at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:269)
at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:292)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.lambda$invokeBeforeAllCallbacks$7(ClassBasedTestDescriptor.java:359)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllCallbacks(ClassBasedTestDescriptor.java:359)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:189)
at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:78)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:132)
```
**To Reproduce**
Steps to reproduce the behavior:
1. Run the the LocationServiceTest
**Configuration**
```yaml
quarkus:
log:
level: INFO
console:
enable: true
format: {"timestamp": "%d{yyyy-MM-dd'T'HH:mm:ss.SSS}", "type":"LogMessage", "level": "%p", "loggerName": "%C", "message": "%s", "appName":"location", "componentName":"location-lambda", "stackTrace":"%e" }
lambda:
handler: LocationLambda
ssl:
native: true
locations:
- prefix: 27
name: LocationName
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Darwin APRXJGH6D5D5F9 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64
- Output of `java -version`: OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
- GraalVM version (if different from Java): N/A
- Quarkus version or git rev: 1.4.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Gradle(w) 6.0.1
**Additional context**
In the previous version of Quarkus 1.3.2.Final the converter was not found when running the test, so I upgraded to 1.4.1.Final and bumped into this issue. | fe4c5127a16ffe6d2526d6bdadbd3d428bc1dce5 | db06d9d39e34ef6744a0896d936168864f794527 | https://github.com/quarkusio/quarkus/compare/fe4c5127a16ffe6d2526d6bdadbd3d428bc1dce5...db06d9d39e34ef6744a0896d936168864f794527 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java
index 6751f23a5b4..52eb887d3d5 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java
@@ -147,7 +147,9 @@ private synchronized void processCpElement(AppArtifact artifact, Consumer<ClassP
}
artifact.getPaths().forEach(path -> {
final ClassPathElement element = ClassPathElement.fromPath(path);
- augmentationElements.put(artifact, element);
+ if (artifact.getPaths().isSinglePath()) {
+ augmentationElements.put(artifact, element);
+ }
consumer.accept(element);
});
}
@@ -176,8 +178,6 @@ public synchronized QuarkusClassLoader getAugmentClassLoader() {
processCpElement(i.getArtifact(), element -> addCpElement(builder, i.getArtifact(), element));
}
- processCpElement(appModel.getAppArtifact(), element -> addCpElement(builder, appModel.getAppArtifact(), element));
-
for (Path i : quarkusBootstrap.getAdditionalDeploymentArchives()) {
builder.addElement(ClassPathElement.fromPath(i));
}
@@ -212,6 +212,9 @@ public synchronized QuarkusClassLoader getBaseRuntimeClassLoader() {
if (quarkusBootstrap.getApplicationRoot() != null) {
builder.addElement(ClassPathElement.fromPath(quarkusBootstrap.getApplicationRoot()));
+ } else {
+ processCpElement(appModel.getAppArtifact(),
+ element -> addCpElement(builder, appModel.getAppArtifact(), element));
}
}
//additional user class path elements first
@@ -234,8 +237,6 @@ public synchronized QuarkusClassLoader getBaseRuntimeClassLoader() {
processCpElement(dependency.getArtifact(), element -> addCpElement(builder, dependency.getArtifact(), element));
}
- processCpElement(appModel.getAppArtifact(), element -> addCpElement(builder, appModel.getAppArtifact(), element));
-
baseRuntimeClassLoader = builder.build();
}
return baseRuntimeClassLoader;
@@ -264,6 +265,8 @@ public QuarkusClassLoader createDeploymentClassLoader() {
if (quarkusBootstrap.getApplicationRoot() != null) {
builder.addElement(ClassPathElement.fromPath(quarkusBootstrap.getApplicationRoot()));
+ } else {
+ processCpElement(appModel.getAppArtifact(), element -> addCpElement(builder, appModel.getAppArtifact(), element));
}
//additional user class path elements first
@@ -284,6 +287,8 @@ public QuarkusClassLoader createRuntimeClassLoader(QuarkusClassLoader loader,
builder.setTransformerClassLoader(deploymentClassLoader);
if (quarkusBootstrap.getApplicationRoot() != null) {
builder.addElement(ClassPathElement.fromPath(quarkusBootstrap.getApplicationRoot()));
+ } else {
+ processCpElement(appModel.getAppArtifact(), element -> addCpElement(builder, appModel.getAppArtifact(), element));
}
builder.addElement(new MemoryClassPathElement(resources));
| ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/app/CuratedApplication.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,557,849 | 1,663,282 | 222,306 | 2,361 | 932 | 172 | 15 | 1 | 4,135 | 273 | 1,007 | 70 | 0 | 2 | 1970-01-01T00:26: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,077 | quarkusio/quarkus/8745/8744 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8744 | https://github.com/quarkusio/quarkus/pull/8745 | https://github.com/quarkusio/quarkus/pull/8745 | 1 | fixes | Recording broken for Optionals containing custom classes | Recording a non-empty `Optional` containing a custom class causes a NPE during runtime, because the object contained in the `Optional` is lost along the way:
```
java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:221)
at java.base/java.util.Optional.<init>(Optional.java:107)
at java.base/java.util.Optional.of(Optional.java:120)
at com.quarkus.test.GenClass.deploy_0(GenClass.zig:53)
at com.quarkus.test.GenClass.deploy(GenClass.zig:36)
at io.quarkus.deployment.recording.BytecodeRecorderTestCase.runTest(BytecodeRecorderTestCase.java:303)
at io.quarkus.deployment.recording.BytecodeRecorderTestCase.testObjects(BytecodeRecorderTestCase.java:274)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:212)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:208)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:137)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:71)
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.base/java.util.ArrayList.forEach(ArrayList.java:1540)
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.base/java.util.ArrayList.forEach(ArrayList.java:1540)
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:220)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:188)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:202)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:181)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
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:384)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
``` | f691708ad7ca0ccc4b7f0fdda2abfc7cc5bceedb | d49ff54ba5ef5ba8c88468f258feff4d7a38b777 | https://github.com/quarkusio/quarkus/compare/f691708ad7ca0ccc4b7f0fdda2abfc7cc5bceedb...d49ff54ba5ef5ba8c88468f258feff4d7a38b777 | 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 c00565a7014..9176291ea0c 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
@@ -547,6 +547,13 @@ ResultHandle createValue(MethodContext creator, MethodCreator method, ResultHand
if (val.isPresent()) {
DeferredParameter res = loadObjectInstance(val.get(), existing, Object.class);
return new DeferredArrayStoreParameter() {
+
+ @Override
+ void doPrepare(MethodContext context) {
+ res.prepare(context);
+ super.doPrepare(context);
+ }
+
@Override
ResultHandle createValue(MethodContext context, MethodCreator method, ResultHandle array) {
return method.invokeStaticMethod(ofMethod(Optional.class, "of", Optional.class, Object.class),
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 bea93050327..a11627f4a67 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
@@ -270,6 +270,11 @@ public void testObjects() throws Exception {
TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class);
recorder.object(emptyOptional);
}, emptyOptional);
+ Optional<TestJavaBean> optionalWithCustomClass = Optional.of(new TestJavaBean());
+ runTest(generator -> {
+ TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class);
+ recorder.object(optionalWithCustomClass);
+ }, optionalWithCustomClass);
URL url = new URL("https://quarkus.io");
runTest(generator -> {
TestRecorder recorder = generator.getRecordingProxy(TestRecorder.class); | ['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 | 8,654,385 | 1,683,770 | 224,647 | 2,348 | 216 | 27 | 7 | 1 | 7,550 | 173 | 1,514 | 77 | 0 | 1 | 1970-01-01T00:26: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,079 | quarkusio/quarkus/8677/8534 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8534 | https://github.com/quarkusio/quarkus/pull/8677 | https://github.com/quarkusio/quarkus/pull/8677 | 1 | fixes | dev mode doesn't recover when an invalid value (typo, space) is added to logging level configuration | Dev mode doesn't recover when an invalid value (typo, space) is added to logging level configuration
When the value is corrected, Quarkus still isn't able to restart itself.
Reproducer:
```
mvn io.quarkus:quarkus-maven-plugin:1.3.2.Final:create \\
-DprojectGroupId=org.acme \\
-DprojectArtifactId=getting-started \\
-DclassName="org.acme.getting.started.GreetingResource" \\
-Dpath="/hello"
cd getting-started
mvn quarkus:dev
open src/main/resources/application.properties
add 'quarkus.log.category."org.hibernate".level=DEBUG ' (extra space at the end) into application.properties
open http://localhost:8080/hello
remove extra space at the end of quarkus.log.category line in application.properties
open http://localhost:8080/hello
```
Log reports:
```
2020-04-10 22:16:26,799 INFO [io.qua.dev] (vert.x-worker-thread-2) File change detected: /Users/rsvoboda/Downloads/ffff/getting-started/src/main/resources/application.properties
2020-04-10 22:16:26,824 INFO [io.quarkus] (vert.x-worker-thread-2) Quarkus stopped in 0.021s
```
Stacktrace from http://localhost:8080/hello
```
io.quarkus.runtime.configuration.ConfigurationException: One or more configuration errors has prevented the application from starting. The errors are:
An invalid value was given for configuration key "quarkus.log.category."org.hibernate".level": java.lang.reflect.InvocationTargetException
Resulted in: java.lang.RuntimeException: Failed to start quarkus
at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:232)
at io.quarkus.runtime.Application.start(Application.java:90)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at io.quarkus.runner.bootstrap.StartupActionImpl.run(StartupActionImpl.java:99)
at io.quarkus.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:103)
at io.quarkus.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:138)
at io.quarkus.vertx.http.runtime.devmode.VertxHotReplacementSetup$1.handle(VertxHotReplacementSetup.java:50)
at io.quarkus.vertx.http.runtime.devmode.VertxHotReplacementSetup$1.handle(VertxHotReplacementSetup.java:42)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:316)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:834)
```
| f772aa1de07c067b44b4a52cbac3a1ab1a252515 | d7a9081fc620e60d07c7b391c76b834eea7d58b6 | https://github.com/quarkusio/quarkus/compare/f772aa1de07c067b44b4a52cbac3a1ab1a252515...d7a9081fc620e60d07c7b391c76b834eea7d58b6 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java
index 75701f2430b..f14e9627fb4 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java
@@ -687,7 +687,7 @@ public void run() {
ResultHandle niceErrorMessage = isError
.invokeStaticMethod(
MethodDescriptor.ofMethod(ConfigDiagnostic.class, "getNiceErrorMessage", String.class));
- readConfig.invokeStaticMethod(CD_RESET_ERROR);
+ isError.invokeStaticMethod(CD_RESET_ERROR);
// throw the proper exception
final ResultHandle finalErrorMessageBuilder = isError.newInstance(SB_NEW);
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
index 7de869ce931..a274fd09848 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
@@ -119,7 +119,6 @@ public void accept(Integer integer) {
public synchronized void restartApp(Set<String> changedResources) {
restarting = true;
stop();
- restarting = false;
Timing.restart(curatedApplication.getAugmentClassLoader());
deploymentProblem = null;
ClassLoader old = Thread.currentThread().getContextClassLoader();
@@ -134,6 +133,7 @@ public synchronized void restartApp(Set<String> changedResources) {
log.error("Failed to start quarkus", t);
}
} finally {
+ restarting = false;
Thread.currentThread().setContextClassLoader(old);
}
}
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 c6b2fb59bd2..47be7673547 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/Application.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/Application.java
@@ -5,6 +5,7 @@
import java.util.concurrent.locks.Lock;
import org.eclipse.microprofile.config.spi.ConfigProviderResolver;
+import org.jboss.logging.Logger;
import org.wildfly.common.Assert;
import org.wildfly.common.lock.Locks;
@@ -88,6 +89,12 @@ public final void start(String[] args) {
doStart(args);
} catch (Throwable t) {
stateLock.lock();
+ final ConfigProviderResolver cpr = ConfigProviderResolver.instance();
+ try {
+ cpr.releaseConfig(cpr.getConfig());
+ } catch (IllegalStateException ignored) {
+ // just means no config was installed, which is fine
+ }
try {
state = ST_STOPPED;
stateCond.signalAll();
@@ -129,6 +136,15 @@ public final void close() {
* stop, that exception is propagated.
*/
public final void stop() {
+ stop(null);
+ }
+
+ /**
+ * Stop the application. If another thread is also trying to stop the application, this method waits for that
+ * thread to finish. Returns immediately if the application is already stopped. If an exception is thrown during
+ * stop, that exception is propagated.
+ */
+ public final void stop(Runnable afterStopTask) {
final Lock stateLock = this.stateLock;
stateLock.lock();
try {
@@ -171,6 +187,13 @@ public final void stop() {
doStop();
} finally {
currentApplication = null;
+ if (afterStopTask != null) {
+ try {
+ afterStopTask.run();
+ } catch (Throwable t) {
+ Logger.getLogger(Application.class).error("Failed to run stop task", t);
+ }
+ }
stateLock.lock();
try {
state = ST_STOPPED;
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java
index 9827cf7e698..629062c9a12 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java
@@ -142,8 +142,12 @@ public static final void run(Application application, Class<? extends QuarkusApp
} finally {
stateLock.unlock();
}
- application.stop();
- (exitCodeHandler == null ? defaultExitCodeHandler : exitCodeHandler).accept(1);
+ application.stop(new Runnable() {
+ @Override
+ public void run() {
+ (exitCodeHandler == null ? defaultExitCodeHandler : exitCodeHandler).accept(1);
+ }
+ });
return;
}
if (!alreadyStarted) { | ['core/runtime/src/main/java/io/quarkus/runtime/Application.java', 'core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java', 'core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java', 'core/runtime/src/main/java/io/quarkus/runtime/ApplicationLifecycleManager.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 8,601,942 | 1,673,746 | 223,475 | 2,341 | 1,533 | 277 | 35 | 4 | 2,868 | 164 | 694 | 49 | 3 | 3 | 1970-01-01T00:26: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,081 | quarkusio/quarkus/8608/8475 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8475 | https://github.com/quarkusio/quarkus/pull/8608 | https://github.com/quarkusio/quarkus/pull/8608 | 1 | fixes | Trailing slash required with Undertow + custom root path | **Describe the bug**
When using `quarkus-undertow` in combination with custom root path, a trailing slash has to be appended to the app path. This is not required when using vert.x. Additionally, Java™ Servlet Specification assumes that the slash shouldn't be required:
> A `ServletContext` is rooted at a known path within a Web server. For example, a
servlet context could be located at `http://www.mycorp.com/catalog`. All requests
that begin with the `/catalog` request path, known as the *context path*, are routed to
the Web application associated with the `ServletContext`.
**Expected behavior**
GET http://localhost:8080/foo => 200 OK (Welcome page or root resource)
GET http://localhost:8080/foo/ => 200 OK (ditto)
**Actual behavior**
GET http://localhost:8080/foo => 404 Not Found + "Resource not found" page
GET http://localhost:8080/foo/ => 200 OK
**Configuration**
```properties
quarkus.servlet.context-path = /foo
```
**Environment (please complete the following information):**
- Quarkus version or git rev: 1.3.1.Final
| acd48cf36d9bd760bfa1bfa274de2d5861b8e7e8 | 137fac9a4c2ffb2ed1c98f7fbb5c59051babda6a | https://github.com/quarkusio/quarkus/compare/acd48cf36d9bd760bfa1bfa274de2d5861b8e7e8...137fac9a4c2ffb2ed1c98f7fbb5c59051babda6a | diff --git a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java
index 83632edb168..4f23d84e7c6 100644
--- a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java
+++ b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java
@@ -172,6 +172,7 @@ public ServiceStartBuildItem boot(UndertowDeploymentRecorder recorder,
undertowProducer.accept(new DefaultRouteBuildItem(ut));
} else {
routeProducer.produce(new RouteBuildItem(servletContextPathBuildItem.getServletContextPath() + "/*", ut, false));
+ routeProducer.produce(new RouteBuildItem(servletContextPathBuildItem.getServletContextPath(), ut, false));
}
return new ServiceStartBuildItem("undertow");
}
diff --git a/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ContextPathTestCase.java b/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ContextPathTestCase.java
index 9e39567c33a..4db6c2fb7d7 100644
--- a/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ContextPathTestCase.java
+++ b/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ContextPathTestCase.java
@@ -19,6 +19,7 @@ public class ContextPathTestCase {
static QuarkusUnitTest runner = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(TestServlet.class, TestGreeter.class)
+ .addAsResource(new StringAsset("index"), "META-INF/resources/index.html")
.addAsResource(new StringAsset("quarkus.servlet.context-path=" + CONTEXT_PATH), "application.properties"));
@Test
@@ -28,4 +29,12 @@ public void testServlet() {
.body(is("test servlet"));
}
+ @Test
+ public void testNoSlash() {
+ RestAssured.given().redirects().follow(false).when().get("/foo").then()
+ .statusCode(302);
+ RestAssured.when().get("/foo").then()
+ .statusCode(200)
+ .body(is("index"));
+ }
} | ['extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java', 'extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/ContextPathTestCase.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 8,558,217 | 1,665,005 | 222,366 | 2,334 | 119 | 23 | 1 | 1 | 1,064 | 143 | 256 | 24 | 5 | 1 | 1970-01-01T00:26: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,082 | quarkusio/quarkus/8581/8578 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8578 | https://github.com/quarkusio/quarkus/pull/8581 | https://github.com/quarkusio/quarkus/pull/8581 | 1 | resolves | OpenTracing quickstart native build failing | The OpenTracing quickstart native build is failing with current Quarkus master + quickstart development branch:
https://github.com/quarkusio/quarkus-quickstarts/runs/586602480?check_suite_focus=true
```
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: io.quarkus.jaeger.runtime.QuarkusJaegerMetricsFactory.<init>(). To diagnose the issue you can use the --allow-incomplete-classpath option. The missing method is then reported at run time when it is accessed the first time.
Trace:
at parsing io.quarkus.jaeger.runtime.QuarkusJaegerTracer.tracer(QuarkusJaegerTracer.java:45)
Call path from entry point to io.quarkus.jaeger.runtime.QuarkusJaegerTracer.tracer():
at io.quarkus.jaeger.runtime.QuarkusJaegerTracer.tracer(QuarkusJaegerTracer.java:42)
at io.quarkus.jaeger.runtime.QuarkusJaegerTracer.toString(QuarkusJaegerTracer.java:31)
at java.lang.String.valueOf(String.java:2994)
at java.nio.charset.IllegalCharsetNameException.<init>(IllegalCharsetNameException.java:55)
at java.nio.charset.Charset.checkName(Charset.java:315)
at com.oracle.svm.core.jdk.Target_java_nio_charset_Charset.lookup(CharsetSubstitutions.java:78)
at java.nio.charset.Charset.isSupported(Charset.java:505)
at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_nio_charset_Charset_2_0002eisSupported_00028Ljava_lang_String_2_00029Z(generated:0)
``` | e58cbcaed7668fbaa348fdedcaf2443402ef090e | 4bab9db1a03a07e558614a6ca7e969650953404c | https://github.com/quarkusio/quarkus/compare/e58cbcaed7668fbaa348fdedcaf2443402ef090e...4bab9db1a03a07e558614a6ca7e969650953404c | diff --git a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java b/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java
index 5a44493fa4c..1c754e3cb1f 100644
--- a/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java
+++ b/extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java
@@ -30,7 +30,11 @@ void setupTracer(JaegerDeploymentRecorder jdr, JaegerBuildTimeConfig buildTimeCo
if (buildTimeConfig.enabled) {
boolean metricsEnabled = capabilities.isCapabilityPresent(Capabilities.METRICS);
- jdr.registerTracer(jaeger, appConfig, metricsEnabled);
+ if (metricsEnabled) {
+ jdr.registerTracerWithMetrics(jaeger, appConfig);
+ } else {
+ jdr.registerTracerWithoutMetrics(jaeger, appConfig);
+ }
}
}
diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java
index 5481c0d9b22..c025cb1ca2c 100644
--- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java
+++ b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java
@@ -5,6 +5,8 @@
import org.jboss.logging.Logger;
+import io.jaegertracing.internal.metrics.NoopMetricsFactory;
+import io.jaegertracing.spi.MetricsFactory;
import io.opentracing.util.GlobalTracer;
import io.quarkus.runtime.ApplicationConfig;
import io.quarkus.runtime.annotations.Recorder;
@@ -15,7 +17,15 @@ public class JaegerDeploymentRecorder {
private static final Optional UNKNOWN_SERVICE_NAME = Optional.of("quarkus/unknown");
private static final QuarkusJaegerTracer quarkusTracer = new QuarkusJaegerTracer();
- synchronized public void registerTracer(JaegerConfig jaeger, ApplicationConfig appConfig, boolean metricsEnabled) {
+ synchronized public void registerTracerWithoutMetrics(JaegerConfig jaeger, ApplicationConfig appConfig) {
+ registerTracer(jaeger, appConfig, new NoopMetricsFactory());
+ }
+
+ synchronized public void registerTracerWithMetrics(JaegerConfig jaeger, ApplicationConfig appConfig) {
+ registerTracer(jaeger, appConfig, new QuarkusJaegerMetricsFactory());
+ }
+
+ private void registerTracer(JaegerConfig jaeger, ApplicationConfig appConfig, MetricsFactory metricsFactory) {
if (!jaeger.serviceName.isPresent()) {
if (appConfig.name.isPresent()) {
jaeger.serviceName = appConfig.name;
@@ -24,7 +34,7 @@ synchronized public void registerTracer(JaegerConfig jaeger, ApplicationConfig a
}
}
initTracerConfig(jaeger);
- quarkusTracer.setMetricsEnabled(metricsEnabled);
+ quarkusTracer.setMetricsFactory(metricsFactory);
quarkusTracer.reset();
// register Quarkus tracer to GlobalTracer.
// Usually the tracer will be registered only here, although consumers
diff --git a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java
index 7764e7fbc91..3a67636bf2b 100644
--- a/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java
+++ b/extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java
@@ -2,7 +2,6 @@
import io.jaegertracing.Configuration;
import io.jaegertracing.internal.JaegerTracer;
-import io.jaegertracing.internal.metrics.NoopMetricsFactory;
import io.jaegertracing.spi.MetricsFactory;
import io.opentracing.ScopeManager;
import io.opentracing.Span;
@@ -16,14 +15,14 @@ public class QuarkusJaegerTracer implements Tracer {
private volatile JaegerTracer tracer;
private boolean logTraceContext;
- private boolean metricsEnabled;
+ private MetricsFactory metricsFactory;
void setLogTraceContext(boolean logTraceContext) {
this.logTraceContext = logTraceContext;
}
- void setMetricsEnabled(boolean metricsEnabled) {
- this.metricsEnabled = metricsEnabled;
+ void setMetricsFactory(MetricsFactory metricsFactory) {
+ this.metricsFactory = metricsFactory;
}
@Override
@@ -42,9 +41,6 @@ private Tracer tracer() {
if (tracer == null) {
synchronized (this) {
if (tracer == null) {
- MetricsFactory metricsFactory = metricsEnabled
- ? new QuarkusJaegerMetricsFactory()
- : new NoopMetricsFactory();
tracer = Configuration.fromEnv()
.withMetricsFactory(metricsFactory)
.getTracerBuilder() | ['extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/JaegerDeploymentRecorder.java', 'extensions/jaeger/runtime/src/main/java/io/quarkus/jaeger/runtime/QuarkusJaegerTracer.java', 'extensions/jaeger/deployment/src/main/java/io/quarkus/jaeger/deployment/JaegerProcessor.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 8,555,562 | 1,664,425 | 222,277 | 2,333 | 1,662 | 335 | 30 | 3 | 1,429 | 79 | 372 | 17 | 1 | 1 | 1970-01-01T00:26: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,083 | quarkusio/quarkus/8524/8478 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8478 | https://github.com/quarkusio/quarkus/pull/8524 | https://github.com/quarkusio/quarkus/pull/8524 | 1 | fixes | Keycloak Claim Information Point - NPE when trying to read body - 1.3.1.Final | It is the same bug described in #5959.
After upgrading to `1.3.1.Final` it does not working anymore.
You can use the sample project from #5959. Only one change is done there - because of the #8464.
You can run the sample project and to verify that is working.
Then change the quarkus version to `1.3.1.Final` and the project will stop working | fd359bfd55e36f9585e1c2b407c1850e30ea525d | 67f5034b9a12860df105c1c83ab14838ac912a88 | https://github.com/quarkusio/quarkus/compare/fd359bfd55e36f9585e1c2b407c1850e30ea525d...67f5034b9a12860df105c1c83ab14838ac912a88 | diff --git a/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/VertxHttpFacade.java b/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/VertxHttpFacade.java
index 36a802e2ad7..0d79e5296a3 100644
--- a/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/VertxHttpFacade.java
+++ b/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/VertxHttpFacade.java
@@ -25,7 +25,6 @@
import io.quarkus.vertx.http.runtime.VertxInputStream;
import io.quarkus.vertx.http.runtime.security.QuarkusHttpUser;
import io.vertx.core.buffer.Buffer;
-import io.vertx.core.http.HttpHeaders;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.http.impl.CookieImpl;
@@ -110,16 +109,7 @@ public Cookie getCookie(String cookieName) {
@Override
public String getHeader(String name) {
- //TODO: this logic should be removed once KEYCLOAK-12412 is fixed
- String value = request.getHeader(name);
-
- if (name.equalsIgnoreCase(HttpHeaders.CONTENT_TYPE.toString())) {
- if (value.indexOf(';') != -1) {
- return value.substring(0, value.indexOf(';'));
- }
- }
-
- return value;
+ return request.getHeader(name);
}
@Override | ['extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/VertxHttpFacade.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,460,178 | 1,645,554 | 219,207 | 2,286 | 513 | 85 | 12 | 1 | 346 | 61 | 90 | 5 | 0 | 0 | 1970-01-01T00:26: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,084 | quarkusio/quarkus/8477/8464 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/8464 | https://github.com/quarkusio/quarkus/pull/8477 | https://github.com/quarkusio/quarkus/pull/8477 | 1 | fixes | Keycloak - path cache is not working | Get the latest version of [Quarkus Keycloack Authorization Example](https://github.com/quarkusio/quarkus-quickstarts/tree/master/security-keycloak-authorization-quickstart)
Start the sample:
`mvn compile quarkus:dev`
It works fine. Now terminate the application.
Now open the `application.properties` file and add the following line:
`quarkus.keycloak.policy-enforcer.path-cache.lifespan=3600000`
Start the application again and after a while you will see this exception:
```
2020-04-08 09:46:48,962 ERROR [io.qua.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.RuntimeException: java.lang.ClassCastException: class io.quarkus.keycloak.pep.runtime.KeycloakPolicyEnforcerConfig$KeycloakConfigPolicyEnforcer cannot be cast to class java.util.Optional (io.quarkus.keycloak.pep.runtime.KeycloakPolicyEnforcerConfig$KeycloakConfigPolicyEnforcer is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @236fdf; java.util.Optional is in module java.base of loader 'bootstrap')
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:206)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:95)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:45)
at io.quarkus.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:59)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:236)
at io.quarkus.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:39)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:131)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:113)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:54)
Caused by: java.lang.ClassCastException: class io.quarkus.keycloak.pep.runtime.KeycloakPolicyEnforcerConfig$KeycloakConfigPolicyEnforcer cannot be cast to class java.util.Optional (io.quarkus.keycloak.pep.runtime.KeycloakPolicyEnforcerConfig$KeycloakConfigPolicyEnforcer is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @236fdf; java.util.Optional is in module java.base of loader 'bootstrap')
at io.quarkus.deployment.configuration.BuildTimeConfigurationReader$ReadOperation.getGroup(BuildTimeConfigurationReader.java:421)
at io.quarkus.deployment.configuration.BuildTimeConfigurationReader$ReadOperation.getGroup(BuildTimeConfigurationReader.java:412)
at io.quarkus.deployment.configuration.BuildTimeConfigurationReader$ReadOperation.run(BuildTimeConfigurationReader.java:321)
at io.quarkus.deployment.configuration.BuildTimeConfigurationReader.readConfiguration(BuildTimeConfigurationReader.java:241)
at io.quarkus.deployment.ExtensionLoader.loadStepsFrom(ExtensionLoader.java:204)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:90)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:204)
... 9 more
```
Seems that the problem is caused from the init of the following Optional class member:
`io.quarkus.keycloak.pep.runtime.KeycloakPolicyEnforcerConfig.KeycloakConfigPolicyEnforcer#pathCache`
| 9f85f8a061a1d81cc4ab6ec23fc7f22dea84d725 | 28fc562c8f8856c0868a20b95983bf8f034801f1 | https://github.com/quarkusio/quarkus/compare/9f85f8a061a1d81cc4ab6ec23fc7f22dea84d725...28fc562c8f8856c0868a20b95983bf8f034801f1 | diff --git a/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerAuthorizer.java b/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerAuthorizer.java
index 9d5c81da478..ded80eccef3 100644
--- a/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerAuthorizer.java
+++ b/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerAuthorizer.java
@@ -150,16 +150,12 @@ private PolicyEnforcerConfig getPolicyEnforcerConfig(KeycloakPolicyEnforcerConfi
PolicyEnforcerConfig.EnforcementMode.valueOf(config.policyEnforcer.enforcementMode));
enforcerConfig.setHttpMethodAsScope(config.policyEnforcer.httpMethodAsScope);
- Optional<KeycloakPolicyEnforcerConfig.KeycloakConfigPolicyEnforcer.PathCacheConfig> pathCache = config.policyEnforcer.pathCache;
+ KeycloakPolicyEnforcerConfig.KeycloakConfigPolicyEnforcer.PathCacheConfig pathCache = config.policyEnforcer.pathCache;
- if (pathCache.isPresent()) {
- PolicyEnforcerConfig.PathCacheConfig pathCacheConfig = new PolicyEnforcerConfig.PathCacheConfig();
-
- pathCacheConfig.setLifespan(pathCache.get().lifespan);
- pathCacheConfig.setMaxEntries(pathCache.get().maxEntries);
-
- enforcerConfig.setPathCacheConfig(pathCacheConfig);
- }
+ PolicyEnforcerConfig.PathCacheConfig pathCacheConfig = new PolicyEnforcerConfig.PathCacheConfig();
+ pathCacheConfig.setLifespan(pathCache.lifespan);
+ pathCacheConfig.setMaxEntries(pathCache.maxEntries);
+ enforcerConfig.setPathCacheConfig(pathCacheConfig);
enforcerConfig.setClaimInformationPointConfig(
getClaimInformationPointConfig(config.policyEnforcer.claimInformationPoint));
diff --git a/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerConfig.java b/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerConfig.java
index 939d5184992..1c16ed8890a 100644
--- a/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerConfig.java
+++ b/extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerConfig.java
@@ -56,7 +56,7 @@ public static class KeycloakConfigPolicyEnforcer {
* protected resources
*/
@ConfigItem
- public Optional<PathCacheConfig> pathCache;
+ public PathCacheConfig pathCache = new PathCacheConfig();
/**
* Specifies how the adapter should fetch the server for resources associated with paths in your application. If true, | ['extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerConfig.java', 'extensions/keycloak-authorization/runtime/src/main/java/io/quarkus/keycloak/pep/runtime/KeycloakPolicyEnforcerAuthorizer.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 8,361,232 | 1,625,985 | 216,663 | 2,267 | 1,091 | 207 | 16 | 2 | 3,278 | 165 | 776 | 36 | 1 | 1 | 1970-01-01T00:26: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,064 | quarkusio/quarkus/9236/9178 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9178 | https://github.com/quarkusio/quarkus/pull/9236 | https://github.com/quarkusio/quarkus/pull/9236 | 1 | fixes | OpenShift deployment (quarkus-openshift extension) fails on Windows | **Describe the bug**
OpenShift deployment using the quarkus-openshift extension fails on Windows.
The same project works fine on Linux.
**Expected behavior**
Deployment works on Windows too.
**Actual behavior**
```
[WARNING] [io.quarkus.container.image.s2i.deployment.S2iProcessor] No Openshift manifests were generated (most likely due to the fact that the service is not an HTTP service) so no s2i process will be taking place
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
```
**To Reproduce**
Steps to reproduce the behavior:
1. Clone repo https://github.com/haraldatbmw/quarkus-openshift-deployment
2. Login to your OpenShift cluster `oc login ...`
3. Start deployment `mvn clean package -Dquarkus.kubernetes.deploy=true`
**Configuration**
```properties
quarkus.kubernetes-client.trust-certs=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/openjdk/openjdk-11-rhel7
quarkus.openshift.expose=true
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Microsoft Windows [Version 10.0.17134.1425]
- Output of `java -version`:
openjdk version "11.0.6" 2020-01-14 LTS
OpenJDK Runtime Environment Zulu11.37+17-CA (build 11.0.6+10-LTS)
OpenJDK 64-Bit Server VM Zulu11.37+17-CA (build 11.0.6+10-LTS, mixed mode)
- Quarkus version or git rev: 1.4.2.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
- oc tool:
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth SSPI Kerberos SPNEGO
| c0b4417e44e299eccb923e55c6908de8bab846e6 | f9da73058f32110a1c1157c76a0141fb35025a32 | https://github.com/quarkusio/quarkus/compare/c0b4417e44e299eccb923e55c6908de8bab846e6...f9da73058f32110a1c1157c76a0141fb35025a32 | diff --git a/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java b/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java
index 1c59065da77..743469e418b 100644
--- a/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java
+++ b/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java
@@ -181,7 +181,7 @@ public void s2iBuildFromJar(S2iConfig s2iConfig, ContainerImageConfig containerI
Optional<GeneratedFileSystemResourceBuildItem> openshiftYml = generatedResources
.stream()
- .filter(r -> r.getName().endsWith("kubernetes/openshift.yml"))
+ .filter(r -> r.getName().endsWith("kubernetes" + File.separator + "openshift.yml"))
.findFirst();
if (!openshiftYml.isPresent()) { | ['extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,860,120 | 1,723,471 | 230,006 | 2,453 | 180 | 39 | 2 | 1 | 1,723 | 175 | 483 | 42 | 1 | 2 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,062 | quarkusio/quarkus/9245/9223 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9223 | https://github.com/quarkusio/quarkus/pull/9245 | https://github.com/quarkusio/quarkus/pull/9245 | 1 | fixes | Quarkus master / dev mode / --enable-preview - compilation fails after .java file edit | Quarkus master / dev mode / --enable-preview - compilation fails after .java file edit
https://github.com/quarkusio/quarkus/pull/8279 should make dev mode ready to work with `--enable-preview` flag, but I'm struggling with it. Tried on Java 14 and Java 15ea and Quarkus master 079cf3925c
I can run dev mode, simple rest endpoint provides the content, it blows up when the simple jaxrs resource is edited, compilation fails, `java.lang.RuntimeException: Compilation failed[error: --enable-preview must be used with either -source or --release]` is returned by the endpoint.
Reproducer:
```
git clone https://github.com/rsvoboda/quarkus-jdk15.git
cd quarkus-jdk15
sdk use java 15.ea.21-open
mvn quarkus:dev
curl http://localhost:8080/hello ## hello
edit ./src/main/java/io/quarkus/qe/jdk/Jdk15Resource.java
curl http://localhost:8080/hello ## java.lang.RuntimeException: Compilation failed[error: --enable-preview must be used with either -source or --release]
``` | 8095f306c4863dfb50dd3a59322dd4018346dd34 | 38302866f34868217669a94efe7d33cb283ec2b4 | https://github.com/quarkusio/quarkus/compare/8095f306c4863dfb50dd3a59322dd4018346dd34...38302866f34868217669a94efe7d33cb283ec2b4 | 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 46ce6ec9bdb..930f71095ac 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -26,6 +26,7 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Optional;
import java.util.Properties;
import java.util.Queue;
import java.util.Set;
@@ -546,26 +547,15 @@ void prepare() throws Exception {
devModeContext.getBuildSystemProperties().putIfAbsent("quarkus.application.version", project.getVersion());
devModeContext.setSourceEncoding(getSourceEncoding());
- devModeContext.setSourceJavaVersion(source);
- devModeContext.setTargetJvmVersion(target);
// Set compilation flags. Try the explicitly given configuration first. Otherwise,
// refer to the configuration of the Maven Compiler Plugin.
+ final Optional<Xpp3Dom> compilerPluginConfiguration = findCompilerPluginConfiguration();
if (compilerArgs != null) {
devModeContext.setCompilerOptions(compilerArgs);
- } else {
- for (Plugin plugin : project.getBuildPlugins()) {
- if (!plugin.getKey().equals("org.apache.maven.plugins:maven-compiler-plugin")) {
- continue;
- }
- Xpp3Dom compilerPluginConfiguration = (Xpp3Dom) plugin.getConfiguration();
- if (compilerPluginConfiguration == null) {
- continue;
- }
- Xpp3Dom compilerPluginArgsConfiguration = compilerPluginConfiguration.getChild("compilerArgs");
- if (compilerPluginArgsConfiguration == null) {
- continue;
- }
+ } else if (compilerPluginConfiguration.isPresent()) {
+ final Xpp3Dom compilerPluginArgsConfiguration = compilerPluginConfiguration.get().getChild("compilerArgs");
+ if (compilerPluginArgsConfiguration != null) {
List<String> compilerPluginArgs = new ArrayList<>();
for (Xpp3Dom argConfiguration : compilerPluginArgsConfiguration.getChildren()) {
compilerPluginArgs.add(argConfiguration.getValue());
@@ -576,7 +566,24 @@ void prepare() throws Exception {
compilerPluginArgs.add(compilerPluginArgsConfiguration.getValue().trim());
}
devModeContext.setCompilerOptions(compilerPluginArgs);
- break;
+ }
+ }
+ if (source != null) {
+ devModeContext.setSourceJavaVersion(source);
+ } else if (compilerPluginConfiguration.isPresent()) {
+ final Xpp3Dom javacSourceVersion = compilerPluginConfiguration.get().getChild("source");
+ if (javacSourceVersion != null && javacSourceVersion.getValue() != null
+ && !javacSourceVersion.getValue().trim().isEmpty()) {
+ devModeContext.setSourceJavaVersion(javacSourceVersion.getValue().trim());
+ }
+ }
+ if (target != null) {
+ devModeContext.setTargetJvmVersion(target);
+ } else if (compilerPluginConfiguration.isPresent()) {
+ final Xpp3Dom javacTargetVersion = compilerPluginConfiguration.get().getChild("target");
+ if (javacTargetVersion != null && javacTargetVersion.getValue() != null
+ && !javacTargetVersion.getValue().trim().isEmpty()) {
+ devModeContext.setTargetJvmVersion(javacTargetVersion.getValue().trim());
}
}
@@ -856,4 +863,17 @@ private List<LocalProject> filterExtensionDependencies(LocalProject localProject
}
return ret;
}
+
+ private Optional<Xpp3Dom> findCompilerPluginConfiguration() {
+ for (final Plugin plugin : project.getBuildPlugins()) {
+ if (!plugin.getKey().equals("org.apache.maven.plugins:maven-compiler-plugin")) {
+ continue;
+ }
+ final Xpp3Dom compilerPluginConfiguration = (Xpp3Dom) plugin.getConfiguration();
+ if (compilerPluginConfiguration != null) {
+ return Optional.of(compilerPluginConfiguration);
+ }
+ }
+ return Optional.empty();
+ }
} | ['devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,866,176 | 1,724,641 | 230,149 | 2,456 | 2,925 | 504 | 52 | 1 | 988 | 116 | 259 | 17 | 4 | 1 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,050 | quarkusio/quarkus/9571/9566 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9566 | https://github.com/quarkusio/quarkus/pull/9571 | https://github.com/quarkusio/quarkus/pull/9571 | 1 | fixes | QuarkusDevModeTest freezes when it fails during the loading | **Describe the bug**
I just discovered a problem with Kogito Hot Reload test. When there is an error in an upper module, the test fails during the loading because of missing `-deplyoment` package but it freezes and then the build will reach the timeout and is aborted.
I did some analysis and created a PR to "workaround" it ([see link](https://github.com/kiegroup/kogito-runtimes/pull/526#issuecomment-632256309)) but I think it should solved also in Quarkus.
We have hot reload tests in a dedicated module instead of inside `-deployment` and we had no maven dependency on `deployment` module (because QuarkusDevModeTest loads the modules independently without using project configuration). The current fix is to declare the dependency so the module is skipped if deployment is not properly built.
I looked for a suggested configuration of hot reload tests from a different module but I was not able to find any so I guess my fix is correct (declare dependency on `deployment`) but still the build should not freeze in case of wrong configuration.
**Expected behavior**
Test fails and then build continue until the end
**Actual behavior**
Test fails during the initialization with [this stacktrace](https://gist.github.com/danielezonca/c3f9a53b37dd6e69aa01eb50e0a61eb4) but then freezes until build timeout (see last lines of the gist)
**To Reproduce**
See [here](https://github.com/kiegroup/kogito-runtimes/pull/526#issuecomment-632256309)
**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 dzonca.mxp.csb 4.18.0-80.11.2.el8_0.x86_64 #1 SMP Sun Sep 15 11:24:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Output of `java -version`:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)
- GraalVM version (if different from Java):
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
- Quarkus version or git rev:
1.4.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
**Additional context**
(Add any other context about the problem here.)
| 8c3ede8d87076b8fef5bbdd0072bd722e2edc7c6 | 754a3beebd8685ca696c26559c1ff2135e65071e | https://github.com/quarkusio/quarkus/compare/8c3ede8d87076b8fef5bbdd0072bd722e2edc7c6...754a3beebd8685ca696c26559c1ff2135e65071e | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
index 2fd84e4b64a..64912a75622 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java
@@ -158,6 +158,8 @@ public void close() throws IOException {
if (realCloseable != null) {
realCloseable.close();
}
- ApplicationStateNotification.waitForApplicationStop();
+ if (ApplicationStateNotification.getState() == ApplicationStateNotification.State.STARTED) {
+ ApplicationStateNotification.waitForApplicationStop();
+ }
}
} | ['core/deployment/src/main/java/io/quarkus/deployment/dev/DevModeMain.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,226,936 | 1,792,957 | 239,325 | 2,557 | 244 | 35 | 4 | 1 | 2,577 | 337 | 725 | 45 | 3 | 1 | 1970-01-01T00:26:30 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,041 | quarkusio/quarkus/9935/9882 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9882 | https://github.com/quarkusio/quarkus/pull/9935 | https://github.com/quarkusio/quarkus/pull/9935 | 1 | fixes | NullPointerException when quarkus.http.access-log.enabled=true | **Describe the bug**
I'm getting too many NullPointerException when setting quarkus.http.access-log.enabled=true here exception logs
```
ERROR [io.qua.ver.htt.run.fil.QuarkusRequestWrapper] (vert.x-eventloop-thread-0) Failed to run io.quarkus.vertx.http.runtime.filters.accesslog.AccessLogHandler$1@23b007d8: java.lang.NullPointerException
at io.quarkus.vertx.http.runtime.attribute.RemoteHostAttribute.readAttribute(RemoteHostAttribute.java:22)
at io.quarkus.vertx.http.runtime.attribute.SubstituteEmptyWrapper$SubstituteEmptyAttribute.readAttribute(SubstituteEmptyWrapper.java:29)
at io.quarkus.vertx.http.runtime.attribute.CompositeExchangeAttribute.readAttribute(CompositeExchangeAttribute.java:23)
at io.quarkus.vertx.http.runtime.filters.accesslog.AccessLogHandler$1.handle(AccessLogHandler.java:120)
at io.quarkus.vertx.http.runtime.filters.accesslog.AccessLogHandler$1.handle(AccessLogHandler.java:117)
at io.quarkus.vertx.http.runtime.filters.QuarkusRequestWrapper.done(QuarkusRequestWrapper.java:70)
at io.quarkus.vertx.http.runtime.filters.QuarkusRequestWrapper$ResponseWrapper$2.handle(QuarkusRequestWrapper.java:114)
at io.quarkus.vertx.http.runtime.filters.QuarkusRequestWrapper$ResponseWrapper$2.handle(QuarkusRequestWrapper.java:111)
at io.vertx.core.http.impl.HttpServerResponseImpl.handleClosed(HttpServerResponseImpl.java:616)
at io.vertx.core.http.impl.HttpServerResponseImpl.handleException(HttpServerResponseImpl.java:590)
at io.vertx.core.http.impl.HttpServerRequestImpl.handleException(HttpServerRequestImpl.java:568)
at io.vertx.core.http.impl.Http1xServerConnection.handleClosed(Http1xServerConnection.java:413)
at io.vertx.core.net.impl.VertxHandler.lambda$channelInactive$4(VertxHandler.java:162)
at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:369)
at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43)
at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:232)
at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:224)
at io.vertx.core.net.impl.VertxHandler.channelInactive(VertxHandler.java:162)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:81)
at io.netty.handler.timeout.IdleStateHandler.channelInactive(IdleStateHandler.java:277)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:389)
at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:354)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:241)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1405)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:262)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:248)
at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:901)
at io.netty.channel.AbstractChannel$AbstractUnsafe$8.run(AbstractChannel.java:818)
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:497)
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**
Request Logs print in console
**Actual behavior**
Request logs are showing but also too many exceptions only if i set quarkus.http.access-log.enabled=true
**To Reproduce**
Steps to reproduce the behavior:
1. build quarkus project with gradle
2. set quarkus.http.access-log.enabled=true in application.properties
3. Send multiple requests to server with jmeter or ab or maybe wrk.
**Configuration**
```properties
# Add your application.properties here, if applicable.
quarkus.application.name=appname
quarkus.application.version=1.0.0
quarkus.container-image.group={GITHUB_USERNAME}/{REPO}
quarkus.container-image.registry=docker.pkg.github.com
quarkus.jib.base-registry-username={GITHUB_USERNAME}
quarkus.jib.base-registry-password={TOKEN}
quarkus.http.port=8282
quarkus.shutdown.timeout=40
quarkus.http.access-log.enabled=false
quarkus.vault.tls.skip-verify=true
quarkus.vertx.max-event-loop-execute-time=4s
quarkus.http.read-timeout=120s
quarkus.vertx.eventbus.connect-timeout=120s
quarkus.resteasy.gzip.enabled=true
quarkus.resteasy.gzip.max-input=10M
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
Linux myapp-74ffb6cc9f-vj92h 4.19.0-0.bpo.6-amd64 #1 SMP Debian 4.19.67-2+deb10u2~bpo9+1 (2019-11-12) x86_64 Linux
- Output of `java -version`:
openjdk version "11.0.2" 2019-01-15
OpenJDK Runtime Environment 18.9 (build 11.0.2+9)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
- GraalVM version (if different from Java): USING JVM
- Quarkus version or git rev: 1.5.0.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Gradle 6.4.1
**Additional context**
(Add any other context about the problem here.)
| 1d456915dfc1a975ad797de9cef9ebd4843f9dcb | da0be1de7ca3aa81c6235e750a47c298c3815fbf | https://github.com/quarkusio/quarkus/compare/1d456915dfc1a975ad797de9cef9ebd4843f9dcb...da0be1de7ca3aa81c6235e750a47c298c3815fbf | diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalIPAttribute.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalIPAttribute.java
index 15ba84f731f..73ad59eb124 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalIPAttribute.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalIPAttribute.java
@@ -20,6 +20,9 @@ private LocalIPAttribute() {
@Override
public String readAttribute(final RoutingContext exchange) {
SocketAddress localAddress = exchange.request().localAddress();
+ if (localAddress == null) {
+ return null;
+ }
return localAddress.host();
}
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalPortAttribute.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalPortAttribute.java
index 93e8da3d9db..9645b15d658 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalPortAttribute.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalPortAttribute.java
@@ -1,5 +1,6 @@
package io.quarkus.vertx.http.runtime.attribute;
+import io.vertx.core.net.SocketAddress;
import io.vertx.ext.web.RoutingContext;
/**
@@ -19,7 +20,11 @@ private LocalPortAttribute() {
@Override
public String readAttribute(final RoutingContext exchange) {
- return Integer.toString(exchange.request().localAddress().port());
+ final SocketAddress localAddr = exchange.request().localAddress();
+ if (localAddr == null) {
+ return null;
+ }
+ return Integer.toString(localAddr.port());
}
@Override
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteHostAttribute.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteHostAttribute.java
index cd7be81b219..5164a1b8ed2 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteHostAttribute.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteHostAttribute.java
@@ -1,5 +1,6 @@
package io.quarkus.vertx.http.runtime.attribute;
+import io.vertx.core.net.SocketAddress;
import io.vertx.ext.web.RoutingContext;
/**
@@ -19,7 +20,11 @@ private RemoteHostAttribute() {
@Override
public String readAttribute(final RoutingContext exchange) {
- return exchange.request().remoteAddress().host();
+ final SocketAddress remoteAddr = exchange.request().remoteAddress();
+ if (remoteAddr == null) {
+ return null;
+ }
+ return remoteAddr.host();
}
@Override
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteIPAttribute.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteIPAttribute.java
index 90bb77f4334..5d8800a8b61 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteIPAttribute.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteIPAttribute.java
@@ -21,6 +21,9 @@ private RemoteIPAttribute() {
@Override
public String readAttribute(final RoutingContext exchange) {
final SocketAddress sourceAddress = exchange.request().remoteAddress();
+ if (sourceAddress == null) {
+ return null;
+ }
return sourceAddress.host();
}
| ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteHostAttribute.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalIPAttribute.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RemoteIPAttribute.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/LocalPortAttribute.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 9,424,383 | 1,831,629 | 244,360 | 2,623 | 746 | 139 | 20 | 4 | 6,821 | 285 | 1,511 | 108 | 0 | 2 | 1970-01-01T00:26:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,042 | quarkusio/quarkus/9919/4996 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4996 | https://github.com/quarkusio/quarkus/pull/9919 | https://github.com/quarkusio/quarkus/pull/9919 | 1 | fixes | quarkus-maven-plugin does not obey --file -f command line flag | **Describe the bug**
When --file is specified on command line (e.g. `mvn --file pom2.xml quarkus:dev`) it is ignored. Quarkus plugin either loads pom.xml or complains that there is no pom.xml.
**Expected behavior**
Plugin should use specified file.
**Actual behavior**
Plugin ignores the flag and always uses pom.xml.
**To Reproduce**
Steps to reproduce the behavior:
1. Rename pom.xml to pom2.xml.
2. mvn --file pom2.xml quarkus:dev
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (D:\\Atron\\repo\\asc\\import-aservice-quarkus). Please verify you invoked Maven from the correct directory. -> [Help 1]
**Configuration**
Not relevant.
```properties
# Add your application.properties here, if applicable.
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Microsoft Windows [Version 10.0.18362.418]
- Output of `java -version`:
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
- GraalVM version (if different from Java):
- Quarkus version or git rev: 0.26.1
**Additional context**
(Add any other context about the problem here.)
| 665dbbab63f56cfdacf4fdca9dff770707eaa19d | 2ad62aaf02c7dd58fb0c47a2399eaedd05de2a70 | https://github.com/quarkusio/quarkus/compare/665dbbab63f56cfdacf4fdca9dff770707eaa19d...2ad62aaf02c7dd58fb0c47a2399eaedd05de2a70 | 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 1374f6fc1f7..9ea99983b50 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -635,16 +635,16 @@ void prepare(final boolean triggerCompile) throws Exception {
setKotlinSpecificFlags(devModeContext);
final LocalProject localProject;
if (noDeps) {
- localProject = LocalProject.load(outputDirectory.toPath());
+ localProject = LocalProject.load(project.getModel().getPomFile().toPath());
addProject(devModeContext, localProject, true);
- pomFiles.add(localProject.getDir().resolve("pom.xml"));
+ pomFiles.add(localProject.getRawModel().getPomFile().toPath());
devModeContext.getLocalArtifacts()
.add(new AppArtifactKey(localProject.getGroupId(), localProject.getArtifactId(), null, "jar"));
} else {
- localProject = LocalProject.loadWorkspace(outputDirectory.toPath());
+ localProject = LocalProject.loadWorkspace(project.getModel().getPomFile().toPath());
for (LocalProject project : filterExtensionDependencies(localProject)) {
addProject(devModeContext, project, project == localProject);
- pomFiles.add(project.getDir().resolve("pom.xml"));
+ pomFiles.add(project.getRawModel().getPomFile().toPath());
devModeContext.getLocalArtifacts()
.add(new AppArtifactKey(project.getGroupId(), project.getArtifactId(), null, "jar"));
}
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
index 0c69f49aec1..2593bcea18d 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
@@ -208,8 +208,9 @@ private BootstrapMavenContext createBootstrapMavenContext() throws AppModelResol
config.setOffline(offline);
}
// Currently projectRoot may be an app location which is not exactly a Maven project dir
- if (projectRoot != null && Files.isDirectory(projectRoot) && Files.exists(projectRoot.resolve("pom.xml"))) {
- config.setCurrentProject(projectRoot.toString());
+ final Path projectPom = config.getPomForDirOrNull(projectRoot);
+ if (projectPom != null) {
+ config.setCurrentProject(projectPom.toString());
}
config.setWorkspaceDiscovery(isWorkspaceDiscoveryEnabled());
return mvnContext = new BootstrapMavenContext(config);
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
index 882888bd107..607885d1e13 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java
@@ -126,7 +126,7 @@ public BootstrapMavenContext(BootstrapMavenContextConfig<?> config)
* This means the values that are available in the config should be set before
* the instance method invocations.
*/
- this.alternatePomName = config.alternativePomName;
+ this.alternatePomName = config.alternatePomName;
this.artifactTransferLogging = config.artifactTransferLogging;
this.localRepo = config.localRepo;
this.offline = config.offline;
@@ -134,6 +134,7 @@ public BootstrapMavenContext(BootstrapMavenContextConfig<?> config)
this.repoSession = config.repoSession;
this.remoteRepos = config.remoteRepos;
this.remoteRepoManager = config.remoteRepoManager;
+ this.cliOptions = config.cliOptions;
if (config.currentProject != null) {
this.currentProject = config.currentProject;
this.currentPom = currentProject.getRawModel().getPomFile().toPath();
@@ -655,32 +656,7 @@ private Path resolveCurrentPom() {
final String basedirProp = PropertyUtils.getProperty(BASEDIR);
if (basedirProp != null) {
// this is the actual current project dir
- final Path basedir = Paths.get(basedirProp);
-
- // if the basedir matches the parent of the alternate pom, it's the alternate pom
- if (alternatePom != null
- && alternatePom.isAbsolute()
- && alternatePom.getParent().equals(basedir)) {
- return alternatePom;
- }
- // even if the alternate pom has been specified we try the default pom.xml first
- // since unlike Maven CLI we don't know which project originated the build
- Path pom = basedir.resolve("pom.xml");
- if (Files.exists(pom)) {
- return pom;
- }
-
- // if alternate pom path has a single element we can try it
- // if it has more, it won't match the basedir
- if (alternatePom != null && !alternatePom.isAbsolute() && alternatePom.getNameCount() == 1) {
- pom = basedir.resolve(alternatePom);
- if (Files.exists(pom)) {
- return pom;
- }
- }
-
- // give up
- return null;
+ return getPomForDirOrNull(Paths.get(basedirProp), alternatePom);
}
// we are not in the context of a Maven build
@@ -697,6 +673,33 @@ private Path resolveCurrentPom() {
return Files.exists(pom) ? pom : null;
}
+ static Path getPomForDirOrNull(final Path basedir, Path alternatePom) {
+ // if the basedir matches the parent of the alternate pom, it's the alternate pom
+ if (alternatePom != null
+ && alternatePom.isAbsolute()
+ && alternatePom.getParent().equals(basedir)) {
+ return alternatePom;
+ }
+ // even if the alternate pom has been specified we try the default pom.xml first
+ // since unlike Maven CLI we don't know which project originated the build
+ Path pom = basedir.resolve("pom.xml");
+ if (Files.exists(pom)) {
+ return pom;
+ }
+
+ // if alternate pom path has a single element we can try it
+ // if it has more, it won't match the basedir
+ if (alternatePom != null && !alternatePom.isAbsolute() && alternatePom.getNameCount() == 1) {
+ pom = basedir.resolve(alternatePom);
+ if (Files.exists(pom)) {
+ return pom;
+ }
+ }
+
+ // give up
+ return null;
+ }
+
private static Path pomXmlOrNull(Path path) {
if (Files.isDirectory(path)) {
path = path.resolve("pom.xml");
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java
index 017c20c249d..26bd0cfad2d 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java
@@ -1,7 +1,11 @@
package io.quarkus.bootstrap.resolver.maven;
+import io.quarkus.bootstrap.resolver.maven.options.BootstrapMavenOptions;
import io.quarkus.bootstrap.resolver.maven.workspace.LocalProject;
import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
import java.util.List;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
@@ -18,9 +22,10 @@
protected RepositorySystemSession repoSession;
protected List<RemoteRepository> remoteRepos;
protected RemoteRepositoryManager remoteRepoManager;
- protected String alternativePomName;
+ protected String alternatePomName;
protected File userSettings;
protected boolean artifactTransferLogging = true;
+ protected BootstrapMavenOptions cliOptions;
/**
* Local repository location
@@ -133,7 +138,7 @@ public T setRemoteRepositoryManager(RemoteRepositoryManager remoteRepoManager) {
*/
@SuppressWarnings("unchecked")
public T setCurrentProject(String currentProject) {
- this.alternativePomName = currentProject;
+ this.alternatePomName = currentProject;
return (T) this;
}
@@ -161,4 +166,24 @@ public T setArtifactTransferLogging(boolean artifactTransferLogging) {
this.artifactTransferLogging = artifactTransferLogging;
return (T) this;
}
+
+ /**
+ * Resolves a POM file for a basedir.
+ *
+ * @param basedir project's basedir
+ * @return POM file for the basedir or null, if it could not be resolved
+ */
+ public Path getPomForDirOrNull(Path basedir) {
+ if (!Files.isDirectory(basedir)) {
+ return null;
+ }
+ final String altPom = alternatePomName == null
+ ? getInitializedCliOptions().getOptionValue(BootstrapMavenOptions.ALTERNATE_POM_FILE)
+ : alternatePomName;
+ return BootstrapMavenContext.getPomForDirOrNull(basedir, altPom == null ? null : Paths.get(altPom));
+ }
+
+ private BootstrapMavenOptions getInitializedCliOptions() {
+ return cliOptions == null ? cliOptions = BootstrapMavenOptions.newInstance() : cliOptions;
+ }
}
diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
index 1c86986a3e3..07b495619ee 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
@@ -148,9 +148,9 @@ public File findArtifact(Artifact artifact) {
// otherwise, this project hasn't been built yet
} else if (type.equals(AppArtifactCoords.TYPE_POM)) {
- final Path path = lp.getDir().resolve("pom.xml");
- if (Files.exists(path)) {
- return path.toFile();
+ final File pom = lp.getRawModel().getPomFile();
+ if (pom.exists()) {
+ return pom;
}
}
return null;
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 93266f33d21..3b739c23abb 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
@@ -166,6 +166,54 @@ public void testThatSourceChangesAreDetectedOnPomChange() throws Exception {
}
+ @Test
+ public void testAlternatePom() throws Exception {
+ testDir = initProject("projects/classic", "projects/project-classic-alternate-pom");
+
+ File pom = new File(testDir, "pom.xml");
+ if (!pom.exists()) {
+ throw new IllegalStateException("Failed to locate project's pom.xml at " + pom);
+ }
+ final String alternatePomName = "alternate-pom.xml";
+ File alternatePom = new File(testDir, alternatePomName);
+ if (alternatePom.exists()) {
+ alternatePom.delete();
+ }
+ pom.renameTo(alternatePom);
+ if (pom.exists()) {
+ throw new IllegalStateException(pom + " was expected to be renamed to " + alternatePom);
+ }
+ runAndCheck("-f", alternatePomName);
+
+ // Edit a Java file too
+ final File javaSource = new File(testDir, "src/main/java/org/acme/HelloResource.java");
+ final String uuid = UUID.randomUUID().toString();
+ filter(javaSource, Collections.singletonMap("return \\"hello\\";", "return \\"hello " + uuid + "\\";"));
+
+ // edit the application.properties too
+ final File applicationProps = new File(testDir, "src/main/resources/application.properties");
+ filter(applicationProps, Collections.singletonMap("greeting=bonjour", "greeting=" + uuid + ""));
+
+ // Now edit the pom.xml to trigger the dev mode restart
+ filter(alternatePom, Collections.singletonMap("<!-- insert test dependencies here -->",
+ " <dependency>\\n" +
+ " <groupId>io.quarkus</groupId>\\n" +
+ " <artifactId>quarkus-smallrye-openapi</artifactId>\\n" +
+ " </dependency>"));
+
+ // Wait until we get the updated responses
+ await()
+ .pollDelay(100, TimeUnit.MILLISECONDS)
+ .atMost(1, TimeUnit.MINUTES)
+ .until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains("hello " + uuid));
+
+ await()
+ .pollDelay(100, TimeUnit.MILLISECONDS)
+ .atMost(1, TimeUnit.MINUTES)
+ .until(() -> DevModeTestUtils.getHttpResponse("/app/hello/greeting").contains(uuid));
+
+ }
+
@Test
public void testThatTheApplicationIsReloadedOnPomChange() throws MavenInvocationException, IOException {
testDir = initProject("projects/classic", "projects/project-classic-run-pom-change"); | ['independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContextConfig.java', 'integration-tests/maven/src/test/java/io/quarkus/maven/it/DevMojoIT.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java', 'independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/BootstrapMavenContext.java', 'independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java', 'devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java'] | {'.java': 6} | 6 | 6 | 0 | 0 | 6 | 9,815,999 | 1,906,042 | 253,707 | 2,720 | 4,927 | 1,045 | 105 | 5 | 1,372 | 181 | 350 | 41 | 0 | 1 | 1970-01-01T00:26:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,043 | quarkusio/quarkus/9879/9849 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9849 | https://github.com/quarkusio/quarkus/pull/9879 | https://github.com/quarkusio/quarkus/pull/9879 | 1 | fixes | Vault Database Credentials - Invalid Password (reactive-pg-client) | **Describe the bug**
I've followed the instructions here for setting up Vault and Quarkus: [QUARKUS - USING HASHICORP VAULT WITH DATABASES](https://quarkus.io/guides/vault-datasource). However, Quarkus cannot connect to my Postgres database.
**Expected behavior**
Quarkus should be able to get credentials from Vault and successfully connect to Postgres database.
**Actual behavior**
Quarkus cannot connect to my Postgres database - I always received "password authentication failure".
There is a bug in PgPoolRecorder @ line 113 (on master) which is setting the password from the username field. I'll submit a PR to fix. I've raised this bug in case others run into the same issue.
**To Reproduce**
Steps to reproduce the behavior:
1. Configure Vault per the instructions
2. Configurate Quarkus per the instructions
3. Run the Quarkus app
4. Quarkus cannot connect to the database
**Configuration**
```properties
quarkus.banner.enabled=false
quarkus.log.level=DEBUG
quarkus.datasource.metrics.enabled=true
quarkus.datasource.db-kind=pg
quarkus.datasource.credentials-provider=insurance-database
quarkus.datasource.reactive.url=postgresql://localhost:5432/postgres
quarkus.datasource.reactive.max-size=20
quarkus.vault.url=http://localhost:8200
quarkus.vault.authentication.userpass.username=insurance
quarkus.vault.authentication.userpass.password=password
quarkus.vault.credentials-provider.insurance-database.database-credentials-role=insurance
quarkus.vault.health.enabled=true
```
**Log Output**
```
2020-06-08 13:14:35,447 DEBUG [io.qua.vau.run.VaultDbManager] (Quarkus Main Thread) generated insurance credentials: {leaseId: database/creds/insurance/D1ruZvpxYZOdN0mhTFpFHLlg, renewable: true, leaseDuration: 3600s, valid_until: Mon Jun 08 14:14:35 AEST 2020, username: v-userpass-insuranc-7feANaQBPoMFUKqmTsrh-1591586075, password:***}
2020-06-08 13:14:35,509 INFO [io.quarkus] (Quarkus Main Thread) getting-started 1.0-SNAPSHOT on JVM (powered by Quarkus 1.5.0.Final) started in 7.710s. Listening on: http://0.0.0.0:8080
2020-06-08 13:14:35,509 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2020-06-08 13:14:35,510 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, keycloak-authorization, mutiny, oidc, reactive-pg-client, resteasy, resteasy-jsonb, resteasy-mutiny, security, smallrye-health, vault, vertx, vertx-web]
...
2020-06-08 13:17:20,289 ERROR [org.acm.get.sta.res.BsbResource] (vert.x-eventloop-thread-14) Error: io.vertx.pgclient.PgException: password authentication failed for user "v-userpass-insuranc-7feANaQBPoMFUKqmTsrh-1591586075"
at io.vertx.pgclient.impl.codec.ErrorResponse.toException(ErrorResponse.java:29)
at io.vertx.pgclient.impl.codec.InitCommandCodec.handleErrorResponse(InitCommandCodec.java:98)
at io.vertx.pgclient.impl.codec.PgDecoder.decodeError(PgDecoder.java:235)
at io.vertx.pgclient.impl.codec.PgDecoder.decodeMessage(PgDecoder.java:123)
at io.vertx.pgclient.impl.codec.PgDecoder.channelRead(PgDecoder.java:103)
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Darwin Marks-Mac-Pro.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
- Output of `java -version`: openjdk 11.0.7 2020-04-14
OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
- GraalVM version (if different from Java): see above
- Quarkus version or git rev: 1.5.0.FINAL
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3
| 4618401be05bd8e04229de3d7ff2cfdc2f71db64 | cb591d9eacdd6df20ca4deb02af8a35ab8de09df | https://github.com/quarkusio/quarkus/compare/4618401be05bd8e04229de3d7ff2cfdc2f71db64...cb591d9eacdd6df20ca4deb02af8a35ab8de09df | diff --git a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
index e97f62198af..4cebcf047df 100644
--- a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
+++ b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
@@ -108,7 +108,7 @@ private MySQLConnectOptions toMySQLConnectOptions(DataSourceRuntimeConfig dataSo
mysqlConnectOptions.setUser(user);
}
if (password != null) {
- mysqlConnectOptions.setPassword(user);
+ mysqlConnectOptions.setPassword(password);
}
}
| ['extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,416,788 | 1,829,440 | 243,869 | 2,612 | 115 | 14 | 2 | 1 | 3,749 | 342 | 1,109 | 61 | 3 | 2 | 1970-01-01T00:26:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,044 | quarkusio/quarkus/9850/9849 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9849 | https://github.com/quarkusio/quarkus/pull/9850 | https://github.com/quarkusio/quarkus/pull/9850 | 1 | closes | Vault Database Credentials - Invalid Password (reactive-pg-client) | **Describe the bug**
I've followed the instructions here for setting up Vault and Quarkus: [QUARKUS - USING HASHICORP VAULT WITH DATABASES](https://quarkus.io/guides/vault-datasource). However, Quarkus cannot connect to my Postgres database.
**Expected behavior**
Quarkus should be able to get credentials from Vault and successfully connect to Postgres database.
**Actual behavior**
Quarkus cannot connect to my Postgres database - I always received "password authentication failure".
There is a bug in PgPoolRecorder @ line 113 (on master) which is setting the password from the username field. I'll submit a PR to fix. I've raised this bug in case others run into the same issue.
**To Reproduce**
Steps to reproduce the behavior:
1. Configure Vault per the instructions
2. Configurate Quarkus per the instructions
3. Run the Quarkus app
4. Quarkus cannot connect to the database
**Configuration**
```properties
quarkus.banner.enabled=false
quarkus.log.level=DEBUG
quarkus.datasource.metrics.enabled=true
quarkus.datasource.db-kind=pg
quarkus.datasource.credentials-provider=insurance-database
quarkus.datasource.reactive.url=postgresql://localhost:5432/postgres
quarkus.datasource.reactive.max-size=20
quarkus.vault.url=http://localhost:8200
quarkus.vault.authentication.userpass.username=insurance
quarkus.vault.authentication.userpass.password=password
quarkus.vault.credentials-provider.insurance-database.database-credentials-role=insurance
quarkus.vault.health.enabled=true
```
**Log Output**
```
2020-06-08 13:14:35,447 DEBUG [io.qua.vau.run.VaultDbManager] (Quarkus Main Thread) generated insurance credentials: {leaseId: database/creds/insurance/D1ruZvpxYZOdN0mhTFpFHLlg, renewable: true, leaseDuration: 3600s, valid_until: Mon Jun 08 14:14:35 AEST 2020, username: v-userpass-insuranc-7feANaQBPoMFUKqmTsrh-1591586075, password:***}
2020-06-08 13:14:35,509 INFO [io.quarkus] (Quarkus Main Thread) getting-started 1.0-SNAPSHOT on JVM (powered by Quarkus 1.5.0.Final) started in 7.710s. Listening on: http://0.0.0.0:8080
2020-06-08 13:14:35,509 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2020-06-08 13:14:35,510 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, keycloak-authorization, mutiny, oidc, reactive-pg-client, resteasy, resteasy-jsonb, resteasy-mutiny, security, smallrye-health, vault, vertx, vertx-web]
...
2020-06-08 13:17:20,289 ERROR [org.acm.get.sta.res.BsbResource] (vert.x-eventloop-thread-14) Error: io.vertx.pgclient.PgException: password authentication failed for user "v-userpass-insuranc-7feANaQBPoMFUKqmTsrh-1591586075"
at io.vertx.pgclient.impl.codec.ErrorResponse.toException(ErrorResponse.java:29)
at io.vertx.pgclient.impl.codec.InitCommandCodec.handleErrorResponse(InitCommandCodec.java:98)
at io.vertx.pgclient.impl.codec.PgDecoder.decodeError(PgDecoder.java:235)
at io.vertx.pgclient.impl.codec.PgDecoder.decodeMessage(PgDecoder.java:123)
at io.vertx.pgclient.impl.codec.PgDecoder.channelRead(PgDecoder.java:103)
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Darwin Marks-Mac-Pro.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
- Output of `java -version`: openjdk 11.0.7 2020-04-14
OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
- GraalVM version (if different from Java): see above
- Quarkus version or git rev: 1.5.0.FINAL
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.3
| 6767ec9c0777f74726e27fa9f11f90e506660248 | 8098f6062f36fe17ca5019bd860582203be2c081 | https://github.com/quarkusio/quarkus/compare/6767ec9c0777f74726e27fa9f11f90e506660248...8098f6062f36fe17ca5019bd860582203be2c081 | diff --git a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
index bf4971bc53d..b9734ed18e6 100644
--- a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
+++ b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
@@ -110,7 +110,7 @@ private PgConnectOptions toPgConnectOptions(DataSourceRuntimeConfig dataSourceRu
pgConnectOptions.setUser(user);
}
if (password != null) {
- pgConnectOptions.setPassword(user);
+ pgConnectOptions.setPassword(password);
}
}
| ['extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,368,855 | 1,820,640 | 242,763 | 2,601 | 109 | 14 | 2 | 1 | 3,749 | 342 | 1,109 | 61 | 3 | 2 | 1970-01-01T00:26:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,045 | quarkusio/quarkus/9810/9748 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9748 | https://github.com/quarkusio/quarkus/pull/9810 | https://github.com/quarkusio/quarkus/pull/9810 | 1 | fixes | Dev mode stops without reason instead of restart when fired by code Changed (worked with 1.4.2.Final) | **Describe the bug**
Problem can be simulated on the example from camel-quarkus: https://github.com/apache/camel-quarkus/tree/master/examples/timer-log
Problem doesn't happen with quarkus **1.4.2.Final**. (but happens with 1.5.0.cr1, 1.5.0.Final and master)
**Expected behavior**
App is reloaded with custom code change.
**Actual behavior**
App stops.
**To Reproduce**
Steps to reproduce the behavior:
1. Download https://github.com/apache/camel-quarkus/tree/master/examples/timer-log (version of quarkus could be chaged in https://github.com/apache/camel-quarkus/blob/master/pom.xml#L69)
2. Run mvn compile quarkus:dev
3. Change message in TimeRoute.java
**Additional context**
Problem seems to be happening somewhere near https://github.com/quarkusio/quarkus/blob/master/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java#L84
I can debug that process enters this method with parameter `META-INF/quarkus-config-roots.list` but it never leaves (no exception is thrown), Java ends also.
I've tried to debug issue also in https://github.com/quarkusio/quarkus/blob/master/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java#L154,
but it usually ens in different places. I'm probably missing something here.
| 25bba0abc7b357d94a550b98340e41d257d8a8eb | b81d579056e10081df25e3930382e51d218166e1 | https://github.com/quarkusio/quarkus/compare/25bba0abc7b357d94a550b98340e41d257d8a8eb...b81d579056e10081df25e3930382e51d218166e1 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
index be15968e689..174d1f4accc 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java
@@ -12,6 +12,7 @@
import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
+import java.util.concurrent.CountDownLatch;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Predicate;
@@ -52,6 +53,7 @@ public class IsolatedDevModeMain implements BiConsumer<CuratedApplication, Map<S
private static volatile AugmentAction augmentAction;
private static volatile boolean restarting;
private static volatile boolean firstStartCompleted;
+ private static final CountDownLatch shutdownLatch = new CountDownLatch(1);
private synchronized void firstStart() {
ClassLoader old = Thread.currentThread().getContextClassLoader();
@@ -228,6 +230,24 @@ public void close() {
@Override
public void accept(CuratedApplication o, Map<String, Object> o2) {
Timing.staticInitStarted(o.getBaseRuntimeClassLoader());
+ //https://github.com/quarkusio/quarkus/issues/9748
+ //if you have an app with all daemon threads then the app thread
+ //may be the only thread keeping the JVM alive
+ //during the restart process when this thread is stopped then
+ //the JVM will die
+ //we start this thread to keep the JVM alive until the shutdown hook is run
+ //even for command mode we still want the JVM to live until it receives
+ //a signal to make the 'press enter to restart' function to work
+ new Thread(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ shutdownLatch.await();
+ } catch (InterruptedException ignore) {
+
+ }
+ }
+ }, "Quarkus Devmode keep alive thread").start();
try {
curatedApplication = o;
@@ -282,6 +302,7 @@ public boolean test(String s) {
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
+ shutdownLatch.countDown();
synchronized (DevModeMain.class) {
if (runner != null) {
try { | ['core/deployment/src/main/java/io/quarkus/deployment/dev/IsolatedDevModeMain.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,323,286 | 1,811,982 | 241,670 | 2,587 | 1,012 | 197 | 21 | 1 | 1,317 | 119 | 323 | 27 | 5 | 0 | 1970-01-01T00:26:31 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,046 | quarkusio/quarkus/9656/9539 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9539 | https://github.com/quarkusio/quarkus/pull/9656 | https://github.com/quarkusio/quarkus/pull/9656 | 1 | fixes | Query parameters lost on redirect to OIDC provider | **Describe the bug**
When using OpenID Connect (OIDC) to protect web applications, query parameters are lost if the user is redirected to login first.
**Expected behavior**
After the user has successfully authenticated with the OIDC provider, he/she should be redirected to the same URL that was initially requested.
**Actual behavior**
After the user has successfully authenticated with the OIDC provider, he/she is redirected to a different URL. The URL has the same scheme, host and path but different query parameters. The original query parameters are missing. Instead the query paramters `session`, `state` and `code` are present.
**To Reproduce**
Steps to reproduce the behavior:
1. `git clone https://github.com/quarkusio/quarkus-quickstarts.git`
2. Open the project `security-openid-connect-web-authentication-quickstart `
3. Configure a valid OIDC provider in `application.properties`
4. Extend the class`TokenResource` as shown below
5. Open the URL `http://localhost:8080/tokens?myparam=abc`
After authenticating, the URL is something like `http://localhost:8080/tokens?state=8b...3e&session_state=3f...57&code=bc...5c (instead of `http://localhost:8080/tokens?myparam=abc`).
The page starts with `myparam: null` (instead of `myparam: abc`).
**Configuration**
Same as example project except for:
- `quarkus.oidc.auth-server-url`
- `quarkus.oidc.client-id=abcfund`
- `quarkus.oidc.credentials.client_secret.value`
**Modified code for `TokenResource`**
Add query parameters in signature of method `getTokens` and output them as HTML:
```java
@GET
public String getTokens(@QueryParam("myparam") String myparam) {
StringBuilder response = new StringBuilder().append("<html>")
.append("<body>")
.append("<ul>");
response.append("<li>myparam: ").append(myparam).append("</li>");
...
```
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: Microsoft Windows [Version 10.0.18363.836]
- Output of `java -version`: openjdk version "13.0.1" 2019-10-15
- GraalVM version (if different from Java):
- Quarkus version or git rev: 1.4.2.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T17:06:16+02:00)
**Additional context**
The OIDC provider used was a Keycloak instance configured for authentication code flow and requiring a client secret for the flow.
**Additional thoughts**
I'm asking myself what would happend with a POST request. Would the request body be saved and replayed after the redirect?
| a0cbe08167b2a05bc279e251a2ed0702b04c7fd4 | 848d20657120a0f1321b7ad44d4202aaa0036a50 | https://github.com/quarkusio/quarkus/compare/a0cbe08167b2a05bc279e251a2ed0702b04c7fd4...848d20657120a0f1321b7ad44d4202aaa0036a50 | 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 2b813b876c0..5c2331a3d48 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
@@ -185,6 +185,7 @@ private Uni<SecurityIdentity> performCodeFlow(IdentityProviderManager identityPr
TenantConfigContext configContext = resolver.resolve(context, true);
Cookie stateCookie = context.getCookie(getStateCookieName(configContext));
+ String userQuery = null;
if (stateCookie != null) {
List<String> values = context.queryParam("state");
// IDP must return a 'state' query parameter and the value of the state cookie must start with this parameter's value
@@ -200,22 +201,42 @@ private Uni<SecurityIdentity> performCodeFlow(IdentityProviderManager identityPr
if (pair.length == 2) {
// The extra path that needs to be added to the current request path
String extraPath = pair[1];
- // Adding a query marker that the state cookie has already been used to restore the path
- // as deleting it now would increase the risk of CSRF
- String extraQuery = "?pathChecked=true";
- // The query parameters returned from IDP need to be included
- if (context.request().query() != null) {
- extraQuery += ("&" + context.request().query());
- }
+ // The original user query if any will be added to the final redirect URI
+ // after the authentication has been complete
+
+ int userQueryIndex = extraPath.indexOf("?");
+ if (userQueryIndex != 0) {
+ if (userQueryIndex > 0) {
+ extraPath = extraPath.substring(0, userQueryIndex);
+ }
+ // Adding a query marker that the state cookie has already been used to restore the path
+ // as deleting it now would increase the risk of CSRF
+ String extraQuery = "?pathChecked=true";
- String localRedirectUri = buildUri(context, isForceHttps(configContext), extraPath + extraQuery);
- LOG.debugf("Local redirect URI: %s", localRedirectUri);
- return Uni.createFrom().failure(new AuthenticationRedirectException(localRedirectUri));
+ // The query parameters returned from IDP need to be included
+ if (context.request().query() != null) {
+ extraQuery += ("&" + context.request().query());
+ }
+
+ String localRedirectUri = buildUri(context, isForceHttps(configContext), extraPath + extraQuery);
+ LOG.debugf("Local redirect URI: %s", localRedirectUri);
+ return Uni.createFrom().failure(new AuthenticationRedirectException(localRedirectUri));
+ } else if (userQueryIndex + 1 < extraPath.length()) {
+ // only the user query needs to be restored, no need to redirect
+ userQuery = extraPath.substring(userQueryIndex + 1);
+ }
}
// The original request path does not have to be restored, the state cookie is no longer needed
removeCookie(context, configContext, getStateCookieName(configContext));
} else {
+ String[] pair = COOKIE_PATTERN.split(stateCookie.getValue());
+ if (pair.length == 2) {
+ int userQueryIndex = pair[1].indexOf("?");
+ if (userQueryIndex >= 0 && userQueryIndex + 1 < pair[1].length()) {
+ userQuery = pair[1].substring(userQueryIndex + 1);
+ }
+ }
// Local redirect restoring the original request path, the state cookie is no longer needed
removeCookie(context, configContext, getStateCookieName(configContext));
}
@@ -244,6 +265,7 @@ private Uni<SecurityIdentity> performCodeFlow(IdentityProviderManager identityPr
params.put("client_assertion", signJwtWithClientSecret(configContext.oidcConfig));
}
+ final String finalUserQuery = userQuery;
return Uni.createFrom().emitter(new Consumer<UniEmitter<? super SecurityIdentity>>() {
@Override
public void accept(UniEmitter<? super SecurityIdentity> uniEmitter) {
@@ -267,7 +289,10 @@ public void accept(SecurityIdentity identity) {
processSuccessfulAuthentication(context, configContext, result, identity);
if (configContext.oidcConfig.authentication.removeRedirectParameters
&& context.request().query() != null) {
- final String finalRedirectUri = buildUriWithoutQueryParams(context);
+ String finalRedirectUri = buildUriWithoutQueryParams(context);
+ if (finalUserQuery != null) {
+ finalRedirectUri += ("?" + finalUserQuery);
+ }
LOG.debugf("Final redirect URI: %s", finalRedirectUri);
uniEmitter.fail(new AuthenticationRedirectException(finalRedirectUri));
} else {
@@ -332,10 +357,17 @@ private String generateCodeFlowState(RoutingContext context, TenantConfigContext
String cookieValue = uuid;
Authentication auth = configContext.oidcConfig.getAuthentication();
- if (auth.isRestorePathAfterRedirect() && !redirectPath.equals(context.request().path())) {
- cookieValue += (COOKIE_DELIM + context.request().path());
+ if (auth.isRestorePathAfterRedirect()) {
+ String requestPath = !redirectPath.equals(context.request().path()) ? context.request().path() : "";
+ if (context.request().query() != null) {
+ requestPath += ("?" + context.request().query());
+ }
+ if (!requestPath.isEmpty()) {
+ cookieValue += (COOKIE_DELIM + requestPath);
+ }
}
- return createCookie(context, configContext, getStateCookieName(configContext), cookieValue, 60 * 30).getValue();
+ createCookie(context, configContext, getStateCookieName(configContext), cookieValue, 60 * 30);
+ return uuid;
}
private String generatePostLogoutState(RoutingContext context, TenantConfigContext configContext) {
diff --git a/integration-tests/oidc-code-flow/src/main/java/io/quarkus/it/keycloak/ProtectedResource.java b/integration-tests/oidc-code-flow/src/main/java/io/quarkus/it/keycloak/ProtectedResource.java
index 570d4f7f5c4..41574f0a9d1 100644
--- a/integration-tests/oidc-code-flow/src/main/java/io/quarkus/it/keycloak/ProtectedResource.java
+++ b/integration-tests/oidc-code-flow/src/main/java/io/quarkus/it/keycloak/ProtectedResource.java
@@ -4,6 +4,7 @@
import javax.ws.rs.GET;
import javax.ws.rs.InternalServerErrorException;
import javax.ws.rs.Path;
+import javax.ws.rs.QueryParam;
import org.eclipse.microprofile.jwt.JsonWebToken;
@@ -101,4 +102,10 @@ public String refresh() {
}
return refreshToken.getToken() != null && !refreshToken.getToken().isEmpty() ? "RT injected" : "no refresh";
}
+
+ @GET
+ @Path("refresh-query")
+ public String refresh(@QueryParam("a") String aValue) {
+ return refresh() + ":" + aValue;
+ }
}
diff --git a/integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java b/integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java
index 2d67ba84fae..6f83c516172 100644
--- a/integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java
+++ b/integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java
@@ -480,6 +480,26 @@ public void testAccessAndRefreshTokenInjectionWithoutIndexHtml() throws IOExcept
}
}
+ @Test
+ public void testAccessAndRefreshTokenInjectionWithoutIndexHtmlWithQuery() throws Exception {
+ try (final WebClient webClient = createWebClient()) {
+ HtmlPage page = webClient.getPage("http://localhost:8081/web-app/refresh-query?a=aValue");
+ assertEquals("/web-app/refresh-query?a=aValue", getStateCookieSavedPath(webClient, null));
+
+ assertEquals("Log in to quarkus", page.getTitleText());
+
+ HtmlForm loginForm = page.getForms().get(0);
+
+ loginForm.getInputByName("username").setValueAttribute("alice");
+ loginForm.getInputByName("password").setValueAttribute("alice");
+
+ page = loginForm.getInputByName("login").click();
+
+ assertEquals("RT injected:aValue", page.getBody().asText());
+ webClient.getCookieManager().clearCookies();
+ }
+ }
+
@Test
public void testNoCodeFlowUnprotected() {
RestAssured.when().get("/public-web-app/access") | ['integration-tests/oidc-code-flow/src/main/java/io/quarkus/it/keycloak/ProtectedResource.java', 'integration-tests/oidc-code-flow/src/test/java/io/quarkus/it/keycloak/CodeFlowTest.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/CodeAuthenticationMechanism.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 9,293,909 | 1,806,289 | 240,945 | 2,576 | 4,083 | 710 | 60 | 1 | 2,678 | 305 | 677 | 55 | 4 | 1 | 1970-01-01T00:26:30 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,047 | quarkusio/quarkus/9644/9642 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9642 | https://github.com/quarkusio/quarkus/pull/9644 | https://github.com/quarkusio/quarkus/pull/9644 | 1 | fixes | Reactive datasource config: cache-prepared-statements is not specific to any DB | `cache-prepared-statements` config attribute is duplicated in MySQL and Postgres configs.
It should be a common attribute of any Reactive SQL client. | 9de653db36d0dedb8e778e89d928d5dfaaae9034 | 93b91ebd68c9a1bbce4701f0e8a81b6d2332e079 | https://github.com/quarkusio/quarkus/compare/9de653db36d0dedb8e778e89d928d5dfaaae9034...93b91ebd68c9a1bbce4701f0e8a81b6d2332e079 | diff --git a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java
index b9092a94050..709d06a23dc 100644
--- a/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java
+++ b/extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java
@@ -17,6 +17,12 @@
@ConfigRoot(name = "datasource.reactive", phase = ConfigPhase.RUN_TIME)
public class DataSourceReactiveRuntimeConfig {
+ /**
+ * Whether prepared statements should be cached on the client side.
+ */
+ @ConfigItem(defaultValue = "false")
+ public boolean cachePreparedStatements;
+
/**
* The datasource URL.
*/
diff --git a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/DataSourceReactiveMySQLConfig.java b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/DataSourceReactiveMySQLConfig.java
index 6f3bd3688a3..e109c2f5818 100644
--- a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/DataSourceReactiveMySQLConfig.java
+++ b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/DataSourceReactiveMySQLConfig.java
@@ -12,8 +12,11 @@ public class DataSourceReactiveMySQLConfig {
/**
* Whether prepared statements should be cached on the client side.
+ *
+ * @deprecated use {@code datasource.reactive.cache-prepared-statements} instead.
*/
@ConfigItem
+ @Deprecated
public Optional<Boolean> cachePreparedStatements;
/**
diff --git a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/LegacyDataSourceReactiveMySQLConfig.java b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/LegacyDataSourceReactiveMySQLConfig.java
index b103aaacd8b..d13c790e97b 100644
--- a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/LegacyDataSourceReactiveMySQLConfig.java
+++ b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/LegacyDataSourceReactiveMySQLConfig.java
@@ -11,21 +11,21 @@
public class LegacyDataSourceReactiveMySQLConfig {
/**
- * @deprecated use quarkus.datasource.reactive.mysql.cache-prepared-statements instead.
+ * @deprecated use {@code quarkus.datasource.reactive.cache-prepared-statements} instead.
*/
@ConfigItem
@Deprecated
public Optional<Boolean> cachePreparedStatements;
/**
- * @deprecated use quarkus.datasource.reactive.mysql.charset instead.
+ * @deprecated use {@code quarkus.datasource.reactive.mysql.charset} instead.
*/
@ConfigItem
@Deprecated
public Optional<String> charset;
/**
- * @deprecated use quarkus.datasource.reactive.mysql.collation instead.
+ * @deprecated use {@code quarkus.datasource.reactive.mysql.collation} instead.
*/
@ConfigItem
@Deprecated
diff --git a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
index d0926fda274..a9bd9517455 100644
--- a/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
+++ b/extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java
@@ -11,6 +11,8 @@
import java.util.Map;
+import org.jboss.logging.Logger;
+
import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.credentials.CredentialsProvider;
import io.quarkus.credentials.runtime.CredentialsProviderFinder;
@@ -30,6 +32,9 @@
@Recorder
@SuppressWarnings("deprecation")
public class MySQLPoolRecorder {
+
+ private static final Logger log = Logger.getLogger(MySQLPoolRecorder.class);
+
public RuntimeValue<MySQLPool> configureMySQLPool(RuntimeValue<Vertx> vertx, BeanContainer container,
DataSourcesRuntimeConfig dataSourcesRuntimeConfig,
DataSourceReactiveRuntimeConfig dataSourceReactiveRuntimeConfig,
@@ -119,8 +124,12 @@ private MySQLConnectOptions toMySQLConnectOptions(DataSourceRuntimeConfig dataSo
}
if (dataSourceReactiveMySQLConfig.cachePreparedStatements.isPresent()) {
+ log.warn("datasource.reactive.mysql.cache-prepared-statements is deprecated, use datasource.reactive.cache-prepared-statements instead");
mysqlConnectOptions.setCachePreparedStatements(dataSourceReactiveMySQLConfig.cachePreparedStatements.get());
+ } else {
+ mysqlConnectOptions.setCachePreparedStatements(dataSourceReactiveRuntimeConfig.cachePreparedStatements);
}
+
if (dataSourceReactiveMySQLConfig.charset.isPresent()) {
mysqlConnectOptions.setCharset(dataSourceReactiveMySQLConfig.charset.get());
}
diff --git a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/DataSourceReactivePostgreSQLConfig.java b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/DataSourceReactivePostgreSQLConfig.java
index a1748ff6ec0..b1dd120d5a8 100644
--- a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/DataSourceReactivePostgreSQLConfig.java
+++ b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/DataSourceReactivePostgreSQLConfig.java
@@ -13,8 +13,11 @@ public class DataSourceReactivePostgreSQLConfig {
/**
* Whether prepared statements should be cached on the client side.
+ *
+ * @deprecated use {@code datasource.reactive.cache-prepared-statements} instead.
*/
@ConfigItem
+ @Deprecated
public Optional<Boolean> cachePreparedStatements;
/**
diff --git a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/LegacyDataSourceReactivePostgreSQLConfig.java b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/LegacyDataSourceReactivePostgreSQLConfig.java
index cbfe8787bcd..e28965a7d64 100644
--- a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/LegacyDataSourceReactivePostgreSQLConfig.java
+++ b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/LegacyDataSourceReactivePostgreSQLConfig.java
@@ -12,14 +12,14 @@
public class LegacyDataSourceReactivePostgreSQLConfig {
/**
- * @deprecated use quarkus.datasource.reactive.postgresql.cache-prepared-statements instead.
+ * @deprecated use {@code quarkus.datasource.reactive.cache-prepared-statements} instead.
*/
@ConfigItem
@Deprecated
public Optional<Boolean> cachePreparedStatements;
/**
- * @deprecated use quarkus.datasource.reactive.postgresql.pipelining-limit instead.
+ * @deprecated use {@code quarkus.datasource.reactive.postgresql.pipelining-limit} instead.
*/
@ConfigItem
@Deprecated
diff --git a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
index b6adc5c95c2..6dc0df3e29e 100644
--- a/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
+++ b/extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java
@@ -11,6 +11,8 @@
import java.util.Map;
+import org.jboss.logging.Logger;
+
import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.credentials.CredentialsProvider;
import io.quarkus.credentials.runtime.CredentialsProviderFinder;
@@ -31,6 +33,8 @@
@SuppressWarnings("deprecation")
public class PgPoolRecorder {
+ private static final Logger log = Logger.getLogger(PgPoolRecorder.class);
+
public RuntimeValue<PgPool> configurePgPool(RuntimeValue<Vertx> vertx, BeanContainer container,
DataSourcesRuntimeConfig dataSourcesRuntimeConfig,
DataSourceReactiveRuntimeConfig dataSourceReactiveRuntimeConfig,
@@ -121,8 +125,12 @@ private PgConnectOptions toPgConnectOptions(DataSourceRuntimeConfig dataSourceRu
}
if (dataSourceReactivePostgreSQLConfig.cachePreparedStatements.isPresent()) {
+ log.warn("datasource.reactive.postgresql.cache-prepared-statements is deprecated, use datasource.reactive.cache-prepared-statements instead");
pgConnectOptions.setCachePreparedStatements(dataSourceReactivePostgreSQLConfig.cachePreparedStatements.get());
+ } else {
+ pgConnectOptions.setCachePreparedStatements(dataSourceReactiveRuntimeConfig.cachePreparedStatements);
}
+
if (dataSourceReactivePostgreSQLConfig.pipeliningLimit.isPresent()) {
pgConnectOptions.setPipeliningLimit(dataSourceReactivePostgreSQLConfig.pipeliningLimit.getAsInt());
} | ['extensions/reactive-datasource/runtime/src/main/java/io/quarkus/reactive/datasource/runtime/DataSourceReactiveRuntimeConfig.java', 'extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/DataSourceReactivePostgreSQLConfig.java', 'extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/PgPoolRecorder.java', 'extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/LegacyDataSourceReactiveMySQLConfig.java', 'extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/MySQLPoolRecorder.java', 'extensions/reactive-pg-client/runtime/src/main/java/io/quarkus/reactive/pg/client/runtime/LegacyDataSourceReactivePostgreSQLConfig.java', 'extensions/reactive-mysql-client/runtime/src/main/java/io/quarkus/reactive/mysql/client/runtime/DataSourceReactiveMySQLConfig.java'] | {'.java': 7} | 7 | 7 | 0 | 0 | 7 | 9,601,123 | 1,865,870 | 248,467 | 2,667 | 2,103 | 421 | 39 | 7 | 152 | 21 | 30 | 3 | 0 | 0 | 1970-01-01T00:26:30 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,048 | quarkusio/quarkus/9637/9635 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9635 | https://github.com/quarkusio/quarkus/pull/9637 | https://github.com/quarkusio/quarkus/pull/9637 | 1 | fix | Panache - could not find indexed method | As discussed [on zulip](https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/Panache.20-.20Could.20not.20find.20indexed.20method) if a panache entity overrides a static method from `PanacheEntityBase` with an array argument the fails with:
```
Caused by: java.lang.IllegalStateException: Could not find indexed method: Lio/quarkus/it/panache/Beer;.persist with descriptor (Ljava/lang/Object;[Ljava/lang/Object;)V and arg types [java.lang.Object, java/lang/Object[]]
at io.quarkus.panache.common.deployment.PanacheEntityEnhancer$PanacheEntityClassVisitor.visitMethod(PanacheEntityEnhancer.java:142)
```
The arg type `java/lang/Object[]` is very likely wrong.
Steps to reproduce:
1. Modify the [Beer](https://github.com/quarkusio/quarkus/blob/master/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/Beer.java) entity as follows
2. Run the `TransactionalRepositoryTest` from `integration-tests/hibernate-orm-panache`
```java
@Entity
public class Beer extends PanacheEntity {
public String name;
public static void persist(Object firstEntity, Object... entities) {
PanacheEntityBase.persist(firstEntity, entities);
}
}
``` | 07a61d007e4257d9a4adcacc57c2c54392d28ebc | a2093c0259127518de56d54cd7a9b6dfbf633155 | https://github.com/quarkusio/quarkus/compare/07a61d007e4257d9a4adcacc57c2c54392d28ebc...a2093c0259127518de56d54cd7a9b6dfbf633155 | diff --git a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/JandexUtil.java b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/JandexUtil.java
index 7c7323a7e6c..d7f1d218975 100644
--- a/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/JandexUtil.java
+++ b/extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/JandexUtil.java
@@ -450,7 +450,8 @@ public static Type[] getParameterTypes(String methodDescriptor) {
String binaryName = argsSignature.substring(i + 1, end);
// arrays take the entire signature
if (dimensions > 0) {
- args.add(Type.create(DotName.createSimple(argsSignature.substring(start, end + 1)), Kind.ARRAY));
+ args.add(Type.create(DotName.createSimple(argsSignature.substring(start, end + 1).replace('/', '.')),
+ Kind.ARRAY));
dimensions = 0;
} else {
// class names take only the binary name
diff --git a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/Person.java b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/Person.java
index 62918ba9160..4fc3066edb5 100644
--- a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/Person.java
+++ b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/Person.java
@@ -23,6 +23,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import io.quarkus.hibernate.orm.panache.PanacheEntity;
+import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
+import io.quarkus.hibernate.orm.panache.PanacheQuery;
+import io.quarkus.hibernate.orm.panache.runtime.JpaOperations;
@XmlRootElement
@Entity(name = "Person2")
@@ -56,6 +59,11 @@ public static List<Person> findOrdered() {
return find("ORDER BY name").list();
}
+ // For https://github.com/quarkusio/quarkus/issues/9635
+ public static <T extends PanacheEntityBase> PanacheQuery<T> find(String query, Object... params) {
+ return (PanacheQuery<T>) JpaOperations.find(Person.class, query, params);
+ }
+
// For JAXB: both getter and setter are required
// Here we make sure the field is not used by Hibernate, but the accessor is used by jaxb, jsonb and jackson
@JsonProperty | ['extensions/panache/panache-common/deployment/src/main/java/io/quarkus/panache/common/deployment/JandexUtil.java', 'integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/Person.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 9,285,524 | 1,804,354 | 240,761 | 2,574 | 296 | 54 | 3 | 1 | 1,209 | 90 | 307 | 25 | 2 | 2 | 1970-01-01T00:26:30 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,051 | quarkusio/quarkus/9562/9515 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9515 | https://github.com/quarkusio/quarkus/pull/9562 | https://github.com/quarkusio/quarkus/pull/9562 | 1 | fixes | 1.5.0.CR1 ClassCastException in multi-module maven project | **Describe the bug**
1.5.0.CR1 introduces a new regression that was not present in 1.4.2.Final.
An invalid ClassCastException occurs within code that was generated by the quarkus-infinispan client during the execution of unit tests.
**Expected behavior**
The Generated code functions without error.
**Actual behavior**
This exception is raised during unit testing:
```
[ERROR] persist_GivenIdentifierWithId_UsesExistingId Time elapsed: 0.019 s <<< ERROR!
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.infinispan.client.deployment.InfinispanClientProcessor#setup threw an exception: java.lang.ClassCastException: class com.lr.core.caching.initializers.IdentifierContextInitializerImpl cannot be cast to class org.infinispan.protostream.SerializationContextInitializer (com.lr.core.caching.initializers.IdentifierContextInitializerImpl is in unnamed module of loader 'app'; org.infinispan.protostream.SerializationContextInitializer is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @58cda03f)
at io.quarkus.infinispan.client.deployment.InfinispanClientProcessor.setup(InfinispanClientProcessor.java:158)
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:932)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
```
**To Reproduce**
Steps to reproduce the behavior:
1. Create a multi-module maven project
2. In module A
- Define a class you wish to use with an infinispan cache. Annotate the class with the appropriate `@ProtoField` annotations. In our case the class is called `Identifier`
- Define the interface required to generate the proto. for example:
```
@AutoProtoSchemaBuilder(
includeClasses = {Identifier.class},
schemaPackageName = "com.lr.core.v1.initializer")
public interface IdentifierContextInitializer extends SerializationContextInitializer {}
```
3. in module B ( which depends on module A )
- Define a class which utilizes the classes defined in module A and define the interface required to generate its proto. for example:
```
@AutoProtoSchemaBuilder(
dependsOn = IdentifierContextInitializer.class,
includeClasses = DependentClass.class)
public interface DependentClassContextInitializer extends SerializationContextInitializer {}
```
4. Run a test in module B and you will see this exception:
```
[ERROR] persist_GivenIdentifierWithId_UsesExistingId Time elapsed: 0.019 s <<< ERROR!
java.lang.RuntimeException:
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.infinispan.client.deployment.InfinispanClientProcessor#setup threw an exception: java.lang.ClassCastException: class com.logrhythm.core.caching.initializers.IdentifierContextInitializerImpl cannot be cast to class org.infinispan.protostream.SerializationContextInitializer (com.lr.core.caching.initializers.IdentifierContextInitializerImpl is in unnamed module of loader 'app'; org.infinispan.protostream.SerializationContextInitializer is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @58cda03f)
at io.quarkus.infinispan.client.deployment.InfinispanClientProcessor.setup(InfinispanClientProcessor.java:158)
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:932)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
```
**Configuration**
```properties
# Add your application.properties here, if applicable.
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
Darwin USMACEA090SSCOT 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
- Output of `java -version`:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.6+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.6+10, mixed mode)
- GraalVM version (if different from Java):
- Quarkus version or git rev:
1.5.0.CR1
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
Apache Maven 3.6.3
**Additional context**
(Add any other context about the problem here.)
| 5c0e7e53581f1dda2724cb013a08132d10ed864b | 054f4f6cbdae37ecd7d6e3b806d3a0a0c2927e49 | https://github.com/quarkusio/quarkus/compare/5c0e7e53581f1dda2724cb013a08132d10ed864b...054f4f6cbdae37ecd7d6e3b806d3a0a0c2927e49 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
index f2f13173380..ee5f6222869 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java
@@ -26,7 +26,7 @@ public class DirectoryClassPathElement extends AbstractClassPathElement {
public DirectoryClassPathElement(Path root) {
assert root != null : "root is null";
- this.root = root;
+ this.root = root.normalize();
}
@Override | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/DirectoryClassPathElement.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,221,657 | 1,791,925 | 239,228 | 2,557 | 65 | 13 | 2 | 1 | 6,337 | 453 | 1,442 | 106 | 0 | 5 | 1970-01-01T00:26:30 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,061 | quarkusio/quarkus/9248/9216 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9216 | https://github.com/quarkusio/quarkus/pull/9248 | https://github.com/quarkusio/quarkus/pull/9248 | 1 | fixes | smallrye-metrics creates counter for private method but does not increase its value | **Describe the bug**
(Describe the problem clearly and concisely.)
If you run a simple project with the following resource, you see the metric `application_build_message_total 0.0` (related to the private method down) being created as soon as the server starts.
However its value does not increase unless the `buildMessage` method is made public.
```java
@Path("/hello")
public class GreetingResource {
@Counted(name = "counter", absolute = true)
@Timed(name = "timer", absolute = true)
@GET
@Produces(MediaType.TEXT_PLAIN)
public Message hello() {
final Message message = buildMessage();
return message;
}
@Counted(name = "build.message", absolute = true)
private Message buildMessage() {
final Message message = new Message();
message.setText(UUID.randomUUID().toString());
return message;
}
}
```
**Expected behavior**
(Describe the expected behavior clearly and concisely.)
The way I see it, 2 options:
1. Do NOT ALLOW interception of private methods -> No metric should be created at all, and it would be nice to get a warning/error message during compilation.
2. Allow interception of private methods -> Metric should be created, and updated accordingly.
**Actual behavior**
(Describe the actual behavior clearly and concisely.)
_See description at the beginning._
**To Reproduce**
Steps to reproduce the behavior:
1. Create Maven project as described in https://quarkus.io/guides/getting-started#bootstrapping-the-project
2. Replace generated resource with class above.
3. Run in any mod, for example, use `mvn quarkus:dev` to quickly change between private & public method.
**Configuration**
_Not applicable._
**Screenshots**
_Not applicable._
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
Linux man-pc 5.6.10-3-MANJARO #1 SMP PREEMPT Sun May 3 11:03:28 UTC 2020 x86_64 GNU/Linux
- Output of `java -version`:
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.0.0 (build 11.0.6+9-jvmci-20.0-b02, mixed mode, sharing)
- GraalVM version (if different from Java):
same as Java above
- Quarkus version or git rev:
1.4.2.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/---/.sdkman/candidates/maven/current
Java version: 11.0.6, vendor: Oracle Corporation, runtime: /home/--/.sdkman/candidates/java/20.0.0.r11-grl
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.6.10-3-manjaro", arch: "amd64", family: "unix"
**Additional context**
(Add any other context about the problem here.)
Started conversation in mailinglinst: https://groups.google.com/forum/#!msg/quarkus-dev/48xmspijNwk/pLx_xpRDCQAJ | 08d1018cdac6b96d2996a7a24fd590ca9bd8b481 | 7d52c12184cffa54cb0be723ab9491bc94348184 | https://github.com/quarkusio/quarkus/compare/08d1018cdac6b96d2996a7a24fd590ca9bd8b481...7d52c12184cffa54cb0be723ab9491bc94348184 | diff --git a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java
index e8eb82b4660..5a4f5262244 100644
--- a/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java
+++ b/extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java
@@ -344,7 +344,14 @@ void registerMetricsFromAnnotatedMethods(SmallRyeMetricsRecorder metrics,
case METHOD:
MethodInfo method = metricAnnotationTarget.asMethod();
if (!method.declaringClass().name().toString().startsWith("io.smallrye.metrics")) {
- collectedMetricsMethods.add(method);
+ if (!Modifier.isPrivate(method.flags())) {
+ collectedMetricsMethods.add(method);
+ } else {
+ LOGGER.warn("Private method is annotated with a metric: " + method +
+ " in class " + method.declaringClass().name() + ". Metrics " +
+ "are not collected for private methods. To enable metrics for this method, make " +
+ "it at least package-private.");
+ }
}
break;
case CLASS: | ['extensions/smallrye-metrics/deployment/src/main/java/io/quarkus/smallrye/metrics/deployment/SmallRyeMetricsProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,867,376 | 1,724,882 | 230,169 | 2,456 | 681 | 92 | 9 | 1 | 2,953 | 354 | 796 | 73 | 2 | 1 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,053 | quarkusio/quarkus/9484/9463 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9463 | https://github.com/quarkusio/quarkus/pull/9484 | https://github.com/quarkusio/quarkus/pull/9484 | 1 | fixes | Bad JSON returned from the default QuarkusErrorServlet | **Describe the bug**
Using quarkus-undertow and quarkus-resteasy, if an exception is thrown in a JAX-RS endpoint and no ExceptionMapper catches it gets forwarded to QuarkusErrorServlet.
In case of JSON Accept header the stack does not get properly escaped there.
For example, I've encountered a stack ending with (there's a tab before ....):
`(SynchronousDispatcher.java:488)\\n ... 53 more`
which produces a JSON with a string including a tab delimiter.
Here is an example of a more thorough escaping from JSON simple.
https://github.com/fangyidong/json-simple/blob/master/src/main/java/org/json/simple/JSONValue.java#L270
**Environment:**
- Quarkus version 1.4.2.Final
| 9ef7784cc0100b12ab9114bdab7d92a30444bae0 | 28e3587c910bec520c40d6d0b5359215e58fee40 | https://github.com/quarkusio/quarkus/compare/9ef7784cc0100b12ab9114bdab7d92a30444bae0...28e3587c910bec520c40d6d0b5359215e58fee40 | diff --git a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java
index 8f109706100..5e2046ef91e 100644
--- a/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java
+++ b/extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java
@@ -40,9 +40,10 @@ protected void service(HttpServletRequest req, HttpServletResponse resp) throws
if (accept != null && accept.contains("application/json")) {
resp.setContentType("application/json");
resp.setCharacterEncoding(StandardCharsets.UTF_8.name());
- String escapedStack = stack.replace(System.lineSeparator(), "\\\\n").replace("\\"", "\\\\\\"");
- StringBuilder jsonPayload = new StringBuilder("{\\"details\\":\\"").append(details).append("\\",\\"stack\\":\\"")
- .append(escapedStack).append("\\"}");
+ String escapedDetails = escapeJsonString(details);
+ String escapedStack = escapeJsonString(stack);
+ StringBuilder jsonPayload = new StringBuilder("{\\"details\\":\\"").append(escapedDetails)
+ .append("\\",\\"stack\\":\\"").append(escapedStack).append("\\"}");
resp.getWriter().write(jsonPayload.toString());
} else {
//We default to HTML representation
@@ -60,12 +61,12 @@ private static String generateStackTrace(final Throwable exception) {
StringWriter stringWriter = new StringWriter();
exception.printStackTrace(new PrintWriter(stringWriter));
- return escapeHtml(stringWriter.toString().trim());
+ return stringWriter.toString().trim();
}
private static String generateHeaderMessage(final Throwable exception, String uuid) {
- return escapeHtml(String.format("Error handling %s, %s: %s", uuid, exception.getClass().getName(),
- extractFirstLine(exception.getMessage())));
+ return String.format("Error handling %s, %s: %s", uuid, exception.getClass().getName(),
+ extractFirstLine(exception.getMessage()));
}
private static String extractFirstLine(final String message) {
@@ -77,14 +78,36 @@ private static String extractFirstLine(final String message) {
return lines[0].trim();
}
- private static String escapeHtml(final String bodyText) {
- if (bodyText == null) {
- return "null";
+ private static String escapeJsonString(final String text) {
+ StringBuilder sb = new StringBuilder();
+ for (int i = 0; i < text.length(); i++) {
+ char ch = text.charAt(i);
+ switch (ch) {
+ case '"':
+ sb.append("\\\\\\"");
+ break;
+ case '\\\\':
+ sb.append("\\\\\\\\");
+ break;
+ case '\\b':
+ sb.append("\\\\b");
+ break;
+ case '\\f':
+ sb.append("\\\\f");
+ break;
+ case '\\n':
+ sb.append("\\\\n");
+ break;
+ case '\\r':
+ sb.append("\\\\r");
+ break;
+ case '\\t':
+ sb.append("\\\\t");
+ break;
+ default:
+ sb.append(ch);
+ }
}
-
- return bodyText
- .replace("&", "&")
- .replace("<", "<")
- .replace(">", ">");
+ return sb.toString();
}
} | ['extensions/undertow/runtime/src/main/java/io/quarkus/undertow/runtime/QuarkusErrorServlet.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,191,643 | 1,786,955 | 238,408 | 2,558 | 2,298 | 404 | 51 | 1 | 692 | 85 | 166 | 16 | 1 | 0 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,054 | quarkusio/quarkus/9435/9295 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9295 | https://github.com/quarkusio/quarkus/pull/9435 | https://github.com/quarkusio/quarkus/pull/9435 | 1 | fixes | Default quarkus.http.access-log.pattern "common" duplicate query_string | With default access-log configuration, the query string is duplicated in access-log.
**To Reproduce**
Steps to reproduce the behavior:
1. GET /myapp?someparam=1
2. In access-log appears: GET /myapp?someparam=value?someparam=value
| 9da2a8f52f9761ab3f7d52782e9f5fd8b56beadd | e7cbc79dadbbf0c711b2dc6daf3c6b589272c240 | https://github.com/quarkusio/quarkus/compare/9da2a8f52f9761ab3f7d52782e9f5fd8b56beadd...e7cbc79dadbbf0c711b2dc6daf3c6b589272c240 | diff --git a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/accesslog/AccessLogFileTestCase.java b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/accesslog/AccessLogFileTestCase.java
index 6e8e98e8a4a..9d16e43c2d5 100644
--- a/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/accesslog/AccessLogFileTestCase.java
+++ b/extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/accesslog/AccessLogFileTestCase.java
@@ -90,7 +90,7 @@ public void after() throws IOException {
@Test
public void testSingleLogMessageToFile() throws IOException, InterruptedException {
- RestAssured.get("/does-not-exist");
+ RestAssured.get("/does-not-exist?foo=bar");
Awaitility.given().pollInterval(100, TimeUnit.MILLISECONDS)
.atMost(10, TimeUnit.SECONDS)
@@ -105,6 +105,10 @@ public void run() throws Throwable {
String data = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
Assertions.assertTrue(data.contains("404"));
Assertions.assertTrue(data.contains("/does-not-exist"));
+ Assertions.assertTrue(data.contains("?foo=bar"),
+ "access log is missing query params");
+ Assertions.assertFalse(data.contains("?foo=bar?foo=bar"),
+ "access log contains duplicated query params");
}
});
}
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RequestLineAttribute.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RequestLineAttribute.java
index b53ea4ad5cf..12b8b4b80f6 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RequestLineAttribute.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RequestLineAttribute.java
@@ -23,10 +23,6 @@ public String readAttribute(final RoutingContext exchange) {
.append(exchange.request().method())
.append(' ')
.append(exchange.request().uri());
- if (exchange.request().query() != null) {
- sb.append('?');
- sb.append(exchange.request().query());
- }
sb.append(' ')
.append(exchange.request().version());
return sb.toString(); | ['extensions/vertx-http/deployment/src/test/java/io/quarkus/vertx/http/accesslog/AccessLogFileTestCase.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/attribute/RequestLineAttribute.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 9,160,701 | 1,781,349 | 237,547 | 2,541 | 142 | 28 | 4 | 1 | 239 | 27 | 58 | 8 | 0 | 0 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,056 | quarkusio/quarkus/9420/9030 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9030 | https://github.com/quarkusio/quarkus/pull/9420 | https://github.com/quarkusio/quarkus/pull/9420 | 1 | fixes | NoClassDefFoundError for transitive dependency when using gradle quarkusDev | **Describe the bug**
When running a Quarkus application in dev mode, `NoClassDefFoundError` occurs for a class that is provided by a transitive dependency, i.e. by a dependency not declared in `build.gradle` but required indirectly by a declared dependency.
The error does not occur when the application is built with `gradle quarkusBuild --uber-jar` and run with `java -jar build/build/trans-dep-1.0.0-SNAPSHOT-runner.jar`.
**Expected behavior**
The application should work no matter if it is run in dev mode or not.
**Actual behavior**
If the application is started with `gradle quarkusDev`, an *internal server error* is returned when a request is made to a REST resource needing the transitive dependency to complete. Both the log and the HTTP response contain a stacktrace:
```
2020-05-03 14:24:58,572 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /hello failed, error id: 010f0882-0682-4c9e-bd7c-b8da19db6d42-1: org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: io/nayuki/qrcodegen/QrCode$Ecc
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:216)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:515)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:259)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:160)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:163)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:245)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:123)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.access$000(VertxRequestHandler.java:36)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:87)
at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: java.lang.NoClassDefFoundError: io/nayuki/qrcodegen/QrCode$Ecc
at net.codecrete.qrbill.generator.QRCode.draw(QRCode.java:49)
at net.codecrete.qrbill.generator.BillLayout.drawPaymentPart(BillLayout.java:131)
at net.codecrete.qrbill.generator.BillLayout.draw(BillLayout.java:94)
at net.codecrete.qrbill.generator.QRBill.validateAndGenerate(QRBill.java:166)
at net.codecrete.qrbill.generator.QRBill.generate(QRBill.java:113)
at quarkus.issue.ExampleResource.hello(ExampleResource.java:45)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:621)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:487)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:437)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:362)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:439)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:400)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:374)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:67)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:488)
... 20 more
Caused by: java.lang.ClassNotFoundException: io.nayuki.qrcodegen.QrCode$Ecc
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:341)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:294)
... 41 more
```
**To Reproduce**
Steps to reproduce the behavior:
1. Fetch to sample project from https://github.com/manuelbl/trans-dep
2. Start the application using `gradle quarkusDev`
3. Open the URL http://localhost:8080/hello
**Configuration**
See sample project on GitHub. It is a minimal generated Quarkus project with as single additional dependency and a modified *hello* endpoint (see `ExampleResource`).
**Environment:**
- Output of `uname -a` or `ver`: macOS Catalina 10.15.4
- Output of `java -version`: java version "11.0.1" 2018-10-16 LTS
- GraalVM version (if different from Java): n/a
- Quarkus version or git rev: 1.4.1.Final
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): Gradle 6.3
**Additional context**
The class `io.nayuki.qrcodegen.QrCode$Ecc` (triggering the exception) is part of the library `io.nayuki:qrcodegen:1.6.0`. This library is a dependency of the library `net.codecrete.qrbill:qrbill-generator:2.2.2`, which is declared in `build.gradle`.
A dependency analysis with gradle shows that `io.nayuki:qrcodegen:1.6.0` is part of the *runtimeClasspath* but not of *compileClasspath*. This is correct. The library is not needed for compilation. It's needed at runtime only.
It would seem that `gradle quarkusDev` uses the wrong class path.
| 5cddc7fbb6559d447fd68b92ea299db7abf516c3 | c5fbbd91c1f7d256da89bffd2badd8dc746d7732 | https://github.com/quarkusio/quarkus/compare/5cddc7fbb6559d447fd68b92ea299db7abf516c3...c5fbbd91c1f7d256da89bffd2badd8dc746d7732 | diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java b/devtools/gradle/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java
index f84191d9540..3db90c079c3 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java
@@ -139,14 +139,19 @@ public AppModel resolveModel(AppArtifact appArtifact) throws AppModelResolverExc
Map<AppArtifactKey, AppDependency> versionMap = new HashMap<>();
Map<ModuleIdentifier, ModuleVersionIdentifier> userModules = new HashMap<>();
- final String classpathConfigName = launchMode == LaunchMode.NORMAL ? JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME
- : launchMode == LaunchMode.TEST ? JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME
- : JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME;
+ final String classpathConfigName = launchMode == LaunchMode.TEST ? JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME
+ : JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME;
collectDependencies(project.getConfigurations().getByName(classpathConfigName),
appBuilder, directExtensionDeps, userDeps,
versionMap, userModules);
+ if (launchMode == LaunchMode.DEVELOPMENT) {
+ collectDependencies(project.getConfigurations().getByName(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME),
+ appBuilder, directExtensionDeps, userDeps,
+ versionMap, userModules);
+ }
+
final List<AppDependency> deploymentDeps = new ArrayList<>();
final List<AppDependency> fullDeploymentDeps = new ArrayList<>(userDeps);
if (!directExtensionDeps.isEmpty()) { | ['devtools/gradle/src/main/java/io/quarkus/gradle/AppModelGradleResolver.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,160,701 | 1,781,349 | 237,547 | 2,541 | 795 | 141 | 11 | 1 | 7,466 | 420 | 1,780 | 92 | 2 | 1 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,057 | quarkusio/quarkus/9414/9309 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9309 | https://github.com/quarkusio/quarkus/pull/9414 | https://github.com/quarkusio/quarkus/pull/9414 | 1 | fix | Quarkus/Undertow does not parse request parameters correctly from multipart post | **Describe the bug**
We tried to setup a PrimeFaces FileUpload with the new MyFaces Quarkus Extension but the post is not correctly considered as postback in JSF as the underlying HttpServletRequest doesnt have any post params.
I tested it and it works fine on jetty.
**Expected behavior**
HttpSevletRequest also parses post params from the multipart request
**Actual behavior**
empty request params
**To Reproduce**
Steps to reproduce the behavior:
1. Build MyFaces (git clone https://github.com/apache/myfaces/ and mvn clean install -DskipTests)
2. Run the Showcase (https://github.com/apache/myfaces/tree/master/extensions/quarkus/showcase): mvn compile quarkus:dev -Ddebug
3. Open localhost:8080/file.xhtml
4. Select a file in the second / simple exmaple and use the styled or not styled button to submit it
5. if you check the post in the browser tools, it's a multipart and correclty contains the javax.faces.ViewState param
6. Now debug HtmlResponseStateManager#isPostback and you will see that the underlying HttpServletRequest doesnt have ANY request params
**Configuration**
```properties
# Add your application.properties here, if applicable.
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
- Output of `java -version`:
- GraalVM version (if different from Java):
- Quarkus version or git rev:
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
**Additional context**
(Add any other context about the problem here.)
| b7560066e43d420c9c25da95592916ba37211680 | 3036496a2938fcbcf04d5b245cd167889702f9c6 | https://github.com/quarkusio/quarkus/compare/b7560066e43d420c9c25da95592916ba37211680...3036496a2938fcbcf04d5b245cd167889702f9c6 | diff --git a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java
index b0c409a9839..8fbb654190c 100644
--- a/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java
+++ b/extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java
@@ -491,6 +491,11 @@ public ServletDeploymentManagerBuildItem build(List<ServletBuildItem> servlets,
for (Map.Entry<String, String> entry : servlet.getInitParams().entrySet()) {
recorder.addServletInitParam(s, entry.getKey(), entry.getValue());
}
+ if (servlet.getMultipartConfig() != null) {
+ recorder.setMultipartConfig(s, servlet.getMultipartConfig().getLocation(),
+ servlet.getMultipartConfig().getMaxFileSize(), servlet.getMultipartConfig().getMaxRequestSize(),
+ servlet.getMultipartConfig().getFileSizeThreshold());
+ }
}
for (FilterBuildItem filter : filters) {
diff --git a/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/MultipartConfigTestCase.java b/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/MultipartConfigTestCase.java
index 420218557f8..866c96e69b3 100644
--- a/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/MultipartConfigTestCase.java
+++ b/extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/MultipartConfigTestCase.java
@@ -6,6 +6,7 @@
import java.io.IOException;
import java.io.PrintWriter;
+import javax.servlet.MultipartConfigElement;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
@@ -17,22 +18,38 @@
import org.apache.commons.codec.Charsets;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.ValueSource;
+import io.quarkus.builder.BuildContext;
+import io.quarkus.builder.BuildStep;
import io.quarkus.test.QuarkusUnitTest;
+import io.quarkus.undertow.deployment.ServletBuildItem;
public class MultipartConfigTestCase {
@RegisterExtension
static QuarkusUnitTest runner = new QuarkusUnitTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
- .addClasses(MultipartServlet.class));
+ .addClasses(MultipartServlet.class))
+ .addBuildChainCustomizer(b -> {
+ b.addBuildStep(new BuildStep() {
+ @Override
+ public void execute(BuildContext context) {
+ context.produce(ServletBuildItem.builder("Test Servlet", MultipartServlet.class.getName())
+ .addMapping("/servlet-item")
+ .setMultipartConfig(new MultipartConfigElement(""))
+ .build());
+ }
+ }).produces(ServletBuildItem.class).build();
+ });
- @Test
- public void testMultipartConfig() {
+ @ParameterizedTest
+ @ValueSource(strings = { "/foo", "/servlet-item" })
+ public void testMultipartConfig(String path) {
given().multiPart("file", "random.txt", "Some random file".getBytes(Charsets.UTF_8))
- .when().post("/foo").then()
+ .when().post(path).then()
.statusCode(201)
.body(is("OK"));
}
diff --git a/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/ServletBuildItem.java b/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/ServletBuildItem.java
index 7452477eddc..88df75142eb 100644
--- a/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/ServletBuildItem.java
+++ b/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/ServletBuildItem.java
@@ -6,6 +6,7 @@
import java.util.List;
import java.util.Map;
+import javax.servlet.MultipartConfigElement;
import javax.servlet.Servlet;
import io.quarkus.builder.item.MultiBuildItem;
@@ -20,6 +21,7 @@ public final class ServletBuildItem extends MultiBuildItem {
private final List<String> mappings;
private final InstanceFactory<? extends Servlet> instanceFactory;
private final Map<String, String> initParams;
+ private final MultipartConfigElement multipartConfig;
private ServletBuildItem(Builder builder) {
this.name = builder.name;
@@ -29,7 +31,7 @@ private ServletBuildItem(Builder builder) {
this.mappings = Collections.unmodifiableList(new ArrayList<>(builder.mappings));
this.instanceFactory = builder.instanceFactory;
this.initParams = Collections.unmodifiableMap(new HashMap<>(builder.initParams));
-
+ this.multipartConfig = builder.multipartConfig;
}
public String getName() {
@@ -60,6 +62,10 @@ public InstanceFactory<? extends Servlet> getInstanceFactory() {
return instanceFactory;
}
+ public MultipartConfigElement getMultipartConfig() {
+ return multipartConfig;
+ }
+
public static Builder builder(String name, String servletClass) {
return new Builder(name, servletClass);
}
@@ -72,6 +78,7 @@ public static class Builder {
private List<String> mappings = new ArrayList<>();
private InstanceFactory<? extends Servlet> instanceFactory;
private Map<String, String> initParams = new HashMap<>();
+ private MultipartConfigElement multipartConfig;
Builder(String name, String servletClass) {
this.name = name;
@@ -136,6 +143,15 @@ public Builder addInitParam(String key, String value) {
return this;
}
+ public MultipartConfigElement getMultipartConfig() {
+ return multipartConfig;
+ }
+
+ public Builder setMultipartConfig(MultipartConfigElement multipartConfig) {
+ this.multipartConfig = multipartConfig;
+ return this;
+ }
+
public ServletBuildItem build() {
return new ServletBuildItem(this);
} | ['extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/ServletBuildItem.java', 'extensions/undertow/deployment/src/main/java/io/quarkus/undertow/deployment/UndertowBuildStep.java', 'extensions/undertow/deployment/src/test/java/io/quarkus/undertow/test/MultipartConfigTestCase.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 9,228,953 | 1,793,393 | 239,479 | 2,562 | 973 | 163 | 23 | 2 | 1,634 | 220 | 371 | 39 | 2 | 1 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,058 | quarkusio/quarkus/9375/6088 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6088 | https://github.com/quarkusio/quarkus/pull/9375 | https://github.com/quarkusio/quarkus/pull/9375 | 1 | fixes | Kafka Streams - Missing topic holds app execution but there is no warning | **Describe the bug**
(Describe the problem clearly and concisely.)
If topics are declared in the application.properties, the admin client waits for them to be created to start running the kafka streams application. There is no message in console or log about this behavior.
**Expected behavior**
(Describe the expected behavior clearly and concisely.)
Should produce a WARN mentioning app can't start processing messages because topic is missing.
**Actual behavior**
(Describe the actual behavior clearly and concisely.)
App freezes without any feeback
**To Reproduce**
Steps to reproduce the behavior:
1. Add non existent topic to properties
2. Start kafka streams app
3.
**Configuration**
```properties
# Add your application.properties here, if applicable.
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
- Output of `java -version`:
- GraalVM version (if different from Java):
- Quarkus version or git rev:
**Additional context**
(Add any other context about the problem here.)
| c1f12be9e48d0426cebee681299982abd8e63330 | b4a8cce1503e444e9f2f9fa4fd80f176f88e41a7 | https://github.com/quarkusio/quarkus/compare/c1f12be9e48d0426cebee681299982abd8e63330...b4a8cce1503e444e9f2f9fa4fd80f176f88e41a7 | diff --git a/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java b/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java
index 7c82607b0f2..c083ea657ec 100644
--- a/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java
+++ b/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java
@@ -160,18 +160,26 @@ public KafkaStreams getStreams() {
private void waitForTopicsToBeCreated(Collection<String> topicsToAwait)
throws InterruptedException {
try (AdminClient adminClient = AdminClient.create(adminClientConfig)) {
+ Set<String> lastMissingTopics = null;
while (true) {
try {
ListTopicsResult topics = adminClient.listTopics();
- Set<String> topicNames = topics.names().get(10, TimeUnit.SECONDS);
+ Set<String> existingTopics = topics.names().get(10, TimeUnit.SECONDS);
- if (topicNames.containsAll(topicsToAwait)) {
- LOGGER.debug("All expected topics created");
+ if (existingTopics.containsAll(topicsToAwait)) {
+ LOGGER.debug("All expected topics created: " + topicsToAwait);
return;
} else {
- Set<String> missing = new HashSet<>(topicsToAwait);
- missing.removeAll(topicNames);
- LOGGER.debug("Waiting for topic(s) to be created: " + missing);
+ Set<String> missingTopics = new HashSet<>(topicsToAwait);
+ missingTopics.removeAll(existingTopics);
+
+ // Do not spam warnings - topics may take time to be created by an operator like Strimzi
+ if (missingTopics.equals(lastMissingTopics)) {
+ LOGGER.debug("Waiting for topic(s) to be created: " + missingTopics);
+ } else {
+ LOGGER.warn("Waiting for topic(s) to be created: " + missingTopics);
+ lastMissingTopics = missingTopics;
+ }
}
Thread.sleep(1_000); | ['extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsTopologyManager.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 9,159,820 | 1,781,191 | 237,523 | 2,541 | 1,405 | 234 | 20 | 1 | 1,164 | 161 | 245 | 36 | 0 | 1 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,059 | quarkusio/quarkus/9258/9070 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/9070 | https://github.com/quarkusio/quarkus/pull/9258 | https://github.com/quarkusio/quarkus/pull/9258 | 1 | fixes | Changing pom file in dev mode can result in changes not being applied | If you change the pom file in dev mode the process is restarted, but if you had made changed to the source and not refreshed the browser these changes will not be applied until you touch the relevant files. This has bitten me on live demos. | 08d1018cdac6b96d2996a7a24fd590ca9bd8b481 | 3d7e64230f97a1772fb6bb58b929a2471e5a5eb2 | https://github.com/quarkusio/quarkus/compare/08d1018cdac6b96d2996a7a24fd590ca9bd8b481...3d7e64230f97a1772fb6bb58b929a2471e5a5eb2 | 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 46ce6ec9bdb..3bee994e027 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/DevMojo.java
@@ -310,7 +310,7 @@ public void execute() throws MojoFailureException, MojoExecutionException {
DevModeRunner runner = new DevModeRunner(args);
- runner.prepare();
+ runner.prepare(false);
Map<Path, Long> pomFiles = readPomFileTimestamps(runner);
runner.run();
long nextCheck = System.currentTimeMillis() + 100;
@@ -324,18 +324,19 @@ public void execute() throws MojoFailureException, MojoExecutionException {
if (!runner.process.isAlive()) {
return;
}
- boolean changed = false;
+ final Set<Path> changed = new HashSet<>();
for (Map.Entry<Path, Long> e : pomFiles.entrySet()) {
long t = Files.getLastModifiedTime(e.getKey()).toMillis();
if (t > e.getValue()) {
- changed = true;
+ changed.add(e.getKey());
pomFiles.put(e.getKey(), t);
}
}
- if (changed) {
+ if (!changed.isEmpty()) {
+ getLog().info("Changes detected to " + changed + ", restarting dev mode");
DevModeRunner newRunner = new DevModeRunner(args);
try {
- newRunner.prepare();
+ newRunner.prepare(true);
} catch (Exception e) {
getLog().info("Could not load changed pom.xml file, changes not applied", e);
continue;
@@ -368,19 +369,23 @@ private void handleAutoCompile() throws MojoExecutionException {
//if the user did not compile we run it for them
if (compileNeeded) {
- // compile the Kotlin sources if needed
- final String kotlinMavenPluginKey = ORG_JETBRAINS_KOTLIN + ":" + KOTLIN_MAVEN_PLUGIN;
- final Plugin kotlinMavenPlugin = project.getPlugin(kotlinMavenPluginKey);
- if (kotlinMavenPlugin != null) {
- executeCompileGoal(kotlinMavenPlugin, ORG_JETBRAINS_KOTLIN, KOTLIN_MAVEN_PLUGIN);
- }
+ triggerCompile();
+ }
+ }
- // Compile the Java sources if needed
- final String compilerPluginKey = ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_COMPILER_PLUGIN;
- final Plugin compilerPlugin = project.getPlugin(compilerPluginKey);
- if (compilerPlugin != null) {
- executeCompileGoal(compilerPlugin, ORG_APACHE_MAVEN_PLUGINS, MAVEN_COMPILER_PLUGIN);
- }
+ private void triggerCompile() throws MojoExecutionException {
+ // compile the Kotlin sources if needed
+ final String kotlinMavenPluginKey = ORG_JETBRAINS_KOTLIN + ":" + KOTLIN_MAVEN_PLUGIN;
+ final Plugin kotlinMavenPlugin = project.getPlugin(kotlinMavenPluginKey);
+ if (kotlinMavenPlugin != null) {
+ executeCompileGoal(kotlinMavenPlugin, ORG_JETBRAINS_KOTLIN, KOTLIN_MAVEN_PLUGIN);
+ }
+
+ // Compile the Java sources if needed
+ final String compilerPluginKey = ORG_APACHE_MAVEN_PLUGINS + ":" + MAVEN_COMPILER_PLUGIN;
+ final Plugin compilerPlugin = project.getPlugin(compilerPluginKey);
+ if (compilerPlugin != null) {
+ executeCompileGoal(compilerPlugin, ORG_APACHE_MAVEN_PLUGINS, MAVEN_COMPILER_PLUGIN);
}
}
@@ -494,7 +499,10 @@ class DevModeRunner {
/**
* Attempts to prepare the dev mode runner.
*/
- void prepare() throws Exception {
+ void prepare(final boolean triggerCompile) throws Exception {
+ if (triggerCompile) {
+ triggerCompile();
+ }
if (debug == null) {
// debug mode not specified
// make sure 5005 is not used, we don't want to just fail if something else is using it
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 ef54583420a..277b8b46ebd 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
@@ -94,6 +94,41 @@ public void testThatTheApplicationIsReloadedOnJavaChange() throws MavenInvocatio
.atMost(1, TimeUnit.MINUTES).until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains("carambar"));
}
+ @Test
+ public void testThatSourceChangesAreDetectedOnPomChange() throws Exception {
+ testDir = initProject("projects/classic", "projects/project-classic-run-src-and-pom-change");
+ runAndCheck();
+
+ // Edit a Java file too
+ final File javaSource = new File(testDir, "src/main/java/org/acme/HelloResource.java");
+ final String uuid = UUID.randomUUID().toString();
+ filter(javaSource, Collections.singletonMap("return \\"hello\\";", "return \\"hello " + uuid + "\\";"));
+
+ // edit the application.properties too
+ final File applicationProps = new File(testDir, "src/main/resources/application.properties");
+ filter(applicationProps, Collections.singletonMap("greeting=bonjour", "greeting=" + uuid + ""));
+
+ // Now edit the pom.xml to trigger the dev mode restart
+ final File pomSource = new File(testDir, "pom.xml");
+ filter(pomSource, Collections.singletonMap("<!-- insert test dependencies here -->",
+ " <dependency>\\n" +
+ " <groupId>io.quarkus</groupId>\\n" +
+ " <artifactId>quarkus-smallrye-openapi</artifactId>\\n" +
+ " </dependency>"));
+
+ // Wait until we get the updated responses
+ await()
+ .pollDelay(100, TimeUnit.MILLISECONDS)
+ .atMost(1, TimeUnit.MINUTES)
+ .until(() -> DevModeTestUtils.getHttpResponse("/app/hello").contains("hello " + uuid));
+
+ await()
+ .pollDelay(100, TimeUnit.MILLISECONDS)
+ .atMost(1, TimeUnit.MINUTES)
+ .until(() -> DevModeTestUtils.getHttpResponse("/app/hello/greeting").contains(uuid));
+
+ }
+
@Test
public void testThatTheApplicationIsReloadedOnPomChange() throws MavenInvocationException, IOException {
testDir = initProject("projects/classic", "projects/project-classic-run-pom-change"); | ['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 | 8,867,376 | 1,724,882 | 230,169 | 2,456 | 2,406 | 488 | 44 | 1 | 240 | 46 | 49 | 1 | 0 | 0 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,060 | quarkusio/quarkus/9250/6679 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6679 | https://github.com/quarkusio/quarkus/pull/9250 | https://github.com/quarkusio/quarkus/pull/9250 | 1 | fixes | KubernetesProcessor - BuildInfo - possible switch of constructor attributes | Hi @iocanel / @geoand, I'm looking at https://github.com/quarkusio/quarkus/blob/master/extensions/kubernetes/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java#L236 and I think attributes on line 239 and 240 should be switched.
```
project.getBuildInfo().getOutputFile(),
project.getBuildInfo().getClassOutputDir());
```
BuildInfo constructor has this signature: `public BuildInfo(String name, String version, String packaging, String buildTool, Path outputFile, Path classOutputDir, Path resourceDir) {`
When looking into BuildInfo sources I'm even more confused by code like this:
```
public void setResourceOutputDir(Path classOutputDir) {
this.classOutputDir = classOutputDir;
}
```
It's probably working atm because `classOutputDir` and `resourceDir` are basically the same for maven.
https://github.com/dekorateio/dekorate/blob/master/core/src/main/java/io/dekorate/project/BuildInfo.java#L54-L55
| 08d1018cdac6b96d2996a7a24fd590ca9bd8b481 | 60da851b561ea4d6feea299e1f481c315ff3bfe7 | https://github.com/quarkusio/quarkus/compare/08d1018cdac6b96d2996a7a24fd590ca9bd8b481...60da851b561ea4d6feea299e1f481c315ff3bfe7 | diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
index 1b7b445aaf0..68cd8d8ea0d 100644
--- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
+++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
@@ -717,8 +717,8 @@ private Project createProject(ApplicationInfoBuildItem app, Path artifactPath) {
BuildInfo buildInfo = new BuildInfo(app.getName(), app.getVersion(),
"jar", project.getBuildInfo().getBuildTool(),
artifactPath,
- project.getBuildInfo().getOutputFile(),
- project.getBuildInfo().getClassOutputDir());
+ project.getBuildInfo().getClassOutputDir(),
+ project.getBuildInfo().getResourceDir());
return new Project(project.getRoot(), buildInfo, project.getScmInfo());
} | ['extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,867,376 | 1,724,882 | 230,169 | 2,456 | 238 | 39 | 4 | 1 | 999 | 84 | 227 | 20 | 2 | 2 | 1970-01-01T00:26:29 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,085 | quarkusio/quarkus/8471/7637 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7637 | https://github.com/quarkusio/quarkus/pull/8471 | https://github.com/quarkusio/quarkus/pull/8471 | 1 | close | the `container-image-s2i` extension runs `oc version` without reason | **Describe the bug**
I added the `container-image-s2i` extension so that I can customize the base S2I image in generated OpenShift resources. (When the extension is not present, the base S2I image is always `fabric8/s2i-java`, even though I added the `quarkus.s2i.base-jvm-image` config property. I personally consider the `fabric8/s2i-java` image long deprecated and dangerous to use, as it clearly hasn't been kept up to date.)
That works fine, if the `oc` binary is present. (If the `oc` binary is not present, I still get all the resources, but again, I always get `fabric8/s2i-java`, even though I added the `quarkus.s2i.base-jvm-image` config property.)
However, there's a noticeable delay as it's running `oc version` to determine OpenShift version. This is because `oc version` by default talks to the OpenShift API server, which takes time.
(The process of determining server version is actually tailored to `oc` from OpenShift 3.x. The `oc` binary from OpenShift 4.x no longer prints a line starting with `kubernetes`. Also the server version is not even used!)
**Expected behavior**
I don't know why I even need the `container-image-s2i` extension to get S2I configuration applied, because the old deprecated `s2i.builder-image` config property works without the extension!
But even if I add the `container-image-s2i` extension, I expect the S2I configuration to be applied when I don't have the `oc` binary present, and I certainly don't expect the build to talk to OpenShift if I don't ask it to. (If I ask to push the container image to the OpenShift registry, or start a build in OpenShift, then sure. But not for creating the YAML files locally!)
**Actual behavior**
The build process talks to OpenShift server needlessly.
**To Reproduce**
Steps to reproduce the behavior:
1. Add the `container-image-s2i` extension.
2. Run `mvn clean package`.
3. If `oc` is present: observe noticeable delay. If `oc` is not present: observe that S2I configuration is not taken into account.
**Configuration**
```properties
quarkus.kubernetes.deployment-target=openshift
quarkus.openshift.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/openjdk/openjdk-11-rhel7
``` | 7b339818660fb5d9a6a46dc1d16215a337cba4ca | 6fb27851a4ed64f228785350d1f844882eb91efe | https://github.com/quarkusio/quarkus/compare/7b339818660fb5d9a6a46dc1d16215a337cba4ca...6fb27851a4ed64f228785350d1f844882eb91efe | diff --git a/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iBuild.java b/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iBuild.java
index 9ed67bab85b..a1b88d0515f 100644
--- a/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iBuild.java
+++ b/extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iBuild.java
@@ -1,25 +1,11 @@
package io.quarkus.container.image.s2i.deployment;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
import java.util.function.BooleanSupplier;
-import java.util.function.Function;
-
-import org.jboss.logging.Logger;
import io.quarkus.container.image.deployment.ContainerImageConfig;
-import io.quarkus.deployment.util.ExecUtil;
public class S2iBuild implements BooleanSupplier {
- private static final Logger LOGGER = Logger.getLogger(S2iBuild.class.getName());
-
private ContainerImageConfig containerImageConfig;
S2iBuild(ContainerImageConfig containerImageConfig) {
@@ -28,47 +14,6 @@ public class S2iBuild implements BooleanSupplier {
@Override
public boolean getAsBoolean() {
- OutputFilter filter = new OutputFilter();
- try {
- if (ExecUtil.exec(new File("."), filter, "oc", "version")) {
- Optional<String> version = getServerVersionFromOc(filter.getLines());
- return true;
- }
- } catch (Exception e) {
- return false;
- }
- return false;
- }
-
- private static Optional<String> getServerVersionFromOc(List<String> lines) {
- return lines.stream()
- .filter(l -> l.startsWith("kubernetes"))
- .map(l -> l.split(" "))
- .filter(a -> a.length > 2)
- .map(a -> a[1])
- .findFirst();
- }
-
- private static class OutputFilter implements Function<InputStream, Runnable> {
- private final List<String> list = new ArrayList();
-
- @Override
- public Runnable apply(InputStream is) {
- return () -> {
- try (InputStreamReader isr = new InputStreamReader(is);
- BufferedReader reader = new BufferedReader(isr)) {
-
- for (String line = reader.readLine(); line != null; line = reader.readLine()) {
- list.add(line);
- }
- } catch (IOException e) {
- throw new RuntimeException("Error reading stream.", e);
- }
- };
- }
-
- public List<String> getLines() {
- return list;
- }
+ return true;
}
} | ['extensions/container-image/container-image-s2i/deployment/src/main/java/io/quarkus/container/image/s2i/deployment/S2iBuild.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,357,576 | 1,625,169 | 216,591 | 2,265 | 1,964 | 356 | 57 | 1 | 2,221 | 317 | 548 | 30 | 0 | 1 | 1970-01-01T00:26: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,121 | quarkusio/quarkus/7776/7771 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7771 | https://github.com/quarkusio/quarkus/pull/7776 | https://github.com/quarkusio/quarkus/pull/7776 | 1 | resolves | Qute 1.3.0.CR2 - property/method [raw] not found on class [java.lang.String] | **Describe the bug**
Updating from 1.2.1 to 1.3.0.CR2 now gives me the following BuildException, that previously worked in 1.2.1:
```
[1] Incorrect expression: playable.getPlayTitleEmbed().raw
- property/method [raw] not found on class [java.lang.String] nor handled by an extension method
- found in template [play.html] on line 6
```
Snippet from play.html contains the following:
```
{@com.foo.model.Playable playable}
{playable.getPlayTitleEmbed().raw}
```
where Playable is an interface:
```
@TemplateData
public interface Playable {
public String getPlayTitleEmbed();
```
If I change the template code to `{playable.getPlayTitleEmbed}` and change the method to be `public RawString getPlayTitleEmbed();`, I instead get the following warning upon startup:
```
WARN [io.qua.dep.ste.ReflectiveHierarchyStep] (build-36) Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- io.quarkus.qute.RawString
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.");.
```
**Environment (please complete the following information):**
Quarkus 1.3.0.CR2
Java 11.0.6
Maven 3.6.3
| b2918169bbdad2f218ff6a6b3a4d465212b99e7e | 512ceefecc19f03a50b50999d105d6470dc988fe | https://github.com/quarkusio/quarkus/compare/b2918169bbdad2f218ff6a6b3a4d465212b99e7e...512ceefecc19f03a50b50999d105d6470dc988fe | 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 4df0854ceee..71e734b6532 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
@@ -118,6 +118,7 @@ public class QuteProcessor {
static final DotName MAP_ENTRY = DotName.createSimple(Entry.class.getName());
static final DotName COLLECTION = DotName.createSimple(Collection.class.getName());
+ static final DotName STRING = DotName.createSimple(String.class.getName());
private static final String MATCH_NAME = "matchName";
private static final String PRIORITY = "priority";
@@ -711,16 +712,21 @@ ServiceProviderBuildItem registerPublisherFactory() {
@BuildStep
void excludeTypeChecks(BuildProducer<TypeCheckExcludeBuildItem> excludes) {
- // Exclude all checks that involve built-in value resolvers that accept at least one parameter
+ // Exclude all checks that involve built-in value resolvers
+ // TODO we need a better way to exclude value resolvers that are not template extension methods
excludes.produce(new TypeCheckExcludeBuildItem(new Predicate<Check>() {
@Override
public boolean test(Check check) {
+ // RawString
+ if (check.isProperty() && check.classNameEquals(STRING) && check.nameIn("raw", "safe")) {
+ return true;
+ }
// Elvis and ternary operators
- if (check.numberOfParameters == 1 && check.nameEquals("?:", "or", ":", "?")) {
+ if (check.numberOfParameters == 1 && check.nameIn("?:", "or", ":", "?")) {
return true;
}
// Collection.contains()
- if (check.numberOfParameters == 1 && check.clazz.name().equals(COLLECTION) && check.name.equals("contains")) {
+ if (check.numberOfParameters == 1 && check.classNameEquals(COLLECTION) && check.name.equals("contains")) {
return true;
}
return false;
diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TypeCheckExcludeBuildItem.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TypeCheckExcludeBuildItem.java
index e3829fd37d2..efca6374b42 100644
--- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TypeCheckExcludeBuildItem.java
+++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TypeCheckExcludeBuildItem.java
@@ -3,6 +3,7 @@
import java.util.function.Predicate;
import org.jboss.jandex.ClassInfo;
+import org.jboss.jandex.DotName;
import io.quarkus.builder.item.MultiBuildItem;
@@ -44,7 +45,7 @@ public Check(String name, ClassInfo clazz, int parameters) {
this.numberOfParameters = parameters;
}
- public boolean nameEquals(String... values) {
+ public boolean nameIn(String... values) {
for (String value : values) {
if (name.equals(value)) {
return true;
@@ -53,6 +54,14 @@ public boolean nameEquals(String... values) {
return false;
}
+ public boolean isProperty() {
+ return numberOfParameters == -1;
+ }
+
+ public boolean classNameEquals(DotName name) {
+ return clazz.name().equals(name);
+ }
+
}
}
diff --git a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java
index 40488586bde..a5c54c1a4fa 100644
--- a/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java
+++ b/extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java
@@ -10,6 +10,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
+import io.quarkus.qute.Engine;
import io.quarkus.qute.RawString;
import io.quarkus.qute.Template;
import io.quarkus.qute.TemplateData;
@@ -26,7 +27,9 @@ public class EscapingTest {
.addAsResource(new StringAsset("{item} {item.raw}"),
"templates/item.html")
.addAsResource(new StringAsset("{text} {other} {text.raw} {text.safe} {item.foo}"),
- "templates/bar.txt"));
+ "templates/bar.txt")
+ .addAsResource(new StringAsset("{@java.lang.String text}{text} {text.raw} {text.safe}"),
+ "templates/validation.html"));
@Inject
Template foo;
@@ -37,6 +40,9 @@ public class EscapingTest {
@Inject
Template item;
+ @Inject
+ Engine engine;
+
@Test
public void testEscaper() {
assertEquals("<div> &"' <div> <div> <span>",
@@ -49,6 +55,12 @@ public void testEscaper() {
item.data("item", new Item()).render());
}
+ @Test
+ public void testValidation() {
+ assertEquals("<div> <div> <div>",
+ engine.getTemplate("validation").data("text", "<div>").render());
+ }
+
@TemplateData
public static class Item {
| ['extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/EscapingTest.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TypeCheckExcludeBuildItem.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 7,977,662 | 1,550,403 | 206,825 | 2,143 | 1,341 | 270 | 23 | 2 | 1,325 | 162 | 328 | 35 | 0 | 4 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,113 | quarkusio/quarkus/7896/7887 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7887 | https://github.com/quarkusio/quarkus/pull/7896 | https://github.com/quarkusio/quarkus/pull/7896 | 1 | fixes | Classloading issue when @QuarkusTest inherits from class from another artifact (Maven module) | **Describe the bug**
I have a database application and I want to support multiple databases. For that, I need to build the application separately for each database. For various reasons, I decided to do this as a multi-module Maven project, structured like this:
- `app`: the application itself, doesn't have `quarkus-maven-plugin`, but has `jandex-maven-plugin` to produce Jandex
- `postgresql`: depends on `app`, adds `quarkus-jdbc-postgresql` and has `quarkus-maven-plugin` to produce the PostgreSQL-specific build
- `mysql`, `mariadb`, `mssql`: same as `postgresql`, but for other databases
With all these different databases, I also want to run integration tests. For that, I created an `abstract` class in the `app` module that has all the tests (`AbstractDatabaseTest`). I also produce a `tests-jar` from the `app` module, so that I can keep `AbstractDatabaseTest` in `src/test`. I use RestAssured for the tests, relying on Quarkus setting up the correct base URL and port in RestAssured for me.
Then, the idea is that in each submodule, I create an empty class that inherits from `AbstractDatabaseTest` and just adds the `@QuarkusTest` annotation.
I also have an empty subclass of `AbstractDatabaseTest` in `app` that runs with H2. That test passes just fine. All the tests in other modules fail with `Connection refused`.
I was able to trace this down to a classloading problem: the test class itself is loaded by `Quarkus Base Runtime ClassLoader`, but its parent class, `AbstractDatabaseTest`, is loaded by the system classloader (some classloader delegation seems to be set up, so this arrangement doesn't immediately crash). The parent class uses RestAssured, so that is loaded by the system classloader as well. And now I have RestAssured loaded by 2 classloaders -- the Quarkus one, which has the correct URL and port set, and the system classloader one, which doesn't have the correct settings, but is the one that is actually used.
**Expected behavior**
Superclasses of test class are loaded by the Quarkus classloader.
**Actual behavior**
Superclasses of test class are loaded by the system classloader.
**To Reproduce**
I have created a minimal reproducer, which doesn't have all the database stuff etc. Just the bare minimum to show what's going on.
Steps to reproduce the behavior:
1. `git clone https://github.com/Ladicek/quarkus-multimodule-test-inheritance-issue.git`
2. `mvn clean test`
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Linux argondie 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux`
- Output of `java -version`:
```
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08)
OpenJDK 64-Bit Server VM (build 25.242-b08, mixed mode)
```
- GraalVM version (if different from Java): N/A
- Quarkus version or git rev: `1.3.0.Final`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`):
```
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/lthon/software/apache-maven
Java version: 1.8.0_242, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: cs_CZ, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-88-generic", arch: "amd64", family: "unix"
```
**Additional context**
If you look at the reproducer, you will notice that the `specific` module contains a dummy class (called `Dummy`). That class is completely useless and I really don't want it there. But if I remove it, Maven doesn't create `target/classes` at all (which is correct) and then Quarkus fails with `java.io.FileNotFoundException: /home/lthon/projects/quarkus/reproducers/quarkus-multimodule-test-inheritance-issue/specific/target/classes (No such file or directory)`. I'd consider that a bug too. | 82a7cf5c7183c7e6693d43a41b89ea9dceb729ff | 30fa50346abc42dce50b0e1e2c8d311d6a3a8067 | https://github.com/quarkusio/quarkus/compare/82a7cf5c7183c7e6693d43a41b89ea9dceb729ff...30fa50346abc42dce50b0e1e2c8d311d6a3a8067 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
index 5995357ba83..a907b8bb140 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java
@@ -202,6 +202,10 @@ public Path getClassesDir() {
return getOutputDir().resolve("classes");
}
+ public Path getTestClassesDir() {
+ return getOutputDir().resolve("test-classes");
+ }
+
public Path getSourcesSourcesDir() {
if (getRawModel().getBuild() != null && getRawModel().getBuild().getSourceDirectory() != null) {
String originalValue = getRawModel().getBuild().getSourceDirectory();
diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
index 0147d4a03f1..a5e1c4e3731 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java
@@ -7,6 +7,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
import org.apache.maven.model.Model;
import org.apache.maven.model.resolution.UnresolvableModelException;
import org.apache.maven.model.resolution.WorkspaceModelResolver;
@@ -89,6 +90,16 @@ public File findArtifact(Artifact artifact) {
&& lp.getVersion().equals(revision))) {
return null;
}
+ if (!Objects.equals(artifact.getClassifier(), lp.getAppArtifact().getClassifier())) {
+ if ("tests".equals(artifact.getClassifier())) {
+ //special classifier used for test jars
+ final File file = lp.getTestClassesDir().toFile();
+ if (file.exists()) {
+ return file;
+ }
+ }
+ return null;
+ }
final String type = artifact.getExtension();
if (type.equals(AppArtifactCoords.TYPE_JAR)) {
final File file = lp.getClassesDir().toFile(); | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalWorkspace.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/LocalProject.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 7,994,981 | 1,553,820 | 207,231 | 2,145 | 553 | 102 | 15 | 2 | 3,892 | 540 | 1,020 | 50 | 1 | 2 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,114 | quarkusio/quarkus/7874/4507 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4507 | https://github.com/quarkusio/quarkus/pull/7874 | https://github.com/quarkusio/quarkus/pull/7874 | 1 | closes | Agroal datasource should be initialized eagerly | **Describe the bug**
Currently the datasources are flagged as `@ApplicaitonScoped`, which means they are wrapped by a proxy making them initialized on first use.
This is annoying as
- we don't respect the configuration of pre-filling the pool on boot
- we can't validate the connection properties, deferring any failure (however also affected by #4503)
- it's an overhead
| 2190d2512e11780f33af25dff77e1512f9e95130 | 18f32b71b4a09b091214b24c830b0e4e420e1beb | https://github.com/quarkusio/quarkus/compare/2190d2512e11780f33af25dff77e1512f9e95130...18f32b71b4a09b091214b24c830b0e4e420e1beb | diff --git a/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java b/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java
index 59df7c1589c..1e495fe4189 100644
--- a/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java
+++ b/extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java
@@ -11,9 +11,9 @@
import java.util.Optional;
import java.util.Set;
-import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.Produces;
+import javax.inject.Singleton;
import javax.sql.XADataSource;
import org.eclipse.microprofile.metrics.Metadata;
@@ -358,7 +358,7 @@ private void createDataSourceProducerBean(BuildProducer<GeneratedBeanBuildItem>
.className(dataSourceProducerClassName)
.superClass(AbstractDataSourceProducer.class)
.build();
- classCreator.addAnnotation(ApplicationScoped.class);
+ classCreator.addAnnotation(Singleton.class);
for (AggregatedDataSourceBuildTimeConfigBuildItem aggregatedDataSourceBuildTimeConfig : aggregatedDataSourceBuildTimeConfigs) {
String dataSourceName = aggregatedDataSourceBuildTimeConfig.getName();
@@ -366,7 +366,7 @@ private void createDataSourceProducerBean(BuildProducer<GeneratedBeanBuildItem>
MethodCreator dataSourceMethodCreator = classCreator.getMethodCreator(
"createDataSource_" + HashUtil.sha1(dataSourceName),
AgroalDataSource.class);
- dataSourceMethodCreator.addAnnotation(ApplicationScoped.class);
+ dataSourceMethodCreator.addAnnotation(Singleton.class);
dataSourceMethodCreator.addAnnotation(Produces.class);
if (aggregatedDataSourceBuildTimeConfig.isDefault()) {
dataSourceMethodCreator.addAnnotation(Default.class); | ['extensions/agroal/deployment/src/main/java/io/quarkus/agroal/deployment/AgroalProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,027,417 | 1,560,145 | 208,018 | 2,151 | 345 | 50 | 6 | 1 | 383 | 59 | 84 | 8 | 0 | 0 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,115 | quarkusio/quarkus/7842/7832 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7832 | https://github.com/quarkusio/quarkus/pull/7842 | https://github.com/quarkusio/quarkus/pull/7842 | 1 | fixes | Failed to startup quarkusDev with gradle + kotlin with subprojects | **Describe the bug**
When use a gradle config with multi-project and kotlin the quarkusDev not starts and a exception is trowed.
**Expected behavior**
Startup the quarkusDev without exception
**Actual behavior**
An exception is trowed at quarkusDev startup
```
Listening for transport dt_socket at address: 5005
Exception in thread "main" java.lang.RuntimeException: java.nio.file.NoSuchFileException: /home/killboard/Dropbox/MovilePay/Projects/quarkus-kt-gradle-multiprojects/core/src/main/java
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:71)
Caused by: java.nio.file.NoSuchFileException: /home/killboard/Dropbox/MovilePay/Projects/quarkus-kt-gradle-multiprojects/core/src/main/java
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144)
at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
at java.nio.file.Files.readAttributes(Files.java:1737)
at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
at java.nio.file.FileTreeIterator.<init>(FileTreeIterator.java:72)
at java.nio.file.Files.walk(Files.java:3574)
at java.nio.file.Files.walk(Files.java:3625)
at io.quarkus.dev.RuntimeUpdatesProcessor.checkForChangedClasses(RuntimeUpdatesProcessor.java:173)
at io.quarkus.dev.DevModeMain.start(DevModeMain.java:92)
at io.quarkus.dev.DevModeMain.main(DevModeMain.java:67)
```
Apparently it try to find a java class but the project is in kotlin.
**To Reproduce**
Steps to reproduce the behavior:
1. clone the repository https://github.com/killboard/quarkus-kt-gradle-multiproject
2. uncomment the line described in README
3. run `gradlew quarkusDev`
**WorkAround**
Is possible to run `quarkusDev` as a workaround creating a empty `Java` class in a java source package.
| 650ed3dd599135cd0cc0dc7730718ac354bc2d26 | b8e68dd43dbb908fe3dddf8a04eeedc0699d2c27 | https://github.com/quarkusio/quarkus/compare/650ed3dd599135cd0cc0dc7730718ac354bc2d26...b8e68dd43dbb908fe3dddf8a04eeedc0699d2c27 | diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
index dd44ca5a174..735f6cfeec4 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
@@ -271,9 +271,6 @@ public void startDev() {
continue;
}
- final AppArtifact appArtifact = AppModelGradleResolver.toAppArtifact(dependency);
- final AppArtifactKey key = new AppArtifactKey(appArtifact.getGroupId(), appArtifact.getArtifactId());
- projectDependencies.add(key);
Project dependencyProject = project.getRootProject()
.findProject(((ProjectComponentIdentifier) componentId).getProjectPath());
JavaPluginConvention javaConvention = dependencyProject.getConvention().findPlugin(JavaPluginConvention.class);
@@ -286,7 +283,12 @@ public void startDev() {
Set<String> sourcePaths = new HashSet<>();
for (File sourceDir : mainSourceSet.getAllJava().getSrcDirs()) {
- sourcePaths.add(sourceDir.getAbsolutePath());
+ if (sourceDir.exists()) {
+ sourcePaths.add(sourceDir.getAbsolutePath());
+ }
+ }
+ if (sourcePaths.isEmpty()) {
+ continue;
}
String resourcePaths = mainSourceSet.getResources().getSourceDirectories().getSingleFile().getAbsolutePath(); //TODO: multiple resource directories
@@ -299,6 +301,10 @@ public void startDev() {
resourcePaths);
context.getModules().add(wsModuleInfo);
+
+ final AppArtifact appArtifact = AppModelGradleResolver.toAppArtifact(dependency);
+ final AppArtifactKey key = new AppArtifactKey(appArtifact.getGroupId(), appArtifact.getArtifactId());
+ projectDependencies.add(key);
}
for (AppDependency appDependency : appModel.getFullDeploymentDeps()) { | ['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,017,532 | 1,558,467 | 207,806 | 2,150 | 835 | 131 | 14 | 1 | 2,377 | 147 | 578 | 45 | 1 | 1 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,116 | quarkusio/quarkus/7834/7823 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7823 | https://github.com/quarkusio/quarkus/pull/7834 | https://github.com/quarkusio/quarkus/pull/7834 | 1 | fixes | Quarkus gradle generateConfig fails | **Describe the bug**
When initialising a quarkus app using the gradle build tool using the following guide:
https://quarkus.io/guides/gradle-tooling
The gradle task fails to do so.
**Expected behavior**
It should create an application.properties file
**Actual behavior**
You get the following error when trying to generate a config file:
```
./gradlew generateConfig
> Task :generateConfig FAILED
generating example config
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':generateConfig'.
> Failed to generate config file
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
1 actionable task: 1 executed
```
**To Reproduce**
Steps to reproduce the behavior:
According to https://quarkus.io/guides/gradle-tooling:
1. mvn io.quarkus:quarkus-maven-plugin:1.2.1.Final:create \\
-DprojectGroupId=my-groupId \\
-DprojectArtifactId=my-artifactId \\
-DprojectVersion=my-version \\
-DclassName="org.my.group.MyResource" \\
-Dextensions="resteasy-jsonb" \\
-DbuildTool=gradle
2. ./gradlew generateConfig
**Environment:**
- Output of `uname -a`: Darwin C02X1FKFJG5J 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64
- Output of `java -version`:
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)
- GraalVM version (if different from Java): n/a
- Quarkus version or git rev: n/a
- Build tool (ie. output of `mvnw --version`): mvn --version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T19:33:14+01:00)
Maven home: /usr/local/Cellar/maven@3.5/3.5.4_1/libexec
Java version: 13.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac" | e90c41f43e23db72109551e8dd369bab6df5082d | 7c1d1cb83638a54e101a503fcb831cee3fff2463 | https://github.com/quarkusio/quarkus/compare/e90c41f43e23db72109551e8dd369bab6df5082d...7c1d1cb83638a54e101a503fcb831cee3fff2463 | diff --git a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/GenerateConfigTask.java b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/GenerateConfigTask.java
index a458071d42d..f4ea790b8bd 100644
--- a/core/deployment/src/main/java/io/quarkus/runner/bootstrap/GenerateConfigTask.java
+++ b/core/deployment/src/main/java/io/quarkus/runner/bootstrap/GenerateConfigTask.java
@@ -7,6 +7,8 @@
import java.nio.file.StandardOpenOption;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -25,17 +27,15 @@
*
* @author Stuart Douglas
*/
-public class GenerateConfigTask {
+public class GenerateConfigTask implements BiConsumer<CuratedApplication, Map<String, Object>> {
private static final Logger log = Logger.getLogger(GenerateConfigTask.class);
- private final Path configFile;
+ public static final String CONFIG_FILE = "config-file";
- public GenerateConfigTask(Path configFile) {
- this.configFile = configFile;
- }
-
- public Path run(CuratedApplication application) {
+ @Override
+ public void accept(CuratedApplication application, Map<String, Object> stringObjectMap) {
+ Path configFile = (Path) stringObjectMap.get(CONFIG_FILE);
//first lets look for some config, as it is not on the current class path
//and we need to load it to run the build process
try {
@@ -89,7 +89,6 @@ public void accept(BuildExecutionBuilder buildExecutionBuilder) {
} catch (Exception e) {
throw new RuntimeException("Failed to generate config file", e);
}
- return configFile;
}
private String formatDocs(String docs) {
@@ -154,4 +153,5 @@ private String configify(String group) {
}
return ret.toString();
}
+
}
diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java
index 9edbca504a9..e761a479ae7 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java
@@ -1,6 +1,7 @@
package io.quarkus.gradle.tasks;
import java.io.File;
+import java.util.Collections;
import org.gradle.api.GradleException;
import org.gradle.api.tasks.Input;
@@ -39,6 +40,7 @@ public void buildQuarkus() {
getLogger().lifecycle("generating example config");
final AppArtifact appArtifact = extension().getAppArtifact();
+ appArtifact.setPath(extension().appJarOrClasses());
final AppModelResolver modelResolver = extension().getAppModelResolver();
if (extension().resourcesDir().isEmpty()) {
throw new GradleException("No resources directory, cannot create application.properties");
@@ -49,14 +51,19 @@ public void buildQuarkus() {
if (name == null || name.isEmpty()) {
name = "application.properties.example";
}
- try (CuratedApplication bootstrap = QuarkusBootstrap.builder(getProject().getBuildDir().toPath())
- .setMode(QuarkusBootstrap.Mode.PROD)
+ try (CuratedApplication bootstrap = QuarkusBootstrap.builder(appArtifact.getPath())
+ .setBaseClassLoader(getClass().getClassLoader())
.setAppModelResolver(modelResolver)
- .setBuildSystemProperties(getBuildSystemProperties(appArtifact))
- .build()
- .bootstrap()) {
- GenerateConfigTask ct = new GenerateConfigTask(new File(target, name).toPath());
- ct.run(bootstrap);
+ .setTargetDirectory(getProject().getBuildDir().toPath())
+ .setBaseName(extension().finalName())
+ .setAppArtifact(appArtifact)
+ .setLocalProjectDiscovery(false)
+ .setIsolateDeployment(true)
+ //.setConfigDir(extension().outputConfigDirectory().toPath())
+ //.setTargetDirectory(extension().outputDirectory().toPath())
+ .build().bootstrap()) {
+ bootstrap.runInAugmentClassLoader(GenerateConfigTask.class.getName(),
+ Collections.singletonMap(GenerateConfigTask.CONFIG_FILE, new File(target, name).toPath()));
getLogger().lifecycle("Generated config file " + name);
} catch (BootstrapException e) {
throw new RuntimeException(e);
diff --git a/devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java b/devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java
index f4e89b5d8d6..bb9390e7c0f 100644
--- a/devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java
+++ b/devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java
@@ -3,6 +3,7 @@
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.util.Collections;
import java.util.List;
import org.apache.maven.model.Resource;
@@ -120,8 +121,8 @@ public void execute() throws MojoExecutionException {
name = "application.properties.example";
}
Path configFile = new File(target, name).toPath();
- GenerateConfigTask generateConfigTask = new GenerateConfigTask(configFile);
- generateConfigTask.run(curatedApplication);
+ curatedApplication.runInAugmentClassLoader(GenerateConfigTask.class.getName(),
+ Collections.singletonMap(GenerateConfigTask.CONFIG_FILE, configFile));
} catch (Exception e) {
throw new MojoExecutionException("Failed to generate config file", e); | ['devtools/maven/src/main/java/io/quarkus/maven/GenerateConfigMojo.java', 'devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateConfig.java', 'core/deployment/src/main/java/io/quarkus/runner/bootstrap/GenerateConfigTask.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 8,015,412 | 1,558,058 | 207,765 | 2,150 | 2,371 | 428 | 42 | 3 | 2,444 | 275 | 732 | 63 | 4 | 1 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,117 | quarkusio/quarkus/7831/7433 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7433 | https://github.com/quarkusio/quarkus/pull/7831 | https://github.com/quarkusio/quarkus/pull/7831 | 1 | fixes | With AdditionalJpaModelBuildItem created Entity not working in dev mode | **Describe the bug**
I have created an own extension which contains a JPA entity and a CDI bean.
I have added the build steps according to the documentation:
@BuildStep
List<AdditionalJpaModelBuildItem> produceModel() {
return Arrays.asList(new AdditionalJpaModelBuildItem(Entity.class));
}
@BuildStep
AdditionalBeanBuildItem registerBeans() {
return AdditionalBeanBuildItem.builder()
.addBeanClass(SomeBean.class)
.build();
}
I instantiate and persist the entity in the mentioned CDI bean in the extension.
When i now use this extension in a quarkus app, for @QuarkusTest classes and normal application starts everything is working fine.
When i start the application in quarkus:dev mode i got this exception when i call the method which is instantiating and persisting the entity:
`
Caused by: org.hibernate.property.access.spi.PropertyAccessException: Error accessing field [private java.lang.Long com.example.Entity.id] by reflection for persistent property [com.example.Entity#id] : Entity[id=null]
at org.hibernate.property.access.spi.GetterFieldImpl.get(GetterFieldImpl.java:75)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:223)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:5102)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:4802)
at org.hibernate.engine.internal.ForeignKeys.isTransient(ForeignKeys.java:294)
at org.hibernate.event.internal.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:517)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:102)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:62)
at org.hibernate.event.service.internal.EventListenerGroupImpl.fireEventOnEachListener(EventListenerGroupImpl.java:108)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:702)
... 78 more
`
`
Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Long field com.example.Entity.id to com.example.Entity
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at java.base/jdk.internal.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:58)
at java.base/jdk.internal.reflect.UnsafeObjectFieldAccessorImpl.get(UnsafeObjectFieldAccessorImpl.java:36)
at java.base/java.lang.reflect.Field.get(Field.java:418)
at org.hibernate.property.access.spi.GetterFieldImpl.get(GetterFieldImpl.java:71)
... 87 more
`
Also the excact same issue occurs also when i try to create a test in the extension itself with the QuarkusUnitTest junit extension.
**Expected behavior**
I would expect, that it is possible to instantiate a entity in a CDI bean in a quarkus extension and persist it there. And that the dev mode is beheaving in the same way like the production mode in this case.
**Actual behavior**
To instantiate a entity in a CDI bean in a quarkus extension and persist it there is only possible in production mode and @QuarkusTest classes, not in dev mode.
**To Reproduce**
Steps to reproduce the behavior:
1. Create an extension with a JPA entity and a CDI bean and create and persist the entity in the bean.
2. Use this extension in a quarkus app
3. Invoke the method of the CDI bean in production and dev mode
**Configuration**
```properties
No special configurations
```
**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 "13" 2019-09-17
- GraalVM version (if different from Java): not used
- Quarkus version or git rev: 1.2.1.Final
**Additional context**
(Add any other context about the problem here.)
| b7457efe052e0b18739387c807d2bea174792ad4 | c434a077e685d048f77106fa8c38092cd018e385 | https://github.com/quarkusio/quarkus/compare/b7457efe052e0b18739387c807d2bea174792ad4...c434a077e685d048f77106fa8c38092cd018e385 | diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java
index 307c42e5c3e..e0d1b30c62e 100644
--- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java
+++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java
@@ -760,7 +760,7 @@ private void enhanceEntities(final JpaEntitiesBuildItem domainObjects,
try {
byte[] bytes = IoUtil.readClassAsBytes(HibernateOrmProcessor.class.getClassLoader(), className);
byte[] enhanced = hibernateEntityEnhancer.enhance(className, bytes);
- additionalClasses.produce(new GeneratedClassBuildItem(true, className, enhanced != null ? enhanced : bytes));
+ additionalClasses.produce(new GeneratedClassBuildItem(false, className, enhanced != null ? enhanced : bytes));
} catch (IOException e) {
throw new RuntimeException("Failed to read Model class", e);
} | ['extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,003,883 | 1,555,876 | 207,481 | 2,149 | 254 | 44 | 2 | 1 | 4,207 | 384 | 894 | 81 | 0 | 1 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,119 | quarkusio/quarkus/7805/6860 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/6860 | https://github.com/quarkusio/quarkus/pull/7805 | https://github.com/quarkusio/quarkus/pull/7805 | 1 | fixes | Quarkus is not following MP Health spec to disable vendor procedures | http://download.eclipse.org/microprofile/microprofile-health-2.1/microprofile-health-spec.html#_disabling_default_vendor_procedures states
> An implementation is allowed to supply a reasonable default (out-of-the-box) procedures as defined in the Health Check Procedures section. To disable all default vendor procedures users can specify a MicroProfile Config configuration property `mp.health.disable-default-procedures` to `true`. This allows the application to process and display only the user-defined health check procedures.
When using Quarkus specific `quarkus.health.extensions.enabled=false` (specified in application.properties) I'm able to suppress vendor specific checks.
```json
curl http://0.0.0.0:8080/health/ 2>/dev/null | jq .
{
"status": "UP",
"checks": []
}
```
When using MP Health specific `mp.health.disable-default-procedures=true` (specified in application.properties) I see "Database connections health check".
```json
curl http://0.0.0.0:8080/health/ 2>/dev/null | jq .
{
"status": "UP",
"checks": [
{
"name": "Database connections health check",
"status": "UP"
}
]
}
```
"Database connections health check" shouldn't be visible.
I used Quarkus mvn plugin generated app and added following deps to have https://quarkus.io/guides/datasource#datasource-health-check
```xml
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-agroal</artifactId>
</dependency>
```
Running against Quarkus master d0029637f | 62c85ed63589852d324f1e5e73e703535712ba5f | 497ca541070a898ebde61a955842ac49772758e9 | https://github.com/quarkusio/quarkus/compare/62c85ed63589852d324f1e5e73e703535712ba5f...497ca541070a898ebde61a955842ac49772758e9 | diff --git a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java
index 1a2b0dbf593..985cb2db255 100644
--- a/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java
+++ b/extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java
@@ -4,6 +4,7 @@
import java.util.List;
import java.util.Set;
+import org.eclipse.microprofile.config.ConfigProvider;
import org.eclipse.microprofile.health.Health;
import org.eclipse.microprofile.health.Liveness;
import org.eclipse.microprofile.health.Readiness;
@@ -76,7 +77,10 @@ static final class SmallRyeHealthConfig {
@BuildStep
void healthCheck(BuildProducer<AdditionalBeanBuildItem> buildItemBuildProducer,
List<HealthBuildItem> healthBuildItems) {
- if (config.extensionsEnabled) {
+ boolean extensionsEnabled = config.extensionsEnabled &&
+ !ConfigProvider.getConfig().getOptionalValue("mp.health.disable-default-procedures", boolean.class)
+ .orElse(false);
+ if (extensionsEnabled) {
for (HealthBuildItem buildItem : healthBuildItems) {
if (buildItem.isEnabled()) {
buildItemBuildProducer.produce(new AdditionalBeanBuildItem(buildItem.getHealthCheckClass())); | ['extensions/smallrye-health/deployment/src/main/java/io/quarkus/smallrye/health/deployment/SmallRyeHealthProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,978,224 | 1,550,511 | 206,840 | 2,143 | 353 | 59 | 6 | 1 | 1,681 | 157 | 400 | 43 | 4 | 3 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,120 | quarkusio/quarkus/7794/7758 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7758 | https://github.com/quarkusio/quarkus/pull/7794 | https://github.com/quarkusio/quarkus/pull/7794 | 1 | fixes | 1.3.0.CR2 Not finding jar from other subproject | I am trying to upgrade to `1.3.0.CR2` from `1.2.0.Final`, and getting an error where the quarkus project can't find a jar generated from one of the sibling projects.
The project can be found here: https://github.com/GregJohnStewart/task-timekeeper
On an interesting note, `:WebServer:Server:test` works, but `:WebServer:Server:quarkusDev` fails with the following information:
```
Caused by: org.gradle.api.GradleException: Failed to run
at io.quarkus.gradle.tasks.QuarkusDev.startDev(QuarkusDev.java:399)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
...
Caused by: java.nio.file.FileSystemNotFoundException: /home/gstewart/GitRepos/task-timekeeper/BaseCode/ManagerIO/build/libs/ManagerIO-1.0.0.409.jar
at com.sun.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:120)
at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:139)
at io.quarkus.gradle.AppModelGradleResolver.collectDependencies(AppModelGradleResolver.java:256)
at io.quarkus.gradle.AppModelGradleResolver.resolveModel(AppModelGradleResolver.java:143)
at io.quarkus.gradle.tasks.QuarkusDev.startDev(QuarkusDev.java:242)
... 92 more
``` | 63596dd582abc43209a55b62ab9cf70fbb4a58fc | 57ba49ec95d3b0318a2aa1264b7863d11abd1dd2 | https://github.com/quarkusio/quarkus/compare/63596dd582abc43209a55b62ab9cf70fbb4a58fc...57ba49ec95d3b0318a2aa1264b7863d11abd1dd2 | diff --git a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
index cf719f67bfd..18dbecbba36 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java
@@ -62,6 +62,7 @@
import io.quarkus.dev.DevModeContext;
import io.quarkus.dev.DevModeMain;
import io.quarkus.gradle.QuarkusPluginExtension;
+import io.quarkus.runtime.LaunchMode;
import io.quarkus.utilities.JavaBinFinder;
public class QuarkusDev extends QuarkusTask {
@@ -235,7 +236,7 @@ public void startDev() {
StringBuilder classPathManifest = new StringBuilder();
final AppModel appModel;
- final AppModelResolver modelResolver = extension().getAppModelResolver();
+ final AppModelResolver modelResolver = extension().getAppModelResolver(LaunchMode.DEVELOPMENT);
try {
final AppArtifact appArtifact = extension.getAppArtifact();
appArtifact.setPath(extension.outputDirectory().toPath()); | ['devtools/gradle/src/main/java/io/quarkus/gradle/tasks/QuarkusDev.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,978,224 | 1,550,511 | 206,840 | 2,143 | 234 | 46 | 3 | 1 | 1,243 | 78 | 317 | 20 | 1 | 1 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,123 | quarkusio/quarkus/7644/7641 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7641 | https://github.com/quarkusio/quarkus/pull/7644 | https://github.com/quarkusio/quarkus/pull/7644 | 1 | resolves | the `container-image-s2i` extension logs a warning when I change the base S2I image | **Describe the bug**
I added the `container-image-s2i` extension so that I can customize the base S2I image in generated OpenShift resources. But when I do so (after overcoming all the obstacles described in #7637), I get a warning:
```
[WARNING] [io.quarkus.kubernetes.deployment.KubernetesDeployer] Replacing s2i-java builder image with openjdk-11-rhel7
```
That is uncalled for. The config property is there for a reason. I don't think even an INFO level would be appropriate -- I don't need a message that a config property is applied.
**Expected behavior**
No message.
**Actual behavior**
Warning (as if I did something wrong!).
**To Reproduce**
Steps to reproduce the behavior:
1. Add the `container-image-s2i` extension.
2. Run `mvn clean package`.
3. Observe the warning.
**Configuration**
```properties
quarkus.kubernetes.deployment-target=openshift
quarkus.openshift.expose=true
quarkus.s2i.base-jvm-image=registry.access.redhat.com/openjdk/openjdk-11-rhel7
``` | 4ac9785ac135973f40d938648d5032d6e63c7e0d | fcaef2b2d450b90e80e1caf60af44f5f7fbb728d | https://github.com/quarkusio/quarkus/compare/4ac9785ac135973f40d938648d5032d6e63c7e0d...fcaef2b2d450b90e80e1caf60af44f5f7fbb728d | diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
index c636a50c233..5370cb7e60c 100644
--- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
+++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java
@@ -418,7 +418,6 @@ private void applyBuildItems(Session session,
String builderImageName = ImageUtil.getName(builderImage);
S2iBuildConfig s2iBuildConfig = new S2iBuildConfigBuilder().withBuilderImage(builderImage).build();
if (!DEFAULT_S2I_IMAGE_NAME.equals(builderImageName)) {
- log.warn("Replacing " + DEFAULT_S2I_IMAGE_NAME + " builder image with " + builderImageName);
session.resources().decorate(OPENSHIFT, new RemoveBuilderImageResourceDecorator(DEFAULT_S2I_IMAGE_NAME));
}
session.resources().decorate(OPENSHIFT, new AddBuilderImageStreamResourceDecorator(s2iBuildConfig)); | ['extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,876,748 | 1,530,104 | 204,071 | 2,125 | 113 | 24 | 1 | 1 | 1,003 | 122 | 249 | 27 | 0 | 2 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,124 | quarkusio/quarkus/7638/7624 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7624 | https://github.com/quarkusio/quarkus/pull/7638 | https://github.com/quarkusio/quarkus/pull/7638 | 1 | fixes | [1.3.0.CR1] Gradle build breaks with local non-jar project dependencies | **Describe the bug**
The feature introduced in #7441 seems too naive. It seems to scan every `project` dependency for a `jar` task without checking if there is one at all.
**Expected behavior**
Gradle builds a multi project build where a sub project with the Quarkus plugins depends on another sub project without a `jar` task (e.g. a `java-platform` project) without any issues.
**Actual behavior**
Gradle fails at configuring the Quarkus sub project because of missing `jar` task in dependent project:
```
❯ ./gradlew tasks
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':service'.
> Task with name 'jar' not found in project ':platform'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 3s
```
**To Reproduce**
Steps to reproduce the behavior:
1. clone https://github.com/pschyma/quarkus-gradle-multi-project
2. `./gradlew tasks`
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`: `Linux enterprise 5.5.8-arch1-1 #1 SMP PREEMPT Fri, 06 Mar 2020 00:57:33 +0000 x86_64 GNU/Linux`
- Output of `java -version`:
```openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07)
OpenJDK 64-Bit Server VM GraalVM CE 19.3.1 (build 11.0.6+9-jvmci-19.3-b07, mixed mode, sharing)
```
- GraalVM version (if different from Java):
- Quarkus version or git rev: `1.3.0.CR1`
- Build tool (ie. output of `mvnw --version` or `gradlew --version`): `6.2.2`
**Additional context**
Another note: simply scanning for the presence of `jar` task could also lead to unexpected results if there is a jar producing task but with another name. Maybe it would be more reliable to scan the project artifacts.
| c7526b0f21667fad4e5154c2e8a70db77d526b44 | 329672022b434996ee1545358b89111075dde042 | https://github.com/quarkusio/quarkus/compare/c7526b0f21667fad4e5154c2e8a70db77d526b44...329672022b434996ee1545358b89111075dde042 | 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 eb7d7a10321..a5015c420e4 100644
--- a/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
+++ b/devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
@@ -7,6 +7,7 @@
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
+import org.gradle.api.UnknownTaskException;
import org.gradle.api.artifacts.ConfigurationContainer;
import org.gradle.api.artifacts.ProjectDependency;
import org.gradle.api.plugins.BasePlugin;
@@ -76,7 +77,7 @@ private void registerTasks(Project project) {
project.getPlugins().withType(
JavaPlugin.class,
javaPlugin -> {
- project.afterEvaluate(p -> afterEvaluate(p));
+ project.afterEvaluate(this::afterEvaluate);
Task classesTask = tasks.getByName(JavaPlugin.CLASSES_TASK_NAME);
quarkusDev.dependsOn(classesTask);
@@ -119,7 +120,7 @@ private void registerTasks(Project project) {
t.useJUnitPlatform();
};
tasks.withType(Test.class).forEach(configureTestTask);
- tasks.withType(Test.class).whenTaskAdded(t -> configureTestTask.accept(t));
+ tasks.withType(Test.class).whenTaskAdded(configureTestTask::accept);
});
}
@@ -135,16 +136,22 @@ private void afterEvaluate(Project project) {
.getIncoming().getDependencies()
.forEach(d -> {
if (d instanceof ProjectDependency) {
- configProjectDependency(project, project.getRootProject().findProject(d.getName()));
+ configProjectDependency(project, ((ProjectDependency) d).getDependencyProject());
}
});
}
private void configProjectDependency(Project project, Project dep) {
- project.getLogger().debug("Configuring %s task dependencies on %s tasks", project, dep);
- final Task quarkusBuild = project.getTasks().findByName(QUARKUS_BUILD_TASK_NAME);
- final Task jarTask = dep.getTasks().getByName(JavaPlugin.JAR_TASK_NAME);
- quarkusBuild.dependsOn(jarTask);
- extension.addProjectDepJarTask(dep, jarTask);
+ try {
+ final Task jarTask = dep.getTasks().getByName(JavaPlugin.JAR_TASK_NAME);
+ final Task quarkusBuild = project.getTasks().findByName(QUARKUS_BUILD_TASK_NAME);
+ project.getLogger().debug("Configuring %s task dependencies on %s tasks", project, dep);
+ if (quarkusBuild != null) {
+ quarkusBuild.dependsOn(jarTask);
+ }
+ extension.addProjectDepJarTask(dep, jarTask);
+ } catch (UnknownTaskException e) {
+ project.getLogger().debug("Expected tasks not present", e);
+ }
}
} | ['devtools/gradle/src/main/java/io/quarkus/gradle/QuarkusPlugin.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,875,780 | 1,529,964 | 204,056 | 2,125 | 1,539 | 308 | 23 | 1 | 1,957 | 286 | 541 | 45 | 2 | 2 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,125 | quarkusio/quarkus/7636/7632 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7632 | https://github.com/quarkusio/quarkus/pull/7636 | https://github.com/quarkusio/quarkus/pull/7636 | 1 | fixes | Bootstrap application - fail with 1.3.0.CR1 in native - substitution target for io.quarkus.vertx.core.runtime.graal.Target_sun_nio_ch_Iocp is not loaded | I see fail with simple bootstrap application based on Quarkus 1.3.0.CR1 in native - substitution target for io.quarkus.vertx.core.runtime.graal.Target_sun_nio_ch_Iocp is not loaded
Using GraalVM CE 19.3.1 JDK11 based one.
```
sdk use java 19.3.1.r11-grl && export GRAALVM_HOME=$JAVA_HOME
rm -rf fooBar
mvn io.quarkus:quarkus-maven-plugin:1.3.0.CR1:create \\
-DprojectGroupId=io.quarkus.qe \\
-DprojectArtifactId=fooBar \\
-DprojectVersion=1.0.0-SNAPSHOT \\
-DplatformArtifactId=quarkus-bom \\
-DclassName="io.quarkus.qe.MyResource"
mvn -f fooBar/pom.xml clean verify -Dnative
```
```
[INFO] --- quarkus-maven-plugin:1.3.0.CR1:build (default) @ fooBar ---
[INFO] [org.jboss.threads] JBoss Threads version 3.0.1.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /Users/rsvoboda/Downloads/fooBar/target/fooBar-1.0.0-SNAPSHOT-native-image-source-jar/fooBar-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /Users/rsvoboda/Downloads/fooBar/target/fooBar-1.0.0-SNAPSHOT-native-image-source-jar/fooBar-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 19.3.1 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /Users/rsvoboda/.sdkman/candidates/java/19.3.1.r11-grl/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar fooBar-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:-IncludeAllTimeZones -H:EnableURLProtocols=http --no-server -H:-UseServiceLoaderFeature -H:+StackTrace fooBar-1.0.0-SNAPSHOT-runner
[fooBar-1.0.0-SNAPSHOT-runner:7565] classlist: 3,882.79 ms
[fooBar-1.0.0-SNAPSHOT-runner:7565] setup: 314.73 ms
Error: substitution target for io.quarkus.vertx.core.runtime.graal.Target_sun_nio_ch_Iocp is not loaded. Use field `onlyWith` in the `TargetClass` annotation to make substitution only active when needed.
com.oracle.svm.core.util.UserError$UserException: substitution target for io.quarkus.vertx.core.runtime.graal.Target_sun_nio_ch_Iocp is not loaded. Use field `onlyWith` in the `TargetClass` annotation to make substitution only active when needed.
at com.oracle.svm.core.util.UserError.abort(UserError.java:65)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:823)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:252)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:230)
at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:876)
at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:825)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:528)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image build request failed with exit status 1
``` | c44630fc1bdfce6bad2b0bfa39c6cc408f35d39e | 8c3458afe2ab1d0c6f21f66bee0892045809b7b8 | https://github.com/quarkusio/quarkus/compare/c44630fc1bdfce6bad2b0bfa39c6cc408f35d39e...8c3458afe2ab1d0c6f21f66bee0892045809b7b8 | diff --git a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/graal/JdkSubstitutions.java b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/graal/JdkSubstitutions.java
index 62fd2e6cb16..bedd8bd8a13 100644
--- a/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/graal/JdkSubstitutions.java
+++ b/extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/graal/JdkSubstitutions.java
@@ -5,6 +5,9 @@
import java.nio.channels.spi.AsynchronousChannelProvider;
import java.util.function.Function;
+import org.graalvm.nativeimage.Platform;
+import org.graalvm.nativeimage.Platforms;
+
import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.InjectAccessors;
import com.oracle.svm.core.annotate.Substitute;
@@ -92,6 +95,7 @@ public String apply(TargetClass annotation) {
@Substitute
@TargetClass(className = "sun.nio.ch.WindowsAsynchronousFileChannelImpl", innerClass = "DefaultIocpHolder", onlyWith = JDK11OrLater.class)
+@Platforms({ Platform.WINDOWS.class })
final class Target_sun_nio_ch_WindowsAsynchronousFileChannelImpl_DefaultIocpHolder {
@Alias
@@ -100,6 +104,7 @@ final class Target_sun_nio_ch_WindowsAsynchronousFileChannelImpl_DefaultIocpHold
}
@TargetClass(className = "sun.nio.ch.Iocp", onlyWith = JDK11OrLater.class)
+@Platforms({ Platform.WINDOWS.class })
final class Target_sun_nio_ch_Iocp {
@Alias
@@ -113,6 +118,7 @@ Target_sun_nio_ch_Iocp start() {
}
@TargetClass(className = "sun.nio.ch.ThreadPool", onlyWith = JDK11OrLater.class)
+@Platforms({ Platform.WINDOWS.class })
final class Target_sun_nio_ch_ThreadPool {
@Alias | ['extensions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/graal/JdkSubstitutions.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,876,748 | 1,530,104 | 204,071 | 2,125 | 206 | 46 | 6 | 1 | 4,116 | 211 | 1,136 | 44 | 0 | 2 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,126 | quarkusio/quarkus/7627/7626 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7626 | https://github.com/quarkusio/quarkus/pull/7627 | https://github.com/quarkusio/quarkus/pull/7627 | 1 | fixes | Caching of hardcoded paths can cause issues | **Describe the bug**
recently something changed in caching so if you have a change in your ~/.m2 settings/location between builds the build fails with errors like:
```
ava.lang.RuntimeException: java.lang.RuntimeException: java.io.UncheckedIOException: Error while reading file as JAR: C:\\Users\\max\\.m2\\repository\\commons-io\\commons-io\\2.6\\commons-io-2.6.jar
Caused by: java.lang.RuntimeException: java.io.UncheckedIOException: Error while reading file as JAR: C:\\Users\\max\\.m2\\repository\\commons-io\\commons-io\\2.6\\commons-io-2.6.jar
Caused by: java.io.UncheckedIOException: Error while reading file as JAR: C:\\Users\\max\\.m2\\repository\\commons-io\\commons-io\\2.6\\commons-io-2.6.jar
Caused by: java.nio.file.NoSuchFileException: C:\\Users\\max\\.m2\\repository\\commons-io\\commons-io\\2.6\\commons-io-2.6.jar
```
**Expected behavior**
in this case its due to doing a build on windows and then afterwards on linux - both have a functioning ~/.m2 folder but since we now store absolute paths things goes wrong.
similar could happen if you cleaned your ~/.m2 repo or changed your .settings.xml or similar
| d0979b2ab352f4ebf078f5d4341567088dcdfbdd | 95743741cd300ec12868354a90f0c397c7ac8a01 | https://github.com/quarkusio/quarkus/compare/d0979b2ab352f4ebf078f5d4341567088dcdfbdd...95743741cd300ec12868354a90f0c397c7ac8a01 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
index ad764ffd007..9ed42945e02 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
@@ -257,14 +257,27 @@ public CurationResult resolveAppModel() throws BootstrapException {
try {
Path cachedCpPath = null;
+
if (workspace != null && enableClasspathCache) {
cachedCpPath = resolveCachedCpPath(localProject);
- if (Files.exists(cachedCpPath)) {
+ if (Files.exists(cachedCpPath)
+ && workspace.getLastModified() < Files.getLastModifiedTime(cachedCpPath).toMillis()) {
try (DataInputStream reader = new DataInputStream(Files.newInputStream(cachedCpPath))) {
if (reader.readInt() == CP_CACHE_FORMAT_ID) {
if (reader.readInt() == workspace.getId()) {
ObjectInputStream in = new ObjectInputStream(reader);
- return new CurationResult((AppModel) in.readObject());
+ AppModel appModel = (AppModel) in.readObject();
+ for (AppDependency i : appModel.getFullDeploymentDeps()) {
+ if (!Files.exists(i.getArtifact().getPath())) {
+ throw new IOException("Cached artifact does not exist: " + i.getArtifact().getPath());
+ }
+ }
+ for (AppDependency i : appModel.getUserDependencies()) {
+ if (!Files.exists(i.getArtifact().getPath())) {
+ throw new IOException("Cached artifact does not exist: " + i.getArtifact().getPath());
+ }
+ }
+ return new CurationResult(appModel);
} else {
debug("Cached deployment classpath has expired for %s", appArtifact);
} | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,875,791 | 1,529,966 | 204,056 | 2,125 | 1,207 | 181 | 17 | 1 | 1,110 | 113 | 289 | 15 | 0 | 1 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,127 | quarkusio/quarkus/7599/7598 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7598 | https://github.com/quarkusio/quarkus/pull/7599 | https://github.com/quarkusio/quarkus/pull/7599 | 1 | fixes | Config option quarkus.thread-pool.core-threads is ignored | setting quarkus.thread-pool.core-threads has no effect on the core number of executor threads. The application is aways started with the default number of executor threads (1).
**Expected behavior**
Number of executor threads equal to the property quarkus.thread-pool.core-threads
**Actual behavior**
Only 1 executor thread is ever started at startup
| 26ec088450b010d0a71dcf652958e29cbd45ea0a | e0f4413f244c2a0070d519b28fdb23e2407e107e | https://github.com/quarkusio/quarkus/compare/26ec088450b010d0a71dcf652958e29cbd45ea0a...e0f4413f244c2a0070d519b28fdb23e2407e107e | diff --git a/core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java b/core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java
index fadc8116df7..cc4805240a4 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java
@@ -57,6 +57,9 @@ public void run() {
shutdownContext.addShutdownTask(shutdownTask);
executor = underlying;
}
+ if (threadPoolConfig.prefill) {
+ underlying.prestartAllCoreThreads();
+ }
current = executor;
return executor;
}
diff --git a/core/runtime/src/main/java/io/quarkus/runtime/ThreadPoolConfig.java b/core/runtime/src/main/java/io/quarkus/runtime/ThreadPoolConfig.java
index c4171e10e0e..748a56a0e9f 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/ThreadPoolConfig.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/ThreadPoolConfig.java
@@ -21,6 +21,13 @@ public class ThreadPoolConfig {
@ConfigItem(defaultValue = "1")
public int coreThreads;
+ /**
+ * Prefill core thread pool.
+ * The core thread pool will be initialised with the core number of threads at startup
+ */
+ @ConfigItem(defaultValue = "true")
+ public boolean prefill;
+
/**
* The maximum number of threads. If this is not specified then
* it will be automatically sized to 8 * the number of available processors | ['core/runtime/src/main/java/io/quarkus/runtime/ThreadPoolConfig.java', 'core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 7,871,795 | 1,529,166 | 203,970 | 2,124 | 315 | 67 | 10 | 2 | 360 | 47 | 75 | 8 | 0 | 0 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,128 | quarkusio/quarkus/7584/7581 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7581 | https://github.com/quarkusio/quarkus/pull/7584 | https://github.com/quarkusio/quarkus/pull/7584 | 1 | fixes | Tests fail after quarkus:dev run | When running mvn package (no clean) after quarkus:dev, 1. tests fail 2. with a weird inlined exception in the console.
```
# build Quarkus master
./mvn clean install -DskipTests
# create new project
cd /tmp
mvn io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:create -DprojectGroupId=org.acme -DprojectArtifactId=test -DclassName="org.acme.GreetingResource" -Dpath="/greeting" -DplatformArtifactId=quarkus-bom -DplatformVersion=999-SNAPSHOT
# run quarkus:dev
cd test
./mvn clean compile quarkus:dev
# CTRL+C
# start package
./mvnw package
^[[A^[[A ~ Dow nob banner-test mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.acme:banner-test >------------------------
[INFO] Building banner-test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ banner-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ banner-test ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ banner-test ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/emmanuel/Downloads/nobackup/banner-test/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ banner-test ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to /Users/emmanuel/Downloads/nobackup/banner-test/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ banner-test ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.acme.GreetingResourceTest
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.28 s <<< FAILURE! - in org.acme.GreetingResourceTest
[ERROR] testHelloEndpoint Time elapsed: 0.011 s <<< ERROR!
java.lang.RuntimeException: java.lang.RuntimeException: java.util.ServiceConfigurationError: org.eclipse.microprofile.config.spi.ConfigSourceProvider: io.quarkus.test.common.http.TestHTTPConfigSourceProvider not a subtype
Caused by: java.lang.RuntimeException: java.util.ServiceConfigurationError: org.eclipse.microprofile.config.spi.ConfigSourceProvider: io.quarkus.test.common.http.TestHTTPConfigSourceProvider not a subtype
Caused by: java.util.ServiceConfigurationError: org.eclipse.microprofile.config.spi.ConfigSourceProvider: io.quarkus.test.common.http.TestHTTPConfigSourceProvider not a subtype
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] GreetingResourceTest.testHelloEndpoint » Runtime java.lang.RuntimeException: j...
[INFO]
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.166 s
[INFO] Finished at: 2020-03-04T21:19:05+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.1:test (default-test) on project banner-test: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/emmanuel/Downloads/nobackup/banner-test/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
```
If `./mvnw clean package` is run, then no failure occurs. | 8f0254b65fce637448c3da20e630f734bc51d193 | 61b3ae077f690b0bb7f576fd0f26572ddc2da667 | https://github.com/quarkusio/quarkus/compare/8f0254b65fce637448c3da20e630f734bc51d193...61b3ae077f690b0bb7f576fd0f26572ddc2da667 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
index 609eef9cd1a..ad764ffd007 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java
@@ -46,7 +46,7 @@ public class BootstrapAppModelFactory {
private static final String QUARKUS = "quarkus";
private static final String BOOTSTRAP = "bootstrap";
- private static final String DEPLOYMENT_CP = "deployment.cp";
+ private static final String APP_MODEL_DAT = "app-model.dat";
public static final String CREATOR_APP_GROUP_ID = "creator.app.groupId";
public static final String CREATOR_APP_ARTIFACT_ID = "creator.app.artifactId";
@@ -441,8 +441,10 @@ private CurationResult createAppModelForJar(Path appArtifactPath) {
}
}
- private static Path resolveCachedCpPath(LocalProject project) {
- return project.getOutputDir().resolve(QUARKUS).resolve(BOOTSTRAP).resolve(DEPLOYMENT_CP);
+ private Path resolveCachedCpPath(LocalProject project) {
+ final String filePrefix = test ? "test-" : (devMode ? "dev-" : null);
+ return project.getOutputDir().resolve(QUARKUS).resolve(BOOTSTRAP)
+ .resolve(filePrefix == null ? APP_MODEL_DAT : filePrefix + APP_MODEL_DAT);
}
private static void debug(String msg, Object... args) { | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,829,933 | 1,521,148 | 202,648 | 2,111 | 607 | 140 | 8 | 1 | 4,213 | 388 | 1,088 | 79 | 1 | 1 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,129 | quarkusio/quarkus/7577/7576 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7576 | https://github.com/quarkusio/quarkus/pull/7577 | https://github.com/quarkusio/quarkus/pull/7577 | 1 | fixes | NettyProcessor marks http2 related classes for runtime initialization even if they are not on the classpath | **Describe the bug**
The NettyProcessor performs some checks to determine what classes should be initialized at runtime :
https://github.com/quarkusio/quarkus/blob/0ecb901c14242e2d31ab44e2480f66931671d84c/extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java#L82-L95
but this code is flawed as http and http2 classes are provided by different artefacts so in case the http2 codec is non on the classpath, the native image build would fail with something like:
```
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 19.3.1 CE
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] /opt/data/sfw/lang/java/8-graal/bin/native-image -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -H:+JNI -jar camel-k-runtime-example-quarkus-yaml-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:NativeLinkerOption=-no-pie --no-server -H:-UseServiceLoaderFeature -H:+StackTrace camel-k-runtime-example-quarkus-yaml-runner
[camel-k-runtime-example-quarkus-yaml-runner:67685] classlist: 6,783.16 ms
16:29:35,484 INFO [org.apa.cam.sup.LRUCacheFactory] Detected and using LURCacheFactory: camel-caffeine-lrucache
[camel-k-runtime-example-quarkus-yaml-runner:67685] (cap): 801.63 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] setup: 2,291.49 ms
java.lang.ClassNotFoundException: io.netty.handler.codec.http2.Http2ClientUpgradeCodec
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.quarkus.runner.AutoFeature.beforeAnalysis(AutoFeature.zig:12746)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:63)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
java.lang.ClassNotFoundException: io.netty.handler.codec.http2.DefaultHttp2FrameWriter
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.quarkus.runner.AutoFeature.beforeAnalysis(AutoFeature.zig:12861)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:63)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
java.lang.ClassNotFoundException: io.netty.handler.codec.http2.Http2ConnectionHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.quarkus.runner.AutoFeature.beforeAnalysis(AutoFeature.zig:12976)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:63)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
java.lang.ClassNotFoundException: io.netty.handler.codec.http2.Http2CodecUtil
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.quarkus.runner.AutoFeature.beforeAnalysis(AutoFeature.zig:13206)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:63)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
java.lang.NullPointerException
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.initializeAtRunTime(ConfigurableClassInitialization.java:249)
at org.graalvm.nativeimage.hosted.RuntimeClassInitialization.initializeAtRunTime(RuntimeClassInitialization.java:99)
at io.quarkus.runner.AutoFeature.beforeAnalysis(AutoFeature.zig:13249)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$7(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:63)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:669)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:530)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
16:29:39,632 INFO [org.jbo.threads] JBoss Threads version 3.0.1.Final
[camel-k-runtime-example-quarkus-yaml-runner:67685] (typeflow): 16,398.23 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] (objects): 10,305.35 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] (features): 469.17 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] analysis: 28,557.61 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] (clinit): 753.17 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] universe: 2,014.83 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] (parse): 2,746.83 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] (inline): 3,935.75 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] (compile): 25,660.12 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] compile: 33,949.94 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] image: 2,269.54 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] write: 417.88 ms
[camel-k-runtime-example-quarkus-yaml-runner:67685] [total]: 76,643.82 ms
```
**Expected behavior**
The NettyProcessor should register only classes that are available on the classpath.
**Actual behavior**
The NettyProcessor marks http2 related classes for runtime initialization even if they are not on the classpath
**Additional context**
I'll provide a PR
| f98827f741afaccfa26a7ac3f9f7b4a0b21bb5e9 | 5e75b10fc42d968b90d5ecf8ab7a101fe74d33c1 | https://github.com/quarkusio/quarkus/compare/f98827f741afaccfa26a7ac3f9f7b4a0b21bb5e9...5e75b10fc42d968b90d5ecf8ab7a101fe74d33c1 | 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 700741feba8..c1914208df5 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
@@ -83,10 +83,6 @@ NativeImageConfigBuildItem build() {
Class.forName("io.netty.handler.codec.http.HttpObjectEncoder");
builder
.addRuntimeInitializedClass("io.netty.handler.codec.http.HttpObjectEncoder")
- .addRuntimeInitializedClass("io.netty.handler.codec.http2.Http2CodecUtil")
- .addRuntimeInitializedClass("io.netty.handler.codec.http2.Http2ClientUpgradeCodec")
- .addRuntimeInitializedClass("io.netty.handler.codec.http2.DefaultHttp2FrameWriter")
- .addRuntimeInitializedClass("io.netty.handler.codec.http2.Http2ConnectionHandler")
.addRuntimeInitializedClass("io.netty.handler.codec.http.websocketx.extensions.compression.DeflateDecoder")
.addRuntimeInitializedClass("io.netty.handler.codec.http.websocketx.WebSocket00FrameEncoder");
} catch (ClassNotFoundException e) {
@@ -94,6 +90,18 @@ NativeImageConfigBuildItem build() {
log.debug("Not registering Netty HTTP classes as they were not found");
}
+ try {
+ Class.forName("io.netty.handler.codec.http2.Http2CodecUtil");
+ builder
+ .addRuntimeInitializedClass("io.netty.handler.codec.http2.Http2CodecUtil")
+ .addRuntimeInitializedClass("io.netty.handler.codec.http2.Http2ClientUpgradeCodec")
+ .addRuntimeInitializedClass("io.netty.handler.codec.http2.DefaultHttp2FrameWriter")
+ .addRuntimeInitializedClass("io.netty.handler.codec.http2.Http2ConnectionHandler");
+ } catch (ClassNotFoundException e) {
+ //ignore
+ log.debug("Not registering Netty HTTP2 classes as they were not found");
+ }
+
try {
Class.forName("io.netty.channel.unix.UnixChannel");
builder.addRuntimeInitializedClass("io.netty.channel.unix.Errors") | ['extensions/netty/deployment/src/main/java/io/quarkus/netty/deployment/NettyProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,825,509 | 1,520,278 | 202,523 | 2,110 | 1,098 | 200 | 16 | 1 | 9,502 | 373 | 2,423 | 121 | 1 | 1 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,130 | quarkusio/quarkus/7550/7403 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7403 | https://github.com/quarkusio/quarkus/pull/7550 | https://github.com/quarkusio/quarkus/pull/7550 | 1 | resolves | CDI beans with array type result in warning. | Adding a producer like:
@Produces
String[] produce() {
return new String[0];
}
results in:
2020-02-25 16:47:35,774 WARN [io.qua.arc.pro.BeanArchives] (build-14) Failed to index [Ljava.lang.String;: Stream closed
2020-02-25 16:47:35,774 INFO [io.qua.arc.pro.IndexClassLookupUtils] (build-14) Class for name: [Ljava.lang.String; was not found in Jandex index. Please ensure the class is part of the index. | f87c4457248c402466cb9e34d1fc3013dd03d50b | 0668d7459887b7c682d3472aebd611fbcaab2bf5 | https://github.com/quarkusio/quarkus/compare/f87c4457248c402466cb9e34d1fc3013dd03d50b...0668d7459887b7c682d3472aebd611fbcaab2bf5 | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java
index f623a2f012c..971c29136be 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java
@@ -1,7 +1,5 @@
package io.quarkus.arc.processor;
-import static io.quarkus.arc.processor.IndexClassLookupUtils.getClassByNameNoLogging;
-
import io.quarkus.arc.impl.ActivateRequestContextInterceptor;
import io.quarkus.arc.impl.InjectableRequestContextController;
import java.io.IOException;
@@ -102,7 +100,7 @@ public Collection<ClassInfo> getKnownClasses() {
@Override
public ClassInfo getClassByName(DotName className) {
- ClassInfo classInfo = getClassByNameNoLogging(index, className);
+ ClassInfo classInfo = IndexClassLookupUtils.getClassByName(index, className, false);
if (classInfo == null) {
classInfo = additionalClasses.computeIfAbsent(className, this::computeAdditional).orElse(null);
}
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java
index a697e6bef6b..b698a03cb61 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java
@@ -384,7 +384,7 @@ void validate(List<Throwable> errors, List<BeanDeploymentValidator> validators)
} else if (isProducerField() || isProducerMethod()) {
ClassInfo returnTypeClass = getClassByName(beanDeployment.getIndex(),
- (isProducerMethod() ? target.get().asMethod().returnType() : target.get().asField().type()).name());
+ isProducerMethod() ? target.get().asMethod().returnType() : target.get().asField().type());
// can be null for primitive types
if (returnTypeClass != null && scope.isNormal() && !Modifier.isInterface(returnTypeClass.flags())) {
String methodOrField = isProducerMethod() ? "method" : "field";
@@ -594,19 +594,9 @@ private ClassInfo initImplClazz(AnnotationTarget target, BeanDeployment beanDepl
case CLASS:
return target.asClass();
case FIELD:
- Type fieldType = target.asField().type();
- if (fieldType.kind() != org.jboss.jandex.Type.Kind.PRIMITIVE
- && fieldType.kind() != org.jboss.jandex.Type.Kind.ARRAY) {
- return getClassByName(beanDeployment.getIndex(), fieldType.name());
- }
- break;
+ return getClassByName(beanDeployment.getIndex(), target.asField().type());
case METHOD:
- Type returnType = target.asMethod().returnType();
- if (returnType.kind() != org.jboss.jandex.Type.Kind.PRIMITIVE
- && returnType.kind() != org.jboss.jandex.Type.Kind.ARRAY) {
- return getClassByName(beanDeployment.getIndex(), returnType.name());
- }
- break;
+ return getClassByName(beanDeployment.getIndex(), target.asMethod().returnType());
default:
break;
}
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 5c6673157c7..6c8cab810d8 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
@@ -231,11 +231,11 @@ Collection<MethodInfo> getDelegatingMethods(BeanInfo bean) {
methods);
} else if (bean.isProducerMethod()) {
MethodInfo producerMethod = bean.getTarget().get().asMethod();
- ClassInfo returnTypeClass = getClassByName(bean.getDeployment().getIndex(), producerMethod.returnType().name());
+ ClassInfo returnTypeClass = getClassByName(bean.getDeployment().getIndex(), producerMethod.returnType());
Methods.addDelegatingMethods(bean.getDeployment().getIndex(), returnTypeClass, methods);
} else if (bean.isProducerField()) {
FieldInfo producerField = bean.getTarget().get().asField();
- ClassInfo fieldClass = getClassByName(bean.getDeployment().getIndex(), producerField.type().name());
+ ClassInfo fieldClass = getClassByName(bean.getDeployment().getIndex(), producerField.type());
Methods.addDelegatingMethods(bean.getDeployment().getIndex(), fieldClass, methods);
} else if (bean.isSynthetic()) {
Methods.addDelegatingMethods(bean.getDeployment().getIndex(), bean.getImplClazz(), methods);
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java
index b05604d0386..a44669943ed 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java
@@ -1,10 +1,12 @@
package io.quarkus.arc.processor;
-import java.util.HashSet;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import org.jboss.jandex.ClassInfo;
import org.jboss.jandex.DotName;
import org.jboss.jandex.IndexView;
+import org.jboss.jandex.Type;
+import org.jboss.jandex.Type.Kind;
import org.jboss.logging.Logger;
final class IndexClassLookupUtils {
@@ -12,23 +14,29 @@ final class IndexClassLookupUtils {
private static final Logger LOGGER = Logger.getLogger(IndexClassLookupUtils.class);
// set of already encountered and logged DotNames that are missing in the index
- private static Set<DotName> alreadyKnown = new HashSet<>();
+ private static final Set<DotName> alreadyKnown = ConcurrentHashMap.newKeySet();
private IndexClassLookupUtils() {
}
- static ClassInfo getClassByName(IndexView index, DotName dotName) {
- return lookupClassInIndex(index, dotName, true);
- }
-
/**
- * Used by {@code BeanArchives.IndexWrapper#getClassByName()} while gathering additional classes for indexing
+ *
+ * @param index
+ * @param type
+ * @return the class for the given type or {@code null} for primitives, arrays and
*/
- static ClassInfo getClassByNameNoLogging(IndexView index, DotName dotName) {
- return lookupClassInIndex(index, dotName, false);
+ static ClassInfo getClassByName(IndexView index, Type type) {
+ if (type != null && (type.kind() == Kind.CLASS || type.kind() == Kind.PARAMETERIZED_TYPE)) {
+ return getClassByName(index, type.name());
+ }
+ return null;
+ }
+
+ static ClassInfo getClassByName(IndexView index, DotName dotName) {
+ return getClassByName(index, dotName, true);
}
- private static ClassInfo lookupClassInIndex(IndexView index, DotName dotName, boolean withLogging) {
+ static ClassInfo getClassByName(IndexView index, DotName dotName, boolean withLogging) {
if (dotName == null) {
throw new IllegalArgumentException("Cannot lookup class, provided DotName was null.");
}
@@ -38,8 +46,8 @@ private static ClassInfo lookupClassInIndex(IndexView index, DotName dotName, bo
ClassInfo info = index.getClassByName(dotName);
if (info == null && withLogging && !alreadyKnown.contains(dotName)) {
// class not in index, log info as this may cause the application to blow up or behave weirdly
- LOGGER.info("Class for name: " + dotName + " was not found in Jandex index. Please ensure the class " +
- "is part of the index.");
+ LOGGER.infof("Class for name: %s was not found in Jandex index. Please ensure the class " +
+ "is part of the index.", dotName);
alreadyKnown.add(dotName);
}
return info;
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java
index 8ab6741353e..d092300cf03 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java
@@ -170,7 +170,7 @@ static Set<Type> getProducerMethodTypeClosure(MethodInfo producerMethod, BeanDep
types.add(OBJECT_TYPE);
return types;
} else {
- ClassInfo returnTypeClassInfo = getClassByName(beanDeployment.getIndex(), returnType.name());
+ ClassInfo returnTypeClassInfo = getClassByName(beanDeployment.getIndex(), returnType);
if (returnTypeClassInfo == null) {
throw new IllegalArgumentException(
"Producer method return type not found in index: " + producerMethod.returnType().name());
@@ -197,7 +197,7 @@ static Set<Type> getProducerFieldTypeClosure(FieldInfo producerField, BeanDeploy
types.add(fieldType);
types.add(OBJECT_TYPE);
} else {
- ClassInfo fieldClassInfo = getClassByName(beanDeployment.getIndex(), producerField.type().name());
+ ClassInfo fieldClassInfo = getClassByName(beanDeployment.getIndex(), producerField.type());
if (fieldClassInfo == null) {
throw new IllegalArgumentException("Producer field type not found in index: " + producerField.type().name());
} | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Types.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanInfo.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ClientProxyGenerator.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/IndexClassLookupUtils.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanArchives.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 7,814,124 | 1,517,947 | 202,232 | 2,107 | 4,038 | 770 | 60 | 5 | 438 | 49 | 129 | 11 | 0 | 0 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,131 | quarkusio/quarkus/7542/7509 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7509 | https://github.com/quarkusio/quarkus/pull/7542 | https://github.com/quarkusio/quarkus/pull/7542 | 1 | fixes | Undertow websockets extension does not register service provider for javax.websocket.server.ServerEndpointConfig.Configurator | In native mode, when connecting to web socket endpoints that were configured programmatically (E.g a class that extends `javax.websocket.Endpoint`). I get the following exception:
```
2020-03-02 10:04:54,746 ERROR [io.und.req.io] (executor-thread-1) Exception handling request a66824b3-c65b-46d6-9be8-39f804502324-1 to /simple: java.lang.RuntimeException: Cannot load platform configurator
at javax.websocket.server.ServerEndpointConfig$Configurator.fetchContainerDefaultConfigurator(ServerEndpointConfig.java:96)
at javax.websocket.server.ServerEndpointConfig$Configurator.getContainerDefaultConfigurator(ServerEndpointConfig.java:101)
at javax.websocket.server.ServerEndpointConfig$Configurator.checkOrigin(ServerEndpointConfig.java:155)
at io.undertow.websockets.jsr.handshake.HandshakeUtil.checkOrigin(HandshakeUtil.java:54)
at io.undertow.websockets.jsr.handshake.Handshake.matches(Handshake.java:283)
at io.undertow.websockets.jsr.JsrWebSocketFilter.doFilter(JsrWebSocketFilter.java:109)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:63)
at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:133)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:65)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:270)
at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:59)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:116)
at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:113)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.quarkus.undertow.runtime.UndertowDeploymentRecorder$9$1$1.call(UndertowDeploymentRecorder.java:476)
```
It seems that the service provider for `javax.websocket.server.ServerEndpointConfig$Configurator` is not available.
If I hack the following build step into the `undertow-websockets` extension, the problem seems fixed:
```java
@BuildStep
ServiceProviderBuildItem registerConfiguratorServiceProvider() {
return new ServiceProviderBuildItem(ServerEndpointConfig.Configurator.class.getName(),
DefaultContainerConfigurator.class.getName());
}
```
I tweaked the websockets quickstart to reproduce the problem here:
https://github.com/jamesnetherton/quarkus-quickstarts/tree/ws-test/websockets-quickstart
| d9e6795dbd74bec4773b8e26ada26c625fefd6b2 | 36fbbdd37f9e23d64a6d1b6b614010f578d18fb6 | https://github.com/quarkusio/quarkus/compare/d9e6795dbd74bec4773b8e26ada26c625fefd6b2...36fbbdd37f9e23d64a6d1b6b614010f578d18fb6 | diff --git a/extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/deployment/UndertowWebsocketProcessor.java b/extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/deployment/UndertowWebsocketProcessor.java
index a4a5e84610d..a69494c7a90 100644
--- a/extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/deployment/UndertowWebsocketProcessor.java
+++ b/extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/deployment/UndertowWebsocketProcessor.java
@@ -13,6 +13,7 @@
import javax.websocket.Endpoint;
import javax.websocket.server.ServerApplicationConfig;
import javax.websocket.server.ServerEndpoint;
+import javax.websocket.server.ServerEndpointConfig;
import org.jboss.jandex.AnnotationInstance;
import org.jboss.jandex.AnnotationValue;
@@ -35,6 +36,7 @@
import io.quarkus.runtime.annotations.ConfigRoot;
import io.quarkus.undertow.deployment.ServletContextAttributeBuildItem;
import io.quarkus.undertow.websockets.runtime.UndertowWebsocketRecorder;
+import io.undertow.websockets.jsr.DefaultContainerConfigurator;
import io.undertow.websockets.jsr.JsrWebSocketFilter;
import io.undertow.websockets.jsr.UndertowContainerProvider;
import io.undertow.websockets.jsr.WebSocketDeploymentInfo;
@@ -51,6 +53,12 @@ void holdConfig(BuildProducer<FeatureBuildItem> feature, HotReloadConfig hotRelo
feature.produce(new FeatureBuildItem(FeatureBuildItem.UNDERTOW_WEBSOCKETS));
}
+ @BuildStep
+ ServiceProviderBuildItem registerConfiguratorServiceProvider() {
+ return new ServiceProviderBuildItem(ServerEndpointConfig.Configurator.class.getName(),
+ DefaultContainerConfigurator.class.getName());
+ }
+
@BuildStep
void scanForAnnotatedEndpoints(CombinedIndexBuildItem indexBuildItem,
BuildProducer<AnnotatedWebsocketEndpointBuildItem> annotatedProducer) { | ['extensions/undertow-websockets/deployment/src/main/java/io/quarkus/undertow/websockets/deployment/UndertowWebsocketProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 7,813,686 | 1,517,883 | 202,225 | 2,107 | 372 | 62 | 8 | 1 | 4,271 | 150 | 916 | 53 | 1 | 2 | 1970-01-01T00:26:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,111 | quarkusio/quarkus/7906/7888 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7888 | https://github.com/quarkusio/quarkus/pull/7906 | https://github.com/quarkusio/quarkus/pull/7906 | 1 | resolves | ArC - it's not possible to inject Instance<> into an observer method parameter | The code generated by `io.quarkus.arc.processor.BuiltinBean.INSTANCE` only considers injection into a bean. | 40a3d8684e21c18833e1ddbb76d4f02865e55924 | 4487d6e42eb75d15a3820dc69ada083b2e774580 | https://github.com/quarkusio/quarkus/compare/40a3d8684e21c18833e1ddbb76d4f02865e55924...4487d6e42eb75d15a3820dc69ada083b2e774580 | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java
index 0011390beea..8684ea34295 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java
@@ -43,10 +43,23 @@ enum BuiltinBean {
ctx.injectionPoint, ctx.annotationLiterals);
ResultHandle javaMemberHandle = BeanGenerator.getJavaMemberHandle(ctx.constructor, ctx.injectionPoint,
ctx.reflectionRegistration);
+ ResultHandle beanHandle;
+ switch (ctx.targetInfo.kind()) {
+ case OBSERVER:
+ // For observers the first argument is always the declaring bean
+ beanHandle = ctx.constructor.invokeInterfaceMethod(
+ MethodDescriptors.SUPPLIER_GET, ctx.constructor.getMethodParam(0));
+ break;
+ case BEAN:
+ beanHandle = ctx.constructor.getThis();
+ break;
+ default:
+ throw new IllegalStateException("Unsupported target info: " + ctx.targetInfo);
+ }
ResultHandle instanceProvider = ctx.constructor.newInstance(
MethodDescriptor.ofConstructor(InstanceProvider.class, java.lang.reflect.Type.class, Set.class,
InjectableBean.class, Set.class, Member.class, int.class),
- parameterizedType, qualifiers, ctx.constructor.getThis(), annotationsHandle, javaMemberHandle,
+ parameterizedType, qualifiers, beanHandle, annotationsHandle, javaMemberHandle,
ctx.constructor.load(ctx.injectionPoint.getPosition()));
ResultHandle instanceProviderSupplier = ctx.constructor.newInstance(
MethodDescriptors.FIXED_VALUE_SUPPLIER_CONSTRUCTOR, instanceProvider);
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 cf412e94f23..6d77b403dd5 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
@@ -414,6 +414,9 @@ void addBean(BeanInfo bean, ResultHandle beanIdToBeanHandle,
}
if (bean.getDisposer() != null) {
for (InjectionPointInfo injectionPoint : bean.getDisposer().getInjection().injectionPoints) {
+ if (BuiltinBean.resolvesTo(injectionPoint)) {
+ continue;
+ }
params.add(addBeansMethod.newInstance(
MethodDescriptors.MAP_VALUE_SUPPLIER_CONSTRUCTOR,
beanIdToBeanHandle, addBeansMethod.load(injectionPoint.getResolvedBean().getIdentifier())));
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/ArcContainerImpl.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/ArcContainerImpl.java
index 1c5aea637fc..0d145c1dc27 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/ArcContainerImpl.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/ArcContainerImpl.java
@@ -144,7 +144,7 @@ private void addBuiltInBeans() {
// BeanManager, Event<?>, Instance<?>
beans.add(new BeanManagerBean());
beans.add(new EventBean());
- beans.add(new InstanceBean());
+ beans.add(InstanceBean.INSTANCE);
}
public void init() {
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceBean.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceBean.java
index fd94809501e..eeb8e7eae53 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceBean.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceBean.java
@@ -15,6 +15,8 @@ public class InstanceBean extends BuiltInBean<Instance<?>> {
public static final Set<Type> INSTANCE_TYPES = Collections
.unmodifiableSet(new HashSet<>(Arrays.asList(Instance.class, Object.class)));
+ static final InstanceBean INSTANCE = new InstanceBean();
+
@Override
public Set<Type> getTypes() {
return INSTANCE_TYPES;
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceImpl.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceImpl.java
index 18804b2f30b..60c4b83f468 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceImpl.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceImpl.java
@@ -35,9 +35,11 @@
private final CreationalContextImpl<?> creationalContext;
private final Set<InjectableBean<?>> resolvedBeans;
- private final Type injectionPointType;
private final Type requiredType;
private final Set<Annotation> requiredQualifiers;
+
+ // The following fields are only needed for InjectionPoint metadata
+ private final Type injectionPointType;
private final InjectableBean<?> targetBean;
private final Set<Annotation> annotations;
private final Member javaMember;
diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceProvider.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceProvider.java
index 9b8ad432ec4..2ac2c92024d 100644
--- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceProvider.java
+++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceProvider.java
@@ -32,10 +32,15 @@ public InstanceProvider(Type type, Set<Annotation> qualifiers, InjectableBean<?>
this.position = position;
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Instance<T> get(CreationalContext<Instance<T>> creationalContext) {
- return new InstanceImpl<T>(targetBean, requiredType, qualifiers, CreationalContextImpl.unwrap(creationalContext),
+ InstanceImpl<T> instance = new InstanceImpl<T>(targetBean, requiredType, qualifiers,
+ CreationalContextImpl.unwrap(creationalContext),
annotations, javaMember, position);
+ CreationalContextImpl.addDependencyToParent(InstanceBean.INSTANCE, instance,
+ (CreationalContext) creationalContext);
+ return instance;
}
}
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/observers/injection/SimpleObserverInjectionTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/observers/injection/SimpleObserverInjectionTest.java
index 32910fcf379..2ffe315367f 100644
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/observers/injection/SimpleObserverInjectionTest.java
+++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/observers/injection/SimpleObserverInjectionTest.java
@@ -13,6 +13,7 @@
import javax.annotation.PreDestroy;
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Observes;
+import javax.enterprise.inject.Instance;
import javax.inject.Singleton;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -40,8 +41,12 @@ public void testObserverInjection() {
static class StringObserver {
@SuppressWarnings({ "rawtypes", "unchecked" })
- void observeString(@Observes AtomicReference value, Fool fool) {
+ void observeString(@Observes AtomicReference value, Fool fool, Instance<Fool> fools) {
value.set(fool.id);
+ fools.forEach(f -> {
+ // Fool is @Dependent!
+ assertNotEquals(fool.id, f.id);
+ });
}
}
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java
index 478e6f6ca77..705516ecc6b 100644
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java
+++ b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java
@@ -2,18 +2,22 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import io.quarkus.arc.Arc;
import io.quarkus.arc.InstanceHandle;
import io.quarkus.arc.test.ArcTestContainer;
import io.quarkus.arc.test.MyQualifier;
import java.math.BigDecimal;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
+import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Dependent;
import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Produces;
import javax.enterprise.util.TypeLiteral;
import javax.inject.Singleton;
@@ -25,7 +29,7 @@ public class DisposerTest {
@RegisterExtension
ArcTestContainer container = new ArcTestContainer(StringProducer.class, LongProducer.class, BigDecimalProducer.class,
- MyQualifier.class);
+ MyQualifier.class, Pong.class);
@AfterAll
public static void afterAll() {
@@ -41,6 +45,9 @@ public void testDisposers() {
assertEquals(LongProducer.DISPOSED.get(), longValue);
// String is only injected in Long disposer
assertNotNull(StringProducer.DISPOSED.get());
+ // Pong should be destroyed when the disposer invocation completes
+ assertTrue(Pong.DESTROYED.get());
+
// A new instance is created for produce and dispose
assertEquals(2, StringProducer.DESTROYED.get());
// Both producer and produced bean are application scoped
@@ -61,9 +68,31 @@ Long produce() {
return System.currentTimeMillis();
}
- void dipose(@Disposes Long value, @MyQualifier String injectedString) {
+ void dipose(@Disposes Long value, @MyQualifier String injectedString, Instance<Pong> pongs) {
assertNotNull(injectedString);
DISPOSED.set(value);
+ pongs.forEach(p -> {
+ assertEquals("OK", p.id);
+ });
+ }
+
+ }
+
+ @Dependent
+ static class Pong {
+
+ static final AtomicBoolean DESTROYED = new AtomicBoolean();
+
+ String id;
+
+ @PostConstruct
+ void init() {
+ id = "OK";
+ }
+
+ @PreDestroy
+ void destroy() {
+ DESTROYED.set(true);
}
} | ['independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceProvider.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceImpl.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/ComponentsProviderGenerator.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/observers/injection/SimpleObserverInjectionTest.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BuiltinBean.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/InstanceBean.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java', 'independent-projects/arc/runtime/src/main/java/io/quarkus/arc/impl/ArcContainerImpl.java'] | {'.java': 8} | 8 | 8 | 0 | 0 | 8 | 8,006,368 | 1,555,873 | 207,495 | 2,146 | 1,748 | 305 | 33 | 6 | 107 | 11 | 23 | 1 | 0 | 0 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,110 | quarkusio/quarkus/7912/7907 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7907 | https://github.com/quarkusio/quarkus/pull/7912 | https://github.com/quarkusio/quarkus/pull/7912 | 1 | fixes | Wrong display name of gc.total base metric | https://github.com/quarkusio/quarkus/blob/1.3.0.Final/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java#L232
Should be "Garbage Collection Count", not "Garbage Collection Time" | 3621aebb67c452240ad376709ce7d28978cf2053 | 7e74c9f86a009d487e76638c80adf2b92bd62b34 | https://github.com/quarkusio/quarkus/compare/3621aebb67c452240ad376709ce7d28978cf2053...7e74c9f86a009d487e76638c80adf2b92bd62b34 | diff --git a/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java b/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
index fded2620d16..0d1c0e535f2 100644
--- a/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
+++ b/extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java
@@ -229,7 +229,7 @@ private void garbageCollectionMetrics(MetricRegistry registry) {
Metadata countMetadata = Metadata.builder()
.withName("gc.total")
.withType(MetricType.COUNTER)
- .withDisplayName("Garbage Collection Time")
+ .withDisplayName("Garbage Collection Count")
.withUnit("none")
.withDescription(
"Displays the total number of collections that have occurred. This attribute lists -1 if the collection count is undefined for this collector.") | ['extensions/smallrye-metrics/runtime/src/main/java/io/quarkus/smallrye/metrics/runtime/SmallRyeMetricsRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,011,767 | 1,556,732 | 207,588 | 2,145 | 122 | 20 | 2 | 1 | 242 | 10 | 66 | 2 | 1 | 0 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,109 | quarkusio/quarkus/7926/7895 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/7895 | https://github.com/quarkusio/quarkus/pull/7926 | https://github.com/quarkusio/quarkus/pull/7926 | 1 | closes | Mongo clients should be initialized eagerly | **Describe the bug**
Currently the mongo clients are flagged as @ApplicaitonScoped, which means they are wrapped by a proxy making them initialized on first use.
This is annoying as
* we don't respect the configuration of pre-filling the pool on boot
* we can't validate the connection properties, deferring any failure
* it's an overhead
relates to #4507 | 15b377ed31ac29b82bacaba7b7e729d1aed81976 | 4af1c3465169f1a08d008ac4a073a1cfe94bf560 | https://github.com/quarkusio/quarkus/compare/15b377ed31ac29b82bacaba7b7e729d1aed81976...4af1c3465169f1a08d008ac4a073a1cfe94bf560 | 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 24fcbf3db90..03e716e6921 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
@@ -11,9 +11,9 @@
import java.util.Set;
import java.util.stream.Collectors;
-import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Default;
import javax.enterprise.inject.Produces;
+import javax.inject.Singleton;
import org.bson.codecs.configuration.CodecProvider;
import org.bson.codecs.pojo.annotations.BsonDiscriminator;
@@ -126,7 +126,7 @@ public void mongoClientNames(ApplicationArchivesBuildItem applicationArchivesBui
*
* <pre>
* public class myclass extends AbstractMongoClientProducer {
- * @ApplicationScoped
+ * @Singleton
* @Produces
* @Default
* public MongoClient createDefaultMongoClient() {
@@ -134,7 +134,7 @@ public void mongoClientNames(ApplicationArchivesBuildItem applicationArchivesBui
* return createMongoClient(cfg);
* }
*
- * @ApplicationScoped
+ * @Singleton
* @Produces
* @Default
* public ReactiveMongoClient createDefaultReactiveMongoClient() {
@@ -145,7 +145,7 @@ public void mongoClientNames(ApplicationArchivesBuildItem applicationArchivesBui
* // for each named mongoclient configuration
* // example:
* // quarkus.mongodb.cluster1.connection-string = mongodb://mongo1:27017,mongo2:27017
- * @ApplicationScoped
+ * @Singleton
* @Produces
* @Named("cluster1")
* @MongoClientName("cluster1")
@@ -154,7 +154,7 @@ public void mongoClientNames(ApplicationArchivesBuildItem applicationArchivesBui
* return createMongoClient(cfg);
* }
*
- * @ApplicationScoped
+ * @Singleton
* @Produces
* @Named("cluster1")
* @MongoClientName("cluster1")
@@ -175,11 +175,11 @@ private void createMongoClientProducerBean(List<MongoClientNameBuildItem> mongoC
.className(mongoClientProducerClassName)
.superClass(AbstractMongoClientProducer.class)
.build()) {
- classCreator.addAnnotation(ApplicationScoped.class);
+ classCreator.addAnnotation(Singleton.class);
try (MethodCreator defaultMongoClientMethodCreator = classCreator.getMethodCreator("createDefaultMongoClient",
MongoClient.class)) {
- defaultMongoClientMethodCreator.addAnnotation(ApplicationScoped.class);
+ defaultMongoClientMethodCreator.addAnnotation(Singleton.class);
defaultMongoClientMethodCreator.addAnnotation(Produces.class);
defaultMongoClientMethodCreator.addAnnotation(Default.class);
if (makeUnremovable) {
@@ -206,7 +206,7 @@ private void createMongoClientProducerBean(List<MongoClientNameBuildItem> mongoC
try (MethodCreator defaultReactiveMongoClientMethodCreator = classCreator.getMethodCreator(
"createDefaultLegacyReactiveMongoClient",
ReactiveMongoClient.class)) {
- defaultReactiveMongoClientMethodCreator.addAnnotation(ApplicationScoped.class);
+ defaultReactiveMongoClientMethodCreator.addAnnotation(Singleton.class);
defaultReactiveMongoClientMethodCreator.addAnnotation(Produces.class);
defaultReactiveMongoClientMethodCreator.addAnnotation(Default.class);
@@ -230,7 +230,7 @@ private void createMongoClientProducerBean(List<MongoClientNameBuildItem> mongoC
try (MethodCreator defaultReactiveMongoClientMethodCreator = classCreator.getMethodCreator(
"createDefaultReactiveMongoClient",
io.quarkus.mongodb.reactive.ReactiveMongoClient.class)) {
- defaultReactiveMongoClientMethodCreator.addAnnotation(ApplicationScoped.class);
+ defaultReactiveMongoClientMethodCreator.addAnnotation(Singleton.class);
defaultReactiveMongoClientMethodCreator.addAnnotation(Produces.class);
defaultReactiveMongoClientMethodCreator.addAnnotation(Default.class);
if (makeUnremovable) {
@@ -258,7 +258,7 @@ private void createMongoClientProducerBean(List<MongoClientNameBuildItem> mongoC
try (MethodCreator namedMongoClientMethodCreator = classCreator.getMethodCreator(
"createNamedMongoClient_" + HashUtil.sha1(namedMongoClientName),
MongoClient.class)) {
- namedMongoClientMethodCreator.addAnnotation(ApplicationScoped.class);
+ namedMongoClientMethodCreator.addAnnotation(Singleton.class);
namedMongoClientMethodCreator.addAnnotation(Produces.class);
namedMongoClientMethodCreator.addAnnotation(AnnotationInstance.create(DotNames.NAMED, null,
new AnnotationValue[] { AnnotationValue.createStringValue("value", namedMongoClientName) }));
@@ -290,7 +290,7 @@ private void createMongoClientProducerBean(List<MongoClientNameBuildItem> mongoC
try (MethodCreator namedReactiveMongoClientMethodCreator = classCreator.getMethodCreator(
"createNamedLegacyReactiveMongoClient_" + HashUtil.sha1(namedMongoClientName),
ReactiveMongoClient.class)) {
- namedReactiveMongoClientMethodCreator.addAnnotation(ApplicationScoped.class);
+ namedReactiveMongoClientMethodCreator.addAnnotation(Singleton.class);
namedReactiveMongoClientMethodCreator.addAnnotation(Produces.class);
namedReactiveMongoClientMethodCreator.addAnnotation(AnnotationInstance.create(DotNames.NAMED, null,
new AnnotationValue[] {
@@ -322,7 +322,7 @@ private void createMongoClientProducerBean(List<MongoClientNameBuildItem> mongoC
try (MethodCreator namedReactiveMongoClientMethodCreator = classCreator.getMethodCreator(
"createNamedReactiveMongoClient_" + HashUtil.sha1(namedMongoClientName),
io.quarkus.mongodb.reactive.ReactiveMongoClient.class)) {
- namedReactiveMongoClientMethodCreator.addAnnotation(ApplicationScoped.class);
+ namedReactiveMongoClientMethodCreator.addAnnotation(Singleton.class);
namedReactiveMongoClientMethodCreator.addAnnotation(Produces.class);
namedReactiveMongoClientMethodCreator.addAnnotation(AnnotationInstance.create(DotNames.NAMED, null,
new AnnotationValue[] {
diff --git a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoMetricsTest.java b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoMetricsTest.java
index 4baae9ebbb9..3a641435788 100644
--- a/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoMetricsTest.java
+++ b/extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoMetricsTest.java
@@ -2,7 +2,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNull;
import javax.inject.Inject;
@@ -47,8 +46,9 @@ void cleanup() {
@Test
void testMetricsInitialization() {
- assertNull(getGaugeValueOrNull("mongodb.connection-pool.size", getTags()));
- assertNull(getGaugeValueOrNull("mongodb.connection-pool.checked-out-count", getTags()));
+ // Clients are created eagerly, this metric should always be initialized to zero once connected
+ assertEquals(0L, getGaugeValueOrNull("mongodb.connection-pool.size", getTags()));
+ assertEquals(0L, getGaugeValueOrNull("mongodb.connection-pool.checked-out-count", getTags()));
// Just need to execute something so that an connection is opened
String name = client.listDatabaseNames().first(); | ['extensions/mongodb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java', 'extensions/mongodb-client/deployment/src/test/java/io/quarkus/mongodb/MongoMetricsTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 8,083,787 | 1,570,690 | 209,667 | 2,189 | 1,551 | 258 | 24 | 1 | 367 | 58 | 81 | 10 | 0 | 0 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,108 | quarkusio/quarkus/7946/3227 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/3227 | https://github.com/quarkusio/quarkus/pull/7946 | https://github.com/quarkusio/quarkus/pull/7946 | 1 | fixes | Quarkus uses deprecated WildFlyElytronProvider | Quarkus uses deprecated WildFlyElytronProvider, this should be adjusted to the changes which caused that deprecation.
Deprecated via https://github.com/wildfly-security/wildfly-elytron/commit/e6b8dbed4e81ed00a27a9b4183374d8c3b42f03e, per-module providers were introduced.
@fjuma @darranl what should be used instead of WildFlyElytronProvider for Quarkus ?
CC @starksm64 | a0fd85a6f10f453100335e174d5f684210ccc925 | f07f763c7d8dd719a7236eac6cc71eeef5bb5583 | https://github.com/quarkusio/quarkus/compare/a0fd85a6f10f453100335e174d5f684210ccc925...f07f763c7d8dd719a7236eac6cc71eeef5bb5583 | diff --git a/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java b/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java
index 53faf6a116e..ea5a6f614bc 100644
--- a/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java
+++ b/extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java
@@ -5,12 +5,12 @@
import javax.sql.DataSource;
-import org.wildfly.security.WildFlyElytronProvider;
import org.wildfly.security.auth.realm.jdbc.JdbcSecurityRealm;
import org.wildfly.security.auth.realm.jdbc.JdbcSecurityRealmBuilder;
import org.wildfly.security.auth.realm.jdbc.QueryBuilder;
import org.wildfly.security.auth.realm.jdbc.mapper.AttributeMapper;
import org.wildfly.security.auth.server.SecurityRealm;
+import org.wildfly.security.password.WildFlyElytronPasswordProvider;
import io.quarkus.arc.Arc;
import io.quarkus.runtime.RuntimeValue;
@@ -19,7 +19,7 @@
@Recorder
public class JdbcRecorder {
- private static final Provider[] PROVIDERS = new Provider[] { new WildFlyElytronProvider() };
+ private static final Provider[] PROVIDERS = new Provider[] { new WildFlyElytronPasswordProvider() };
/**
* Create a runtime value for a {@linkplain JdbcSecurityRealm}
diff --git a/extensions/elytron-security-properties-file/deployment/src/test/java/io/quarkus/security/test/SecurityRealmsTestCase.java b/extensions/elytron-security-properties-file/deployment/src/test/java/io/quarkus/security/test/SecurityRealmsTestCase.java
index 228ac0336f9..ae3f0bd1c73 100644
--- a/extensions/elytron-security-properties-file/deployment/src/test/java/io/quarkus/security/test/SecurityRealmsTestCase.java
+++ b/extensions/elytron-security-properties-file/deployment/src/test/java/io/quarkus/security/test/SecurityRealmsTestCase.java
@@ -11,7 +11,6 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
-import org.wildfly.security.WildFlyElytronProvider;
import org.wildfly.security.auth.principal.NamePrincipal;
import org.wildfly.security.auth.realm.LegacyPropertiesSecurityRealm;
import org.wildfly.security.auth.realm.SimpleMapBackedSecurityRealm;
@@ -23,6 +22,7 @@
import org.wildfly.security.authz.MapAttributes;
import org.wildfly.security.credential.Credential;
import org.wildfly.security.credential.PasswordCredential;
+import org.wildfly.security.password.WildFlyElytronPasswordProvider;
import org.wildfly.security.password.interfaces.ClearPassword;
/**
@@ -41,7 +41,7 @@ public void testLegacyPropertiesSecurityRealm() throws IOException {
.setProviders(new Supplier<Provider[]>() {
@Override
public Provider[] get() {
- return new Provider[] { new WildFlyElytronProvider() };
+ return new Provider[] { new WildFlyElytronPasswordProvider() };
}
})
.build();
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 75805ad91a4..cd71d8d8e37 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
@@ -17,7 +17,6 @@
import org.jboss.logging.Logger;
import org.wildfly.common.iteration.ByteIterator;
-import org.wildfly.security.WildFlyElytronProvider;
import org.wildfly.security.auth.realm.LegacyPropertiesSecurityRealm;
import org.wildfly.security.auth.realm.SimpleMapBackedSecurityRealm;
import org.wildfly.security.auth.realm.SimpleRealmEntry;
@@ -44,7 +43,7 @@
public class ElytronPropertiesFileRecorder {
static final Logger log = Logger.getLogger(ElytronPropertiesFileRecorder.class);
- private static final Provider[] PROVIDERS = new Provider[] { new WildFlyElytronProvider() };
+ private static final Provider[] PROVIDERS = new Provider[] { new WildFlyElytronPasswordProvider() };
/**
* Load the user.properties and roles.properties files into the {@linkplain SecurityRealm} | ['extensions/elytron-security-properties-file/deployment/src/test/java/io/quarkus/security/test/SecurityRealmsTestCase.java', 'extensions/elytron-security-jdbc/runtime/src/main/java/io/quarkus/elytron/security/jdbc/JdbcRecorder.java', 'extensions/elytron-security-properties-file/runtime/src/main/java/io/quarkus/elytron/security/runtime/ElytronPropertiesFileRecorder.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 8,087,060 | 1,571,302 | 209,710 | 2,189 | 582 | 134 | 7 | 2 | 377 | 36 | 112 | 6 | 1 | 0 | 1970-01-01T00:26:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
3,090 | quarkusio/quarkus/8341/4460 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/4460 | https://github.com/quarkusio/quarkus/pull/8341 | https://github.com/quarkusio/quarkus/pull/8341 | 1 | fixes | Bootstrap resolver should log if it is accessing the network | When running tests or building for the first time the bootstrap resolver might need to download -deployment artifacts and their dependencies. If the network is slow this can appear that tests or the build are hanging. If we need to hit the network we should log a message and update the user on our progress in a similar way to a normal maven build, | 34721c39b72614e521f8690cd8bbbddac72ca3a4 | 044255e99de231505577a0c3d46e1ed207ab525e | https://github.com/quarkusio/quarkus/compare/34721c39b72614e521f8690cd8bbbddac72ca3a4...044255e99de231505577a0c3d46e1ed207ab525e | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java
index d880b4edf83..76e03df7caf 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java
@@ -17,6 +17,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.maven.cli.transfer.ConsoleMavenTransferListener;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.eclipse.aether.DefaultRepositoryCache;
import org.eclipse.aether.DefaultRepositorySystemSession;
@@ -145,6 +146,9 @@ private MavenArtifactResolver(Builder builder) throws AppModelResolverException
if (builder.offline != null) {
newSession.setOffline(builder.offline);
}
+ if (newSession.getTransferListener() == null) {
+ newSession.setTransferListener(new ConsoleMavenTransferListener(System.out, true));
+ }
newSession.setSystemProperties(System.getProperties());
MavenLocalRepositoryManager lrm = null; | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/resolver/maven/MavenArtifactResolver.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 8,270,381 | 1,608,371 | 214,513 | 2,240 | 232 | 44 | 4 | 1 | 349 | 64 | 69 | 1 | 0 | 0 | 1970-01-01T00:26:25 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |