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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9,738 | deeplearning4j/deeplearning4j/4667/4596 | deeplearning4j | deeplearning4j | https://github.com/deeplearning4j/deeplearning4j/issues/4596 | https://github.com/deeplearning4j/deeplearning4j/pull/4667 | https://github.com/deeplearning4j/deeplearning4j/pull/4667 | 1 | fix | UIServer: plotVocab and TsneModule routes do not match up | For some reason the route that would accept a POST request has been replaced with a GET based route.
https://github.com/deeplearning4j/deeplearning4j/blob/master/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/tsne/TsneModule.java#L50
```java
// Route r5 = new Route("/tsne/post/:sid", HttpMethod.POST, FunctionType.Function, this::postFile);
Route r5 = new Route("/tsne/post/:sid", HttpMethod.GET, FunctionType.Function, this::postFile);
```
However, the InMemoryLookupTable.plotVocab method still tries to use the POST based version:
https://github.com/deeplearning4j/deeplearning4j/blob/master/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java#L222
```java
String address = connectionInfo.getFirstPart() + "/tsne/post/" + connectionInfo.getSessionId();
// System.out.println("ADDRESS: " + address);
URI uri = new URI(address);
HttpURLConnection connection = (HttpURLConnection) uri.toURL().openConnection();
connection.setRequestMethod("POST");
```
@fenneclabs found the Bug, and it has shown itself with the following exception:
```
15:54:23.369 Trc [main ] BarnesHutTsne <> Error at iteration 99 is -176691.3168704078
RESPONSE CODE: 404
15:54:23.416 Std [main ] InMemoryLookupTable <> Error posting to remote UI at http://localhost:9000/tsne/post/08cd2dcb-f68a-4861-abd6-76ce86d186aa java.io.FileNotFoundException: http://localhost:9000/tsne/post/08cd2dcb-f68a-4861-abd6-76ce86d186aa
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1926)
```
The bug affects both 0.9.1 and current master.
In Order to reproduce the bug, simply add the following to Word2VecRawTextExample after the `vec.fit()` call:
```
BarnesHutTsne tsne = new BarnesHutTsne.Builder()
.setMaxIter(1)
.theta(0.5)
.normalize(false)
.learningRate(500)
.useAdaGrad(false)
.build();
UIServer uiServer = UIServer.getInstance();
StatsStorage statsStorage = new InMemoryStatsStorage();
uiServer.attach(statsStorage);
vec.lookupTable().plotVocab(tsne, 42, new UiConnectionInfo.Builder()
.setPort(uiServer.getPort())
.build());
``` | f20fdf0b584484283c7b270676aaf761a7353b5a | 3fa9ae90f63e2860fe762c3464d799a0e7cfdcab | https://github.com/deeplearning4j/deeplearning4j/compare/f20fdf0b584484283c7b270676aaf761a7353b5a...3fa9ae90f63e2860fe762c3464d799a0e7cfdcab | diff --git a/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java b/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java
index 3961c9416e..3d483ad391 100644
--- a/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java
+++ b/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java
@@ -222,13 +222,25 @@ public class InMemoryLookupTable<T extends SequenceElement> implements WeightLoo
connection.setRequestMethod("POST");
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
// connection.setRequestProperty("Content-Type", "application/json");
- connection.setRequestProperty("Content-Type", "multipart/form-data");
+ connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=-----TSNE-POST-DATA-----");
connection.setDoOutput(true);
- DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
+ final OutputStream outputStream = connection.getOutputStream();
+ final PrintWriter writer = new PrintWriter(outputStream);
+ writer.println("-------TSNE-POST-DATA-----");
+ writer.println("Content-Disposition: form-data; name=\\"fileupload\\"; filename=\\"tsne.csv\\"");
+ writer.println("Content-Type: text/plain; charset=UTF-16");
+ writer.println("Content-Transfer-Encoding: binary");
+ writer.println();
+ writer.flush();
+
+ DataOutputStream dos = new DataOutputStream(outputStream);
dos.writeBytes(sb.toString());
dos.flush();
+ writer.println();
+ writer.flush();
dos.close();
+ outputStream.close();
try {
int responseCode = connection.getResponseCode();
diff --git a/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/tsne/TsneModule.java b/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/tsne/TsneModule.java
index 131e48d459..e903206603 100644
--- a/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/tsne/TsneModule.java
+++ b/deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/tsne/TsneModule.java
@@ -47,8 +47,7 @@ public class TsneModule implements UIModule {
Route r2 = new Route("/tsne/sessions", HttpMethod.GET, FunctionType.Supplier, this::listSessions);
Route r3 = new Route("/tsne/coords/:sid", HttpMethod.GET, FunctionType.Function, this::getCoords);
Route r4 = new Route("/tsne/upload", HttpMethod.POST, FunctionType.Supplier, this::uploadFile);
- // Route r5 = new Route("/tsne/post/:sid", HttpMethod.POST, FunctionType.Function, this::postFile);
- Route r5 = new Route("/tsne/post/:sid", HttpMethod.GET, FunctionType.Function, this::postFile);
+ Route r5 = new Route("/tsne/post/:sid", HttpMethod.POST, FunctionType.Function, this::postFile);
return Arrays.asList(r1, r2, r3, r4, r5);
}
@@ -126,7 +125,8 @@ public class TsneModule implements UIModule {
List<String> lines;
try {
- lines = FileUtils.readLines(file);
+ // Set to uploadedFileLines as well, as the TSNE UI doesn't allow to properly select Sessions yet
+ lines = uploadedFileLines = FileUtils.readLines(file);
} catch (IOException e) {
// System.out.println("**** COULD NOT READ FILE ****");
return badRequest("Could not read from uploaded file"); | ['deeplearning4j-ui-parent/deeplearning4j-play/src/main/java/org/deeplearning4j/ui/module/tsne/TsneModule.java', 'deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/inmemory/InMemoryLookupTable.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 7,880,004 | 1,707,768 | 215,824 | 1,363 | 1,523 | 283 | 22 | 2 | 2,709 | 187 | 672 | 52 | 4 | 4 | 1970-01-01T00:25:18 | 13,099 | Java | {'Java': 42895752, 'C++': 17237193, 'Cuda': 2203734, 'Kotlin': 2030453, 'JavaScript': 296767, 'C': 172853, 'CMake': 126415, 'Shell': 96643, 'TypeScript': 81217, 'Python': 77566, 'FreeMarker': 77257, 'HTML': 18609, 'CSS': 12974, 'PureBasic': 12254, 'Cython': 12094, 'Ruby': 4558, 'Batchfile': 1458, 'Scala': 1026, 'Smarty': 975, 'Starlark': 931} | Apache License 2.0 |
9,742 | deeplearning4j/deeplearning4j/4345/4339 | deeplearning4j | deeplearning4j | https://github.com/deeplearning4j/deeplearning4j/issues/4339 | https://github.com/deeplearning4j/deeplearning4j/pull/4345 | https://github.com/deeplearning4j/deeplearning4j/pull/4345 | 1 | fix | InputStream used twice, causing a NoSuchElementException | In case data is contained in an InputStream, the following snippet fails:
```
InputStream dataFile = this.getClass().getResourceAsStream("/mydata.csv");
RecordReader recordReader = new CSVRecordReader(0, ",");
recordReader.initialize(new InputStreamInputSplit(dataFile));
DataSetIterator iterator = new RecordReaderDataSetIterator(recordReader, batchSize, labelIndex, numClasses);
DataSet allData = iterator.next();
```
The exception is the following:
```
Exception in thread "Thread-3" java.util.NoSuchElementException: No next elements
at org.deeplearning4j.datasets.datavec.RecordReaderMultiDataSetIterator.next(RecordReaderMultiDataSetIterator.java:116)
at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:320)
at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:409)
at org.deeplearning4j.datasets.datavec.RecordReaderDataSetIterator.next(RecordReaderDataSetIterator.java:51)
at com.gluonhq.dlearning.DataRetrievalService.getData(DataRetrievalService.java:92)
```
Looking into the code, it seems the `InputStream` is consumed twice, by 2 different iterators. As a result, the second iterator will return false in its `hasNext()` method.
The first iterator is created in
`recordReader.initialize(new InputStreamInputSplit(dataFile));
`
The initialize method will set the InputStreamInputSplit, but also create the iterator. I don't see a method on recordReader that sets the InputStreamInputSplit but doesn't initialize the iterator.
Next, the second iterator is created around the same InputStream in `org.datavec.api.records.reader.impl.LineRecordReader`
when the next method is called:
`
iter = IOUtils.lineIterator(new InputStreamReader(locations[splitIndex].toURL().openStream()));`
| 1691f3d5edcd7257cac9e2b1a1ad249be673d2bb | 6a61e95e517b2d8edfc73dbcdd1f2e9adbe919bb | https://github.com/deeplearning4j/deeplearning4j/compare/1691f3d5edcd7257cac9e2b1a1ad249be673d2bb...6a61e95e517b2d8edfc73dbcdd1f2e9adbe919bb | diff --git a/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetIterator.java b/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetIterator.java
index f480864109..a382b84253 100644
--- a/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetIterator.java
+++ b/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetIterator.java
@@ -27,6 +27,8 @@ import org.datavec.api.records.metadata.RecordMetaData;
import org.datavec.api.records.metadata.RecordMetaDataComposableMap;
import org.datavec.api.records.reader.RecordReader;
import org.datavec.api.records.reader.SequenceRecordReader;
+import org.datavec.api.records.reader.impl.ConcatenatingRecordReader;
+import org.datavec.api.records.reader.impl.collection.CollectionRecordReader;
import org.datavec.api.writable.Writable;
import org.nd4j.linalg.api.ndarray.INDArray;
import org.nd4j.linalg.dataset.DataSet;
@@ -170,6 +172,13 @@ public class RecordReaderDataSetIterator implements DataSetIterator {
this.collectMetaData = collectMetaData;
}
+ private void initializeUnderlying(){
+ if (underlying == null) {
+ Record next = recordReader.nextRecord();
+ initializeUnderlying(next);
+ }
+ }
+
private void initializeUnderlying(Record next) {
int totalSize = next.getRecord().size();
@@ -178,7 +187,15 @@ public class RecordReaderDataSetIterator implements DataSetIterator {
labelIndex = totalSize - 1;
}
- recordReader.reset();
+ if(recordReader.resetSupported()) {
+ recordReader.reset();
+ } else {
+ //Hack around the fact that we need the first record to initialize the underlying RRMDSI, but can't reset
+ // the original reader
+ recordReader = new ConcatenatingRecordReader(
+ new CollectionRecordReader(Collections.singletonList(next.getRecord())),
+ recordReader);
+ }
RecordReaderMultiDataSetIterator.Builder builder = new RecordReaderMultiDataSetIterator.Builder(batchSize);
if (recordReader instanceof SequenceRecordReader) {
@@ -297,8 +314,7 @@ public class RecordReaderDataSetIterator implements DataSetIterator {
}
if (underlying == null) {
- Record next = recordReader.nextRecord();
- initializeUnderlying(next);
+ initializeUnderlying();
}
@@ -343,7 +359,10 @@ public class RecordReaderDataSetIterator implements DataSetIterator {
@Override
public boolean resetSupported() {
- return true;
+ if(underlying == null){
+ initializeUnderlying();
+ }
+ return underlying.resetSupported();
}
@Override
diff --git a/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderMultiDataSetIterator.java b/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderMultiDataSetIterator.java
index 527a4e192a..ebb31158e8 100644
--- a/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderMultiDataSetIterator.java
+++ b/deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderMultiDataSetIterator.java
@@ -86,6 +86,8 @@ public class RecordReaderMultiDataSetIterator implements MultiDataSetIterator, S
private MultiDataSetPreProcessor preProcessor;
+ private boolean resetSupported = true;
+
private RecordReaderMultiDataSetIterator(Builder builder) {
this.batchSize = builder.batchSize;
this.alignmentMode = builder.alignmentMode;
@@ -97,6 +99,18 @@ public class RecordReaderMultiDataSetIterator implements MultiDataSetIterator, S
if (this.timeSeriesRandomOffset) {
timeSeriesRandomOffsetRng = new Random(builder.timeSeriesRandomOffsetSeed);
}
+
+
+ if(recordReaders != null){
+ for(RecordReader rr : recordReaders.values()){
+ resetSupported &= rr.resetSupported();
+ }
+ }
+ if(sequenceRecordReaders != null){
+ for(SequenceRecordReader srr : sequenceRecordReaders.values()){
+ resetSupported &= srr.resetSupported();
+ }
+ }
}
@Override
@@ -622,7 +636,7 @@ public class RecordReaderMultiDataSetIterator implements MultiDataSetIterator, S
@Override
public boolean resetSupported() {
- return true;
+ return resetSupported;
}
@Override
@@ -632,6 +646,11 @@ public class RecordReaderMultiDataSetIterator implements MultiDataSetIterator, S
@Override
public void reset() {
+ if(!resetSupported){
+ throw new IllegalStateException("Cannot reset iterator - reset not supported (resetSupported() == false):" +
+ " one or more underlying (sequence) record readers do not support resetting");
+ }
+
for (RecordReader rr : recordReaders.values())
rr.reset();
for (SequenceRecordReader rr : sequenceRecordReaders.values())
diff --git a/deeplearning4j-core/src/test/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetiteratorTest.java b/deeplearning4j-core/src/test/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetiteratorTest.java
index 857989f5ae..c4cc460577 100644
--- a/deeplearning4j-core/src/test/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetiteratorTest.java
+++ b/deeplearning4j-core/src/test/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetiteratorTest.java
@@ -29,6 +29,7 @@ import org.datavec.api.records.reader.impl.collection.CollectionSequenceRecordRe
import org.datavec.api.records.reader.impl.csv.CSVRecordReader;
import org.datavec.api.records.reader.impl.csv.CSVSequenceRecordReader;
import org.datavec.api.split.FileSplit;
+import org.datavec.api.split.InputStreamInputSplit;
import org.datavec.api.split.NumberedFileInputSplit;
import org.datavec.api.writable.DoubleWritable;
import org.datavec.api.writable.IntWritable;
@@ -1248,4 +1249,35 @@ public class RecordReaderDataSetiteratorTest {
iter.reset();
iter.next();
}
+
+ @Test
+ public void testReadingFromStream() throws Exception {
+ int batchSize = 1;
+ int labelIndex = 4;
+ int numClasses = 3;
+ InputStream dataFile = new ClassPathResource("iris.txt").getInputStream();
+ RecordReader recordReader = new CSVRecordReader(0, ',');
+ recordReader.initialize(new InputStreamInputSplit(dataFile));
+
+ assertTrue(recordReader.hasNext());
+ assertFalse(recordReader.resetSupported());
+
+ DataSetIterator iterator = new RecordReaderDataSetIterator(recordReader, batchSize, labelIndex, numClasses);
+ assertFalse(iterator.resetSupported());
+
+ int count = 0;
+ while(iterator.hasNext()){
+ assertNotNull(iterator.next());
+ count++;
+ }
+
+ assertEquals(150, count);
+
+ try{
+ iterator.reset();
+ fail("Expected exception");
+ } catch (Exception e){
+ //expected
+ }
+ }
}
diff --git a/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/SparkSourceDummyReader.java b/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/SparkSourceDummyReader.java
index 27d866ead8..c1b81a162d 100644
--- a/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/SparkSourceDummyReader.java
+++ b/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/SparkSourceDummyReader.java
@@ -75,6 +75,11 @@ public class SparkSourceDummyReader implements RecordReader, Serializable {
@Override
public void reset() { /* No op */ }
+ @Override
+ public boolean resetSupported() {
+ return true;
+ }
+
@Override
public List<Writable> record(URI uri, DataInputStream dataInputStream) throws IOException {
throw new UnsupportedOperationException(); | ['deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderMultiDataSetIterator.java', 'deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/datavec/iterator/SparkSourceDummyReader.java', 'deeplearning4j-core/src/main/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetIterator.java', 'deeplearning4j-core/src/test/java/org/deeplearning4j/datasets/datavec/RecordReaderDataSetiteratorTest.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 7,499,439 | 1,624,547 | 205,857 | 1,314 | 1,939 | 341 | 53 | 3 | 1,878 | 151 | 390 | 33 | 0 | 2 | 1970-01-01T00:25:11 | 13,099 | Java | {'Java': 42895752, 'C++': 17237193, 'Cuda': 2203734, 'Kotlin': 2030453, 'JavaScript': 296767, 'C': 172853, 'CMake': 126415, 'Shell': 96643, 'TypeScript': 81217, 'Python': 77566, 'FreeMarker': 77257, 'HTML': 18609, 'CSS': 12974, 'PureBasic': 12254, 'Cython': 12094, 'Ruby': 4558, 'Batchfile': 1458, 'Scala': 1026, 'Smarty': 975, 'Starlark': 931} | Apache License 2.0 |
9,741 | deeplearning4j/deeplearning4j/4370/4368 | deeplearning4j | deeplearning4j | https://github.com/deeplearning4j/deeplearning4j/issues/4368 | https://github.com/deeplearning4j/deeplearning4j/pull/4370 | https://github.com/deeplearning4j/deeplearning4j/pull/4370 | 1 | fix | Transfer learning: 0 dropout doesn't remove/override existing layer dropout | ```
netToTest = new TransferLearning.Builder(net)
.fineTuneConfiguration(new FineTuneConfiguration.Builder()
.dropOut(0.0)
.build()).build();
```
The original dropout is still present on the existing layers. Reason: .dropOut(0.0) does dropOut((IDropOut)null) hence it's treated as equivalent to "not set"
| eb98b40cba85affb7cfaaad1147ed84f64a06148 | fe338bab56c2ca129a56e775c8c73cd249f37243 | https://github.com/deeplearning4j/deeplearning4j/compare/eb98b40cba85affb7cfaaad1147ed84f64a06148...fe338bab56c2ca129a56e775c8c73cd249f37243 | diff --git a/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningCompGraphTest.java b/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningCompGraphTest.java
index da2b116696..893b8d68de 100644
--- a/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningCompGraphTest.java
+++ b/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningCompGraphTest.java
@@ -2,11 +2,14 @@ package org.deeplearning4j.nn.transferlearning;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
import org.deeplearning4j.nn.conf.ComputationGraphConfiguration;
+import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
+import org.deeplearning4j.nn.conf.constraint.UnitNormConstraint;
import org.deeplearning4j.nn.conf.distribution.NormalDistribution;
import org.deeplearning4j.nn.conf.inputs.InputType;
import org.deeplearning4j.nn.conf.layers.*;
import org.deeplearning4j.nn.conf.layers.misc.FrozenLayer;
+import org.deeplearning4j.nn.conf.weightnoise.DropConnect;
import org.deeplearning4j.nn.graph.ComputationGraph;
import org.deeplearning4j.nn.weights.WeightInit;
import org.junit.Test;
@@ -23,6 +26,7 @@ import java.util.Collections;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
/**
* Created by susaneraly on 2/17/17.
@@ -421,4 +425,41 @@ public class TransferLearningCompGraphTest {
// assertEquals(confExpected, graph.getConfiguration());
assertEquals(confExpected.toJson(), graph.getConfiguration().toJson());
}
+
+
+ @Test
+ public void testObjectOverrides(){
+ //https://github.com/deeplearning4j/deeplearning4j/issues/4368
+ ComputationGraphConfiguration conf = new NeuralNetConfiguration.Builder()
+ .dropOut(0.5)
+ .weightNoise(new DropConnect(0.5))
+ .l2(0.5)
+ .constrainWeights(new UnitNormConstraint())
+ .graphBuilder()
+ .addInputs("in")
+ .addLayer("layer", new DenseLayer.Builder().nIn(10).nOut(10).build(), "in")
+ .setOutputs("layer")
+ .build();
+
+ ComputationGraph orig = new ComputationGraph(conf);
+ orig.init();
+
+ FineTuneConfiguration ftc = new FineTuneConfiguration.Builder()
+ .dropOut(0)
+ .weightNoise(null)
+ .constraints(null)
+ .l2(0.0)
+ .build();
+
+ ComputationGraph transfer = new TransferLearning.GraphBuilder(orig)
+ .fineTuneConfiguration(ftc)
+ .build();
+
+ DenseLayer l = (DenseLayer) transfer.getLayer(0).conf().getLayer();
+
+ assertNull(l.getIDropout());
+ assertNull(l.getWeightNoise());
+ assertNull(l.getConstraints());
+ assertEquals(0.0, l.getL2(), 0.0);
+ }
}
diff --git a/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningMLNTest.java b/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningMLNTest.java
index 443eb1e7e5..86f2599489 100644
--- a/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningMLNTest.java
+++ b/deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningMLNTest.java
@@ -6,12 +6,14 @@ import org.deeplearning4j.nn.conf.BackpropType;
import org.deeplearning4j.nn.conf.GradientNormalization;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
+import org.deeplearning4j.nn.conf.constraint.UnitNormConstraint;
import org.deeplearning4j.nn.conf.distribution.NormalDistribution;
import org.deeplearning4j.nn.conf.inputs.InputType;
import org.deeplearning4j.nn.conf.layers.*;
import org.deeplearning4j.nn.conf.preprocessor.CnnToFeedForwardPreProcessor;
import org.deeplearning4j.nn.conf.preprocessor.FeedForwardToRnnPreProcessor;
import org.deeplearning4j.nn.conf.preprocessor.RnnToCnnPreProcessor;
+import org.deeplearning4j.nn.conf.weightnoise.DropConnect;
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
import org.deeplearning4j.nn.weights.WeightInit;
import org.junit.Test;
@@ -578,5 +580,38 @@ public class TransferLearningMLNTest {
assertEquals(expectedParams, modelNow.params());
}
+ @Test
+ public void testObjectOverrides(){
+ //https://github.com/deeplearning4j/deeplearning4j/issues/4368
+ MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
+ .dropOut(0.5)
+ .weightNoise(new DropConnect(0.5))
+ .l2(0.5)
+ .constrainWeights(new UnitNormConstraint())
+ .list()
+ .layer(new DenseLayer.Builder().nIn(10).nOut(10).build())
+ .build();
+
+ MultiLayerNetwork orig = new MultiLayerNetwork(conf);
+ orig.init();
+
+ FineTuneConfiguration ftc = new FineTuneConfiguration.Builder()
+ .dropOut(0)
+ .weightNoise(null)
+ .constraints(null)
+ .l2(0.0)
+ .build();
+
+ MultiLayerNetwork transfer = new TransferLearning.Builder(orig)
+ .fineTuneConfiguration(ftc)
+ .build();
+
+ DenseLayer l = (DenseLayer) transfer.getLayer(0).conf().getLayer();
+
+ assertNull(l.getIDropout());
+ assertNull(l.getWeightNoise());
+ assertNull(l.getConstraints());
+ assertEquals(0.0, l.getL2(), 0.0);
+ }
}
diff --git a/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/FineTuneConfiguration.java b/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/FineTuneConfiguration.java
index c68b7430bd..d2de16ab1b 100644
--- a/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/FineTuneConfiguration.java
+++ b/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/FineTuneConfiguration.java
@@ -1,7 +1,6 @@
package org.deeplearning4j.nn.transferlearning;
import lombok.AllArgsConstructor;
-import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.deeplearning4j.nn.api.OptimizationAlgorithm;
@@ -17,6 +16,7 @@ import org.deeplearning4j.nn.weights.WeightInit;
import org.nd4j.linalg.activations.Activation;
import org.nd4j.linalg.activations.IActivation;
import org.nd4j.linalg.learning.config.IUpdater;
+import org.nd4j.linalg.primitives.Optional;
import org.nd4j.shade.jackson.annotation.JsonInclude;
import org.nd4j.shade.jackson.annotation.JsonTypeInfo;
import org.nd4j.shade.jackson.core.JsonProcessingException;
@@ -25,14 +25,16 @@ import java.io.IOException;
import java.util.List;
/**
- * Created by Alex on 21/02/2017.
+ * Configuration for fine tuning. Note that values set here will override values for all non-frozen layers
+ *
+ * @author Alex Black
+ * @author Susan Eraly
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "type")
@JsonInclude(JsonInclude.Include.NON_NULL)
@NoArgsConstructor
@AllArgsConstructor
@Data
-@Builder(builderClassName = "Builder")
public class FineTuneConfiguration {
protected IActivation activationFn;
@@ -43,9 +45,9 @@ public class FineTuneConfiguration {
protected Double l2;
protected Double l1Bias;
protected Double l2Bias;
- protected IDropout dropout;
- protected IWeightNoise weightNoise;
- protected IUpdater iUpdater;
+ protected Optional<IDropout> dropout;
+ protected Optional<IWeightNoise> weightNoise;
+ protected IUpdater updater;
protected IUpdater biasUpdater;
protected Boolean miniBatch;
protected Integer maxNumLineSearchIterations;
@@ -53,12 +55,10 @@ public class FineTuneConfiguration {
protected OptimizationAlgorithm optimizationAlgo;
protected StepFunction stepFunction;
protected Boolean minimize;
- protected GradientNormalization gradientNormalization;
+ protected Optional<GradientNormalization> gradientNormalization;
protected Double gradientNormalizationThreshold;
protected ConvolutionMode convolutionMode;
- protected List<LayerConstraint> constraints;
- protected Boolean hasBiasConstraints;
- protected Boolean hasWeightConstraints;
+ protected Optional<List<LayerConstraint>> constraints;
protected Boolean pretrain;
protected Boolean backprop;
@@ -69,20 +69,103 @@ public class FineTuneConfiguration {
protected WorkspaceMode trainingWorkspaceMode;
protected WorkspaceMode inferenceWorkspaceMode;
- //Lombok builder. Note that the code below ADDS OR OVERRIDES the lombok implementation; the final builder class
- // is the composite of the lombok parts and the parts defined here
- //partial implementation to allow public no-arg constructor (lombok default is package private)
- //Plus some implementations to match NeuralNetConfiguration builder methods
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /*
+ * Can't use Lombok @Builder annotation due to optionals (otherwise we have a bunch of ugly .x(Optional<T> value)
+ * methods - lombok builder doesn't support excluding fields? :(
+ * Note the use of optional here: gives us 3 states...
+ * 1. Null: not set
+ * 2. Optional (empty): set to null
+ * 3. Optional (not empty): set to specific value
+ *
+ * Obviously, having null only makes sense for some things (dropout, etc) whereas null for other things doesn't
+ * make sense
+ */
public static class Builder {
- public Builder() {}
+ private IActivation activation;
+ private WeightInit weightInit;
+ private Double biasInit;
+ private Distribution dist;
+ private Double l1;
+ private Double l2;
+ private Double l1Bias;
+ private Double l2Bias;
+ private Optional<IDropout> dropout;
+ private Optional<IWeightNoise> weightNoise;
+ private IUpdater updater;
+ private IUpdater biasUpdater;
+ private Boolean miniBatch;
+ private Integer maxNumLineSearchIterations;
+ private Long seed;
+ private OptimizationAlgorithm optimizationAlgo;
+ private StepFunction stepFunction;
+ private Boolean minimize;
+ private Optional<GradientNormalization> gradientNormalization;
+ private Double gradientNormalizationThreshold;
+ private ConvolutionMode convolutionMode;
+ private Optional<List<LayerConstraint>> constraints;
+ private Boolean pretrain;
+ private Boolean backprop;
+ private BackpropType backpropType;
+ private Integer tbpttFwdLength;
+ private Integer tbpttBackLength;
+ private WorkspaceMode trainingWorkspaceMode;
+ private WorkspaceMode inferenceWorkspaceMode;
- public Builder seed(int seed) {
- this.seed = (long) seed;
+ public Builder() {
+
+ }
+
+ public Builder activation(IActivation activationFn) {
+ this.activation = activationFn;
return this;
}
- public Builder seed(long seed) {
- this.seed = seed;
+ public Builder activation(Activation activation) {
+ this.activation = activation.getActivationFunction();
+ return this;
+ }
+
+ public Builder weightInit(WeightInit weightInit) {
+ this.weightInit = weightInit;
+ return this;
+ }
+
+ public Builder biasInit(double biasInit) {
+ this.biasInit = biasInit;
+ return this;
+ }
+
+ public Builder dist(Distribution dist) {
+ this.dist = dist;
+ return this;
+ }
+
+ public Builder l1(double l1) {
+ this.l1 = l1;
+ return this;
+ }
+
+ public Builder l2(double l2) {
+ this.l2 = l2;
+ return this;
+ }
+
+ public Builder l1Bias(double l1Bias) {
+ this.l1Bias = l1Bias;
+ return this;
+ }
+
+ public Builder l2Bias(double l2Bias) {
+ this.l2Bias = l2Bias;
+ return this;
+ }
+
+ public Builder dropout(IDropout dropout) {
+ this.dropout = Optional.ofNullable(dropout);
return this;
}
@@ -93,19 +176,122 @@ public class FineTuneConfiguration {
return dropout(new Dropout(dropout));
}
- public Builder activation(Activation activation) {
- this.activationFn = activation.getActivationFunction();
+ public Builder weightNoise(IWeightNoise weightNoise) {
+ this.weightNoise = Optional.ofNullable(weightNoise);
return this;
}
public Builder updater(IUpdater updater) {
- return iUpdater(updater);
+ this.updater = updater;
+ return this;
}
@Deprecated
public Builder updater(Updater updater) {
return updater(updater.getIUpdaterWithDefaultConfig());
}
+
+ public Builder biasUpdater(IUpdater biasUpdater) {
+ this.biasUpdater = biasUpdater;
+ return this;
+ }
+
+ public Builder miniBatch(boolean miniBatch) {
+ this.miniBatch = miniBatch;
+ return this;
+ }
+
+ public Builder maxNumLineSearchIterations(int maxNumLineSearchIterations) {
+ this.maxNumLineSearchIterations = maxNumLineSearchIterations;
+ return this;
+ }
+
+ public Builder seed(long seed) {
+ this.seed = seed;
+ return this;
+ }
+
+ public Builder seed(int seed){
+ return seed((long)seed);
+ }
+
+ public Builder optimizationAlgo(OptimizationAlgorithm optimizationAlgo) {
+ this.optimizationAlgo = optimizationAlgo;
+ return this;
+ }
+
+ public Builder stepFunction(StepFunction stepFunction) {
+ this.stepFunction = stepFunction;
+ return this;
+ }
+
+ public Builder minimize(boolean minimize) {
+ this.minimize = minimize;
+ return this;
+ }
+
+ public Builder gradientNormalization(GradientNormalization gradientNormalization) {
+ this.gradientNormalization = Optional.ofNullable(gradientNormalization);
+ return this;
+ }
+
+ public Builder gradientNormalizationThreshold(double gradientNormalizationThreshold) {
+ this.gradientNormalizationThreshold = gradientNormalizationThreshold;
+ return this;
+ }
+
+ public Builder convolutionMode(ConvolutionMode convolutionMode) {
+ this.convolutionMode = convolutionMode;
+ return this;
+ }
+
+ public Builder constraints(List<LayerConstraint> constraints) {
+ this.constraints = Optional.ofNullable(constraints);
+ return this;
+ }
+
+ public Builder pretrain(boolean pretrain) {
+ this.pretrain = pretrain;
+ return this;
+ }
+
+ public Builder backprop(boolean backprop) {
+ this.backprop = backprop;
+ return this;
+ }
+
+ public Builder backpropType(BackpropType backpropType) {
+ this.backpropType = backpropType;
+ return this;
+ }
+
+ public Builder tbpttFwdLength(int tbpttFwdLength) {
+ this.tbpttFwdLength = tbpttFwdLength;
+ return this;
+ }
+
+ public Builder tbpttBackLength(int tbpttBackLength) {
+ this.tbpttBackLength = tbpttBackLength;
+ return this;
+ }
+
+ public Builder trainingWorkspaceMode(WorkspaceMode trainingWorkspaceMode) {
+ this.trainingWorkspaceMode = trainingWorkspaceMode;
+ return this;
+ }
+
+ public Builder inferenceWorkspaceMode(WorkspaceMode inferenceWorkspaceMode) {
+ this.inferenceWorkspaceMode = inferenceWorkspaceMode;
+ return this;
+ }
+
+ public FineTuneConfiguration build() {
+ return new FineTuneConfiguration(activation, weightInit, biasInit, dist, l1, l2, l1Bias, l2Bias, dropout, weightNoise, updater, biasUpdater, miniBatch, maxNumLineSearchIterations, seed, optimizationAlgo, stepFunction, minimize, gradientNormalization, gradientNormalizationThreshold, convolutionMode, constraints, pretrain, backprop, backpropType, tbpttFwdLength, tbpttBackLength, trainingWorkspaceMode, inferenceWorkspaceMode);
+ }
+
+ public String toString() {
+ return "FineTuneConfiguration.Builder(activation=" + this.activation + ", weightInit=" + this.weightInit + ", biasInit=" + this.biasInit + ", dist=" + this.dist + ", l1=" + this.l1 + ", l2=" + this.l2 + ", l1Bias=" + this.l1Bias + ", l2Bias=" + this.l2Bias + ", dropout=" + this.dropout + ", weightNoise=" + this.weightNoise + ", updater=" + this.updater + ", biasUpdater=" + this.biasUpdater + ", miniBatch=" + this.miniBatch + ", maxNumLineSearchIterations=" + this.maxNumLineSearchIterations + ", seed=" + this.seed + ", optimizationAlgo=" + this.optimizationAlgo + ", stepFunction=" + this.stepFunction + ", minimize=" + this.minimize + ", gradientNormalization=" + this.gradientNormalization + ", gradientNormalizationThreshold=" + this.gradientNormalizationThreshold + ", convolutionMode=" + this.convolutionMode + ", constraints=" + this.constraints + ", pretrain=" + this.pretrain + ", backprop=" + this.backprop + ", backpropType=" + this.backpropType + ", tbpttFwdLength=" + this.tbpttFwdLength + ", tbpttBackLength=" + this.tbpttBackLength + ", trainingWorkspaceMode=" + this.trainingWorkspaceMode + ", inferenceWorkspaceMode=" + this.inferenceWorkspaceMode + ")";
+ }
}
@@ -123,7 +309,9 @@ public class FineTuneConfiguration {
if (l != null) {
if (dropout != null)
- l.setIDropout(dropout);
+ l.setIDropout(dropout.orElse(null));
+ if(constraints != null)
+ l.setConstraints(constraints.orElse(null));
}
if (l != null && l instanceof BaseLayer) {
@@ -146,17 +334,17 @@ public class FineTuneConfiguration {
if (l2Bias != null)
bl.setL2Bias(l2Bias);
if (gradientNormalization != null)
- bl.setGradientNormalization(gradientNormalization);
+ bl.setGradientNormalization(gradientNormalization.orElse(null));
if (gradientNormalizationThreshold != null)
bl.setGradientNormalizationThreshold(gradientNormalizationThreshold);
- if (iUpdater != null){
- bl.setIUpdater(iUpdater);
+ if (updater != null){
+ bl.setIUpdater(updater);
}
if (biasUpdater != null){
bl.setBiasUpdater(biasUpdater);
}
if (weightNoise != null){
- bl.setWeightNoise(weightNoise);
+ bl.setWeightNoise(weightNoise.orElse(null));
}
}
if (miniBatch != null)
@@ -185,9 +373,10 @@ public class FineTuneConfiguration {
((BaseLayer) l).setDist(null);
}
- //Perform validation. This also sets the defaults for updaters. For example, Updater.RMSProp -> set rmsDecay
+ //Perform validation
if (l != null) {
- LayerValidation.generalValidation(l.getLayerName(), l, dropout, l2, l2Bias, l1, l1Bias, dist, constraints, null, null);
+ LayerValidation.generalValidation(l.getLayerName(), l, get(dropout), l2, l2Bias, l1, l1Bias,
+ dist, get(constraints), null, null);
}
//Also: update the LR, L1 and L2 maps, based on current config (which might be different to original config)
@@ -198,6 +387,13 @@ public class FineTuneConfiguration {
}
}
+ private static <T> T get(Optional<T> optional){
+ if(optional == null){
+ return null;
+ }
+ return optional.orElse(null);
+ }
+
public void applyToMultiLayerConfiguration(MultiLayerConfiguration conf) {
if (pretrain != null)
conf.setPretrain(pretrain);
@@ -243,9 +439,9 @@ public class FineTuneConfiguration {
if (l2Bias != null)
confBuilder.setL2Bias(l2Bias);
if (dropout != null)
- confBuilder.setIdropOut(dropout);
- if (iUpdater != null)
- confBuilder.updater(iUpdater);
+ confBuilder.setIdropOut(dropout.orElse(null));
+ if (updater != null)
+ confBuilder.updater(updater);
if(biasUpdater != null)
confBuilder.biasUpdater(biasUpdater);
if (miniBatch != null)
@@ -261,7 +457,7 @@ public class FineTuneConfiguration {
if (minimize != null)
confBuilder.setMinimize(minimize);
if (gradientNormalization != null)
- confBuilder.setGradientNormalization(gradientNormalization);
+ confBuilder.setGradientNormalization(gradientNormalization.orElse(null));
if (gradientNormalizationThreshold != null)
confBuilder.setGradientNormalizationThreshold(gradientNormalizationThreshold);
if (trainingWorkspaceMode != null) | ['deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/transferlearning/FineTuneConfiguration.java', 'deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningMLNTest.java', 'deeplearning4j-core/src/test/java/org/deeplearning4j/nn/transferlearning/TransferLearningCompGraphTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 7,528,113 | 1,630,902 | 206,601 | 1,316 | 11,311 | 2,223 | 262 | 1 | 394 | 32 | 84 | 9 | 0 | 1 | 1970-01-01T00:25:12 | 13,099 | Java | {'Java': 42895752, 'C++': 17237193, 'Cuda': 2203734, 'Kotlin': 2030453, 'JavaScript': 296767, 'C': 172853, 'CMake': 126415, 'Shell': 96643, 'TypeScript': 81217, 'Python': 77566, 'FreeMarker': 77257, 'HTML': 18609, 'CSS': 12974, 'PureBasic': 12254, 'Cython': 12094, 'Ruby': 4558, 'Batchfile': 1458, 'Scala': 1026, 'Smarty': 975, 'Starlark': 931} | Apache License 2.0 |
9,740 | deeplearning4j/deeplearning4j/4415/4404 | deeplearning4j | deeplearning4j | https://github.com/deeplearning4j/deeplearning4j/issues/4404 | https://github.com/deeplearning4j/deeplearning4j/pull/4415 | https://github.com/deeplearning4j/deeplearning4j/pull/4415 | 1 | fix | RegressionEvaluation bug | ```
@Test
public void testRegressionEvalTimeSeriesSplit(){
INDArray out1 = Nd4j.rand(new int[]{3, 5, 20});
INDArray outSub1 = out1.get(all(), all(), interval(0,10));
INDArray outSub2 = out1.get(all(), all(), interval(10, 20));
INDArray label1 = Nd4j.rand(new int[]{3, 5, 20});
INDArray labelSub1 = label1.get(all(), all(), interval(0,10));
INDArray labelSub2 = label1.get(all(), all(), interval(10, 20));
RegressionEvaluation e1 = new RegressionEvaluation();
RegressionEvaluation e2 = new RegressionEvaluation();
e1.eval(label1, out1);
e2.eval(labelSub1, outSub1);
e2.eval(labelSub2, outSub2);
assertEquals(e1, e2);
}
```
Following test fails due to ```sumSquaredLabelDeviations``` array only. | 2a5c7ba77d2392aad5467fab38c7fed392897d1b | 4e0b2189a17b6e3977711bcb0d7f97c7029394b4 | https://github.com/deeplearning4j/deeplearning4j/compare/2a5c7ba77d2392aad5467fab38c7fed392897d1b...4e0b2189a17b6e3977711bcb0d7f97c7029394b4 | diff --git a/deeplearning4j-core/src/test/java/org/deeplearning4j/eval/EvalTest.java b/deeplearning4j-core/src/test/java/org/deeplearning4j/eval/EvalTest.java
index 599a5e53f9..2de65032de 100644
--- a/deeplearning4j-core/src/test/java/org/deeplearning4j/eval/EvalTest.java
+++ b/deeplearning4j-core/src/test/java/org/deeplearning4j/eval/EvalTest.java
@@ -53,6 +53,8 @@ import org.nd4j.linalg.util.FeatureUtil;
import java.util.*;
import static org.junit.Assert.*;
+import static org.nd4j.linalg.indexing.NDArrayIndex.all;
+import static org.nd4j.linalg.indexing.NDArrayIndex.interval;
/**
* Created by agibsonccc on 12/22/14.
@@ -254,7 +256,7 @@ public class EvalTest {
for (int j = 0; j < tsLength; j++) {
INDArray rand = Nd4j.rand(1, nOut);
rand.divi(rand.sumNumber());
- predicted.put(new INDArrayIndex[] {NDArrayIndex.point(i), NDArrayIndex.all(), NDArrayIndex.point(j)},
+ predicted.put(new INDArrayIndex[] {NDArrayIndex.point(i), all(), NDArrayIndex.point(j)},
rand);
int idx = r.nextInt(nOut);
labels.putScalar(new int[] {i, idx, j}, 1.0);
@@ -264,11 +266,11 @@ public class EvalTest {
//Create a longer labels/predicted with mask for first and last time step
//Expect masked evaluation to be identical to original evaluation
INDArray labels2 = Nd4j.zeros(miniBatch, nOut, tsLength + 2);
- labels2.put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(),
- NDArrayIndex.interval(1, tsLength + 1)}, labels);
+ labels2.put(new INDArrayIndex[] {all(), all(),
+ interval(1, tsLength + 1)}, labels);
INDArray predicted2 = Nd4j.zeros(miniBatch, nOut, tsLength + 2);
- predicted2.put(new INDArrayIndex[] {NDArrayIndex.all(), NDArrayIndex.all(),
- NDArrayIndex.interval(1, tsLength + 1)}, predicted);
+ predicted2.put(new INDArrayIndex[] {all(), all(),
+ interval(1, tsLength + 1)}, predicted);
INDArray labelsMask = Nd4j.ones(miniBatch, tsLength + 2);
for (int i = 0; i < miniBatch; i++) {
@@ -323,7 +325,7 @@ public class EvalTest {
INDArray rand = Nd4j.rand(1, numClasses);
rand.put(0, winner, rand.sumNumber());
rand.divi(rand.sumNumber());
- predicted.put(new INDArrayIndex[] {NDArrayIndex.point(i), NDArrayIndex.all()}, rand);
+ predicted.put(new INDArrayIndex[] {NDArrayIndex.point(i), all()}, rand);
//Generating random label
int label = r.nextInt(numClasses);
labels.putScalar(new int[] {i, label}, 1.0);
@@ -359,16 +361,16 @@ public class EvalTest {
//Now: split into 3 separate evaluation objects -> expect identical values after merging
Evaluation eval1 = new Evaluation();
- eval1.eval(actual.get(NDArrayIndex.interval(0, 5), NDArrayIndex.all()),
- predicted.get(NDArrayIndex.interval(0, 5), NDArrayIndex.all()));
+ eval1.eval(actual.get(interval(0, 5), all()),
+ predicted.get(interval(0, 5), all()));
Evaluation eval2 = new Evaluation();
- eval2.eval(actual.get(NDArrayIndex.interval(5, 10), NDArrayIndex.all()),
- predicted.get(NDArrayIndex.interval(5, 10), NDArrayIndex.all()));
+ eval2.eval(actual.get(interval(5, 10), all()),
+ predicted.get(interval(5, 10), all()));
Evaluation eval3 = new Evaluation();
- eval3.eval(actual.get(NDArrayIndex.interval(10, nRows), NDArrayIndex.all()),
- predicted.get(NDArrayIndex.interval(10, nRows), NDArrayIndex.all()));
+ eval3.eval(actual.get(interval(10, nRows), all()),
+ predicted.get(interval(10, nRows), all()));
eval1.merge(eval2);
eval1.merge(eval3);
@@ -378,8 +380,8 @@ public class EvalTest {
//Next: check evaluation merging with empty, and empty merging with non-empty
eval1 = new Evaluation();
- eval1.eval(actual.get(NDArrayIndex.interval(0, 5), NDArrayIndex.all()),
- predicted.get(NDArrayIndex.interval(0, 5), NDArrayIndex.all()));
+ eval1.eval(actual.get(interval(0, 5), all()),
+ predicted.get(interval(0, 5), all()));
Evaluation evalInitiallyEmpty = new Evaluation();
evalInitiallyEmpty.merge(eval1);
diff --git a/deeplearning4j-core/src/test/java/org/deeplearning4j/eval/RegressionEvalTest.java b/deeplearning4j-core/src/test/java/org/deeplearning4j/eval/RegressionEvalTest.java
index dcc42cb9f1..ff2523abfc 100644
--- a/deeplearning4j-core/src/test/java/org/deeplearning4j/eval/RegressionEvalTest.java
+++ b/deeplearning4j-core/src/test/java/org/deeplearning4j/eval/RegressionEvalTest.java
@@ -20,6 +20,8 @@ import java.util.Collections;
import java.util.List;
import static org.junit.Assert.assertEquals;
+import static org.nd4j.linalg.indexing.NDArrayIndex.all;
+import static org.nd4j.linalg.indexing.NDArrayIndex.interval;
/**
* @author Alex Black
@@ -204,4 +206,26 @@ public class RegressionEvalTest {
assertEquals(rmse[i], re.rootMeanSquaredError(i), 1e-6);
}
}
+
+ @Test
+ public void testRegressionEvalTimeSeriesSplit(){
+
+ INDArray out1 = Nd4j.rand(new int[]{3, 5, 20});
+ INDArray outSub1 = out1.get(all(), all(), interval(0,10));
+ INDArray outSub2 = out1.get(all(), all(), interval(10, 20));
+
+ INDArray label1 = Nd4j.rand(new int[]{3, 5, 20});
+ INDArray labelSub1 = label1.get(all(), all(), interval(0,10));
+ INDArray labelSub2 = label1.get(all(), all(), interval(10, 20));
+
+ RegressionEvaluation e1 = new RegressionEvaluation();
+ RegressionEvaluation e2 = new RegressionEvaluation();
+
+ e1.eval(label1, out1);
+
+ e2.eval(labelSub1, outSub1);
+ e2.eval(labelSub2, outSub2);
+
+ assertEquals(e1, e2);
+ }
}
diff --git a/deeplearning4j-nn/src/main/java/org/deeplearning4j/eval/RegressionEvaluation.java b/deeplearning4j-nn/src/main/java/org/deeplearning4j/eval/RegressionEvaluation.java
index 9ef34ca53c..de701ca49c 100644
--- a/deeplearning4j-nn/src/main/java/org/deeplearning4j/eval/RegressionEvaluation.java
+++ b/deeplearning4j-nn/src/main/java/org/deeplearning4j/eval/RegressionEvaluation.java
@@ -66,7 +66,7 @@ public class RegressionEvaluation extends BaseEvaluation<RegressionEvaluation> {
private INDArray sumSquaredPredicted;
@JsonSerialize(using = RowVectorSerializer.class)
@JsonDeserialize(using = RowVectorDeserializer.class)
- private INDArray sumSquaredLabelDeviations;
+ private INDArray sumLabels;
public RegressionEvaluation() {
this(null, DEFAULT_PRECISION);
@@ -135,7 +135,7 @@ public class RegressionEvaluation extends BaseEvaluation<RegressionEvaluation> {
sumOfProducts = Nd4j.zeros(n);
sumSquaredLabels = Nd4j.zeros(n);
sumSquaredPredicted = Nd4j.zeros(n);
- sumSquaredLabelDeviations = Nd4j.zeros(n);
+ sumLabels = Nd4j.zeros(n);
initialized = true;
}
@@ -217,8 +217,7 @@ public class RegressionEvaluation extends BaseEvaluation<RegressionEvaluation> {
.divi(newExampleCountPerColumn);
exampleCountPerColumn = newExampleCountPerColumn;
- final INDArray n = labels.dup().subRowVector(currentMean);
- sumSquaredLabelDeviations.addi(n.muli(n).sum(0));
+ sumLabels.addi(labels.sum(0));
}
@Override
@@ -384,8 +383,14 @@ public class RegressionEvaluation extends BaseEvaluation<RegressionEvaluation> {
* @see <a href="https://en.wikipedia.org/wiki/Coefficient_of_determination">Wikipedia</a>
*/
public double rSquared(int column) {
- final double sstot = sumSquaredLabelDeviations.getDouble(column);
- final double ssres = sumSquaredErrorsPerColumn.getDouble(column);
+ //ss_tot = sum_i (label_i - mean(labels))^2
+ // = (sum_i label_i^2) + mean(labels) * (n * mean(labels) - 2 * sum_i label_i)
+ double sumLabelSquared = sumSquaredLabels.getDouble(column);
+ double meanLabel = currentMean.getDouble(column);
+ double sumLabel = sumLabels.getDouble(column);
+ double n = exampleCountPerColumn.getDouble(column);
+ double sstot = sumLabelSquared + meanLabel * (n * meanLabel - 2 * sumLabel);
+ double ssres = sumSquaredErrorsPerColumn.getDouble(column);
return (sstot - ssres) / sstot;
}
| ['deeplearning4j-core/src/test/java/org/deeplearning4j/eval/RegressionEvalTest.java', 'deeplearning4j-nn/src/main/java/org/deeplearning4j/eval/RegressionEvaluation.java', 'deeplearning4j-core/src/test/java/org/deeplearning4j/eval/EvalTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 7,645,923 | 1,657,739 | 209,745 | 1,331 | 1,034 | 244 | 17 | 1 | 832 | 73 | 222 | 25 | 0 | 2 | 1970-01-01T00:25:13 | 13,099 | Java | {'Java': 42895752, 'C++': 17237193, 'Cuda': 2203734, 'Kotlin': 2030453, 'JavaScript': 296767, 'C': 172853, 'CMake': 126415, 'Shell': 96643, 'TypeScript': 81217, 'Python': 77566, 'FreeMarker': 77257, 'HTML': 18609, 'CSS': 12974, 'PureBasic': 12254, 'Cython': 12094, 'Ruby': 4558, 'Batchfile': 1458, 'Scala': 1026, 'Smarty': 975, 'Starlark': 931} | Apache License 2.0 |
1,214 | pinpoint-apm/pinpoint/616/611 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/611 | https://github.com/pinpoint-apm/pinpoint/pull/616 | https://github.com/pinpoint-apm/pinpoint/pull/616 | 1 | resolve | Handle cases where services have the same application name with different service type. | Backporting fixes to 1.1.0.
Issue resolves the following cases.
1. Services with the same application name but different service types should be selectable separately - #214
2. User nodes now take the destination's service type along with the application name when drawing the server map - #254
| a1409559e43a7943f533ed3cf8a39233167b9cea | 4fa9ef9ddb1cddcc4e78dd31a2ae0fafb19a41c7 | https://github.com/pinpoint-apm/pinpoint/compare/a1409559e43a7943f533ed3cf8a39233167b9cea...4fa9ef9ddb1cddcc4e78dd31a2ae0fafb19a41c7 | diff --git a/commons/src/main/java/com/navercorp/pinpoint/common/util/ApplicationMapStatisticsUtils.java b/commons/src/main/java/com/navercorp/pinpoint/common/util/ApplicationMapStatisticsUtils.java
index a0ff208e00..948e912ba1 100644
--- a/commons/src/main/java/com/navercorp/pinpoint/common/util/ApplicationMapStatisticsUtils.java
+++ b/commons/src/main/java/com/navercorp/pinpoint/common/util/ApplicationMapStatisticsUtils.java
@@ -103,6 +103,12 @@ public class ApplicationMapStatisticsUtils {
return BytesUtils.toStringAndRightTrim(bytes, 6, length);
}
+ public static String getDestApplicationNameFromColumnNameForUser(byte[] bytes, ServiceType destServiceType) {
+ String destApplicationName = getDestApplicationNameFromColumnName(bytes);
+ String destServiceTypeName = destServiceType.name();
+ return destApplicationName + "_" + destServiceTypeName;
+ }
+
public static String getHost(byte[] bytes) {
int offset = 6 + BytesUtils.bytesToShort(bytes, 4);
diff --git a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseApplicationIndexDao.java b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseApplicationIndexDao.java
index f4ef005500..9b5d1cc420 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseApplicationIndexDao.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseApplicationIndexDao.java
@@ -16,6 +16,7 @@
package com.navercorp.pinpoint.web.dao.hbase;
+import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
@@ -45,7 +46,7 @@ public class HbaseApplicationIndexDao implements ApplicationIndexDao {
@Autowired
@Qualifier("applicationNameMapper")
- private RowMapper<Application> applicationNameMapper;
+ private RowMapper<List<Application>> applicationNameMapper;
@Autowired
@Qualifier("agentIdMapper")
@@ -55,7 +56,12 @@ public class HbaseApplicationIndexDao implements ApplicationIndexDao {
public List<Application> selectAllApplicationNames() {
Scan scan = new Scan();
scan.setCaching(30);
- return hbaseOperations2.find(HBaseTables.APPLICATION_INDEX, scan, applicationNameMapper);
+ List<List<Application>> results = hbaseOperations2.find(HBaseTables.APPLICATION_INDEX, scan, applicationNameMapper);
+ List<Application> applications = new ArrayList<Application>();
+ for (List<Application> result : results) {
+ applications.addAll(result);
+ }
+ return applications;
}
@Override
diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/ApplicationNameMapper.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/ApplicationNameMapper.java
index 186e061e0c..62220fc0f3 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/ApplicationNameMapper.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/mapper/ApplicationNameMapper.java
@@ -16,25 +16,50 @@
package com.navercorp.pinpoint.web.mapper;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.util.Bytes;
import org.springframework.data.hadoop.hbase.RowMapper;
import org.springframework.stereotype.Component;
+import com.navercorp.pinpoint.common.ServiceType;
import com.navercorp.pinpoint.web.vo.Application;
/**
*
*/
@Component
-public class ApplicationNameMapper implements RowMapper<Application> {
+public class ApplicationNameMapper implements RowMapper<List<Application>> {
+
@Override
- public Application mapRow(Result result, int rowNum) throws Exception {
+ public List<Application> mapRow(Result result, int rowNum) throws Exception {
if (result.isEmpty()) {
- return null;
+ return Collections.emptyList();
}
+ Set<Short> uniqueTypeCodes = new HashSet<Short>();
String applicationName = Bytes.toString(result.getRow());
- short serviceType = Bytes.toShort(result.value());
- return new Application(applicationName, serviceType);
+
+ List<Cell> list = result.listCells();
+ if (list == null) {
+ return Collections.emptyList();
+ }
+
+ for (Cell cell : list) {
+ short serviceTypeCode = Bytes.toShort(CellUtil.cloneValue(cell));
+ uniqueTypeCodes.add(serviceTypeCode);
+ }
+ List<Application> applications = new ArrayList<Application>();
+ for (short serviceTypeCode : uniqueTypeCodes) {
+ applications.add(new Application(applicationName, ServiceType.findServiceType(serviceTypeCode)));
+ }
+
+ return applications;
}
}
diff --git a/web/src/main/java/com/navercorp/pinpoint/web/mapper/MapStatisticsCalleeMapper.java b/web/src/main/java/com/navercorp/pinpoint/web/mapper/MapStatisticsCalleeMapper.java
index 2040310f47..6afdf3812b 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/mapper/MapStatisticsCalleeMapper.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/mapper/MapStatisticsCalleeMapper.java
@@ -16,6 +16,7 @@
package com.navercorp.pinpoint.web.mapper;
+import com.navercorp.pinpoint.common.ServiceType;
import com.navercorp.pinpoint.common.buffer.Buffer;
import com.navercorp.pinpoint.common.buffer.FixedBuffer;
import com.navercorp.pinpoint.common.util.ApplicationMapStatisticsUtils;
@@ -71,7 +72,7 @@ public class MapStatisticsCalleeMapper implements RowMapper<LinkDataMap> {
for (Cell cell : result.rawCells()) {
final byte[] qualifier = CellUtil.cloneQualifier(cell);
- final Application callerApplication = readCallerApplication(qualifier);
+ final Application callerApplication = readCallerApplication(qualifier, calleeApplication.getServiceType());
if (filter.filter(callerApplication)) {
continue;
}
@@ -98,9 +99,15 @@ public class MapStatisticsCalleeMapper implements RowMapper<LinkDataMap> {
return linkDataMap;
}
- private Application readCallerApplication(byte[] qualifier) {
- String callerApplicationName = ApplicationMapStatisticsUtils.getDestApplicationNameFromColumnName(qualifier);
- short callerServiceType = ApplicationMapStatisticsUtils.getDestServiceTypeFromColumnName(qualifier);
+ private Application readCallerApplication(byte[] qualifier, ServiceType calleeServiceType) {
+ short callerServiceType = ApplicationMapStatisticsUtils.getDestServiceTypeFromColumnName(qualifier);// Caller may be a user node, and user nodes may call nodes with the same application name but different service type.
+ // To distinguish between these user nodes, append callee's service type to the application name.
+ String callerApplicationName;
+ if (ServiceType.findServiceType(callerServiceType).isUser()) {
+ callerApplicationName = ApplicationMapStatisticsUtils.getDestApplicationNameFromColumnNameForUser(qualifier, calleeServiceType);
+ } else {
+ callerApplicationName = ApplicationMapStatisticsUtils.getDestApplicationNameFromColumnName(qualifier);
+ }
return new Application(callerApplicationName, callerServiceType);
}
| ['web/src/main/java/com/navercorp/pinpoint/web/dao/hbase/HbaseApplicationIndexDao.java', 'web/src/main/java/com/navercorp/pinpoint/web/mapper/MapStatisticsCalleeMapper.java', 'commons/src/main/java/com/navercorp/pinpoint/common/util/ApplicationMapStatisticsUtils.java', 'web/src/main/java/com/navercorp/pinpoint/web/mapper/ApplicationNameMapper.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 4,100,269 | 858,432 | 120,031 | 1,111 | 3,752 | 669 | 66 | 4 | 298 | 47 | 63 | 6 | 0 | 0 | 1970-01-01T00:23:54 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,206 | pinpoint-apm/pinpoint/2078/2077 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/2077 | https://github.com/pinpoint-apm/pinpoint/pull/2078 | https://github.com/pinpoint-apm/pinpoint/pull/2078 | 1 | fixes | Tomcat plugin fails to trace when profiler.tomcat.excludeurl is empty | Tomcat plugin fails to inject interceptor to `StandardHostValve.invoke(...)` when _pinpoint.config_'s `profiler.tomcat.excludeurl` option is empty.
| 0f94b21205ca84f01d18283b381615f5e88f3f55 | 6f90e3cbcd4d1f34dbe87ef28f84e2759966d6d2 | https://github.com/pinpoint-apm/pinpoint/compare/0f94b21205ca84f01d18283b381615f5e88f3f55...6f90e3cbcd4d1f34dbe87ef28f84e2759966d6d2 | diff --git a/plugins/tomcat/src/main/java/com/navercorp/pinpoint/plugin/tomcat/TomcatConfiguration.java b/plugins/tomcat/src/main/java/com/navercorp/pinpoint/plugin/tomcat/TomcatConfiguration.java
index 0c0ba3bfcf..3f7e8089f6 100644
--- a/plugins/tomcat/src/main/java/com/navercorp/pinpoint/plugin/tomcat/TomcatConfiguration.java
+++ b/plugins/tomcat/src/main/java/com/navercorp/pinpoint/plugin/tomcat/TomcatConfiguration.java
@@ -14,9 +14,9 @@
*/
package com.navercorp.pinpoint.plugin.tomcat;
-import com.navercorp.pinpoint.bootstrap.config.ExcludePathFilter;
import com.navercorp.pinpoint.bootstrap.config.Filter;
import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
+import com.navercorp.pinpoint.bootstrap.config.SkipFilter;
/**
* @author Jongho Moon
@@ -24,14 +24,14 @@ import com.navercorp.pinpoint.bootstrap.config.ProfilerConfig;
*/
public class TomcatConfiguration {
private final boolean tomcatHidePinpointHeader;
- private Filter<String> tomcatExcludeUrlFilter;
+ private final Filter<String> tomcatExcludeUrlFilter;
public TomcatConfiguration(ProfilerConfig config) {
this.tomcatHidePinpointHeader = config.readBoolean("profiler.tomcat.hidepinpointheader", true);
- final String tomcatExcludeURL = config.readString("profiler.tomcat.excludeurl", "");
-
- if (!tomcatExcludeURL.isEmpty()) {
- this.tomcatExcludeUrlFilter = new ExcludePathFilter(tomcatExcludeURL);
+ if (config.getTomcatExcludeProfileMethodFilter() == null) {
+ this.tomcatExcludeUrlFilter = new SkipFilter<String>();
+ } else {
+ this.tomcatExcludeUrlFilter = config.getTomcatExcludeUrlFilter();
}
}
| ['plugins/tomcat/src/main/java/com/navercorp/pinpoint/plugin/tomcat/TomcatConfiguration.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 11,648,680 | 2,582,423 | 338,149 | 2,482 | 703 | 146 | 12 | 1 | 148 | 14 | 35 | 2 | 0 | 0 | 1970-01-01T00:24:33 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,207 | pinpoint-apm/pinpoint/2011/2010 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/2010 | https://github.com/pinpoint-apm/pinpoint/pull/2011 | https://github.com/pinpoint-apm/pinpoint/pull/2011 | 1 | fixes | Jdk's HttpUrlConnection's target nodes are not rendered in the server map | Http calls made using `HttpUrlConnection` is currently being traced, but the server map does not seem to be rendering the target nodes,
Related google groups post - https://groups.google.com/forum/#!topic/pinpoint_user/OgwAB9sPnak
| 2e39615c5c4b283d821aa3dba607a5d6d3fd856b | a2858a90331fb9e4dbd72d88a0ab4d5fdd1f58ab | https://github.com/pinpoint-apm/pinpoint/compare/2e39615c5c4b283d821aa3dba607a5d6d3fd856b...a2858a90331fb9e4dbd72d88a0ab4d5fdd1f58ab | diff --git a/plugins/jdk-http/src/main/java/com/navercorp/pinpoint/plugin/jdk/http/JdkHttpConstants.java b/plugins/jdk-http/src/main/java/com/navercorp/pinpoint/plugin/jdk/http/JdkHttpConstants.java
index 184baf89b5..3a6bfa4ea7 100644
--- a/plugins/jdk-http/src/main/java/com/navercorp/pinpoint/plugin/jdk/http/JdkHttpConstants.java
+++ b/plugins/jdk-http/src/main/java/com/navercorp/pinpoint/plugin/jdk/http/JdkHttpConstants.java
@@ -17,6 +17,8 @@ package com.navercorp.pinpoint.plugin.jdk.http;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.common.trace.ServiceTypeFactory;
+import static com.navercorp.pinpoint.common.trace.ServiceTypeProperty.RECORD_STATISTICS;
+
/**
* @author Jongho Moon
*
@@ -25,5 +27,5 @@ public final class JdkHttpConstants {
private JdkHttpConstants() {
}
- public static final ServiceType SERVICE_TYPE = ServiceTypeFactory.of(9055, "JDK_HTTPURLCONNECTOR", "JDK_HTTPCONNECTOR");
+ public static final ServiceType SERVICE_TYPE = ServiceTypeFactory.of(9055, "JDK_HTTPURLCONNECTOR", "JDK_HTTPCONNECTOR", RECORD_STATISTICS);
} | ['plugins/jdk-http/src/main/java/com/navercorp/pinpoint/plugin/jdk/http/JdkHttpConstants.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 6,815,140 | 1,429,449 | 195,772 | 1,959 | 362 | 86 | 4 | 1 | 232 | 28 | 54 | 4 | 1 | 0 | 1970-01-01T00:24:32 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,209 | pinpoint-apm/pinpoint/1457/1443 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/1443 | https://github.com/pinpoint-apm/pinpoint/pull/1457 | https://github.com/pinpoint-apm/pinpoint/pull/1457 | 1 | fix | Fixed invalid classloading when using the AspectJ + Spring AOP | - support spring aspectj weaving
- support OSGI (atlassian jira)
- #1583 Enhancement PlaingClassLoaderHandler for Jira.
| dd7c6f23472ca9bf0a8eef571c694921113145ee | e28e3cedad91e10c3c5ca9b1c22a82a16065e5bb | https://github.com/pinpoint-apm/pinpoint/compare/dd7c6f23472ca9bf0a8eef571c694921113145ee...e28e3cedad91e10c3c5ca9b1c22a82a16065e5bb | diff --git a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointStarter.java b/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointStarter.java
index 056da38017..7beb09d8df 100644
--- a/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointStarter.java
+++ b/bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointStarter.java
@@ -127,7 +127,7 @@ public class PinpointStarter {
agentClassLoader.setBootClass(bootClass);
logger.info("pinpoint agent [" + bootClass + "] starting...");
- AgentOption option = createAgentOption(agentArgs, instrumentation, profilerConfig, pluginJars, bootStrapCore, serviceTypeRegistryService, annotationKeyRegistryService, bootStrapCoreJar);
+ AgentOption option = createAgentOption(agentArgs, instrumentation, profilerConfig, pluginJars, bootStrapCore, serviceTypeRegistryService, annotationKeyRegistryService);
Agent pinpointAgent = agentClassLoader.boot(option);
pinpointAgent.start();
registerShutdownHook(pinpointAgent);
@@ -139,9 +139,9 @@ public class PinpointStarter {
}
}
- private AgentOption createAgentOption(String agentArgs, Instrumentation instrumentation, ProfilerConfig profilerConfig, URL[] pluginJars, String bootStrapJarPath, ServiceTypeRegistryService serviceTypeRegistryService, AnnotationKeyRegistryService annotationKeyRegistryService, String bootStrapCoreJar) {
+ private AgentOption createAgentOption(String agentArgs, Instrumentation instrumentation, ProfilerConfig profilerConfig, URL[] pluginJars, String bootStrapJarCorePath, ServiceTypeRegistryService serviceTypeRegistryService, AnnotationKeyRegistryService annotationKeyRegistryService) {
- return new DefaultAgentOption(agentArgs, instrumentation, profilerConfig, pluginJars, bootStrapJarPath, serviceTypeRegistryService, annotationKeyRegistryService);
+ return new DefaultAgentOption(agentArgs, instrumentation, profilerConfig, pluginJars, bootStrapJarCorePath, serviceTypeRegistryService, annotationKeyRegistryService);
}
// for test
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/JarProfilerPluginClassInjector.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/JarProfilerPluginClassInjector.java
index bafcb5cb51..1733f61f1c 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/JarProfilerPluginClassInjector.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/JarProfilerPluginClassInjector.java
@@ -215,7 +215,7 @@ public class JarProfilerPluginClassInjector implements ClassInjector {
}
}
if (logger.isInfoEnabled()) {
- logger.debug("defineClass pluginClass:{} cl:{}", className, classLoader);
+ logger.info("defineClass pluginClass:{} cl:{}", className, classLoader);
}
final byte[] bytes = ct.toBytecode();
return (Class<?>)DEFINE_CLASS.invoke(classLoader, ct.getName(), bytes, 0, bytes.length); | ['bootstrap/src/main/java/com/navercorp/pinpoint/bootstrap/PinpointStarter.java', 'profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/JarProfilerPluginClassInjector.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 5,822,357 | 1,216,183 | 168,303 | 1,617 | 1,498 | 293 | 8 | 2 | 126 | 16 | 36 | 4 | 0 | 0 | 1970-01-01T00:24:12 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,210 | pinpoint-apm/pinpoint/1272/1271 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/1271 | https://github.com/pinpoint-apm/pinpoint/pull/1272 | https://github.com/pinpoint-apm/pinpoint/pull/1272 | 2 | fixed | Unsampled Continuation is not collected for transaction metric. | Metric Gauge for TRANSACTION_UNSAMPLED_CONTINUATION is missing.
Unsampled continuation gauge instead uses TRANSACTION_UNSAMPLED_NEW, which is wrong.
| df606e80ff905ae81d51192708ae9e409967c69d | 2cc7a9186af5b7cb9c7f6cccc33fd20e46ba9e16 | https://github.com/pinpoint-apm/pinpoint/compare/df606e80ff905ae81d51192708ae9e409967c69d...2cc7a9186af5b7cb9c7f6cccc33fd20e46ba9e16 | diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/tps/TransactionMetricCollector.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/tps/TransactionMetricCollector.java
index d505a228f8..f52520d703 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/tps/TransactionMetricCollector.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/tps/TransactionMetricCollector.java
@@ -49,7 +49,7 @@ public class TransactionMetricCollector implements AgentStatCollector<TTransacti
this.sampledNewGauge = (Gauge<Long>)MetricMonitorValues.getMetric(metrics, TRANSACTION_SAMPLED_NEW, UNSUPPORTED_GAUGE);
this.sampledContinuationGauge = (Gauge<Long>)MetricMonitorValues.getMetric(metrics, TRANSACTION_SAMPLED_CONTINUATION, UNSUPPORTED_GAUGE);
this.unsampledNewGauge = (Gauge<Long>)MetricMonitorValues.getMetric(metrics, TRANSACTION_UNSAMPLED_NEW, UNSUPPORTED_GAUGE);
- this.unsampledContinuationGuage = (Gauge<Long>)MetricMonitorValues.getMetric(metrics, TRANSACTION_UNSAMPLED_NEW, UNSUPPORTED_GAUGE);
+ this.unsampledContinuationGuage = (Gauge<Long>)MetricMonitorValues.getMetric(metrics, TRANSACTION_UNSAMPLED_CONTINUATION, UNSUPPORTED_GAUGE);
}
@Override
| ['profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/tps/TransactionMetricCollector.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,659,803 | 1,179,856 | 164,006 | 1,593 | 294 | 71 | 2 | 1 | 149 | 15 | 30 | 3 | 0 | 0 | 1970-01-01T00:24:08 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,211 | pinpoint-apm/pinpoint/1173/1171 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/1171 | https://github.com/pinpoint-apm/pinpoint/pull/1173 | https://github.com/pinpoint-apm/pinpoint/pull/1173 | 1 | fixed | Fixed a side effect of Arcus interceptor | Side effect : faild to failover.
Root cause : Unnecessary reverse DNS lookup
Bug fix : Avoid DNS lookup API.
- ApiInterceptor.java
- FutureGetInterceptor.java
``` java
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
...
final Operation op = (Operation) getOperation.invoke(target);
if (op != null) {
MemcachedNode handlingNode = op.getHandlingNode();
if (handlingNode != null) {
SocketAddress socketAddress = handlingNode.getSocketAddress();
if (socketAddress instanceof InetSocketAddress) {
InetSocketAddress address = (InetSocketAddress) socketAddress;
// ROOT Cause : Unnecessary DNS look -> InetSocketAddress.getHostName()
trace.recordEndPoint(address.getHostName() + ":" + address.getPort());
}
} else {
logger.info("no handling node");
}
} else {
logger.info("operation not found");
}
}
```
| cd182945f1b1bb1e6be6091869bbd7ba64b3c504 | a79a27bde7eee135f7ae1e5094243bedd7528fa9 | https://github.com/pinpoint-apm/pinpoint/compare/cd182945f1b1bb1e6be6091869bbd7ba64b3c504...a79a27bde7eee135f7ae1e5094243bedd7528fa9 | diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/ApiInterceptor.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/ApiInterceptor.java
index e9d33e86a0..d90c717676 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/ApiInterceptor.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/ApiInterceptor.java
@@ -16,6 +16,7 @@
package com.navercorp.pinpoint.profiler.modifier.arcus.interceptor;
+import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.concurrent.Future;
@@ -61,11 +62,12 @@ public class ApiInterceptor extends SpanEventSimpleAroundInterceptor implements
if (result instanceof Future && !(result instanceof FrontCacheGetFuture)) {
final Operation op = getOperation(result);
if (op != null) {
- MemcachedNode handlingNode = op.getHandlingNode();
- SocketAddress socketAddress = handlingNode.getSocketAddress();
- if (socketAddress instanceof InetSocketAddress) {
- InetSocketAddress address = (InetSocketAddress) socketAddress;
- trace.recordEndPoint(address.getHostName() + ":" + address.getPort());
+ final MemcachedNode handlingNode = op.getHandlingNode();
+ if (handlingNode != null) {
+ final String endPoint = getEndPoint(handlingNode);
+ if (endPoint != null) {
+ trace.recordEndPoint(endPoint);
+ }
}
} else {
logger.info("operation not found");
@@ -85,6 +87,40 @@ public class ApiInterceptor extends SpanEventSimpleAroundInterceptor implements
trace.markAfterTime();
}
+ private String getEndPoint(MemcachedNode handlingNode) {
+ // TODO duplicated code : ApiInterceptor, FutureGetInterceptor
+ final SocketAddress socketAddress = handlingNode.getSocketAddress();
+ if (socketAddress instanceof InetSocketAddress) {
+ final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+ final String hostAddress = getHostAddress(inetSocketAddress);
+ if (hostAddress == null) {
+ // TODO return "Unknown Host"; ?
+ logger.debug("hostAddress is null");
+ return null;
+ }
+ return hostAddress + ":" + inetSocketAddress.getPort();
+
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("invalid socketAddress:{}", socketAddress);
+ }
+ return null;
+ }
+ }
+
+ private String getHostAddress(InetSocketAddress inetSocketAddress) {
+ if (inetSocketAddress == null) {
+ return null;
+ }
+ // TODO JDK 1.7 InetSocketAddress.getHostString();
+ // Warning : Avoid unnecessary DNS lookup (warning:InetSocketAddress.getHostName())
+ final InetAddress inetAddress = inetSocketAddress.getAddress();
+ if (inetAddress == null) {
+ return null;
+ }
+ return inetAddress.getHostAddress();
+ }
+
private Operation getOperation(Object result) {
// __operation -> ObjectTraceValue1.class
final Object operationObject = ObjectTraceValue1Utils.__getTraceObject1(result, null);
diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/FutureGetInterceptor.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/FutureGetInterceptor.java
index 6e5579a9ae..1d0ca160a8 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/FutureGetInterceptor.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/FutureGetInterceptor.java
@@ -16,6 +16,7 @@
package com.navercorp.pinpoint.profiler.modifier.arcus.interceptor;
+import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
@@ -77,12 +78,11 @@ public class FutureGetInterceptor implements SimpleAroundInterceptor, ByteCodeMe
// find the target node
final Operation op = getOperation(target);
if (op != null) {
- MemcachedNode handlingNode = op.getHandlingNode();
+ final MemcachedNode handlingNode = op.getHandlingNode();
if (handlingNode != null) {
- SocketAddress socketAddress = handlingNode.getSocketAddress();
- if (socketAddress instanceof InetSocketAddress) {
- InetSocketAddress address = (InetSocketAddress) socketAddress;
- trace.recordEndPoint(address.getHostName() + ":" + address.getPort());
+ final String endPoint = getEndPoint(handlingNode);
+ if (endPoint != null) {
+ trace.recordEndPoint(endPoint);
}
trace.recordException(op.getException());
} else {
@@ -113,6 +113,40 @@ public class FutureGetInterceptor implements SimpleAroundInterceptor, ByteCodeMe
}
}
+ private String getEndPoint(MemcachedNode handlingNode) {
+ // TODO duplicated code : ApiInterceptor, FutureGetInterceptor
+ final SocketAddress socketAddress = handlingNode.getSocketAddress();
+ if (socketAddress instanceof InetSocketAddress) {
+ final InetSocketAddress inetSocketAddress = (InetSocketAddress) socketAddress;
+ final String hostAddress = getHostAddress(inetSocketAddress);
+ if (hostAddress == null) {
+ // TODO return "Unknown Host";
+ logger.debug("hostAddress is null");
+ return null;
+ }
+ return hostAddress + ":" + inetSocketAddress.getPort();
+
+ } else {
+ if (logger.isDebugEnabled()) {
+ logger.debug("invalid socketAddress:{}", socketAddress);
+ }
+ return null;
+ }
+ }
+
+ private String getHostAddress(InetSocketAddress inetSocketAddress) {
+ if (inetSocketAddress == null) {
+ return null;
+ }
+ // TODO JDK 1.7 InetSocketAddress.getHostString();
+ // Warning : Avoid unnecessary DNS lookup (warning:InetSocketAddress.getHostName())
+ final InetAddress inetAddress = inetSocketAddress.getAddress();
+ if (inetAddress == null) {
+ return null;
+ }
+ return inetAddress.getHostAddress();
+ }
+
// __operation -> ObjectTraceValue1.class
private Operation getOperation(Object target) {
final Object operationObject = ObjectTraceValue1Utils.__getTraceObject1(target, null); | ['profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/ApiInterceptor.java', 'profiler/src/main/java/com/navercorp/pinpoint/profiler/modifier/arcus/interceptor/FutureGetInterceptor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 4,196,939 | 880,306 | 123,159 | 1,150 | 4,224 | 704 | 90 | 2 | 1,127 | 104 | 199 | 29 | 0 | 1 | 1970-01-01T00:24:07 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,212 | pinpoint-apm/pinpoint/916/914 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/914 | https://github.com/pinpoint-apm/pinpoint/pull/916 | https://github.com/pinpoint-apm/pinpoint/pull/916 | 1 | fixes | Handle cases where collected cpu load is NaN | There was a case where calling `OperatingSystemMXBean.getSystemCpuLoad()` returned Double.NaN (the agent was ran on a virtual machine).
The data collected was as follows:
```
TAgentStatBatch(agentId:test-agent, startTimestamp:1441085794300, agentStats:[
TAgentStat(timestamp:1441087205292, cpuLoad:TCpuLoad(systemCpuLoad:0.026276276276276277, jvmCpuLoad:5.983020928131048E-4), gc:TJvmGc(...)),
TAgentStat(timestamp:1441087802597, cpuLoad:TCpuLoad(systemCpuLoad:0.13733025877530106, jvmCpuLoad:9.909711377187762E-6), gc:TJvmGc(...)),
TAgentStat(timestamp:1441087802597, cpuLoad:TCpuLoad(systemCpuLoad:NaN, jvmCpuLoad:0.14527027027027026), gc:TJvmGc(...)),
TAgentStat(timestamp:1441087802597, cpuLoad:TCpuLoad(systemCpuLoad:NaN, jvmCpuLoad:0.1275), gc:TJvmGc(...)),
TAgentStat(timestamp:1441087802597, cpuLoad:TCpuLoad(systemCpuLoad:NaNjvmCpuLoad:0.125), gc:TJvmGc(...)),
TAgentStat(timestamp:1441087802597, cpuLoad:TCpuLoad(systemCpuLoad:0.0jvmCpuLoad:0.125), gc:TJvmGc(...))
])
```
Need a NaN check - use `Double.isNaN()`.
(equals check does not work on NaNs as `Double.NaN != Double.NaN`)
| 07b1cb664ed44b63014501a27828c913e95dff51 | 7b62f1d0313867f6d89d8d05f06b8006a49499bf | https://github.com/pinpoint-apm/pinpoint/compare/07b1cb664ed44b63014501a27828c913e95dff51...7b62f1d0313867f6d89d8d05f06b8006a49499bf | diff --git a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadCollector.java b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadCollector.java
index 3b47af433e..547864abe1 100644
--- a/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadCollector.java
+++ b/profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadCollector.java
@@ -61,6 +61,6 @@ public class CpuLoadCollector {
}
private boolean notCollected(double cpuLoad) {
- return cpuLoad < 0;
+ return cpuLoad < 0 || Double.isNaN(cpuLoad);
}
} | ['profiler/src/main/java/com/navercorp/pinpoint/profiler/monitor/codahale/cpu/CpuLoadCollector.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,492,652 | 1,142,179 | 158,665 | 1,535 | 82 | 22 | 2 | 1 | 1,122 | 69 | 383 | 18 | 0 | 1 | 1970-01-01T00:24:01 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,208 | pinpoint-apm/pinpoint/1488/1487 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/1487 | https://github.com/pinpoint-apm/pinpoint/pull/1488 | https://github.com/pinpoint-apm/pinpoint/pull/1488 | 1 | fixes | Link data missing on emulated application nodes | Call counts on edges pointing to emulated application nodes are calculated from callee statistics rather than caller statistics. This is done because the caller cannot differentiate which emulated application node it has called as the caller only knows the host name of it's target (and emulated application nodes share the same host name).
When such emulated application nodes sit on the edge of the callee search depth (for example, inbound depth=1, outbound depth=2 on a `USER -> SELECTED NODE -> EMULATED NODE -> some node`), the callee statistics of the `EMULATED_NODE` is not fetched as the inbound depth limit is 1.
In these situations, the server map incorrectly renders the above as `USER --N--> SELECTED NODE --0--> --N--> some node`.
| 875a4a42f0a24dfeeca0b65a56baac02f23f48af | 77cc779df69dc52a37e03f31c5b9298d62e004ec | https://github.com/pinpoint-apm/pinpoint/compare/875a4a42f0a24dfeeca0b65a56baac02f23f48af...77cc779df69dc52a37e03f31c5b9298d62e004ec | diff --git a/web/src/main/java/com/navercorp/pinpoint/web/service/BFSLinkSelector.java b/web/src/main/java/com/navercorp/pinpoint/web/service/BFSLinkSelector.java
index 82dad1e345..7eda23ea77 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/service/BFSLinkSelector.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/service/BFSLinkSelector.java
@@ -196,7 +196,7 @@ public class BFSLinkSelector implements LinkSelector {
}
private List<LinkData> createVirtualLinkData(LinkData linkData, Application toApplication, Set<AcceptApplication> acceptApplicationList) {
- logger.warn("ono to N replaced. node:{}->host:{} accept:{}", linkData.getFromApplication(), toApplication.getName(), acceptApplicationList);
+ logger.warn("one to N replaced. node:{}->host:{} accept:{}", linkData.getFromApplication(), toApplication.getName(), acceptApplicationList);
List<LinkData> emulationLink = new ArrayList<>();
for (AcceptApplication acceptApplication : acceptApplicationList) {
@@ -234,7 +234,7 @@ public class BFSLinkSelector implements LinkSelector {
return acceptApplication;
}
- private void fillEmulationLink(LinkDataDuplexMap linkDataDuplexMap) {
+ private void fillEmulationLink(LinkDataDuplexMap linkDataDuplexMap, Range range) {
// TODO need to be reimplemented - virtual node creation logic needs an overhaul.
// Currently, only the reversed relationship node is displayed. We need to create a virtual node and convert the rpc data appropriately.
logger.debug("this.emulationLinkMarker:{}", this.emulationLinkMarker);
@@ -248,10 +248,18 @@ public class BFSLinkSelector implements LinkSelector {
LinkKey findLinkKey = new LinkKey(emulationLinkData.getFromApplication(), emulationLinkData.getToApplication());
LinkData targetLinkData = linkDataDuplexMap.getTargetLinkData(findLinkKey);
if (targetLinkData == null) {
- // There has been a case where targetLinkData was null, but exact event could not be captured for analysis.
- // Logging the case for further analysis should it happen again in the future.
- logger.error("targetLinkData not found findLinkKey:{}", findLinkKey);
- continue;
+ // This is a case where the emulation target node has been only "partially" visited, (ie. does not have a target link data)
+ // Most likely due to the limit imposed by inbound search depth.
+ // Must go fetch the target link data here.
+ final Application targetApplication = emulationLinkData.getToApplication();
+ final LinkDataMap callee = mapStatisticsCalleeDao.selectCallee(targetApplication, range);
+ targetLinkData = callee.getLinkData(findLinkKey);
+ if (targetLinkData == null) {
+ // There has been a case where targetLinkData was null, but exact event could not be captured for analysis.
+ // Logging the case for further analysis should it happen again in the future.
+ logger.error("targetLinkData not found findLinkKey:{}", findLinkKey);
+ continue;
+ }
}
// create reversed link data - convert data accepted by the target to target's call data
@@ -332,7 +340,7 @@ public class BFSLinkSelector implements LinkSelector {
logger.debug("Link emulation size:{}", emulationLinkMarker.size());
// special case
checkUnsearchEmulationCalleeNode(linkDataDuplexMap, range);
- fillEmulationLink(linkDataDuplexMap);
+ fillEmulationLink(linkDataDuplexMap, range);
}
return linkDataDuplexMap; | ['web/src/main/java/com/navercorp/pinpoint/web/service/BFSLinkSelector.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 5,842,200 | 1,220,042 | 168,813 | 1,621 | 1,874 | 363 | 22 | 1 | 747 | 120 | 158 | 6 | 0 | 0 | 1970-01-01T00:24:13 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,215 | pinpoint-apm/pinpoint/491/488 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/488 | https://github.com/pinpoint-apm/pinpoint/pull/491 | https://github.com/pinpoint-apm/pinpoint/pull/491 | 1 | resolve | Web throws NPE when filtering calls with RPC internal types | When filtering RPC calls on Pinpoint web, NullPointerException is thrown.
This is due to a missing check inside the filtering logic. WAS -> WAS filtering checks each span event for its `ServiceType` and if it is in the RPC range (9000~9999), does an equals check with the span event's `destinationId`. Since RPC internal methods does not have a `destinationId`, while being within the RPC range, NPE is thrown.
Fix needs 2 checks - to check if the span event's ServiceType is set to record statistics, and to check for null `destinationId`.
| 1b5d37598c12c53c733ea362bcf7876cd97c060b | bb65435ffbdb8997d5fd3fc7bf1513389e2ae541 | https://github.com/pinpoint-apm/pinpoint/compare/1b5d37598c12c53c733ea362bcf7876cd97c060b...bb65435ffbdb8997d5fd3fc7bf1513389e2ae541 | diff --git a/web/src/main/java/com/navercorp/pinpoint/web/filter/DefaultFilterBuilder.java b/web/src/main/java/com/navercorp/pinpoint/web/filter/DefaultFilterBuilder.java
index 9a5d2afaa9..e944caa7a5 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/filter/DefaultFilterBuilder.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/filter/DefaultFilterBuilder.java
@@ -149,7 +149,7 @@ public class DefaultFilterBuilder implements FilterBuilder {
Long fromResponseTime = descriptor.getResponseFrom();
Long toResponseTime = descriptor.getResponseTo();
Boolean includeFailed = descriptor.getIncludeException();
- return new FromToResponseFilter(fromServiceType, fromApplicationName, fromAgentName, toServiceType, toApplicationName, toAgentName,fromResponseTime, toResponseTime, includeFailed, hint);
+ return new FromToResponseFilter(fromServiceType, fromApplicationName, fromAgentName, toServiceType, toApplicationName, toAgentName,fromResponseTime, toResponseTime, includeFailed, hint, this.registry);
}
private FromToFilter createFromToFilter(FilterDescriptor descriptor) {
diff --git a/web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java b/web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java
index 87ee338fdb..07a776cbd1 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java
@@ -46,6 +46,10 @@ public class FilterHint extends HashMap<String, List<Object>> {
if (!containApplicationHint(applicationName)) {
return false;
}
+
+ if (endPoint == null) {
+ return false;
+ }
List<Object> list = get(applicationName);
diff --git a/web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java b/web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java
index 7e18feb8db..f6a3497cbc 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java
@@ -20,6 +20,7 @@ import java.util.List;
import com.navercorp.pinpoint.common.bo.SpanBo;
import com.navercorp.pinpoint.common.bo.SpanEventBo;
+import com.navercorp.pinpoint.common.service.ServiceTypeRegistryService;
import com.navercorp.pinpoint.common.trace.ServiceType;
import com.navercorp.pinpoint.common.trace.ServiceTypeCategory;
@@ -43,8 +44,10 @@ public class FromToResponseFilter implements Filter {
private final Boolean includeFailed;
private final FilterHint hint;
+
+ private final ServiceTypeRegistryService registry;
- public FromToResponseFilter(List<ServiceType> fromServiceList, String fromApplicationName, String fromAgentName, List<ServiceType> toServiceList, String toApplicationName, String toAgentName, Long fromResponseTime, Long toResponseTime, Boolean includeFailed, FilterHint hint) {
+ public FromToResponseFilter(List<ServiceType> fromServiceList, String fromApplicationName, String fromAgentName, List<ServiceType> toServiceList, String toApplicationName, String toAgentName, Long fromResponseTime, Long toResponseTime, Boolean includeFailed, FilterHint hint, ServiceTypeRegistryService registry) {
if (fromServiceList == null) {
throw new NullPointerException("fromServiceList must not be null");
@@ -61,6 +64,9 @@ public class FromToResponseFilter implements Filter {
if (hint == null) {
throw new NullPointerException("hint must not be null");
}
+ if (registry == null) {
+ throw new NullPointerException("registry must not be null");
+ }
this.fromServiceCode = fromServiceList;
this.fromApplicationName = fromApplicationName;
@@ -74,8 +80,9 @@ public class FromToResponseFilter implements Filter {
this.toResponseTime = toResponseTime;
this.includeFailed = includeFailed;
-
this.hint = hint;
+
+ this.registry = registry;
}
private boolean checkResponseCondition(long elapsed, boolean hasError) {
@@ -211,8 +218,12 @@ public class FromToResponseFilter implements Filter {
return false;
}
- private boolean isRpcClient(short serviceType) {
- return ServiceTypeCategory.RPC.contains(serviceType);
+ private boolean isRpcClient(short serviceTypeCode) {
+ if (ServiceTypeCategory.RPC.contains(serviceTypeCode)) {
+ ServiceType serviceType = this.registry.findServiceType(serviceTypeCode);
+ return serviceType.isRecordStatistics();
+ }
+ return false;
}
| ['web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java', 'web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java', 'web/src/main/java/com/navercorp/pinpoint/web/filter/DefaultFilterBuilder.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 4,677,555 | 974,422 | 136,422 | 1,293 | 1,805 | 364 | 25 | 3 | 543 | 91 | 121 | 6 | 0 | 0 | 1970-01-01T00:23:52 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
1,216 | pinpoint-apm/pinpoint/490/488 | pinpoint-apm | pinpoint | https://github.com/pinpoint-apm/pinpoint/issues/488 | https://github.com/pinpoint-apm/pinpoint/pull/490 | https://github.com/pinpoint-apm/pinpoint/pull/490 | 1 | fix | Web throws NPE when filtering calls with RPC internal types | When filtering RPC calls on Pinpoint web, NullPointerException is thrown.
This is due to a missing check inside the filtering logic. WAS -> WAS filtering checks each span event for its `ServiceType` and if it is in the RPC range (9000~9999), does an equals check with the span event's `destinationId`. Since RPC internal methods does not have a `destinationId`, while being within the RPC range, NPE is thrown.
Fix needs 2 checks - to check if the span event's ServiceType is set to record statistics, and to check for null `destinationId`.
| bce3c67128eed0d80a05519269323892fa0b72ed | f5da5ba237aa0fc14852f2dd30e69b04a8bf49f1 | https://github.com/pinpoint-apm/pinpoint/compare/bce3c67128eed0d80a05519269323892fa0b72ed...f5da5ba237aa0fc14852f2dd30e69b04a8bf49f1 | diff --git a/web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java b/web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java
index 1da96e2f28..c686337f26 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java
@@ -46,6 +46,10 @@ public class FilterHint extends HashMap<String, List<Object>> {
if (!containApplicationHint(applicationName)) {
return false;
}
+
+ if (endPoint == null) {
+ return false;
+ }
List<Object> list = get(applicationName);
diff --git a/web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java b/web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java
index a8fd905f9b..ff484bbef5 100644
--- a/web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java
+++ b/web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java
@@ -147,8 +147,10 @@ public class FromToResponseFilter implements Filter {
for (SpanEventBo event : eventBoList) {
// check only whether a client exists or not.
- if (event.getServiceType().isRpcClient() && toApplicationName.equals(event.getDestinationId())) {
- return checkResponseCondition(event.getEndElapsed(), event.hasException());
+ if (event.getServiceType().isRpcClient() && event.getServiceType().isRecordStatistics()) {
+ if (toApplicationName.equals(event.getDestinationId())) {
+ return checkResponseCondition(event.getEndElapsed(), event.hasException());
+ }
}
}
}
@@ -169,6 +171,10 @@ public class FromToResponseFilter implements Filter {
if (!event.getServiceType().isRpcClient()) {
continue;
}
+
+ if (!event.getServiceType().isRecordStatistics()) {
+ continue;
+ }
if (!hint.containApplicationEndpoint(toApplicationName, event.getDestinationId(), event.getServiceType().getCode())) {
continue; | ['web/src/main/java/com/navercorp/pinpoint/web/filter/FilterHint.java', 'web/src/main/java/com/navercorp/pinpoint/web/filter/FromToResponseFilter.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 4,063,496 | 851,058 | 119,106 | 1,104 | 819 | 119 | 14 | 2 | 543 | 91 | 121 | 6 | 0 | 0 | 1970-01-01T00:23:52 | 12,879 | Java | {'Java': 20427181, 'TypeScript': 1739527, 'CSS': 222853, 'HTML': 216928, 'Thrift': 15920, 'Shell': 6420, 'JavaScript': 6310, 'Groovy': 1431, 'Kotlin': 1329, 'TSQL': 978, 'Batchfile': 200} | Apache License 2.0 |
2,180 | quarkusio/quarkus/33586/33305 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33305 | https://github.com/quarkusio/quarkus/pull/33586 | https://github.com/quarkusio/quarkus/pull/33586 | 1 | fix | OutputTargetBuildItem.getOutputDirectory() returning a strange value when running a test in the Platform | ### Describe the bug
I see `OutputTargetBuildItem.getOutputDirectory()` returning a very strange value
```
/home/ppalaga/orgs/quarkus/quarkus-platform/generated-platform-project/quarkus-cxf/integration-tests/quarkus-cxf-integration-test-server/..
```
when running a generarated test project on the Platform.
I'd expect something like
```
/home/ppalaga/orgs/quarkus/quarkus-platform/generated-platform-project/quarkus-cxf/integration-tests/quarkus-cxf-integration-test-server/target
```
Is this a bug or some peculiarity of the Platform test config @aloubyansky ?
| 8101c3ec85fed92ecfff556a40c68243e93b0c73 | 47fa50fa5e6b5203c14af80e1c68a0e3cb1de089 | https://github.com/quarkusio/quarkus/compare/8101c3ec85fed92ecfff556a40c68243e93b0c73...47fa50fa5e6b5203c14af80e1c68a0e3cb1de089 | 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 6c068b88029..e7b1c5a1e4c 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
@@ -205,7 +205,7 @@ public CurationResult resolveAppModel() throws BootstrapException {
if (serializedModel != null) {
final Path p = Paths.get(serializedModel);
if (Files.exists(p)) {
- try (InputStream existing = Files.newInputStream(Paths.get(serializedModel))) {
+ try (InputStream existing = Files.newInputStream(p)) {
final ApplicationModel appModel = (ApplicationModel) new ObjectInputStream(existing).readObject();
return new CurationResult(appModel);
} catch (IOException | ClassNotFoundException e) {
diff --git a/test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java b/test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java
index 079f0d7a32d..05fda9bc7c6 100644
--- a/test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java
+++ b/test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java
@@ -292,14 +292,10 @@ private static Path toPath(URL resource) {
* @return project build dir
*/
public static Path getProjectBuildDir(Path projectRoot, Path testClassLocation) {
- Path outputDir;
- try {
- // this should work for both maven and gradle
- outputDir = projectRoot.resolve(projectRoot.relativize(testClassLocation).getName(0));
- } catch (Exception e) {
- // this shouldn't happen since testClassLocation is usually found under the project dir
- outputDir = projectRoot;
+ if (!testClassLocation.startsWith(projectRoot)) {
+ // this typically happens in the platform testsuite where test classes are loaded from jars
+ return projectRoot.resolve("target");
}
- return outputDir;
+ return projectRoot.resolve(projectRoot.relativize(testClassLocation).getName(0));
}
} | ['test-framework/common/src/main/java/io/quarkus/test/common/PathTestHelper.java', 'independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/BootstrapAppModelFactory.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 26,579,575 | 5,242,481 | 675,870 | 6,244 | 168 | 29 | 2 | 1 | 586 | 45 | 140 | 17 | 0 | 2 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,183 | quarkusio/quarkus/33510/33477 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33477 | https://github.com/quarkusio/quarkus/pull/33510 | https://github.com/quarkusio/quarkus/pull/33510 | 1 | fix | Dev-UI v2 fails to work with swagger-ui extension after changing its path config | ### Describe the bug
After changing the path config for swagger-ui and openapi extension in quarkus `application.properties` like this `quarkus.swagger-ui.path=my-custom-path` and this `quarkus.smallrye-openapi.path=/swagger`, Dev-UI v2 fails to load the swagger-ui page. Dev-UI v1 works as expected. The following error log was captured by my error mapping and interceptor when I tried to open the swagger-ui page link.
```
2023-05-18 22:41:17,043 INFO [ao.pla.com.log.LoggingFilters$ResponseFilter] (vert.x-eventloop-thread-5) [Response] GET /q/swagger-ui (404 Not Found) (00:00:00.005)
2023-05-18 22:41:25,120 ERROR [ao.pla.ResponseErrorMappers$WebApplicationErrorMapper] (vert.x-eventloop-thread-6) web error raised, errorId: c1e06f2c-6ef0-49c3-8403-0de38fd99977: jakarta.ws.rs.NotFoundException: HTTP 404 Not Found
at org.jboss.resteasy.reactive.server.handlers.RestInitialHandler.handle(RestInitialHandler.java:71)
at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:121)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
at org.jboss.resteasy.reactive.server.handlers.RestInitialHandler.beginProcessing(RestInitialHandler.java:48)
at org.jboss.resteasy.reactive.server.vertx.ResteasyReactiveVertxHandler.handle(ResteasyReactiveVertxHandler.java:23)
at org.jboss.resteasy.reactive.server.vertx.ResteasyReactiveVertxHandler.handle(ResteasyReactiveVertxHandler.java:10)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:177)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at io.quarkus.vertx.http.runtime.StaticResourcesRecorder$2.handle(StaticResourcesRecorder.java:102)
at io.quarkus.vertx.http.runtime.StaticResourcesRecorder$2.handle(StaticResourcesRecorder.java:88)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1284)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:140)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at io.vertx.ext.web.handler.impl.StaticHandlerImpl.lambda$sendStatic$1(StaticHandlerImpl.java:290)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
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:1589)
2023-05-18 22:41:25,123 INFO [ao.pla.com.log.LoggingFilters$ResponseFilter] (vert.x-eventloop-thread-6) [Response] GET /q/openapi (404 Not Found) (00:00:00.002)
```
And also, this is a screenshot when I was trying to open the swagger-ui page.
![image](https://github.com/quarkusio/quarkus/assets/118693213/78e3c449-97a1-4b3a-905a-8e26fe482cd2)
### Expected behavior
Dev-UI v2 should be ok to open swagger-ui page as expected, just like Dev-UI v1 does.
### Actual behavior
It just shows a blank page and reports a 404 NotFound error.
### 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_ | 7bcfd6874a91ebb471b1e5a2442c7ef569c2e8b3 | 4027e96759d046dfbc69b1039a2267527fcbebc8 | https://github.com/quarkusio/quarkus/compare/7bcfd6874a91ebb471b1e5a2442c7ef569c2e8b3...4027e96759d046dfbc69b1039a2267527fcbebc8 | diff --git a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java
index e98b6a9f9f2..3e5cc8b6080 100644
--- a/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java
+++ b/extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java
@@ -4,24 +4,28 @@
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.devui.spi.page.CardPageBuildItem;
import io.quarkus.devui.spi.page.Page;
+import io.quarkus.smallrye.openapi.common.deployment.SmallRyeOpenApiConfig;
+import io.quarkus.swaggerui.deployment.SwaggerUiConfig;
import io.quarkus.vertx.http.deployment.NonApplicationRootPathBuildItem;
public class OpenApiDevUIProcessor {
@BuildStep(onlyIf = IsDevelopment.class)
- public CardPageBuildItem pages(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem) {
+ public CardPageBuildItem pages(NonApplicationRootPathBuildItem nonApplicationRootPathBuildItem,
+ SwaggerUiConfig swaggerUiConfig, SmallRyeOpenApiConfig openApiConfig) {
- String uiPath = nonApplicationRootPathBuildItem.resolvePath("swagger-ui");
+ String uiPath = nonApplicationRootPathBuildItem.resolvePath(swaggerUiConfig.path);
+ String schemaPath = nonApplicationRootPathBuildItem.resolvePath(openApiConfig.path);
CardPageBuildItem cardPageBuildItem = new CardPageBuildItem();
cardPageBuildItem.addPage(Page.externalPageBuilder("Schema yaml")
- .url(nonApplicationRootPathBuildItem.resolvePath("openapi"))
+ .url(nonApplicationRootPathBuildItem.resolvePath(schemaPath))
.isYamlContent()
.icon("font-awesome-solid:file-lines"));
cardPageBuildItem.addPage(Page.externalPageBuilder("Schema json")
- .url(nonApplicationRootPathBuildItem.resolvePath("openapi") + "?format=json")
+ .url(nonApplicationRootPathBuildItem.resolvePath(schemaPath) + "?format=json")
.isJsonContent()
.icon("font-awesome-solid:file-code"));
diff --git a/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java b/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java
index b8d2180832a..deb0ad261ee 100644
--- a/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java
+++ b/extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java
@@ -21,7 +21,7 @@ public class SwaggerUiConfig {
* By default, this value will be resolved as a path relative to `${quarkus.http.non-application-root-path}`.
*/
@ConfigItem(defaultValue = "swagger-ui")
- String path;
+ public String path;
/**
* If this should be included every time. By default, this is only included when the application is running | ['extensions/swagger-ui/deployment/src/main/java/io/quarkus/swaggerui/deployment/SwaggerUiConfig.java', 'extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/devui/OpenApiDevUIProcessor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 26,559,962 | 5,238,461 | 675,393 | 6,235 | 1,082 | 227 | 14 | 2 | 4,332 | 255 | 1,079 | 77 | 1 | 1 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,184 | quarkusio/quarkus/33476/33475 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33475 | https://github.com/quarkusio/quarkus/pull/33476 | https://github.com/quarkusio/quarkus/pull/33476 | 1 | fixes | Warning message if quarkus.oidc.application-type=service | ### Describe the bug
I got the warning message:
> Secret key for encrypting tokens is missing, auto-generating it
despite `quarkus.oidc.application-type=service` and I am not using cookies.
https://github.com/quarkusio/quarkus/blob/0e63bfcfc468a48081c0ed54771d37ea75bcec3b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java#L77-L78
### Quarkus version
3.0.2.Final
### Workaround
Set `quarkus.oidc.token-state-manager.encryption-required=false` | 6a8dadc48bf6ea586d17ca1b9f9ee898ab5213c5 | 77d1bb97de286cd5a2d2e04adc0d3ecb6ef482c4 | https://github.com/quarkusio/quarkus/compare/6a8dadc48bf6ea586d17ca1b9f9ee898ab5213c5...77d1bb97de286cd5a2d2e04adc0d3ecb6ef482c4 | 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 42ffc9ea3a1..936cae8f81c 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
@@ -187,7 +187,7 @@ private Uni<TenantConfigContext> createTenantContext(Vertx vertx, OidcTenantConf
throw new ConfigurationException("'quarkus.oidc.auth-server-url' property must be configured");
}
OidcCommonUtils.verifyEndpointUrl(oidcConfig.getAuthServerUrl().get());
- OidcCommonUtils.verifyCommonConfiguration(oidcConfig, isServiceApp(oidcConfig), true);
+ OidcCommonUtils.verifyCommonConfiguration(oidcConfig, OidcUtils.isServiceApp(oidcConfig), true);
} catch (ConfigurationException t) {
return Uni.createFrom().failure(t);
}
@@ -196,7 +196,7 @@ private Uni<TenantConfigContext> createTenantContext(Vertx vertx, OidcTenantConf
throw new ConfigurationException(
"UserInfo is not required but UserInfo is expected to be the source of authorization roles");
}
- if (oidcConfig.token.verifyAccessTokenWithUserInfo.orElse(false) && !isWebApp(oidcConfig)
+ if (oidcConfig.token.verifyAccessTokenWithUserInfo.orElse(false) && !OidcUtils.isWebApp(oidcConfig)
&& !enableUserInfo(oidcConfig)) {
throw new ConfigurationException(
"UserInfo is not required but 'verifyAccessTokenWithUserInfo' is enabled");
@@ -207,7 +207,7 @@ private Uni<TenantConfigContext> createTenantContext(Vertx vertx, OidcTenantConf
}
if (!oidcConfig.discoveryEnabled.orElse(true)) {
- if (!isServiceApp(oidcConfig)) {
+ if (!OidcUtils.isServiceApp(oidcConfig)) {
if (!oidcConfig.authorizationPath.isPresent() || !oidcConfig.tokenPath.isPresent()) {
throw new ConfigurationException(
"'web-app' applications must have 'authorization-path' and 'token-path' properties "
@@ -228,7 +228,7 @@ private Uni<TenantConfigContext> createTenantContext(Vertx vertx, OidcTenantConf
}
}
- if (isServiceApp(oidcConfig)) {
+ if (OidcUtils.isServiceApp(oidcConfig)) {
if (oidcConfig.token.refreshExpired) {
throw new ConfigurationException(
"The 'token.refresh-expired' property can only be enabled for " + ApplicationType.WEB_APP
@@ -294,7 +294,7 @@ private static boolean enableUserInfo(OidcTenantConfig oidcConfig) {
}
private static TenantConfigContext createTenantContextFromPublicKey(OidcTenantConfig oidcConfig) {
- if (!isServiceApp(oidcConfig)) {
+ if (!OidcUtils.isServiceApp(oidcConfig)) {
throw new ConfigurationException("'public-key' property can only be used with the 'service' applications");
}
LOG.debug("'public-key' property for the local token verification is set,"
@@ -443,6 +443,7 @@ public Uni<OidcProviderClient> apply(OidcConfigurationMetadata metadata, Throwab
}
return Uni.createFrom().item(new OidcProviderClient(client, metadata, oidcConfig));
}
+
});
}
@@ -459,12 +460,4 @@ private static OidcConfigurationMetadata createLocalMetadata(OidcTenantConfig oi
introspectionUri, authorizationUri, jwksUri, userInfoUri, endSessionUri,
oidcConfig.token.issuer.orElse(null));
}
-
- private static boolean isServiceApp(OidcTenantConfig oidcConfig) {
- return ApplicationType.SERVICE.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE));
- }
-
- private static boolean isWebApp(OidcTenantConfig oidcConfig) {
- return ApplicationType.WEB_APP.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE));
- }
}
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java
index 8aa82db7da3..d8c99953005 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java
@@ -29,6 +29,7 @@
import io.quarkus.oidc.AuthorizationCodeTokens;
import io.quarkus.oidc.OIDCException;
import io.quarkus.oidc.OidcTenantConfig;
+import io.quarkus.oidc.OidcTenantConfig.ApplicationType;
import io.quarkus.oidc.OidcTenantConfig.Authentication;
import io.quarkus.oidc.RefreshToken;
import io.quarkus.oidc.TokenIntrospection;
@@ -78,6 +79,14 @@ private OidcUtils() {
}
+ public static boolean isServiceApp(OidcTenantConfig oidcConfig) {
+ return ApplicationType.SERVICE.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE));
+ }
+
+ public static boolean isWebApp(OidcTenantConfig oidcConfig) {
+ return ApplicationType.WEB_APP.equals(oidcConfig.applicationType.orElse(ApplicationType.SERVICE));
+ }
+
public static boolean isEncryptedToken(String token) {
return new StringTokenizer(token, ".").countTokens() == 5;
}
diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java
index 9ff389f5acd..d748c56035f 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java
@@ -47,8 +47,9 @@ public TenantConfigContext(OidcProvider client, OidcTenantConfig config, boolean
this.oidcConfig = config;
this.ready = ready;
- pkceSecretKey = provider != null && provider.client != null ? createPkceSecretKey(config) : null;
- tokenEncSecretKey = provider != null && provider.client != null ? createTokenEncSecretKey(config) : null;
+ boolean isService = OidcUtils.isServiceApp(config);
+ pkceSecretKey = !isService && provider != null && provider.client != null ? createPkceSecretKey(config) : null;
+ tokenEncSecretKey = !isService && provider != null && provider.client != null ? createTokenEncSecretKey(config) : null;
}
private static SecretKey createPkceSecretKey(OidcTenantConfig config) { | ['extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/TenantConfigContext.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcUtils.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,553,617 | 5,237,162 | 675,226 | 6,234 | 2,042 | 487 | 33 | 3 | 503 | 36 | 144 | 17 | 1 | 0 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,185 | quarkusio/quarkus/33466/33441 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33441 | https://github.com/quarkusio/quarkus/pull/33466 | https://github.com/quarkusio/quarkus/pull/33466 | 1 | fix | Two classes have the same XML type name "xmlObject". | After upgrading from 2.16.2 to 3.0.1 I'm getting the exception below when running tests with quarkus dev. Every first tests round are complete without trouble. But when the tests are run again, they keep failing until I stop dev mode and start it again.
The exception occurs while testing a process that uses a RestClient which consumes XML. I'm using Wiremock to create the endpoint.
<pre>
at io.restassured.internal.ValidatableResponseOptionsImpl.statusCode(ValidatableResponseOptionsImpl.java:89)
at org.acme.ExampleResourceTest.testHelloEndpoint(ExampleResourceTest.java:19)
Suppressed: java.lang.RuntimeException: org.glassfish.jaxb.runtime.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "xmlObject". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at org.acme.XmlObject
this problem is related to the following location:
at org.acme.XmlObject
at io.quarkus.jaxb.runtime.JaxbContextProducer.createJAXBContext(JaxbContextProducer.java:80)
at io.quarkus.jaxb.runtime.JaxbContextProducer.jaxbContext(JaxbContextProducer.java:29)
at io.quarkus.jaxb.runtime.JaxbContextProducer_ProducerMethod_jaxbContext_6a6d20272304edd64c7bdfa35e3ed5d5971a3949_Bean.doCreate(Unknown Source)
at io.quarkus.jaxb.runtime.JaxbContextProducer_ProducerMethod_jaxbContext_6a6d20272304edd64c7bdfa35e3ed5d5971a3949_Bean.create(Unknown Source)
at io.quarkus.jaxb.runtime.JaxbContextProducer_ProducerMethod_jaxbContext_6a6d20272304edd64c7bdfa35e3ed5d5971a3949_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 io.quarkus.jaxb.runtime.JaxbContextProducer_ProducerMethod_jaxbContext_6a6d20272304edd64c7bdfa35e3ed5d5971a3949_Bean.get(Unknown Source)
at io.quarkus.jaxb.runtime.JaxbContextProducer_ProducerMethod_jaxbContext_6a6d20272304edd64c7bdfa35e3ed5d5971a3949_Bean.get(Unknown Source)
at io.quarkus.jaxb.runtime.JaxbContextProducer_ProducerMethod_marshaller_9a19ba6b6391808bfb74663c9d044d412a8d27d6_Bean.doCreate(Unknown Source)
at io.quarkus.jaxb.runtime.JaxbContextProducer_ProducerMethod_marshaller_9a19ba6b6391808bfb74663c9d044d412a8d27d6_Bean.create(Unknown Source)
at io.quarkus.jaxb.runtime.JaxbContextProducer_ProducerMethod_marshaller_9a19ba6b6391808bfb74663c9d044d412a8d27d6_Bean.create(Unknown Source)
at io.quarkus.arc.impl.RequestContext.getIfActive(RequestContext.java:74)
at io.quarkus.arc.impl.ClientProxies.getDelegate(ClientProxies.java:30)
at jakarta.xml.bind.JaxbContextProducer_ProducerMethod_marshaller_9a19ba6b6391808bfb74663c9d044d412a8d27d6_ClientProxy.arc$delegate(Unknown Source)
at jakarta.xml.bind.JaxbContextProducer_ProducerMethod_marshaller_9a19ba6b6391808bfb74663c9d044d412a8d27d6_ClientProxy.marshal(Unknown Source)
at io.quarkus.rest.client.reactive.jaxb.runtime.ClientMessageBodyWriter.marshal(ClientMessageBodyWriter.java:56)
at io.quarkus.rest.client.reactive.jaxb.runtime.ClientMessageBodyWriter_Subclass.marshal$$superforward(Unknown Source)
at io.quarkus.rest.client.reactive.jaxb.runtime.ClientMessageBodyWriter_Subclass$$function$$3.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:74)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:63)
at io.quarkus.arc.impl.ActivateRequestContextInterceptor.invoke(ActivateRequestContextInterceptor.java:124)
at io.quarkus.arc.impl.ActivateRequestContextInterceptor.aroundInvoke(ActivateRequestContextInterceptor.java:33)
at io.quarkus.arc.impl.ActivateRequestContextInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:38)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:26)
at io.quarkus.rest.client.reactive.jaxb.runtime.ClientMessageBodyWriter_Subclass.marshal(Unknown Source)
at io.quarkus.rest.client.reactive.jaxb.runtime.ClientMessageBodyWriter.writeTo(ClientMessageBodyWriter.java:37)
at io.quarkus.rest.client.reactive.jaxb.runtime.ClientMessageBodyWriter_Subclass.writeTo$$superforward(Unknown Source)
at io.quarkus.rest.client.reactive.jaxb.runtime.ClientMessageBodyWriter_Subclass$$function$$4.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:74)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:63)
at io.quarkus.arc.impl.ActivateRequestContextInterceptor.invoke(ActivateRequestContextInterceptor.java:124)
at io.quarkus.arc.impl.ActivateRequestContextInterceptor.aroundInvoke(ActivateRequestContextInterceptor.java:33)
at io.quarkus.arc.impl.ActivateRequestContextInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:38)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:26)
at io.quarkus.rest.client.reactive.jaxb.runtime.ClientMessageBodyWriter_Subclass.writeTo(Unknown Source)
at org.jboss.resteasy.reactive.client.impl.ClientSerialisers.invokeClientWriter(ClientSerialisers.java:126)
at org.jboss.resteasy.reactive.client.impl.RestClientRequestContext.writeEntity(RestClientRequestContext.java:265)
at org.jboss.resteasy.reactive.client.handlers.ClientSendRequestHandler.setRequestHeadersAndPrepareBody(ClientSendRequestHandler.java:525)
at org.jboss.resteasy.reactive.client.handlers.ClientSendRequestHandler$2.accept(ClientSendRequestHandler.java:196)
at org.jboss.resteasy.reactive.client.handlers.ClientSendRequestHandler$2.accept(ClientSendRequestHandler.java:117)
at io.smallrye.context.impl.wrappers.SlowContextualConsumer.accept(SlowContextualConsumer.java:21)
at io.smallrye.mutiny.helpers.UniCallbackSubscriber.onItem(UniCallbackSubscriber.java:73)
at io.smallrye.mutiny.operators.uni.UniOperatorProcessor.onItem(UniOperatorProcessor.java:47)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
at org.jboss.resteasy.reactive.client.AsyncResultUni.lambda$subscribe$1(AsyncResultUni.java:35)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.core.http.impl.HttpClientImpl.lambda$null$5(HttpClientImpl.java:683)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:86)
at io.vertx.core.impl.DuplicatedContext.execute(DuplicatedContext.java:163)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:51)
at io.vertx.core.impl.future.FutureImpl.addListener(FutureImpl.java:196)
at io.vertx.core.impl.future.PromiseImpl.addListener(PromiseImpl.java:23)
at io.vertx.core.impl.future.FutureImpl.onComplete(FutureImpl.java:164)
at io.vertx.core.impl.future.PromiseImpl.onComplete(PromiseImpl.java:23)
at io.vertx.core.http.impl.Http1xClientConnection.createStream(Http1xClientConnection.java:1270)
at io.vertx.core.http.impl.HttpClientImpl.lambda$doRequest$6(HttpClientImpl.java:666)
at io.verpl.pool.Endpoint.lambda$getConnection$0(Endpoint.java:52)
at io.vertx.core.http.impl.SharedClientHttpStreamEndpoint$Request.handle(SharedClientHttpStreamEndpoint.java:162)
at io.vertx.core.http.impl.SharedClientHttpStreamEndpoint$Request.handle(SharedClientHttpStreamEndpoint.java:123)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:55)
at io.vertx.core.impl.ContextBase.emit(ContextBase.java:239)
at io.vertx.core.net.impl.pool.SimpleConnectionPool$LeaseImpl.emit(SimpleConnectionPool.java:704)
at io.vertx.core.net.impl.pool.SimpleConnectionPool$ConnectSuccess$2.run(SimpleConnectionPool.java:338)
at io.vertx.core.net.impl.pool.CombinerExecutor.submit(CombinerExecutor.java:56)
at io.vertx.core.net.impl.pool.SimpleConnectionPool.execute(SimpleConnectionPool.java:245)
at io.vertx.core.net.impl.pool.SimpleConnectionPool.lambda$connect$2(SimpleConnectionPool.java:257)
at io.vertx.core.http.impl.SharedClientHttpStreamEndpoint.lambda$connect$2(SharedClientHttpStreamEndpoint.java:102)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.Composition$1.onSuccess(Composition.java:62)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.addListener(FutureImpl.java:196)
at io.vertx.core.impl.future.PromiseImpl.addListener(PromiseImpl.java:23)
at io.vertx.core.impl.future.Composition.onSuccess(Composition.java:43)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.core.Promise.complete(Promise.java:66)
at io.vertx.core.net.impl.NetClientImpl.lambda$connected$9(NetClientImpl.java:330)
at io.vertx.core.net.impl.VertxHandler.setConnection(VertxHandler.java:82)
at io.vertx.core.net.impl.VertxHandler.handlerAdded(VertxHandler.java:88)
at io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:1114)
at io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:609)
at io.netty.channel.DefaultChannelPipeline.addLast(DefaultChannelPipeline.java:223)
at io.netty.channel.DefaultChannelPipeline.addLast(DefaultChannelPipeline.java:195)
at io.vertx.core.net.impl.NetClientImpl.connected(NetClientImpl.java:332)
at io.vertx.core.net.impl.NetClientImpl.lambda$connectInternal2$3(NetClientImpl.java:294)
at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:264)
at io.vertx.core.net.impl.ChannelProvider.connected(ChannelProvider.java:172)
at io.vertx.core.net.impl.ChannelProvider.lambda$handleConnect$0(ChannelProvider.java:155)
at io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
at io.netty.util.concurrent.DefaultPromise.notifyListeners0(DefaultPromise.java:583)
at io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:559)
at io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
at io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
at io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625)
at io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:105)
at io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.fulfillConnectPromise(AbstractNioChannel.java:300)
at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:335)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:776)
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:833)
Caused by: org.glassfish.jaxb.runtime.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "xmlObject". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at org.acme.XmlObject
this problem is related to the following location:
at org.acme.XmlObject
at org.glassfish.jaxb.runtime.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:83)
at org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:421)
at org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:255)
at org.glassfish.jaxb.runtime.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1115)
at org.glassfish.jaxb.runtime.v2.ContextFactory.createContext(ContextFactory.java:144)
at org.glassfish.jaxb.runtime.v2.JAXBContextFactory.createContext(JAXBContextFactory.java:44)
at jakarta.xml.bind.ContextFinder.find(ContextFinder.java:368)
at jakarta.xml.bind.JAXBContext.newInstance(JAXBContext.java:605)
at io.quarkus.jaxb.runtime.JaxbContextProducer.createJAXBContext(JaxbContextProducer.java:78)
... 122 more
</pre>
### Expected behavior
The test should continue to pass
### Actual behavior
After the first execution, the test fails.
### How to Reproduce?
1. Create a XML consumer RestClient
2. Mock the responding endpoint with Wiremock
3. Create a Test that uses this RestClient
4. Execute quarkus dev and start the tests
5. Run the test again to see the exception
### Output of `uname -a` or `ver`
Linux 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment (build 17.0.7+7-Ubuntu-0ubuntu122.04.2) OpenJDK 64-Bit Server VM (build 17.0.7+7-Ubuntu-0ubuntu122.04.2, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 17.0.7, vendor: Private Build, runtime: /usr/lib/jvm/java-17-openjdk-amd64 Default locale: en, platform encoding: UTF-8 OS name: "linux", version: "5.15.90.1-microsoft-standard-wsl2", arch: "amd64", family: "unix"
### Additional information
_No response_ | 58374616d0034003359f9e87616a03397144e74e | 4a5006e3240c65688c19e48bb22a04c65272bdfa | https://github.com/quarkusio/quarkus/compare/58374616d0034003359f9e87616a03397144e74e...4a5006e3240c65688c19e48bb22a04c65272bdfa | diff --git a/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java b/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java
index 22ce22a0d46..17768f6d8e6 100644
--- a/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java
+++ b/extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java
@@ -322,6 +322,7 @@ void bindClassesToJaxbContext(
SynthesisFinishedBuildItem beanContainerState,
JaxbContextConfigRecorder jaxbContextConfig /* Force the build time container to invoke this method */) {
+ jaxbContextConfig.reset();
final BeanResolver beanResolver = beanContainerState.getBeanResolver();
final Set<BeanInfo> beans = beanResolver
.resolveBeans(Type.create(DotName.createSimple(JAXBContext.class), org.jboss.jandex.Type.Kind.CLASS));
diff --git a/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java b/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java
index 30ef87780cd..f0a6e4587a5 100644
--- a/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java
+++ b/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java
@@ -15,6 +15,10 @@ public void addClassesToBeBound(Collection<Class<?>> classes) {
this.classesToBeBound.addAll(classes);
}
+ public void reset() {
+ classesToBeBound.clear();
+ }
+
public static Set<Class<?>> getClassesToBeBound() {
return Collections.unmodifiableSet(classesToBeBound);
}
diff --git a/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java b/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java
index 8bfb0c6f1af..3b2dbc7cf4c 100644
--- a/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java
+++ b/extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java
@@ -4,8 +4,10 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.context.RequestScoped;
@@ -71,7 +73,7 @@ public JAXBContext createJAXBContext(Instance<JaxbContextCustomizer> customizers
customizer.customizeContextProperties(properties);
}
- List<Class> classes = new ArrayList<>();
+ Set<Class> classes = new HashSet<>();
classes.addAll(Arrays.asList(extraClasses));
classes.addAll(JaxbContextConfigRecorder.getClassesToBeBound());
| ['extensions/jaxb/deployment/src/main/java/io/quarkus/jaxb/deployment/JaxbProcessor.java', 'extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextConfigRecorder.java', 'extensions/jaxb/runtime/src/main/java/io/quarkus/jaxb/runtime/JaxbContextProducer.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,545,682 | 5,235,628 | 675,034 | 6,234 | 259 | 51 | 9 | 3 | 17,335 | 614 | 3,880 | 196 | 0 | 0 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,186 | quarkusio/quarkus/33451/33450 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33450 | https://github.com/quarkusio/quarkus/pull/33451 | https://github.com/quarkusio/quarkus/pull/33451 | 1 | fix | Native build fails if quarkus.package.output-directory is set | ### Describe the bug
Im my project, we generate several native executables using several executions with several quarkus.package.output-directory.
Since Quarkus 3, each native generation fails if quarkus.package.output-directory is set.
### Expected behavior
We expect to have as many binares as executions nodes in quarkus-maven-plugin.
### Actual behavior
The native executable generation fails with :
```[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.0.3.Final:build (oracle) on project getting-started: 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#buildNativeImageJar threw an exception: java.io.UncheckedIOException: Unable to copy json config file from /resources-config.json to /home/osboxes/Documents/Formations/quarkus/getting-started/target/oracle-quarkus-app/getting-started-1.0.0-SNAPSHOT-native-image-source-jar
```
In our real project we also have reflection-config.json and other properties with just this file it fails
### How to Reproduce?
Here is a little project done with getting-started quarkus project to rerpduce.
[getting-started.zip](https://github.com/quarkusio/quarkus/files/11500033/getting-started.zip)
### Output of `uname -a` or `ver`
Linux localhost.localdomain 6.2.14-300.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Mon May 1 00:55:28 UTC 2023 x86_64 GNU/Linux
### Output of `java -version`
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.2 (ea98e05a04480131370aa0c110b8c54cf726c06f)
### Additional information
_No response_ | 5a2347f0671acdc3e33fd0988588ffa7c27f9840 | fe93f9f486b9f3b7be7167caa0f5711f39efbcbb | https://github.com/quarkusio/quarkus/compare/5a2347f0671acdc3e33fd0988588ffa7c27f9840...fe93f9f486b9f3b7be7167caa0f5711f39efbcbb | 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 9fac9e84a25..3936e20529b 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
@@ -1030,6 +1030,7 @@ private void copyJsonConfigFiles(ApplicationArchivesBuildItem applicationArchive
@Override
public void accept(Path jsonPath) {
try {
+ Files.createDirectories(thinJarDirectory);
Files.copy(jsonPath, thinJarDirectory.resolve(jsonPath.getFileName().toString()));
} catch (IOException e) {
throw new UncheckedIOException( | ['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/JarResultBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,544,023 | 5,235,289 | 674,995 | 6,234 | 71 | 9 | 1 | 1 | 1,918 | 203 | 505 | 49 | 1 | 1 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,187 | quarkusio/quarkus/33448/33419 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33419 | https://github.com/quarkusio/quarkus/pull/33448 | https://github.com/quarkusio/quarkus/pull/33448 | 1 | fix | RESTEasy ResponseBuilder.location Inadvertently Decodes Path Segments in Relative URI | ### Describe the bug
The `ResponseBuilder.location(URI)` method accepts relative URIs and will build an absolute URI relative to the base URI to put in the `Location` header. When the relative URI contains URL-encoded path segments, `ResponseBuilder.location` erroneously decodes those segments when building the new absolute URI.
For example, the given JAX-RS resource method should build an HTTP response with a `Location` header that has the URI path `/items/foo%2Fbar`, but it instead returns `/items/foo/bar`.
```java
public Response create() {
var uri = UriBuilder.newInstance().path("{id}").build("foo/bar");
return ResponseBuilder.status(202).location(uri).build();
}
```
### Expected behavior
`ResponseBuilder.location` creates an absolute URI without changing the semantics of the URI path.
### Actual behavior
`ResponseBuilder.location` creates an absolute URI with a URI path that has different semantics.
### How to Reproduce?
[quarkus-resteasy-reactive-uri-decode-issue.tar.gz](https://github.com/quarkusio/quarkus/files/11490428/quarkus-resteasy-reactive-uri-decode-issue.tar.gz)
The attached reproducer includes a test that demonstrates the issue through a failure. The test fails with a message like
```
2023-05-16 13:29:47,195 INFO [io.quarkus] (main) quarkus-resteasy-reactive-uri-decode-issue 1.0.0-SNAPSHOT on JVM (powered by Quarkus 3.0.3.Final) started in 0.940s. Listening on: http://localhost:63035
2023-05-16 13:29:47,214 INFO [io.quarkus] (main) Profile test activated.
2023-05-16 13:29:47,215 INFO [io.quarkus] (main) Installed features: [cdi, resteasy-reactive, smallrye-context-propagation, vertx]
HTTP/1.1 201 Created
Location: http://localhost:63035/greeting/en/us
content-length: 0
java.lang.AssertionError: 1 expectation failed.
Expected header "Location" was not a string matching the pattern 'http://localhost:\\d+/greeting/en-us', was "http://localhost:63035/greeting/en/us". Headers are:
Location=http://localhost:63035/greeting/en/us
content-length=0
```
because the URI path should have been `/greeting/en%2Fus`
### Output of `uname -a` or `ver`
Darwin pixee-mbp-gilday.localdomain 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
### Output of `java -version`
openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39) Maven home: /Users/jgilday/.m2/wrapper/dists/apache-maven-3.8.8-bin/67c30f74/apache-maven-3.8.8 Java version: 17.0.7, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "13.3.1", arch: "aarch64", family: "mac"
### Additional information
_No response_ | aad9ce5afbba406a56528ca962b2f352344a2c3c | ced8b0a739651f312744e721ca9f11c49f1834f0 | https://github.com/quarkusio/quarkus/compare/aad9ce5afbba406a56528ca962b2f352344a2c3c...ced8b0a739651f312744e721ca9f11c49f1834f0 | diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java
index c4c2847152c..208c1093d4f 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java
@@ -40,10 +40,12 @@ public Response.ResponseBuilder location(URI location) {
prefix = deployment.getPrefix();
}
// Spec says relative to request, but TCK tests relative to Base URI, so we do that
- location = new URI(req.getRequestScheme(), null, host, port,
- prefix +
- (location.getPath().startsWith("/") ? location.getPath() : "/" + location.getPath()),
- location.getQuery(), null);
+ String path = location.toString();
+ if (!path.startsWith("/")) {
+ path = "/" + path;
+ }
+ URI baseUri = new URI(req.getRequestScheme(), null, host, port, null, null, null);
+ location = baseUri.resolve(prefix + path);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
@@ -72,9 +74,12 @@ public Response.ResponseBuilder contentLocation(URI location) {
port = Integer.parseInt(host.substring(index + 1));
host = host.substring(0, index);
}
- location = new URI(req.getRequestScheme(), null, host, port,
- location.getPath().startsWith("/") ? location.getPath() : "/" + location.getPath(),
- location.getQuery(), null);
+ String path = location.toString();
+ if (!path.startsWith("/")) {
+ path = "/" + path;
+ }
+ location = new URI(req.getRequestScheme(), null, host, port, null, null, null)
+ .resolve(path);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java
index 21d74d4b9f8..a62003cbef6 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java
@@ -40,10 +40,12 @@ public RestResponse.ResponseBuilder<T> location(URI location) {
prefix = deployment.getPrefix();
}
// Spec says relative to request, but TCK tests relative to Base URI, so we do that
- location = new URI(req.getRequestScheme(), null, host, port,
- prefix +
- (location.getPath().startsWith("/") ? location.getPath() : "/" + location.getPath()),
- location.getQuery(), null);
+ String path = location.toString();
+ if (!path.startsWith("/")) {
+ path = "/" + path;
+ }
+ URI baseUri = new URI(req.getRequestScheme(), null, host, port, null, null, null);
+ location = baseUri.resolve(prefix + path);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
@@ -72,9 +74,12 @@ public RestResponse.ResponseBuilder<T> contentLocation(URI location) {
port = Integer.parseInt(host.substring(index + 1));
host = host.substring(0, index);
}
- location = new URI(req.getRequestScheme(), null, host, port,
- location.getPath().startsWith("/") ? location.getPath() : "/" + location.getPath(),
- location.getQuery(), null);
+ String path = location.toString();
+ if (!path.startsWith("/")) {
+ path = "/" + path;
+ }
+ location = new URI(req.getRequestScheme(), null, host, port, null, null, null)
+ .resolve(path);
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java
index 40af3653860..849646f9eb3 100644
--- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java
+++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java
@@ -2,6 +2,7 @@
import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.UriBuilder;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -16,4 +17,20 @@ public void testCaseInsensitivity() {
Assertions.assertEquals("HEAD", response.getHeaders().getFirst("allow"));
Assertions.assertEquals("HEAD", response.getHeaders().getFirst(HttpHeaders.ALLOW));
}
+
+ @Test
+ public void testLocation() {
+ final var location = UriBuilder.fromUri("http://localhost:8080").path("{language}")
+ .build("en/us");
+ Response response = Response.ok("Hello").location(location).build();
+ Assertions.assertEquals("http://localhost:8080/en%2Fus", response.getLocation().toString());
+ }
+
+ @Test
+ public void testContentLocation() {
+ final var location = UriBuilder.fromUri("http://localhost:8080").path("{language}")
+ .build("en/us");
+ Response response = Response.ok("Hello").contentLocation(location).build();
+ Assertions.assertEquals("http://localhost:8080/en%2Fus", response.getHeaderString("Content-Location"));
+ }
}
diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java
index 1c2f8f1e5a8..d72fdf301ac 100644
--- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java
+++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java
@@ -13,6 +13,7 @@
import jakarta.ws.rs.core.CacheControl;
import jakarta.ws.rs.core.NewCookie;
import jakarta.ws.rs.core.Response;
+import jakarta.ws.rs.core.UriBuilder;
import jakarta.ws.rs.core.Variant;
import org.jboss.resteasy.reactive.RestResponse;
@@ -47,6 +48,24 @@ public RestResponse<?> wildcard() {
return RestResponse.ResponseBuilder.ok("Hello").header("content-type", "text/plain").build();
}
+ @GET
+ @Path("rest-response-location")
+ public RestResponse<?> location() {
+ final var location = UriBuilder.fromResource(RestResponseResource.class).path("{language}")
+ .queryParam("user", "John")
+ .build("en/us");
+ return RestResponse.ResponseBuilder.ok("Hello").location(location).build();
+ }
+
+ @GET
+ @Path("rest-response-content-location")
+ public RestResponse<?> contentLocation() {
+ final var location = UriBuilder.fromResource(RestResponseResource.class).path("{language}")
+ .queryParam("user", "John")
+ .build("en/us");
+ return RestResponse.ResponseBuilder.ok("Hello").contentLocation(location).build();
+ }
+
@GET
@Path("rest-response-full")
@SuppressWarnings("deprecation")
diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java
index 03d83f208b2..2563091c4f0 100644
--- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java
+++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java
@@ -1,5 +1,7 @@
package org.jboss.resteasy.reactive.server.vertx.test.response;
+import static org.hamcrest.CoreMatchers.endsWith;
+
import java.util.function.Supplier;
import org.hamcrest.Matchers;
@@ -107,5 +109,11 @@ public void test() {
.then().statusCode(200)
.and().body(Matchers.equalTo("Uni<RestResponse> request filter"))
.and().contentType("text/plain");
+ RestAssured.get("/rest-response-location")
+ .then().statusCode(200)
+ .header("Location", endsWith("/en%2Fus?user=John"));
+ RestAssured.get("/rest-response-content-location")
+ .then().statusCode(200)
+ .header("Content-Location", endsWith("/en%2Fus?user=John"));
}
} | ['independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/RestResponseBuilderImpl.java', 'independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseTest.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/jaxrs/ResponseBuilderImpl.java', 'independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/RestResponseResource.java', 'independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/response/ResponseTest.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 26,544,023 | 5,235,289 | 674,995 | 6,234 | 2,420 | 376 | 38 | 2 | 3,108 | 329 | 922 | 66 | 6 | 2 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,188 | quarkusio/quarkus/33446/33188 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33188 | https://github.com/quarkusio/quarkus/pull/33446 | https://github.com/quarkusio/quarkus/pull/33446 | 1 | closes | Podman fails to build native on macOS | ### Describe the bug
Podman 4.5.0 fails to build native on macOS ([longer output](https://gist.github.com/galderz/4ba6e81310f181d01fb2f1dc6dc3dbb5)):
```
/usr/bin/ld: cannot open output file /project/code-with-quarkus-1.0.0-SNAPSHOT-runner: Permission denied
collect2: error: ld returned 1 exit status
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.handleLinkerFailure(NativeImageViaCC.java:203)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.runLinkerCommand(NativeImageViaCC.java:151)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.image.NativeImageViaCC.write(NativeImageViaCC.java:117)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:718)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:535)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:580)
at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
```
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
Darwin m22 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
### Output of `java -version`
native-image 22.3.2.1-Final Mandrel Distribution (Java Version 17.0.7+7)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
Podman machine was started with:
```
$ podman machine init --rootful -m 8092 --cpus 4
```
FYI @n1hility @holly-cummins @tqvarnst | aad9ce5afbba406a56528ca962b2f352344a2c3c | aa8fd68d94a52368811c77645d1adbea7f9a4f24 | https://github.com/quarkusio/quarkus/compare/aad9ce5afbba406a56528ca962b2f352344a2c3c...aa8fd68d94a52368811c77645d1adbea7f9a4f24 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildLocalContainerRunner.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildLocalContainerRunner.java
index c5e50652d4d..9d678efb538 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildLocalContainerRunner.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildLocalContainerRunner.java
@@ -17,7 +17,7 @@ public class NativeImageBuildLocalContainerRunner extends NativeImageBuildContai
public NativeImageBuildLocalContainerRunner(NativeConfig nativeConfig) {
super(nativeConfig);
- if (SystemUtils.IS_OS_LINUX) {
+ if (SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC) {
final ArrayList<String> containerRuntimeArgs = new ArrayList<>(Arrays.asList(baseContainerRuntimeArgs));
if (containerRuntime.isDocker() && containerRuntime.isRootless()) {
Collections.addAll(containerRuntimeArgs, "--user", String.valueOf(0)); | ['core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/NativeImageBuildLocalContainerRunner.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,544,023 | 5,235,289 | 674,995 | 6,234 | 104 | 26 | 2 | 1 | 2,081 | 149 | 573 | 58 | 1 | 2 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,189 | quarkusio/quarkus/33440/33417 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33417 | https://github.com/quarkusio/quarkus/pull/33440 | https://github.com/quarkusio/quarkus/pull/33440 | 1 | fixes | Custom cdi context not applied for certain bean types | ### Describe the bug
When using a custom `InjectableContext` the context implementation is not beeing used for all bean types.
### Expected behavior
Either all beans that are annotated with my scope annotation should be handled over my context implementation or if not a clear feedback (visible log or exception) should be given from Quarkus.
### Actual behavior
When having certain beantype e.g. `AtomicBoolean `, the context implementation is ignored
```
@MyCustomScoped
@Produces
AtomicBoolean atomicBoolean(){
return new AtomicBoolean();
```
It is still scoped as `@MyCustomScoped` when checking with `Arc.container().instance(AtomicBoolean.class).getBean().getScope();` but the bean is not beeing handled over my context implementation.
### How to Reproduce?
https://github.com/HerrDerb/extension-issues/tree/custom-context-issue
### Quarkus version or git rev
3.0.3Final
| 58374616d0034003359f9e87616a03397144e74e | c4bfc05bedae6945f0ce7da738b67f6cdfebdbcb | https://github.com/quarkusio/quarkus/compare/58374616d0034003359f9e87616a03397144e74e...c4bfc05bedae6945f0ce7da738b67f6cdfebdbcb | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java
index cfede763330..c6c3c7e4df9 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java
@@ -123,10 +123,16 @@ private static boolean skipForClientProxy(MethodInfo method, boolean transformUn
.add(NameAndDescriptor.fromMethodInfo(method));
return false;
}
-
+ // in case we want to transform classes but are unable to, we log a WARN
LOGGER.warn(String.format(
"Final method %s.%s() is ignored during proxy generation and should never be invoked upon the proxy instance!",
className, method.name()));
+ } else {
+ // JDK classes with final method are not proxyable and not transformable, we skip those methods and log a WARN
+ LOGGER.warn(String.format(
+ "JDK class %s with final method %s() cannot be proxied and is not transformable. " +
+ "This method will be ignored during proxy generation and should never be invoked upon the proxy instance!",
+ className, method.name()));
}
return true;
} | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,545,682 | 5,235,628 | 675,034 | 6,234 | 589 | 107 | 8 | 1 | 920 | 112 | 198 | 29 | 1 | 1 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,190 | quarkusio/quarkus/33429/33356 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33356 | https://github.com/quarkusio/quarkus/pull/33429 | https://github.com/quarkusio/quarkus/pull/33429 | 1 | fixes | `ConsoleProcessor.java` references `quarkus.log.console.color`, which was deprecated in Quarkus 2.1 | ### Describe the bug
[Line 77 in core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java](https://github.com/quarkusio/quarkus/blob/78c3e36b846168b6cce37c92aa642164436c7228/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java#L77) references `quarkus.log.console.color`, which [was deprecated in Quarkus 2.1](https://github.com/quarkusio/quarkus/pull/18506):
E.g.,:
```
ConfigProvider.getConfig().getOptionalValue("quarkus.log.console.color",
```
Should it reference `quarkus.console.color` instead?
### 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_ | d73267b857555515f7e55b65f11e89baa825457d | 8ceee5fdd2dabf6734a5c85d18ea92b192fe18b3 | https://github.com/quarkusio/quarkus/compare/d73267b857555515f7e55b65f11e89baa825457d...8ceee5fdd2dabf6734a5c85d18ea92b192fe18b3 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java
index ee2838f9481..83389f7902a 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java
@@ -74,7 +74,7 @@ ConsoleInstalledBuildItem setupConsole(TestConfig config,
ConsoleRuntimeConfig consoleRuntimeConfig = new ConsoleRuntimeConfig();
consoleRuntimeConfig.color = ConfigProvider.getConfig().getOptionalValue("quarkus.console.color", Boolean.class);
io.quarkus.runtime.logging.ConsoleConfig loggingConsoleConfig = new io.quarkus.runtime.logging.ConsoleConfig();
- loggingConsoleConfig.color = ConfigProvider.getConfig().getOptionalValue("quarkus.log.console.color",
+ loggingConsoleConfig.color = ConfigProvider.getConfig().getOptionalValue("quarkus.console.color",
Boolean.class);
ConsoleHelper.installConsole(config, consoleConfig, consoleRuntimeConfig, loggingConsoleConfig,
launchModeBuildItem.isTest()); | ['core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,562,404 | 5,238,950 | 675,446 | 6,235 | 225 | 41 | 2 | 1 | 1,048 | 92 | 268 | 46 | 2 | 1 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,192 | quarkusio/quarkus/33375/33372 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33372 | https://github.com/quarkusio/quarkus/pull/33375 | https://github.com/quarkusio/quarkus/pull/33375 | 1 | fix | Error handling with @WithSpan (OpenTelemetry) | ### Describe the bug
If an exception occurs in a method that's annotated with `@WithSpan`, the error won't be recorded in the trace.
### Expected behavior
Trace will contain error span.
### Actual behavior
Currently the error span is missing from the trace. Or in the reproducer's case the entire trace is missing.
### How to Reproduce?
Slightly modified `TracedResources` class from the OpenTelemetry quickstart. https://quarkus.io/guides/opentelemetry
```java
package org.acme.opentelemetry;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import org.jboss.logging.Logger;
@Path("/hello")
public class TracedResources {
private static final Logger LOG = Logger.getLogger(TracedResources.class);
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello(){
LOG.info("hello");
doSomething();
return "hello";
}
@WithSpan
public String doSomething() {
throw new RuntimeException("foo");
}
}
```
When the app is running, execute the command `curl http://localhost:8080/hello` and look at the trace result.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
openjdk version "17.0.5"
### 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_ | 2ddf46ef447771b3094ddfea64f0ba8e04b58327 | e723c0b760cbed5d1be2d65106276f839001734c | https://github.com/quarkusio/quarkus/compare/2ddf46ef447771b3094ddfea64f0ba8e04b58327...e723c0b760cbed5d1be2d65106276f839001734c | diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/WithSpanInterceptorTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/WithSpanInterceptorTest.java
index ee2a43b4721..52de43f905e 100644
--- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/WithSpanInterceptorTest.java
+++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/WithSpanInterceptorTest.java
@@ -3,9 +3,13 @@
import static io.opentelemetry.api.trace.SpanKind.CLIENT;
import static io.opentelemetry.api.trace.SpanKind.INTERNAL;
import static io.opentelemetry.api.trace.SpanKind.SERVER;
+import static io.opentelemetry.api.trace.StatusCode.ERROR;
import static io.quarkus.opentelemetry.deployment.common.TestSpanExporter.getSpanByKindAndParentId;
import static java.net.HttpURLConnection.HTTP_OK;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.fail;
import java.util.List;
@@ -27,6 +31,7 @@
import io.opentelemetry.instrumentation.annotations.SpanAttribute;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.opentelemetry.sdk.trace.data.SpanData;
+import io.opentelemetry.sdk.trace.internal.data.ExceptionEventData;
import io.quarkus.opentelemetry.deployment.common.TestSpanExporter;
import io.quarkus.opentelemetry.deployment.common.TestSpanExporterProvider;
import io.quarkus.runtime.StartupEvent;
@@ -62,6 +67,7 @@ void span() {
List<SpanData> spanItems = spanExporter.getFinishedSpanItems(1);
assertEquals("SpanBean.span", spanItems.get(0).getName());
assertEquals(INTERNAL, spanItems.get(0).getKind());
+ assertNotEquals(ERROR, spanItems.get(0).getStatus().getStatusCode());
}
@Test
@@ -112,6 +118,25 @@ void spanCdiRest() {
final SpanData server = getSpanByKindAndParentId(spans, SERVER, client.getSpanId());
}
+ @Test
+ void spanWithException() {
+ try {
+ spanBean.spanWithException();
+ fail("Exception expected");
+ } catch (Exception e) {
+ assertThrows(RuntimeException.class, () -> {
+ throw e;
+ });
+ }
+ List<SpanData> spanItems = spanExporter.getFinishedSpanItems(1);
+ assertEquals("SpanBean.spanWithException", spanItems.get(0).getName());
+ assertEquals(INTERNAL, spanItems.get(0).getKind());
+ assertEquals(ERROR, spanItems.get(0).getStatus().getStatusCode());
+ assertEquals(1, spanItems.get(0).getEvents().size());
+ assertEquals("spanWithException for tests",
+ ((ExceptionEventData) spanItems.get(0).getEvents().get(0)).getException().getMessage());
+ }
+
@ApplicationScoped
public static class SpanBean {
@WithSpan
@@ -119,6 +144,11 @@ public void span() {
}
+ @WithSpan
+ public void spanWithException() {
+ throw new RuntimeException("spanWithException for tests");
+ }
+
@WithSpan("name")
public void spanName() {
diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java
index 49eecfad212..2948f09f273 100644
--- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java
+++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java
@@ -70,6 +70,11 @@ public Object span(final ArcInvocationContext invocationContext) throws Exceptio
}
return result;
+ } catch (Throwable t) {
+ if (shouldStart) {
+ instrumenter.end(spanContext, methodRequest, null, t);
+ }
+ throw t;
} finally {
if (scope != null) {
scope.close(); | ['extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/tracing/cdi/WithSpanInterceptor.java', 'extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/WithSpanInterceptorTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 26,521,788 | 5,230,860 | 674,459 | 6,231 | 173 | 35 | 5 | 1 | 1,579 | 182 | 359 | 69 | 2 | 1 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,544 | quarkusio/quarkus/22621/20904 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/20904 | https://github.com/quarkusio/quarkus/pull/22621 | https://github.com/quarkusio/quarkus/pull/22621 | 1 | fixes | Remote dev mode with gradle throwing connection refused | ### Describe the bug
I am attempting to run remote dev mode via Gradle against a Kubernetes deployment. Everything appears to be working as expected, mutable jar deployed in a container, logs show live coding enabled. When I attempt to connect via `./gradlew quarkusRemoteDev` I get a connection refused.
### Expected behavior
Remote dev mode working.
### Actual behavior
The server side throws a BadRequestException and my workstation fails to connect.
The issue mentioned in https://github.com/quarkusio/quarkus/pull/12969 seems similar. Specifically "The JDK client sends malformed q values (.2 instead of 0.2), resteasy rejects this with a bad request exception".
I captured the initial http requests coming from HttpRemoteDevClient and verified the Header values `*; q=.2, */*; q=.2` were being included which I'm assuming is causing the issue.
Here's the server side stacktrace:
```text
2021-10-19 19:35:34,387 INFO [io.quarkus] [{}] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-10-19 19:35:34,387 INFO [io.quarkus] [{}] (Quarkus Main Thread) Installed features: [agroal, cdi, config-yaml, elasticsearch-rest-client, elasticsearch-rest-high-level-client, flyway, hibernate-orm, jdbc-postgresql, kubernetes-client, narayana-jta, quartz, reactive-routes, rest-client, rest-client-jackson, resteasy, resteasy-jackson, resteasy-mutiny, scheduler, security, smallrye-context-propagation, smallrye-health, smallrye-jwt, smallrye-metrics, smallrye-openapi, smallrye-reactive-messaging, smallrye-reactive-messaging-amqp, swagger-ui, vertx]
2021-10-19 19:38:02,062 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] [{}] (executor-thread-0) HTTP Request to /connect failed, error id: a2e06b4b-fd41-4203-a991-88eee1224451-1: javax.ws.rs.BadRequestException: RESTEASY003520: Malformed quality value.
at org.jboss.resteasy.core.request.QualityValue.parseAsInteger(QualityValue.java:113)
at org.jboss.resteasy.core.request.QualityValue.valueOf(QualityValue.java:40)
at org.jboss.resteasy.core.request.AcceptHeaders.evaluateAcceptParameters(AcceptHeaders.java:292)
at org.jboss.resteasy.core.request.AcceptHeaders.getMediaTypeQualityValues(AcceptHeaders.java:170)
at org.jboss.resteasy.core.request.ServerDrivenNegotiation.setAcceptHeaders(ServerDrivenNegotiation.java:41)
at io.quarkus.resteasy.runtime.NotFoundExceptionMapper.selectVariant(NotFoundExceptionMapper.java:386)
at io.quarkus.resteasy.runtime.NotFoundExceptionMapper.respond(NotFoundExceptionMapper.java:244)
at io.quarkus.resteasy.runtime.NotFoundExceptionMapper.toResponse(NotFoundExceptionMapper.java:225)
at io.quarkus.resteasy.runtime.NotFoundExceptionMapper.toResponse(NotFoundExceptionMapper.java:53)
at org.jboss.resteasy.core.ExceptionHandler.executeExactExceptionMapper(ExceptionHandler.java:65)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:317)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:218)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:258)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:135)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:90)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:543)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Unknown Source)
```
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
Microsoft Windows Version 10.0.19042 Build 19042
### Output of `java -version`
JVM: 11.0.2 (Oracle Corporation 11.0.2+9)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.3.0
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 6.8.3
### Additional information
_No response_ | 077ea2ffce5cbfbb2217a8a8e11cd952387df142 | b65ae06d982cc461f5c53c19e2955da0ba8da2d9 | https://github.com/quarkusio/quarkus/compare/077ea2ffce5cbfbb2217a8a8e11cd952387df142...b65ae06d982cc461f5c53c19e2955da0ba8da2d9 | diff --git a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java
index aacf027f117..f3253f45768 100644
--- a/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java
+++ b/extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java
@@ -32,6 +32,16 @@ public class HttpRemoteDevClient implements RemoteDevClient {
private final Logger log = Logger.getLogger(HttpRemoteDevClient.class);
+ /**
+ * The default Accept header defined in sun.net.www.protocol.http.HttpURLConnection is invalid and
+ * does not respect the RFC so we override it with a valid value.
+ * RESTEasy is quite strict regarding the RFC and throws an error.
+ * Note that this is just the default HttpURLConnection header value made valid.
+ * See https://bugs.openjdk.java.net/browse/JDK-8163921 and https://bugs.openjdk.java.net/browse/JDK-8177439
+ * and https://github.com/quarkusio/quarkus/issues/20904
+ */
+ private static final String DEFAULT_ACCEPT = "text/html, image/gif, image/jpeg; q=0.2, */*; q=0.2";
+
private final String url;
private final String password;
private final long reconnectTimeoutMillis;
@@ -95,6 +105,7 @@ private void sendData(Map.Entry<String, byte[]> entry, String session) throws IO
connection = (HttpURLConnection) new URL(url + "/" + entry.getKey()).openConnection();
connection.setRequestMethod("PUT");
connection.setDoOutput(true);
+ connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION_COUNT, Integer.toString(currentSessionCounter));
@@ -120,6 +131,7 @@ private String doConnect(RemoteDevState initialState, Function<Set<String>, Map<
HttpURLConnection connection = (HttpURLConnection) new URL(url + RemoteSyncHandler.CONNECT)
.openConnection();
+ connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
//for the connection we use the hash of the password and the contents
//this can be replayed, but only with the same contents, and this does not affect the server
@@ -195,6 +207,7 @@ public void run() {
//long polling request
//we always send the current problem state
connection = (HttpURLConnection) devUrl.openConnection();
+ connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.setRequestMethod("POST");
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
connection.addRequestProperty(RemoteSyncHandler.QUARKUS_SESSION_COUNT,
@@ -223,6 +236,7 @@ public void run() {
}
log.info("deleting " + file);
connection = (HttpURLConnection) new URL(url + "/" + file).openConnection();
+ connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.setRequestMethod("DELETE");
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(),
RemoteSyncHandler.APPLICATION_QUARKUS);
@@ -270,6 +284,7 @@ private String waitForRestart(RemoteDevState initialState,
while (System.currentTimeMillis() < timeout) {
try {
HttpURLConnection connection = (HttpURLConnection) probeUrl.openConnection();
+ connection.setRequestProperty(HttpHeaders.ACCEPT.toString(), DEFAULT_ACCEPT);
connection.setRequestMethod("POST");
connection.addRequestProperty(HttpHeaders.CONTENT_TYPE.toString(), RemoteSyncHandler.APPLICATION_QUARKUS);
IoUtil.readBytes(connection.getInputStream()); | ['extensions/vertx-http/deployment/src/main/java/io/quarkus/vertx/http/deployment/devmode/HttpRemoteDevClient.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,040,732 | 3,688,223 | 484,901 | 4,718 | 1,120 | 221 | 15 | 1 | 4,877 | 322 | 1,226 | 78 | 1 | 1 | 1970-01-01T00:27:21 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,545 | quarkusio/quarkus/22620/21030 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21030 | https://github.com/quarkusio/quarkus/pull/22620 | https://github.com/quarkusio/quarkus/pull/22620 | 1 | fixes | Warning in `quarkus:dev` when using `quarkus-smallrye-graphql` | ### Describe the bug
When running in dev mode (`quarkus:dev`) with the `quarkus-smallrye-graphql` extension, an unexpected warning is printed out:
```
2021-10-27 09:40:54,889 WARN [io.qua.run.con.ConfigRecorder] (Quarkus Main Thread) Build time property cannot be changed at runtime:
- quarkus.smallrye-graphql.print-data-fetcher-exception was 'null' at build time and is now 'true'
```
### Expected behavior
Aforementioned warning is not present in the log output.
### Actual behavior
Aforementioned warning is present in the log output.
### How to Reproduce?
Steps to reproduce:
1.
```
wget -O ./smallrye-qraphql-warn-reproducer.zip "https://code.quarkus.io/api/download?S=io.quarkus.platform:2.3&a=smallrye-qraphql-warn-reproducer&nc=true&e=quarkus-smallrye-graphql"
```
Alternatively for `2.4`:
```
wget -O ./smallrye-qraphql-warn-reproducer.zip "https://code.quarkus.io/api/download?S=io.quarkus.platform:2.4&a=smallrye-qraphql-warn-reproducer&nc=true&e=quarkus-smallrye-graphql"
```
2.
```
unzip ./smallrye-qraphql-warn-reproducer.zip
cd ./smallrye-qraphql-warn-reproducer/
./mvnw clean quarkus:dev
```
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.3.1.Final, 2.4.0.CR1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
### Additional information
_No response_ | 077ea2ffce5cbfbb2217a8a8e11cd952387df142 | bed3ac660b3a541ceba9745a5e327c976a68e011 | https://github.com/quarkusio/quarkus/compare/077ea2ffce5cbfbb2217a8a8e11cd952387df142...bed3ac660b3a541ceba9745a5e327c976a68e011 | diff --git a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
index 84058828434..8c059f1dfd9 100644
--- a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
+++ b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
@@ -417,7 +417,7 @@ void printDataFetcherExceptionInDevMode(SmallRyeGraphQLConfig graphQLConfig,
LaunchModeBuildItem launchMode,
BuildProducer<SystemPropertyBuildItem> systemProperties) {
- // User did not set this explisitly
+ // User did not set this explicitly
if (!graphQLConfig.printDataFetcherException.isPresent()) {
if (launchMode.getLaunchMode().isDevOrTest()) {
systemProperties.produce(new SystemPropertyBuildItem(ConfigKey.PRINT_DATAFETCHER_EXCEPTION, TRUE));
diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLConfigMapping.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLConfigMapping.java
index 2eedffe9e10..2625810641a 100644
--- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLConfigMapping.java
+++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLConfigMapping.java
@@ -42,7 +42,6 @@ private static Map<String, String> relocations() {
mapKey(relocations, ConfigKey.ALLOW_POST_WITH_QUERY_PARAMETERS, QUARKUS_HTTP_POST_QUERYPARAMETERS_ENABLED);
mapKey(relocations, ConfigKey.ERROR_EXTENSION_FIELDS, QUARKUS_ERROR_EXTENSION_FIELDS);
mapKey(relocations, ConfigKey.DEFAULT_ERROR_MESSAGE, QUARKUS_DEFAULT_ERROR_MESSAGE);
- mapKey(relocations, ConfigKey.PRINT_DATAFETCHER_EXCEPTION, QUARKUS_PRINT_DATAFETCHER_EXCEPTION);
mapKey(relocations, ConfigKey.SCHEMA_INCLUDE_SCALARS, QUARKUS_SCHEMA_INCLUDE_SCALARS);
mapKey(relocations, ConfigKey.SCHEMA_INCLUDE_DEFINITION, QUARKUS_SCHEMA_INCLUDE_DEFINITION);
mapKey(relocations, ConfigKey.SCHEMA_INCLUDE_DIRECTIVES, QUARKUS_SCHEMA_INCLUDE_DIRECTIVES); | ['extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java', 'extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLConfigMapping.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,040,732 | 3,688,223 | 484,901 | 4,718 | 195 | 45 | 3 | 2 | 1,701 | 174 | 551 | 59 | 2 | 4 | 1970-01-01T00:27:21 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,546 | quarkusio/quarkus/22575/22574 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22574 | https://github.com/quarkusio/quarkus/pull/22575 | https://github.com/quarkusio/quarkus/pull/22575 | 1 | fixes | x - open last stacktrace not working with vscode/codium | ### Describe the bug
have exception occur and try use `x` to open it and you get code to open "main.java:18" which is not a syntax code supports.
example app:
```
//usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.quarkus.platform:quarkus-bom:2.6.1.Final@pom
//DEPS io.quarkus:quarkus-resteasy
//JAVAC_OPTIONS -parameters
import io.quarkus.runtime.Quarkus;
import javax.enterprise.context.ApplicationScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@Path("/hello-resteasy")
@ApplicationScoped
public class main {
@GET
public String sayHello() {
throw new IllegalStateException("What up");
}
public static void main(String[] args) {
Quarkus.run(args);
}
}
```
### 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_ | effb7b4513b37b1be7c0db4697fb68fca650974a | 9a29739f8a4b3fe7b8a7f07a964e1c3aa8804cd7 | https://github.com/quarkusio/quarkus/compare/effb7b4513b37b1be7c0db4697fb68fca650974a...9a29739f8a4b3fe7b8a7f07a964e1c3aa8804cd7 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java b/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java
index 3182290ffd1..e945ece2c64 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java
@@ -156,6 +156,7 @@ public void run() {
List<String> command = new ArrayList<>();
command.add(effectiveCommand);
command.addAll(args);
+ log.debugf("Opening IDE with %s", command);
new ProcessBuilder(command).redirectOutput(ProcessBuilder.Redirect.DISCARD)
.redirectError(ProcessBuilder.Redirect.DISCARD).start().waitFor(10,
TimeUnit.SECONDS);
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/ide/Ide.java b/core/deployment/src/main/java/io/quarkus/deployment/ide/Ide.java
index 5c13170cc6f..50959a7d7e7 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/ide/Ide.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/ide/Ide.java
@@ -3,32 +3,36 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import org.jboss.logging.Logger;
import io.quarkus.dev.console.DevConsoleManager;
public enum Ide {
// see for cli syntax of idea https://www.jetbrains.com/help/idea/opening-files-from-command-line.html
- IDEA("idea", null, "--help"),
- ECLIPSE("eclipse", null, (String[]) null),
- VSCODE("code", null, "--version"),
- NETBEANS("netbeans", null, "--help");
+ IDEA("idea", List.of("--line", "{lineNumber}", "{fileName}"), List.of("--help")),
+ ECLIPSE("eclipse", List.of("--launcher.openFile", "{fileName}:{lineNumber}"), Collections.emptyList()),
+ VSCODE("code", List.of("--goto", "{fileName}:{lineNumber}"), List.of("--version")),
+ NETBEANS("netbeans", Collections.emptyList(), List.of("--help"));
+
+ private static final Logger log = Logger.getLogger(Ide.class);
private final String defaultCommand;
private final List<String> markerArgs;
- private final String lineNumberArg;
+ private final List<String> lineNumberArgs;
private String machineSpecificCommand;
private String effectiveCommand;
- Ide(String defaultCommand, String lineNumberArg, String... markerArgs) {
+ Ide(String defaultCommand, List<String> lineNumberArgs, List<String> markerArgs) {
this.defaultCommand = defaultCommand;
- this.lineNumberArg = lineNumberArg;
- this.markerArgs = markerArgs != null ? Arrays.asList(markerArgs) : Collections.emptyList();
+ this.lineNumberArgs = lineNumberArgs;
+ this.markerArgs = markerArgs;
}
/**
@@ -46,7 +50,7 @@ public String getEffectiveCommand() {
private String doGetEffectiveCommand() {
if (defaultCommand != null) {
- if (markerArgs == null) {
+ if (markerArgs.isEmpty()) {
// in this case there is nothing much we can do but hope that the default command will work
return defaultCommand;
} else {
@@ -54,6 +58,7 @@ private String doGetEffectiveCommand() {
List<String> command = new ArrayList<>(1 + markerArgs.size());
command.add(defaultCommand);
command.addAll(markerArgs);
+ log.debugf("Checking if IDE available with %s", command);
new ProcessBuilder(command).redirectError(ProcessBuilder.Redirect.DISCARD.file())
.redirectOutput(ProcessBuilder.Redirect.DISCARD.file()).start()
.waitFor(10,
@@ -75,13 +80,16 @@ public List<String> createFileOpeningArgs(String fileName, String line) {
return Collections.singletonList(fileName);
}
- if (lineNumberArg == null) {
- return Collections.singletonList(fileName + ":" + line);
+ // we don't know the syntax for opening a file at a given line
+ // so we just open the file
+ if (lineNumberArgs.isEmpty()) {
+ log.debug("No syntax provided for opening the file at a given line for this IDE so we will just open the file");
+ return Collections.singletonList(fileName);
}
- String formattedLineArg = String.format(lineNumberArg, line);
-
- return List.of(formattedLineArg, fileName);
+ return lineNumberArgs.stream()
+ .map(arg -> arg.replace("{fileName}", fileName).replace("{lineNumber}", line))
+ .collect(Collectors.toList());
}
public void setMachineSpecificCommand(String machineSpecificCommand) { | ['core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/ide/Ide.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,584,066 | 3,793,038 | 498,815 | 4,820 | 2,151 | 458 | 39 | 2 | 1,232 | 145 | 302 | 69 | 0 | 1 | 1970-01-01T00:27:21 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,547 | quarkusio/quarkus/22504/22495 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22495 | https://github.com/quarkusio/quarkus/pull/22504 | https://github.com/quarkusio/quarkus/pull/22504 | 1 | fixes | 4 warnings about unknown 'wildfly.sasl.relax-compliance' config when using infinispan-client + smallrye-reactive-messaging-kafka | ### Describe the bug
4 warnings about unknown 'wildfly.sasl.relax-compliance' config when using `infinispan-client` + `smallrye-reactive-messaging-kafka`
I used vanilla application from code.quarkus, using Quarkus 2.6.0.Final
```
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2021-12-23 13:16:59,208 INFO [io.sma.rea.mes.kafka] (Quarkus Main Thread) SRMSG18214: Key deserializer omitted, using String as default
2021-12-23 13:16:59,294 WARN [org.apa.kaf.cli.con.ConsumerConfig] (Quarkus Main Thread) The configuration 'wildfly.sasl.relax-compliance' was supplied but isn't a known config.
2021-12-23 13:16:59,324 INFO [io.sma.rea.mes.kafka] (Quarkus Main Thread) SRMSG18229: Configured topics for channel 'uppercase-in': [uppercase-word]
2021-12-23 13:16:59,329 INFO [io.sma.rea.mes.kafka] (Quarkus Main Thread) SRMSG18214: Key deserializer omitted, using String as default
2021-12-23 13:16:59,335 WARN [org.apa.kaf.cli.con.ConsumerConfig] (Quarkus Main Thread) The configuration 'wildfly.sasl.relax-compliance' was supplied but isn't a known config.
2021-12-23 13:16:59,356 WARN [org.apa.kaf.cli.pro.ProducerConfig] (Quarkus Main Thread) The configuration 'wildfly.sasl.relax-compliance' was supplied but isn't a known config.
2021-12-23 13:16:59,363 INFO [io.sma.rea.mes.kafka] (Quarkus Main Thread) SRMSG18258: Kafka producer kafka-producer-source-out, connected to Kafka brokers 'OUTSIDE://localhost:55023', is configured to write records to 'word'
2021-12-23 13:16:59,377 WARN [org.apa.kaf.cli.pro.ProducerConfig] (Quarkus Main Thread) The configuration 'wildfly.sasl.relax-compliance' was supplied but isn't a known config.
2021-12-23 13:16:59,379 INFO [io.sma.rea.mes.kafka] (Quarkus Main Thread) SRMSG18258: Kafka producer kafka-producer-uppercase-out, connected to Kafka brokers 'OUTSIDE://localhost:55023', is configured to write records to 'uppercase-word'
2021-12-23 13:16:59,407 INFO [io.sma.rea.mes.kafka] (smallrye-kafka-consumer-thread-0) SRMSG18257: Kafka consumer kafka-consumer-uppercase-in, connected to Kafka brokers 'OUTSIDE://localhost:55023', belongs to the 'code-with-quarkus' consumer group and is configured to poll records from [uppercase-word]
2021-12-23 13:16:59,407 INFO [io.sma.rea.mes.kafka] (smallrye-kafka-consumer-thread-1) SRMSG18257: Kafka consumer kafka-consumer-source-in, connected to Kafka brokers 'OUTSIDE://localhost:55023', belongs to the 'code-with-quarkus' consumer group and is configured to poll records from [word]
2021-12-23 13:16:59,436 INFO [io.quarkus] (Quarkus Main Thread) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.6.0.Final) started in 14.033s.
2021-12-23 13:16:59,437 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2021-12-23 13:16:59,437 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, infinispan-client, kafka-client, smallrye-context-propagation, smallrye-reactive-messaging, smallrye-reactive-messaging-kafka, vertx]
```
### Expected behavior
No warnings about unknown config property are expected
### Actual behavior
4 x `2021-12-23 13:16:59,356 WARN [org.apa.kaf.cli.pro.ProducerConfig] (Quarkus Main Thread) The configuration 'wildfly.sasl.relax-compliance' was supplied but isn't a known config.`
### How to Reproduce?
- Go to https://code.quarkus.io
- Select quarkus-infinispan-client
- Select quarkus-smallrye-reactive-messaging-kafka
- Download and uzip the app
- Run `mvn quarkus:dev`
- Check the log
### 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.6.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | f133a1bb8a32989b0a1d68da0679d51d1ea98c82 | d54255b1839370534a39fa5e4ad23a1e10574582 | https://github.com/quarkusio/quarkus/compare/f133a1bb8a32989b0a1d68da0679d51d1ea98c82...d54255b1839370534a39fa5e4ad23a1e10574582 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
index e856ae2b974..7c3b23c5f12 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java
@@ -1,6 +1,7 @@
package io.quarkus.deployment.logging;
import java.util.Arrays;
+import java.util.List;
import java.util.logging.Level;
import io.quarkus.builder.item.MultiBuildItem;
@@ -17,17 +18,25 @@ public final class LogCleanupFilterBuildItem extends MultiBuildItem {
private LogCleanupFilterElement filterElement;
public LogCleanupFilterBuildItem(String loggerName, String... messageStarts) {
- if (messageStarts.length == 0) {
- throw new IllegalArgumentException("messageStarts cannot be null");
- }
- this.filterElement = new LogCleanupFilterElement(loggerName, Arrays.asList(messageStarts));
+ this(loggerName, Arrays.asList(messageStarts));
}
public LogCleanupFilterBuildItem(String loggerName, Level targetLevel, String... messageStarts) {
- if (messageStarts.length == 0) {
- throw new IllegalArgumentException("messageStarts cannot be null");
+ this(loggerName, targetLevel, Arrays.asList(messageStarts));
+ }
+
+ public LogCleanupFilterBuildItem(String loggerName, List<String> messageStarts) {
+ if (messageStarts.isEmpty()) {
+ throw new IllegalArgumentException("messageStarts cannot be empty");
+ }
+ this.filterElement = new LogCleanupFilterElement(loggerName, messageStarts);
+ }
+
+ public LogCleanupFilterBuildItem(String loggerName, Level targetLevel, List<String> messageStarts) {
+ if (messageStarts.isEmpty()) {
+ throw new IllegalArgumentException("messageStarts cannot be empty");
}
- this.filterElement = new LogCleanupFilterElement(loggerName, targetLevel, Arrays.asList(messageStarts));
+ this.filterElement = new LogCleanupFilterElement(loggerName, targetLevel, messageStarts);
}
public LogCleanupFilterElement getFilterElement() {
diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
index 79027fdba7f..76ccae4a3d1 100644
--- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
+++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
@@ -1,8 +1,10 @@
package io.quarkus.kafka.client.deployment;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.logging.Level;
@@ -79,6 +81,7 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
+import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
import io.quarkus.deployment.pkg.NativeConfig;
import io.quarkus.kafka.client.runtime.KafkaBindingConverter;
import io.quarkus.kafka.client.runtime.KafkaRecorder;
@@ -137,7 +140,21 @@ void logging(BuildProducer<LogCategoryBuildItem> log) {
log.produce(new LogCategoryBuildItem("org.apache.kafka.clients", Level.WARNING));
log.produce(new LogCategoryBuildItem("org.apache.kafka.common.utils", Level.WARNING));
log.produce(new LogCategoryBuildItem("org.apache.kafka.common.metrics", Level.WARNING));
+ }
+
+ @BuildStep
+ void silenceUnwantedConfigLogs(BuildProducer<LogCleanupFilterBuildItem> logCleanupFilters) {
+ String[] ignoredConfigProperties = { "wildfly.sasl.relax-compliance", "ssl.endpoint.identification.algorithm" };
+
+ List<String> ignoredMessages = new ArrayList<>();
+ for (String ignoredConfigProperty : ignoredConfigProperties) {
+ ignoredMessages.add("The configuration '" + ignoredConfigProperty + "' was supplied but isn't a known config.");
+ }
+ logCleanupFilters.produce(new LogCleanupFilterBuildItem("org.apache.kafka.clients.consumer.ConsumerConfig",
+ ignoredMessages));
+ logCleanupFilters.produce(new LogCleanupFilterBuildItem("org.apache.kafka.clients.producer.ProducerConfig",
+ ignoredMessages));
}
@BuildStep | ['extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java', 'core/deployment/src/main/java/io/quarkus/deployment/logging/LogCleanupFilterBuildItem.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,015,226 | 3,683,588 | 484,290 | 4,717 | 2,211 | 427 | 40 | 2 | 3,997 | 438 | 1,237 | 67 | 1 | 1 | 1970-01-01T00:27:20 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,181 | quarkusio/quarkus/33569/33573 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33573 | https://github.com/quarkusio/quarkus/pull/33569 | https://github.com/quarkusio/quarkus/pull/33569 | 1 | fixes | disableTrustManager is not used in ResteasyReactiveClientProvider | ### Describe the bug
The parameter `disableTrustManager` is not passed to `clientBuilder`.
https://github.com/quarkusio/quarkus/blob/071a89c3b8acc50eb760b6740a547851e8032a0c/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java#L32-L36
| 8101c3ec85fed92ecfff556a40c68243e93b0c73 | f61b0b37040b28c3eea5f734ef48c1d4977c5f1d | https://github.com/quarkusio/quarkus/compare/8101c3ec85fed92ecfff556a40c68243e93b0c73...f61b0b37040b28c3eea5f734ef48c1d4977c5f1d | diff --git a/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java b/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java
index 275fc580fb2..26cd9782d31 100644
--- a/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java
+++ b/extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java
@@ -31,7 +31,7 @@ public class ResteasyReactiveClientProvider implements ResteasyClientProvider {
@Override
public Client newRestEasyClient(Object messageHandler, SSLContext sslContext, boolean disableTrustManager) {
- ClientBuilderImpl clientBuilder = new ClientBuilderImpl();
+ ClientBuilderImpl clientBuilder = new ClientBuilderImpl().trustAll(disableTrustManager);
return registerJacksonProviders(clientBuilder).build();
}
| ['extensions/keycloak-admin-client-reactive/runtime/src/main/java/io/quarkus/keycloak/admin/client/reactive/runtime/ResteasyReactiveClientProvider.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,579,575 | 5,242,481 | 675,870 | 6,244 | 165 | 31 | 2 | 1 | 339 | 13 | 93 | 6 | 1 | 0 | 1970-01-01T00:28:04 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,179 | quarkusio/quarkus/33598/33585 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33585 | https://github.com/quarkusio/quarkus/pull/33598 | https://github.com/quarkusio/quarkus/pull/33598 | 1 | fixes | NPE When Constructor Injecting a Microprofile Metric | ### Describe the bug
Quarkus throws an NPE when a bean constructor injects a microprofile metric e.g.
```java
@ApplicationScoped
public class FailsToInjectMetric {
private final Timer timer;
@Inject
public FailsToInjectMetric(
@Metric(name = "my-timer", unit = MetricUnits.MILLISECONDS) final Timer timer) {
this.timer = timer;
}
```
```
java.lang.NullPointerException: Cannot invoke "org.eclipse.microprofile.metrics.annotation.Metric.name()" because "annotation" is null
at io.quarkus.micrometer.runtime.binder.mpmetrics.MetricRegistryAdapter.injectedTimer(MetricRegistryAdapter.java:365)
at io.quarkus.micrometer.runtime.binder.mpmetrics.InjectedMetricProducer.getTimer(InjectedMetricProducer.java:72)
at io.quarkus.micrometer.runtime.binder.mpmetrics.InjectedMetricProducer_ProducerMethod_getTimer_40638bc6dcfae855a99f42cfc454029922b9370a_Bean.doCreate(Unknown Source)
at io.quarkus.micrometer.runtime.binder.mpmetrics.InjectedMetricProducer_ProducerMethod_getTimer_40638bc6dcfae855a99f42cfc454029922b9370a_Bean.create(Unknown Source)
at io.quarkus.micrometer.runtime.binder.mpmetrics.InjectedMetricProducer_ProducerMethod_getTimer_40638bc6dcfae855a99f42cfc454029922b9370a_Bean.get(Unknown Source)
at io.quarkus.micrometer.runtime.binder.mpmetrics.InjectedMetricProducer_ProducerMethod_getTimer_40638bc6dcfae855a99f42cfc454029922b9370a_Bean.get(Unknown Source)
at io.quarkus.arc.impl.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:48)
at com.acme.FailsToInjectMetric_Bean.doCreate(Unknown Source)
```
Changing the bean to use package-private field injection instead of constructor injection works around this issue.
### Expected behavior
Quarkus constructor injection works with microprofile metrics.
### Actual behavior
Quarkus throws NPE.
### How to Reproduce?
Run the tests in the attached Maven project.
[constructor-inject-microprofile-metric-issue.zip](https://github.com/quarkusio/quarkus/files/11557001/constructor-inject-microprofile-metric-issue.zip)
### Output of `uname -a` or `ver`
Darwin pixee-mbp-gilday.localdomain 22.4.0 Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:28 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T6000 arm64
### Output of `java -version`
openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39) Maven home: /Users/jgilday/.m2/wrapper/dists/apache-maven-3.8.8-bin/67c30f74/apache-maven-3.8.8 Java version: 17.0.7, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "13.3.1", arch: "aarch64", family: "mac"
### Additional information
_No response_ | 7a39f3135ae387bc9ed70f6c7d837a2ee259530d | 5ef3b089b13d432210461c1c491799accbf829c7 | https://github.com/quarkusio/quarkus/compare/7a39f3135ae387bc9ed70f6c7d837a2ee259530d...5ef3b089b13d432210461c1c491799accbf829c7 | diff --git a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/binder/mpmetrics/AnnotationHandler.java b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/binder/mpmetrics/AnnotationHandler.java
index 1645ffbe59e..50d29838e39 100644
--- a/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/binder/mpmetrics/AnnotationHandler.java
+++ b/extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/binder/mpmetrics/AnnotationHandler.java
@@ -29,12 +29,12 @@ static AnnotationsTransformerBuildItem transformAnnotations(final IndexView inde
}
static AnnotationsTransformerBuildItem transformAnnotations(final IndexView index,
- DotName sourceAnnotation, DotName targetAnnotation) {
+ DotName sourceAnnotationName, DotName targetAnnotationName) {
return new AnnotationsTransformerBuildItem(new AnnotationsTransformer() {
@Override
public void transform(TransformationContext ctx) {
final Collection<AnnotationInstance> annotations = ctx.getAnnotations();
- AnnotationInstance annotation = Annotations.find(annotations, sourceAnnotation);
+ AnnotationInstance annotation = Annotations.find(annotations, sourceAnnotationName);
if (annotation == null) {
return;
}
@@ -59,8 +59,8 @@ public void transform(TransformationContext ctx) {
// Remove the @Counted annotation when both @Counted & @Timed/SimplyTimed
// Ignore @Metric with @Produces
- if (removeCountedWhenTimed(sourceAnnotation, target, classInfo, methodInfo) ||
- removeMetricWhenProduces(sourceAnnotation, target, methodInfo, fieldInfo)) {
+ if (removeCountedWhenTimed(sourceAnnotationName, target, classInfo, methodInfo) ||
+ removeMetricWhenProduces(sourceAnnotationName, target, methodInfo, fieldInfo)) {
ctx.transform()
.remove(x -> x == annotation)
.done();
@@ -71,10 +71,14 @@ public void transform(TransformationContext ctx) {
MetricAnnotationInfo annotationInfo = new MetricAnnotationInfo(annotation, index,
classInfo, methodInfo, fieldInfo);
+ // preserve the original annotation target, `ctx.getTarget()` is different in case of method parameters
+ AnnotationInstance newAnnotation = AnnotationInstance.create(targetAnnotationName, annotation.target(),
+ annotationInfo.getAnnotationValues());
+
// Remove the existing annotation, and add a new one with all the fields
ctx.transform()
.remove(x -> x == annotation)
- .add(targetAnnotation, annotationInfo.getAnnotationValues())
+ .add(newAnnotation)
.done();
}
}); | ['extensions/micrometer/deployment/src/main/java/io/quarkus/micrometer/deployment/binder/mpmetrics/AnnotationHandler.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,579,737 | 5,242,514 | 675,872 | 6,244 | 1,184 | 195 | 14 | 1 | 3,065 | 231 | 890 | 70 | 1 | 2 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,549 | quarkusio/quarkus/22475/21694 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21694 | https://github.com/quarkusio/quarkus/pull/22475 | https://github.com/quarkusio/quarkus/pull/22475 | 1 | fixes | Hibernate Validator warnings are displayed when optional ResourceBundles are missing | ### Describe the bug
When an app depending on the Hibernate Validator extension is package using the native build, the following messages are printed to the output:
```
The bundle named: ContributorValidationMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: ValidationMessages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
The bundle named: messages, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
```
Although that does no harm to the build, it may lead to confusion giving that those bundles are optional.
### Expected behavior
Do not print any message if the bundle does not exist in the user's application
### Actual behavior
The message is printed.
### How to Reproduce?
1. Clone https://github.com/quarkusio/registry.quarkus.io
2. run `mvn clean package -Dnative -DskipTests`
### Output of `uname -a` or `ver`
Fedora 35
### Output of `java -version`
11
### GraalVM version (if different from Java)
21
### Quarkus version or git rev
2.5.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Maven 3.8.4
### Additional information
This issue was originated from [a chat in Zulip](https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/Hibernate.20Validation).
Also it seems that [this snippet](https://github.com/quarkusio/quarkus/blob/main/extensions/hibernate-validator/deployment/src/main/java/io/quarkus/hibernate/validator/deployment/HibernateValidatorProcessor.java#L346-L353) may need to be enhanced to check if the bundle really exists | bb06c1a40d8c1c38f507462bf7d89052453f8c1d | 0a1eda3a3d66df33790b1df0ff751eef6003215a | https://github.com/quarkusio/quarkus/compare/bb06c1a40d8c1c38f507462bf7d89052453f8c1d...0a1eda3a3d66df33790b1df0ff751eef6003215a | diff --git a/extensions/hibernate-validator/deployment/src/main/java/io/quarkus/hibernate/validator/deployment/HibernateValidatorProcessor.java b/extensions/hibernate-validator/deployment/src/main/java/io/quarkus/hibernate/validator/deployment/HibernateValidatorProcessor.java
index 81d69df34b4..428d556583f 100644
--- a/extensions/hibernate-validator/deployment/src/main/java/io/quarkus/hibernate/validator/deployment/HibernateValidatorProcessor.java
+++ b/extensions/hibernate-validator/deployment/src/main/java/io/quarkus/hibernate/validator/deployment/HibernateValidatorProcessor.java
@@ -345,11 +345,28 @@ public void build(HibernateValidatorRecorder recorder, RecorderContext recorderC
@BuildStep
NativeImageConfigBuildItem nativeImageConfig() {
- return NativeImageConfigBuildItem.builder()
- .addResourceBundle(AbstractMessageInterpolator.DEFAULT_VALIDATION_MESSAGES)
- .addResourceBundle(AbstractMessageInterpolator.USER_VALIDATION_MESSAGES)
- .addResourceBundle(AbstractMessageInterpolator.CONTRIBUTOR_VALIDATION_MESSAGES)
- .build();
+ List<String> potentialHibernateValidatorResourceBundles = List.of(
+ AbstractMessageInterpolator.DEFAULT_VALIDATION_MESSAGES,
+ AbstractMessageInterpolator.USER_VALIDATION_MESSAGES,
+ AbstractMessageInterpolator.CONTRIBUTOR_VALIDATION_MESSAGES);
+ List<String> userDefinedHibernateValidatorResourceBundles = new ArrayList<>();
+
+ for (String potentialHibernateValidatorResourceBundle : potentialHibernateValidatorResourceBundles) {
+ if (Thread.currentThread().getContextClassLoader().getResource(potentialHibernateValidatorResourceBundle) != null) {
+ userDefinedHibernateValidatorResourceBundles.add(potentialHibernateValidatorResourceBundle);
+ }
+ }
+
+ if (userDefinedHibernateValidatorResourceBundles.isEmpty()) {
+ return null;
+ }
+
+ NativeImageConfigBuildItem.Builder builder = NativeImageConfigBuildItem.builder();
+ for (String hibernateValidatorResourceBundle : userDefinedHibernateValidatorResourceBundles) {
+ builder.addResourceBundle(hibernateValidatorResourceBundle);
+ }
+
+ return builder.build();
}
@BuildStep
diff --git a/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java b/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
index d65a5a58c02..3595bd4899f 100755
--- a/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
+++ b/extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java
@@ -88,6 +88,7 @@ public class ResteasyServerCommonProcessor {
private static final Logger log = Logger.getLogger("io.quarkus.resteasy");
private static final String JAX_RS_APPLICATION_PARAMETER_NAME = "javax.ws.rs.Application";
+ private static final String MESSAGES_RESOURCE_BUNDLE = "messages";
private static final DotName JSONB_ANNOTATION = DotName.createSimple("javax.json.bind.annotation.JsonbAnnotation");
@@ -181,8 +182,12 @@ static final class ResteasyConfig {
@BuildStep
NativeImageConfigBuildItem config() {
+ if (Thread.currentThread().getContextClassLoader().getResource(MESSAGES_RESOURCE_BUNDLE) == null) {
+ return null;
+ }
+
return NativeImageConfigBuildItem.builder()
- .addResourceBundle("messages")
+ .addResourceBundle(MESSAGES_RESOURCE_BUNDLE)
.build();
}
| ['extensions/resteasy-classic/resteasy-server-common/deployment/src/main/java/io/quarkus/resteasy/server/common/deployment/ResteasyServerCommonProcessor.java', 'extensions/hibernate-validator/deployment/src/main/java/io/quarkus/hibernate/validator/deployment/HibernateValidatorProcessor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,017,280 | 3,684,097 | 484,310 | 4,718 | 1,883 | 307 | 34 | 2 | 1,931 | 268 | 457 | 50 | 3 | 1 | 1970-01-01T00:27:20 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,178 | quarkusio/quarkus/33608/33418 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33418 | https://github.com/quarkusio/quarkus/pull/33608 | https://github.com/quarkusio/quarkus/pull/33608 | 1 | fix | Quarkus redis reactive pubsub disconnecting handler | ### Describe the bug
I have the following code:
```
ReactiveRedisDataSource redis; -> Injected
ReactivePubSubCommands<String> pubsub = redis.pubsub(String.class);
pubsub.subscribe('my-channel')
.onItem().call(this::consume)
.subscribe().with(
notificationId -> log.debug("New notification has been processed {}", notificationId),
err -> log.error("Error while listening for new notifications ", err));
```
Everything is working fine, I receive data via the subscription, but for some reason, after a while (days, weeks), my subscription is gone. It can be checked by running in redis the folowing command:
```
PUBSUB NUMSUB my-channel
```
Initially returns 1, but when my issues occurs, it is going to 0. No other failures can be seen in the application.
It is very easy to reproduce the issue:
1. Connect via the code above to a redis docker instance.
2. Check `PUBSUB NUMSUB my-channel -> 1`
3. Stop redis container
4. Start redis container
5. Now `PUBSUB NUMSUB my-channel -> 0` and no errors thrown in code.
**How can I watch the disconnected state to be able to manually reconnect?** I tried to add handlers like `onTermination`, `onCanncelation`, `onFailure`, `onCompletion` but they are never triggered.
An undesired solution is to use
```
pubsub.Uni<ReactiveRedisSubscriber> subscribe(String channel, Consumer<V> onMessage, Runnable onEnd,
Consumer<Throwable> onException);
```
I noticed that when my redis connection is going down, it triggers `onEnd` handler.
But this cuts my reactivity in the process for consuming the event. I want to use `pubsub.Multi<V> subscribe(String... channels)`
### Quarkus version or git rev
2.14.3.Final
| 9495ee57355c49780c0bca17f80472775a1af54b | f406a26f4e8af255ee2fd31836d2e3be298d761b | https://github.com/quarkusio/quarkus/compare/9495ee57355c49780c0bca17f80472775a1af54b...f406a26f4e8af255ee2fd31836d2e3be298d761b | diff --git a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/ReactivePubSubCommandsImpl.java b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/ReactivePubSubCommandsImpl.java
index c06075075d3..95476dcb225 100644
--- a/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/ReactivePubSubCommandsImpl.java
+++ b/extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/ReactivePubSubCommandsImpl.java
@@ -143,9 +143,11 @@ public Multi<V> subscribe(String... channels) {
doesNotContainNull(channels, "channels");
return Multi.createFrom().emitter(emitter -> {
- subscribe(List.of(channels), emitter::emit)
+ subscribe(List.of(channels), emitter::emit, emitter::complete, emitter::fail)
.subscribe().with(x -> {
- emitter.onTermination(() -> x.unsubscribe(channels).subscribe().asCompletionStage());
+ emitter.onTermination(() -> {
+ x.unsubscribe(channels).subscribe().asCompletionStage();
+ });
}, emitter::fail);
});
}
@@ -156,7 +158,7 @@ public Multi<V> subscribeToPatterns(String... patterns) {
doesNotContainNull(patterns, "patterns");
return Multi.createFrom().emitter(emitter -> {
- subscribeToPatterns(List.of(patterns), emitter::emit)
+ subscribeToPatterns(List.of(patterns), emitter::emit, emitter::complete, emitter::fail)
.subscribe().with(x -> {
emitter.onTermination(() -> x.unsubscribe(patterns).subscribe().asCompletionStage());
}, emitter::fail);
@@ -186,10 +188,12 @@ private AbstractRedisSubscriber(RedisConnection connection, RedisAPI api, Consum
public Uni<String> subscribe() {
Uni<Void> handled = Uni.createFrom().emitter(emitter -> {
connection.handler(r -> runOnDuplicatedContext(() -> handleRedisEvent(emitter, r)));
- if (onEnd != null)
+ if (onEnd != null) {
connection.endHandler(() -> runOnDuplicatedContext(onEnd));
- if (onException != null)
+ }
+ if (onException != null) {
connection.exceptionHandler(t -> runOnDuplicatedContext(() -> onException.accept(t)));
+ }
});
Uni<Void> subscribed = subscribeToRedis(); | ['extensions/redis-client/runtime/src/main/java/io/quarkus/redis/runtime/datasource/ReactivePubSubCommandsImpl.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,592,968 | 5,245,206 | 676,210 | 6,249 | 794 | 142 | 14 | 1 | 1,795 | 234 | 411 | 45 | 0 | 3 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,163 | quarkusio/quarkus/33923/33922 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33922 | https://github.com/quarkusio/quarkus/pull/33923 | https://github.com/quarkusio/quarkus/pull/33923 | 1 | fixes | Access-Control-Expose-Headers not returned to request | ### Describe the bug
The Access-Control-Expose-Headers is only returned during the preflight request but not included in the subsequent request itself. Consequently, the header cannot be accessed through JavaScript in the browser.
### Expected behavior
The Access-Control-Expose-Headers should be returned
### Actual behavior
The Access-Control-Expose-Headers is not returned.
### How to Reproduce?
1 - Configure the quarkus.http.cors.exposed-headers with some header.
2 - Send a request from browser
### 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_ | 1c8d56437bc335f6d5766ccd5eb655794c1f66be | 0fcfc8b517f72f49c780ea96ec8ff6350bda5062 | https://github.com/quarkusio/quarkus/compare/1c8d56437bc335f6d5766ccd5eb655794c1f66be...0fcfc8b517f72f49c780ea96ec8ff6350bda5062 | diff --git a/extensions/reactive-routes/deployment/src/test/java/io/quarkus/vertx/web/cors/CORSFullConfigHandlerTestCase.java b/extensions/reactive-routes/deployment/src/test/java/io/quarkus/vertx/web/cors/CORSFullConfigHandlerTestCase.java
index 445fe9adc05..8b829208564 100644
--- a/extensions/reactive-routes/deployment/src/test/java/io/quarkus/vertx/web/cors/CORSFullConfigHandlerTestCase.java
+++ b/extensions/reactive-routes/deployment/src/test/java/io/quarkus/vertx/web/cors/CORSFullConfigHandlerTestCase.java
@@ -32,6 +32,15 @@ public void corsFullConfigTestServlet() {
.header("Access-Control-Allow-Headers", "X-Custom")
.header("Access-Control-Max-Age", "86400");
+ given().header("Origin", "http://custom.origin.quarkus")
+ .when()
+ .get("/test").then()
+ .statusCode(200)
+ .header("Access-Control-Allow-Origin", "http://custom.origin.quarkus")
+ .header("Access-Control-Allow-Methods", "GET,PUT,POST")
+ .header("Access-Control-Expose-Headers", "Content-Disposition")
+ .header("Access-Control-Allow-Headers", "X-Custom");
+
given().header("Origin", "http://www.quarkus.io")
.header("Access-Control-Request-Method", "PUT")
.when()
@@ -40,6 +49,7 @@ public void corsFullConfigTestServlet() {
.header("Access-Control-Allow-Origin", "http://www.quarkus.io")
.header("Access-Control-Allow-Methods", "GET,PUT,POST")
.header("Access-Control-Expose-Headers", "Content-Disposition");
+
}
@Test
diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java
index 4cd477c951b..4304433190d 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java
@@ -176,6 +176,12 @@ public void handle(RoutingContext event) {
if (allowedMethods != null) {
response.headers().add(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, allowedMethods);
}
+
+ //always set expose headers if present
+ if (exposedHeaders != null) {
+ response.headers().add(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, exposedHeaders);
+ }
+
//we check that the actual request matches the allowed methods and headers
if (!isMethodAllowed(request.method())) {
LOG.debug("Method is not allowed");
@@ -216,10 +222,6 @@ private void handlePreflightRequest(RoutingContext event, String requestedHeader
response.headers().add(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, exposedHeaders);
}
- if (!isConfiguredWithWildcard(corsConfig.exposedHeaders)) {
- response.headers().set(HttpHeaders.ACCESS_CONTROL_EXPOSE_HEADERS, this.exposedHeaders);
- }
-
}
static boolean isSameOrigin(HttpServerRequest request, String origin) { | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/cors/CORSFilter.java', 'extensions/reactive-routes/deployment/src/test/java/io/quarkus/vertx/web/cors/CORSFullConfigHandlerTestCase.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 26,873,800 | 5,300,578 | 682,384 | 6,290 | 396 | 73 | 10 | 1 | 843 | 118 | 186 | 40 | 0 | 0 | 1970-01-01T00:28:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,164 | quarkusio/quarkus/33910/33658 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33658 | https://github.com/quarkusio/quarkus/pull/33910 | https://github.com/quarkusio/quarkus/pull/33910 | 1 | fix | redirect of /q/dev too permanent? | ### Describe the bug
was using quarkus dev with quarkus 3 using dev UI all good.
now switch to quarkus 2.x by running quarkus dev in https://github.com/quarkusio/todo-demo-app
pressing 'd' gets me to http://localhost:8080/dev which then redirects to http://localhost:8080/dev-ui presumably because of previous quarkus 3 returned a permanent redirect?
### Expected behavior
dont break quarkus 2 dev ui just because I ran a quarkus 3 dev mode app
### 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_ | 58f8abb270dfe86925ae235d0b903f5f8f8a2e3d | 4031d6259a25036bdd30536c9806e92486abe8db | https://github.com/quarkusio/quarkus/compare/58f8abb270dfe86925ae235d0b903f5f8f8a2e3d...4031d6259a25036bdd30536c9806e92486abe8db | diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/DevUIRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/DevUIRecorder.java
index 4b8eca0d506..57fc606b1b7 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/DevUIRecorder.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/DevUIRecorder.java
@@ -17,6 +17,7 @@
import org.jboss.logging.Logger;
+import io.netty.handler.codec.http.HttpResponseStatus;
import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.dev.console.DevConsoleManager;
import io.quarkus.devui.runtime.comms.JsonRpcRouter;
@@ -98,8 +99,14 @@ public Handler<RoutingContext> redirect(String contextRoot) {
return new Handler<RoutingContext>() {
@Override
public void handle(RoutingContext rc) {
- // 308 because we also want to redirect other HTTP Methods (and not only GET).
- rc.response().putHeader("Location", contextRoot + "dev-ui").setStatusCode(308).end();
+ // Initially we were using 308 (MOVED PERMANENTLY) because we also want to redirect other HTTP Methods
+ // (and not only GET).
+ // However, it caused issues with browser caches and prevented users to have applications using Quarkus 2
+ // and Quarkus 3 at the same time. So, we decided to switch to FOUND (302)
+ // See https://github.com/quarkusio/quarkus/issues/33658 for more context.
+ rc.response()
+ .putHeader("Location", contextRoot + "dev-ui")
+ .setStatusCode(HttpResponseStatus.FOUND.code()).end();
}
};
} | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/devui/runtime/DevUIRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,834,275 | 5,293,240 | 681,505 | 6,284 | 904 | 183 | 11 | 1 | 861 | 129 | 219 | 43 | 3 | 0 | 1970-01-01T00:28:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,165 | quarkusio/quarkus/33904/33870 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33870 | https://github.com/quarkusio/quarkus/pull/33904 | https://github.com/quarkusio/quarkus/pull/33904 | 1 | fixes | Gradle plugin does not copy all files correctly, when having parent-first-artifacts | ### Describe the bug
I've a Quarkus project, which uses an own Jackson ObjectMapper, with that I had problems using the same ClassLoader for that lib. As a solution I added the lib to the property ```quarkus.class-loading.parent-first-artifacts```.
With Quarkus < 3.x this worked well. Now I've tried to migrate to Quarkus 3.x and I got a ClassNotFoundException.
After searching I found the reason. My lib - added via the parent-first-artifact - is copied during the build to ```build/quarkus-build/gen/querkus-app/lib/boot```, which is as expected.
But in the next step, I would expect, that it should also be copied to ```build/quarkus-build/dep/lib/boot``` (and finally to ```build/quarkus-app/lib/boot```), but this doesn't happen. The lib is mentioned in the manifest file.
### Expected behavior
The parent-first-artifact lib is copied in the app folder.
### Actual behavior
JAR is not copied.
### How to Reproduce?
Run ```gradle build``` and the ```gson``` lib (just used as an example) was not copied to ```build/quarkus-build/dep/lib/boot```
[reproducer.zip](https://github.com/quarkusio/quarkus/files/11676041/reproducer.zip)
### Output of `uname -a` or `ver`
Darwin TMXQT47KNH 22.5.0 Darwin Kernel Version 22.5.0
### Output of `java -version`
openjdk version "17.0.6" 2023-01-17 LTS
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.1.0
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 8.1.1
### Additional information
_No response_ | 51cb9667c303d62b5c7ffb0c40e47f2d57213f42 | b46341ae8c8af4787d32d4267eacd83ceca3f3c0 | https://github.com/quarkusio/quarkus/compare/51cb9667c303d62b5c7ffb0c40e47f2d57213f42...b46341ae8c8af4787d32d4267eacd83ceca3f3c0 | diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java
index 2e7b714ff72..a410e1af412 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java
@@ -5,6 +5,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@@ -34,6 +35,8 @@
public abstract class QuarkusBuildDependencies extends QuarkusBuildTask {
static final String CLASS_LOADING_REMOVED_ARTIFACTS = "quarkus.class-loading.removed-artifacts";
static final String CLASS_LOADING_PARENT_FIRST_ARTIFACTS = "quarkus.class-loading.parent-first-artifacts";
+ static final String FILTER_OPTIONAL_DEPENDENCIES = "quarkus.package.filter-optional-dependencies";
+ static final String INCLUDED_OPTIONAL_DEPENDENCIES = "quarkus.package.included-optional-dependencies";
@Inject
public QuarkusBuildDependencies() {
@@ -139,19 +142,22 @@ private void jarDependencies(Path libBoot, Path libMain) {
Map<String, String> configMap = extension().buildEffectiveConfiguration(appModel.getAppArtifact()).configMap();
// see https://quarkus.io/guides/class-loading-reference#configuring-class-loading
- String removedArtifactsProp = configMap.getOrDefault(CLASS_LOADING_PARENT_FIRST_ARTIFACTS, "");
- java.util.Optional<Set<ArtifactKey>> optionalDependencies = java.util.Optional.ofNullable(
+ Set<ArtifactKey> removedArtifacts = java.util.Optional.ofNullable(
configMap.getOrDefault(CLASS_LOADING_REMOVED_ARTIFACTS, null))
- .map(s -> Arrays.stream(s.split(","))
- .map(String::trim)
- .filter(gact -> !gact.isEmpty())
- .map(ArtifactKey::fromString)
- .collect(Collectors.toSet()));
- Set<ArtifactKey> removedArtifacts = Arrays.stream(removedArtifactsProp.split(","))
- .map(String::trim)
- .filter(gact -> !gact.isEmpty())
- .map(ArtifactKey::fromString)
- .collect(Collectors.toSet());
+ .map(QuarkusBuildDependencies::dependenciesListToArtifactKeySet)
+ .orElse(Collections.emptySet());
+ getLogger().info("Removed artifacts: {}", configMap.getOrDefault(CLASS_LOADING_REMOVED_ARTIFACTS, "(none)"));
+
+ String parentFirstArtifactsProp = configMap.getOrDefault(CLASS_LOADING_PARENT_FIRST_ARTIFACTS, "");
+ Set<ArtifactKey> parentFirstArtifacts = dependenciesListToArtifactKeySet(parentFirstArtifactsProp);
+ getLogger().info("parent first artifacts: {}", configMap.getOrDefault(CLASS_LOADING_PARENT_FIRST_ARTIFACTS, "(none)"));
+
+ String optionalDependenciesProp = configMap.getOrDefault(INCLUDED_OPTIONAL_DEPENDENCIES, "");
+ boolean filterOptionalDependencies = Boolean
+ .parseBoolean(configMap.getOrDefault(FILTER_OPTIONAL_DEPENDENCIES, "false"));
+ Set<ArtifactKey> optionalDependencies = filterOptionalDependencies
+ ? dependenciesListToArtifactKeySet(optionalDependenciesProp)
+ : Collections.emptySet();
appModel.getRuntimeDependencies().stream()
.filter(appDep -> {
@@ -159,13 +165,13 @@ private void jarDependencies(Path libBoot, Path libMain) {
if (!appDep.isJar()) {
return false;
}
- if (appDep.isOptional()) {
- return optionalDependencies.map(appArtifactKeys -> appArtifactKeys.contains(appDep.getKey()))
- .orElse(true);
+ if (filterOptionalDependencies && appDep.isOptional()) {
+ return optionalDependencies.contains(appDep.getKey());
}
return !removedArtifacts.contains(appDep.getKey());
})
- .map(dep -> Map.entry(dep.isFlagSet(DependencyFlags.CLASSLOADER_RUNNER_PARENT_FIRST) ? libBoot : libMain, dep))
+ .map(dep -> Map.entry(dep.isFlagSet(DependencyFlags.CLASSLOADER_RUNNER_PARENT_FIRST)
+ || parentFirstArtifacts.contains(dep.getKey()) ? libBoot : libMain, dep))
.peek(depAndTarget -> {
ResolvedDependency dep = depAndTarget.getValue();
Path targetDir = depAndTarget.getKey();
@@ -199,4 +205,12 @@ private void jarDependencies(Path libBoot, Path libMain) {
.collect(Collectors.toMap(Map.Entry::getKey, depAndTarget -> 1, Integer::sum))
.forEach((path, count) -> getLogger().info("Copied {} files into {}", count, path));
}
+
+ private static Set<ArtifactKey> dependenciesListToArtifactKeySet(String optionalDependenciesProp) {
+ return Arrays.stream(optionalDependenciesProp.split(","))
+ .map(String::trim)
+ .filter(gact -> !gact.isEmpty())
+ .map(ArtifactKey::fromString)
+ .collect(Collectors.toSet());
+ }
} | ['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,833,245 | 5,293,026 | 681,489 | 6,284 | 3,178 | 601 | 46 | 1 | 1,585 | 213 | 417 | 48 | 1 | 7 | 1970-01-01T00:28:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,167 | quarkusio/quarkus/33901/33842 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33842 | https://github.com/quarkusio/quarkus/pull/33901 | https://github.com/quarkusio/quarkus/pull/33901 | 1 | fixes | AppCDS generation failed with `Permission denied` | ### Describe the bug
Building application with AppCDS `gradle build -Dquarkus.package.create-appcds=true` failed with error
```
> Could not copy file '/home/palo/git/app-cds-fail/build/quarkus-build/app/quarkus-app/app-cds.jsa' to '/home/palo/git/app-cds-fail/build/quarkus-app/app-cds.jsa'.
> /home/palo/git/app-cds-fail/build/quarkus-app/app-cds.jsa (Permission denied)
```
### Expected behavior
AppCDS generation success.
### Actual behavior
_No response_
### How to Reproduce?
Reproducer: https://github.com/paloliska/app-cds-fail
1. build with `gradle build -Dquarkus.package.create-appcds=true`
### Output of `uname -a` or `ver`
Linux *** 6.1.0-1013-oem #13-Ubuntu SMP PREEMPT_DYNAMIC Thu May 18 16:45:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.7" 2023-04-18 OpenJDK Runtime Environment (build 17.0.7+7-Ubuntu-0ubuntu122.04.2) OpenJDK 64-Bit Server VM (build 17.0.7+7-Ubuntu-0ubuntu122.04.2, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.1.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
8.1.1
### Additional information
_No response_ | 51cb9667c303d62b5c7ffb0c40e47f2d57213f42 | 5ee63a01d06e91a493617a73fb493f1cf0826a39 | https://github.com/quarkusio/quarkus/compare/51cb9667c303d62b5c7ffb0c40e47f2d57213f42...5ee63a01d06e91a493617a73fb493f1cf0826a39 | diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java
index 8f9a34bc20c..a2dcbb502b1 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java
@@ -308,6 +308,7 @@ private void assembleFastJar() {
getLogger().info("Synchronizing Quarkus build for {} packaging from {} and {} into {}", packageType(),
appBuildDir, depBuildDir, appTargetDir);
getFileSystemOperations().sync(sync -> {
+ sync.eachFile(new CopyActionDeleteNonWriteableTarget(appTargetDir.toPath()));
sync.into(appTargetDir);
sync.from(appBuildDir, depBuildDir);
});
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java
index fa954cbed2a..ec21628c731 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java
@@ -1,14 +1,18 @@
package io.quarkus.gradle.tasks;
import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import java.util.stream.Collectors;
import javax.inject.Inject;
+import org.gradle.api.Action;
import org.gradle.api.GradleException;
import org.gradle.api.file.FileCollection;
+import org.gradle.api.file.FileCopyDetails;
import org.gradle.api.file.FileSystemOperations;
import org.gradle.api.logging.LogLevel;
import org.gradle.api.tasks.Classpath;
@@ -168,6 +172,9 @@ void generateBuild() {
PackageConfig.BuiltInType packageType = packageType();
getLogger().info("Building Quarkus app for package type {} in {}", packageType, genDir);
+ // Need to delete app-cds.jsa specially, because it's usually read-only and Gradle's delete file-system
+ // operation doesn't delete "read only" files :(
+ deleteFileIfExists(genDir.resolve(outputDirectory()).resolve("app-cds.jsa"));
getFileSystemOperations().delete(delete -> {
// Caching and "up-to-date" checks depend on the inputs, this 'delete()' should ensure that the up-to-date
// checks work against "clean" outputs, considering that the outputs depend on the package-type.
@@ -223,6 +230,7 @@ void generateBuild() {
getFileSystemOperations().copy(copy -> {
copy.from(buildDir);
copy.into(genDir);
+ copy.eachFile(new CopyActionDeleteNonWriteableTarget(genDir));
switch (packageType) {
case NATIVE:
copy.include(nativeRunnerFileName());
@@ -261,4 +269,32 @@ void abort(String message, Object... args) {
});
throw new StopExecutionException();
}
+
+ public static final class CopyActionDeleteNonWriteableTarget implements Action<FileCopyDetails> {
+ private final Path destDir;
+
+ public CopyActionDeleteNonWriteableTarget(Path destDir) {
+ this.destDir = destDir;
+ }
+
+ @Override
+ public void execute(FileCopyDetails details) {
+ // Delete a pre-existing non-writeable file, otherwise a copy or sync operation would fail.
+ // This situation happens for 'app-cds.jsa' files, which are created as "read only" files,
+ // prefer to keep those files read-only.
+
+ Path destFile = destDir.resolve(details.getPath());
+ if (Files.exists(destFile) && !Files.isWritable(destFile)) {
+ deleteFileIfExists(destFile);
+ }
+ }
+ }
+
+ protected static void deleteFileIfExists(Path file) {
+ try {
+ Files.deleteIfExists(file);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java
index 94a82fc82ac..3a71110e64d 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java
@@ -15,6 +15,7 @@
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.CompileClasspath;
+import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
@@ -62,6 +63,11 @@ public void setCompileClasspath(Configuration compileClasspath) {
this.compileClasspath = compileClasspath;
}
+ @Input
+ public Map<String, String> getCachingRelevantInput() {
+ return extension().baseConfig().quarkusProperties();
+ }
+
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
public Set<File> getInputDirectory() { | ['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuild.java', 'devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGenerateCode.java', 'devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildTask.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,833,245 | 5,293,026 | 681,489 | 6,284 | 1,769 | 354 | 43 | 3 | 1,224 | 130 | 395 | 46 | 1 | 1 | 1970-01-01T00:28:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,168 | quarkusio/quarkus/33834/33730 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33730 | https://github.com/quarkusio/quarkus/pull/33834 | https://github.com/quarkusio/quarkus/pull/33834 | 1 | fixes | Smallrye Reactive Messaging with Kafka Connector does not support channel names containing a dot | ### Describe the bug
Seems like that a dot in the channel name isn't supported when using ``Smallrye Reactive Messaging`` and ``Kafka``:
```
@ApplicationScoped
public class TestConsumer {
@Incoming("test.test")
public void consume(ChangeEvent event) {
Log.info(event);
}
}
```
This leads to the following exception:
``(Quarkus Main Thread) Failed to start application (with profile [dev]): java.lang.IllegalArgumentException: The attribute `value.deserializer` on connector 'smallrye-kafka' (channel: test.test) must be set``
### Expected behavior
Quarkus should behave in the same way as defining a channel name without a dot like ``test``:
```
2023-05-31 14:50:31,122 INFO [io.qua.sma.dep.processor] (build-22) Configuring the channel 'test' to be managed by the connector 'smallrye-kafka'
2023-05-31 14:50:31,125 INFO [io.qua.sma.dep.processor] (build-37) Generating Jackson deserializer for type com........event.consumer.ChangeEvent
2023-05-31 14:50:35,103 INFO [io.qua.kaf.cli.dep.DevServicesKafkaProcessor] (build-2) Dev Services for Kafka started. Other Quarkus applications in dev mode will find the broker automatically. For Quarkus applications in production mode, you can connect to this by starting your application with -Dkafka.bootstr
ap.servers=OUTSIDE://localhost:32777
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2023-05-31 14:50:35,854 INFO [io.sma.rea.mes.kafka] (Quarkus Main Thread) SRMSG18229: Configured topics for channel 'test': [test]
2023-05-31 14:50:35,859 INFO [io.sma.rea.mes.kafka] (Quarkus Main Thread) SRMSG18214: Key deserializer omitted, using String as default
2023-05-31 14:50:35,993 INFO [io.ope.api.GlobalOpenTelemetry] (Quarkus Main Thread) AutoConfiguredOpenTelemetrySdk found on classpath but automatic configuration is disabled. To enable, run your JVM with -Dotel.java.global-autoconfigure.enabled=true
2023-05-31 14:50:36,011 INFO [io.sma.rea.mes.kafka] (smallrye-kafka-consumer-thread-0) SRMSG18257: Kafka consumer kafka-consumer-test, connected to Kafka brokers 'OUTSIDE://localhost:32777', belongs to the 'eventbatching' consumer group and is configured to poll records from [test]
2023-05-31 14:50:36,071 INFO [io.quarkus] (Quarkus Main Thread) eventbatching main-SNAPSHOT on JVM (powered by Quarkus 3.0.4.Final) started in 5.846s. Listening on: http://localhost:8080
2023-05-31 14:50:36,072 INFO [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2023-05-31 14:50:36,072 INFO [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, jdbc-postgresql, kafka-client, logging-json, micrometer, opentelemetry, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-health, smallrye-reactive-messaging, smallrye-reactive-messaging
-kafka, vertx]
```
### Actual behavior
The startup fails due to the following exception:
```
2023-05-31 14:44:41,302 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile [dev]): java.lang.IllegalArgumentException: The attribute `value.deserializer` on connector 'smallrye-kafka' (channel: test.test) must be set
at io.smallrye.reactive.messaging.kafka.KafkaConnectorIncomingConfiguration.lambda$getValueDeserializer$0(KafkaConnectorIncomingConfiguration.java:62)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at io.smallrye.reactive.messaging.kafka.KafkaConnectorIncomingConfiguration.getValueDeserializer(KafkaConnectorIncomingConfiguration.java:62)
at io.smallrye.reactive.messaging.kafka.KafkaConnectorIncomingConfiguration.validate(KafkaConnectorIncomingConfiguration.java:425)
at io.smallrye.reactive.messaging.kafka.KafkaConnectorIncomingConfiguration.<init>(KafkaConnectorIncomingConfiguration.java:16)
at io.smallrye.reactive.messaging.kafka.KafkaConnector.getPublisher(KafkaConnector.java:189)
at io.smallrye.reactive.messaging.kafka.KafkaConnector_Subclass.getPublisher$$superforward(Unknown Source)
at io.smallrye.reactive.messaging.kafka.KafkaConnector_Subclass$$function$$9.apply(Unknown Source)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:74)
at io.quarkus.arc.impl.AroundInvokeInvocationContext$NextAroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:100)
at io.quarkus.smallrye.reactivemessaging.runtime.devmode.DevModeSupportConnectorFactoryInterceptor.intercept(DevModeSupportConnectorFactoryInterceptor.java:53)
at io.quarkus.smallrye.reactivemessaging.runtime.devmode.DevModeSupportConnectorFactoryInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:71)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:63)
at io.quarkus.smallrye.reactivemessaging.runtime.DuplicatedContextConnectorFactoryInterceptor.intercept(DuplicatedContextConnectorFactoryInterceptor.java:32)
at io.quarkus.smallrye.reactivemessaging.runtime.DuplicatedContextConnectorFactoryInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:38)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:26)
at io.smallrye.reactive.messaging.kafka.KafkaConnector_Subclass.getPublisher(Unknown Source)
at io.smallrye.reactive.messaging.kafka.KafkaConnector_ClientProxy.getPublisher(Unknown Source)
at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.createPublisher(ConfiguredChannelFactory.java:172)
at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.register(ConfiguredChannelFactory.java:134)
at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory.initialize(ConfiguredChannelFactory.java:106)
at io.smallrye.reactive.messaging.providers.impl.ConfiguredChannelFactory_ClientProxy.initialize(Unknown Source)
at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at io.smallrye.reactive.messaging.providers.extension.MediatorManager.start(MediatorManager.java:206)
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:346)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:328)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:82)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:155)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:106)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.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: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)
at java.base/java.lang.Thread.run(Thread.java:833)
```
### How to Reproduce?
Try to run the following code snippet:
```
@ApplicationScoped
public class TestConsumer {
@Incoming("test.test")
public void consume(ChangeEvent event) {
Log.info(event);
}
}
```
### 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
3.0.4.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
mvn 3.8.8
### Additional information
_No response_ | e361121d056f19e7d342427755ca7ca3f1981c60 | 81f3014552446129382abfe6b666bd8881d9eb09 | https://github.com/quarkusio/quarkus/compare/e361121d056f19e7d342427755ca7ca3f1981c60...81f3014552446129382abfe6b666bd8881d9eb09 | diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java
index 7e49c499fba..dbe9ede291e 100644
--- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java
+++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java
@@ -1,5 +1,7 @@
package io.quarkus.smallrye.reactivemessaging.kafka.deployment;
+import static io.quarkus.smallrye.reactivemessaging.kafka.deployment.SmallRyeReactiveMessagingKafkaProcessor.getChannelPropertyKey;
+
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -57,7 +59,7 @@ boolean isKafkaConnector(List<ConnectorManagedChannelBuildItem> channelsManagedB
String channelType = incoming ? "incoming" : "outgoing";
return isKafkaConnector.computeIfAbsent(channelType + "|" + channelName, ignored -> {
- String connectorKey = "mp.messaging." + channelType + "." + channelName + ".connector";
+ String connectorKey = getChannelPropertyKey(channelName, "connector", incoming);
String connector = getConfig()
.getOptionalValue(connectorKey, String.class)
.orElse("ignored");
diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java
index ae4319516a4..d974580b1a6 100644
--- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java
+++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java
@@ -102,6 +102,13 @@ private static List<String> getChannelProperties(String keySuffix, Config config
return values;
}
+ static String channelPropertyFormat = "mp.messaging.%s.%s.%s";
+
+ static String getChannelPropertyKey(String channelName, String propertyName, boolean incoming) {
+ return String.format(channelPropertyFormat, incoming ? "incoming" : "outgoing",
+ channelName.contains(".") ? "\\"" + channelName + "\\"" : channelName, propertyName);
+ }
+
@BuildStep
public void checkpointRedis(BuildProducer<AdditionalBeanBuildItem> additionalBean,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
@@ -173,7 +180,7 @@ public void defaultChannelConfiguration(
if (!discoveryState.isKafkaConnector(channelsManagedByConnectors, true, channelName)) {
continue;
}
- String key = "mp.messaging.incoming." + channelName + ".graceful-shutdown";
+ String key = getChannelPropertyKey(channelName, "graceful-shutdown", true);
discoveryState.ifNotYetConfigured(key, () -> {
defaultConfigProducer.produce(new RunTimeConfigurationDefaultBuildItem(key, "false"));
});
@@ -215,12 +222,11 @@ void discoverDefaultSerdeConfig(DefaultSerdeDiscoveryState discovery,
Type outgoingType = getOutgoingTypeFromMethod(method);
processOutgoingType(discovery, outgoingType, (keySerializer, valueSerializer) -> {
produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.outgoing." + channelName + ".key.serializer", keySerializer);
+ getChannelPropertyKey(channelName, "key.serializer", false), keySerializer);
produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.outgoing." + channelName + ".value.serializer", valueSerializer);
+ getChannelPropertyKey(channelName, "value.serializer", false), valueSerializer);
- handleAdditionalProperties("mp.messaging.outgoing." + channelName + ".", discovery,
- config, keySerializer, valueSerializer);
+ handleAdditionalProperties(channelName, false, discovery, config, keySerializer, valueSerializer);
}, generatedClass, reflection, alreadyGeneratedSerializers);
}
@@ -246,12 +252,11 @@ void discoverDefaultSerdeConfig(DefaultSerdeDiscoveryState discovery,
Type outgoingType = getOutgoingTypeFromChannelInjectionPoint(injectionPointType);
processOutgoingType(discovery, outgoingType, (keySerializer, valueSerializer) -> {
produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.outgoing." + channelName + ".key.serializer", keySerializer);
+ getChannelPropertyKey(channelName, "key.serializer", false), keySerializer);
produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.outgoing." + channelName + ".value.serializer", valueSerializer);
+ getChannelPropertyKey(channelName, "value.serializer", false), valueSerializer);
- handleAdditionalProperties("mp.messaging.outgoing." + channelName + ".", discovery,
- config, keySerializer, valueSerializer);
+ handleAdditionalProperties(channelName, false, discovery, config, keySerializer, valueSerializer);
}, generatedClass, reflection, alreadyGeneratedSerializers);
}
}
@@ -259,17 +264,17 @@ void discoverDefaultSerdeConfig(DefaultSerdeDiscoveryState discovery,
private void processKafkaTransactions(DefaultSerdeDiscoveryState discovery,
BuildProducer<RunTimeConfigurationDefaultBuildItem> config, String channelName, Type injectionPointType) {
if (injectionPointType != null && isKafkaEmitter(injectionPointType)) {
+ String transactionalIdKey = getChannelPropertyKey(channelName, "transactional.id", false);
+ String enableIdempotenceKey = getChannelPropertyKey(channelName, "enable.idempotence", false);
+ String acksKey = getChannelPropertyKey(channelName, "acks", false);
LOGGER.infof("Transactional producer detected for channel '%s', setting following default config values: "
- + "'mp.messaging.outgoing.%s.transactional.id=${quarkus.application.name}-${channelName}', "
- + "'mp.messaging.outgoing.%s.enable.idempotence=true', "
- + "'mp.messaging.outgoing.%s.acks=all'", channelName, channelName, channelName, channelName);
- produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.outgoing." + channelName + ".transactional.id",
+ + "'" + transactionalIdKey + "=${quarkus.application.name}-${channelName}', "
+ + "'" + enableIdempotenceKey + "=true', "
+ + "'" + acksKey + "=all'", channelName);
+ produceRuntimeConfigurationDefaultBuildItem(discovery, config, transactionalIdKey,
"${quarkus.application.name}-" + channelName);
- produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.outgoing." + channelName + ".enable.idempotence", "true");
- produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.outgoing." + channelName + ".acks", "all");
+ produceRuntimeConfigurationDefaultBuildItem(discovery, config, enableIdempotenceKey, "true");
+ produceRuntimeConfigurationDefaultBuildItem(discovery, config, acksKey, "all");
}
}
@@ -283,16 +288,15 @@ private void processIncomingType(DefaultSerdeDiscoveryState discovery,
alreadyGeneratedDeserializers);
produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.incoming." + channelName + ".key.deserializer", keyDeserializer);
+ getChannelPropertyKey(channelName, "key.deserializer", true), keyDeserializer);
produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.incoming." + channelName + ".value.deserializer", valueDeserializer);
+ getChannelPropertyKey(channelName, "value.deserializer", true), valueDeserializer);
if (Boolean.TRUE.equals(isBatchType)) {
produceRuntimeConfigurationDefaultBuildItem(discovery, config,
- "mp.messaging.incoming." + channelName + ".batch", "true");
+ getChannelPropertyKey(channelName, "batch", true), "true");
}
- handleAdditionalProperties("mp.messaging.incoming." + channelName + ".", discovery,
- config, keyDeserializer, valueDeserializer);
+ handleAdditionalProperties(channelName, true, discovery, config, keyDeserializer, valueDeserializer);
});
}
@@ -308,7 +312,7 @@ private Type getInjectionPointType(AnnotationInstance annotation) {
}
}
- private void handleAdditionalProperties(String configPropertyBase, DefaultSerdeDiscoveryState discovery,
+ private void handleAdditionalProperties(String channelName, boolean incoming, DefaultSerdeDiscoveryState discovery,
BuildProducer<RunTimeConfigurationDefaultBuildItem> config, Result... results) {
for (Result result : results) {
if (result == null) {
@@ -316,7 +320,8 @@ private void handleAdditionalProperties(String configPropertyBase, DefaultSerdeD
}
result.additionalProperties.forEach((key, value) -> {
- produceRuntimeConfigurationDefaultBuildItem(discovery, config, configPropertyBase + key, value);
+ String configKey = getChannelPropertyKey(channelName, key, incoming);
+ produceRuntimeConfigurationDefaultBuildItem(discovery, config, configKey, value);
});
}
}
@@ -946,7 +951,9 @@ private void processAnnotationsForReflectiveClassPayload(IndexView index, Config
}
private boolean isSerdeJson(IndexView index, Config config, String channelName, boolean serializer, boolean isKey) {
- ConfigValue configValue = config.getConfigValue(getConfigName(channelName, serializer, isKey));
+ String configKey = getChannelPropertyKey(channelName, (isKey ? "key" : "value") + "." +
+ (serializer ? "serializer" : "deserializer"), !serializer);
+ ConfigValue configValue = config.getConfigValue(configKey);
if (configValue.getValue() != null) {
DotName serdeName = DotName.createSimple(configValue.getValue());
return serializer ? isSubclassOfJsonSerializer(index, serdeName) : isSubclassOfJsonDeserializer(index, serdeName);
@@ -954,14 +961,6 @@ private boolean isSerdeJson(IndexView index, Config config, String channelName,
return false;
}
- String getConfigName(String channelName, boolean serializer, boolean isKey) {
- return "mp.messaging." +
- (serializer ? "outgoing" : "incoming") + "." +
- channelName + "." +
- (isKey ? "key" : "value") + "." +
- (serializer ? "serializer" : "deserializer");
- }
-
private boolean isSubclassOfJsonSerializer(IndexView index, DotName serializerName) {
return isSubclassOf(index, DotNames.OBJECT_MAPPER_SERIALIZER, serializerName) ||
isSubclassOf(index, DotNames.JSONB_SERIALIZER, serializerName);
diff --git a/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java b/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java
index 0f941cc60d1..70a6d866a70 100644
--- a/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java
+++ b/extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java
@@ -2727,5 +2727,32 @@ void method2(JsonObject msg) {
}
+ @Test
+ void channelNameContainingDot() {
+ Tuple[] expectations = {
+ tuple("mp.messaging.incoming.\\"new.channel\\".key.deserializer", "org.apache.kafka.common.serialization.IntegerDeserializer"),
+ tuple("mp.messaging.incoming.\\"new.channel\\".value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer"),
+ tuple("mp.messaging.outgoing.\\"new.channel.out\\".key.serializer", "org.apache.kafka.common.serialization.LongSerializer"),
+ tuple("mp.messaging.outgoing.\\"new.channel.out\\".value.serializer", "io.quarkus.kafka.client.serialization.JsonObjectSerializer"),
+ tuple("mp.messaging.outgoing.\\"new.channel.out\\".transactional.id", "${quarkus.application.name}-new.channel.out"),
+ tuple("mp.messaging.outgoing.\\"new.channel.out\\".enable.idempotence", "true"),
+ tuple("mp.messaging.outgoing.\\"new.channel.out\\".acks", "all"),
+ };
+ doTest(expectations, ChannelContainingDot.class);
+ }
+
+
+ private static class ChannelContainingDot {
+
+ @Incoming("new.channel")
+ void method1(KafkaRecord<Integer, String> msg) {
+
+ }
+
+ @Channel("new.channel.out")
+ KafkaTransactions<ProducerRecord<Long, JsonObject>> transactions;
+
+ }
+
} | ['extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/SmallRyeReactiveMessagingKafkaProcessor.java', 'extensions/smallrye-reactive-messaging-kafka/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeDiscoveryState.java', 'extensions/smallrye-reactive-messaging-kafka/deployment/src/test/java/io/quarkus/smallrye/reactivemessaging/kafka/deployment/DefaultSerdeConfigTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,815,184 | 5,289,505 | 681,189 | 6,285 | 5,971 | 1,122 | 71 | 2 | 9,527 | 566 | 2,318 | 145 | 1 | 4 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,169 | quarkusio/quarkus/33819/33321 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33321 | https://github.com/quarkusio/quarkus/pull/33819 | https://github.com/quarkusio/quarkus/pull/33819 | 1 | fixes | Different behavior in native build using env var in application.properties when build with gradle vs. maven (Quarkus 3.x) | ### Describe the bug
Setting a environment variable which is used like `quarkus.some.var=${MY_ENV_VAR:defaultValue}` in application.properties has no effect when the native image is build with gradle.
The important part is the replacement of `MY_ENV_VAR` with the set value in the property `quarkus.some.var`.
This can lead to unexpected behaviour during execution in production because a property does not have the expected value.
The behavior is only reproducible in Quarkus 3.x, but not in Quarkus 2.x.
To describe and reproduce this behavior the following configuration example is used:
`quarkus.banner.enabled=${BANNER:false}`
Reproducers:
maven -> https://github.com/dagrammy/quarkus-env-reproducer-maven
gradle -> https://github.com/dagrammy/quarkus-env-reproducer-gradle
### Expected behavior
Setting the env var `BANNER` to `true` before starting the application should show the banner regardless of the build tool used.
### Actual behavior
Using maven:
Expected behavior is met, the banner is shown.
Using gradle:
Expected behavior is not met, the banner is **NOT** shown.
### How to Reproduce?
maven -> https://github.com/dagrammy/quarkus-env-reproducer-maven
**build it using maven:**
```
unset BANNER
./mvnw clean package -Pnative
```
**run it without env var:**
```
./target/command-mode-quickstart-1.0.0-SNAPSHOT-runner
```
-> header is NOT shown
**run it with env var:**
```
export BANNER=true
./target/command-mode-quickstart-1.0.0-SNAPSHOT-runner
```
-> header is shown
---
gradle -> https://github.com/dagrammy/quarkus-env-reproducer-gradle
**build it using gradle:**
```
unset BANNER
./gradlew clean build -Dquarkus.package.type=native --info
```
**run it without env var:**
```
./build/command-mode-quickstart-gradle-1.0.0-SNAPSHOT-runner
```
-> header is NOT shown
**run it with env var:**
```
export BANNER=true
./build/command-mode-quickstart-gradle-1.0.0-SNAPSHOT-runner
```
-> header is **NOT** shown although env var is set
### Output of `uname -a` or `ver`
Darwin grammy.local 22.3.0 Darwin Kernel Version 22.3.0: Thu Jan 5 20:49:43 PST 2023; root:xnu-8792.81.2~2/RELEASE_ARM64_T8103 arm64
### Output of `java -version`
openjdk version "17.0.5" 2022-10-18 OpenJDK Runtime Environment GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08) OpenJDK 64-Bit Server VM GraalVM CE 22.3.0 (build 17.0.5+8-jvmci-22.3-b08, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.3
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.6 / Gradle 7.5.1
### Additional information
_No response_ | 5ed7597ea415438a66c9e3f392e15b5d5aff4951 | 2b1f2b1dfa6651fd70b9158984ac72c0a23be1d2 | https://github.com/quarkusio/quarkus/compare/5ed7597ea415438a66c9e3f392e15b5d5aff4951...2b1f2b1dfa6651fd70b9158984ac72c0a23be1d2 | diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusTask.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusTask.java
index 1fc804e23f4..2e01013032b 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusTask.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusTask.java
@@ -20,6 +20,9 @@
import io.quarkus.utilities.OS;
public abstract class QuarkusTask extends DefaultTask {
+ private static final List<String> WORKER_BUILD_FORK_OPTIONS = List.of("quarkus.package.",
+ "quarkus.application.", "quarkus.gradle-worker.");
+
private final transient QuarkusPluginExtension extension;
protected final File projectDir;
protected final File buildDir;
@@ -85,15 +88,17 @@ private void configureProcessWorkerSpec(ProcessWorkerSpec processWorkerSpec, Map
forkOptions.environment("PATH", javaBin + File.pathSeparator + System.getenv("PATH"));
}
- // It's kind of a "very big hammer" here, but this way we ensure that all 'quarkus.*' properties from
- // all configuration sources are (forcefully) used in the Quarkus build - even properties defined on the
- // QuarkusPluginExtension.
+ // It's kind of a "very big hammer" here, but this way we ensure that all necessary properties
+ // ("quarkus.package.*","quarkus.application,*", "quarkus.gradle-worker.*") from all configuration sources
+ // are (forcefully) used in the Quarkus build - even properties defined on the QuarkusPluginExtension.
// This prevents that settings from e.g. a application.properties takes precedence over an explicit
// setting in Gradle project properties, the Quarkus extension or even via the environment or system
// properties.
+ // see https://github.com/quarkusio/quarkus/issues/33321 why not all properties are passed as system properties
// Note that we MUST NOT mess with the system properties of the JVM running the build! And that is the
// main reason why build and code generation happen in a separate process.
- configMap.entrySet().stream().filter(e -> e.getKey().startsWith("quarkus."))
+ configMap.entrySet().stream()
+ .filter(e -> WORKER_BUILD_FORK_OPTIONS.stream().anyMatch(e.getKey().toLowerCase()::startsWith))
.forEach(e -> forkOptions.systemProperty(e.getKey(), e.getValue()));
// populate worker classpath with additional content? | ['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusTask.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,820,670 | 5,290,630 | 681,304 | 6,285 | 1,112 | 256 | 13 | 1 | 2,708 | 328 | 770 | 101 | 4 | 6 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,170 | quarkusio/quarkus/33811/33804 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33804 | https://github.com/quarkusio/quarkus/pull/33811 | https://github.com/quarkusio/quarkus/pull/33811 | 1 | fix | Dev Mode fails with Quarkus 3.1 and Kafka client (no vert.x http extension on the classpath) | ### Describe the bug
When starting devservices with `io.quarkus:quarkus-kafka-client:3.1.0.Final`, I get this error:
```
2023-06-02 22:48:36,647 INFO [io.qua.kaf.cli.dep.DevServicesKafkaProcessor] (build-24) Dev Services for Kafka started. Other Quarkus applications in dev mode will find the broker automatically. For Quarkus applications in production mode, you can connect to this by starting your application with -Dkafka.bootstrap.servers=OUTSIDE://localhost:32769
2023-06-02 22:48:36,832 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile [dev]): java.lang.ClassNotFoundException: io.vertx.core.Handler
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
at io.quarkus.deployment.steps.KafkaProcessor$registerKafkaUiExecHandler1228376192.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.KafkaProcessor$registerKafkaUiExecHandler1228376192.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: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)
at java.base/java.lang.Thread.run(Thread.java:833)
```
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
To reproduce is simple. Create a Quarkus 3 project, add `io.quarkus:quarkus-kafka-client` extension.
Run the app in devMode.
### 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_ | f7cfbd316ae081b8771fb3baae9e602c681340d9 | ffc0d8b5fdf761334e541f2e6e56473e5c856517 | https://github.com/quarkusio/quarkus/compare/f7cfbd316ae081b8771fb3baae9e602c681340d9...ffc0d8b5fdf761334e541f2e6e56473e5c856517 | diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
index d2ced26b180..eef8ad985c9 100644
--- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
+++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
@@ -561,14 +561,17 @@ public AdditionalBeanBuildItem kafkaClientBeans() {
@BuildStep(onlyIf = IsDevelopment.class)
@Record(ExecutionTime.RUNTIME_INIT)
public void registerKafkaUiExecHandler(
+ Capabilities capabilities,
BuildProducer<DevConsoleRouteBuildItem> routeProducer,
KafkaUiRecorder recorder) {
- routeProducer.produce(DevConsoleRouteBuildItem.builder()
- .method("POST")
- .handler(recorder.kafkaControlHandler())
- .path(KAFKA_ADMIN_PATH)
- .bodyHandlerRequired()
- .build());
+ if (capabilities.isPresent(Capability.VERTX_HTTP)) {
+ routeProducer.produce(DevConsoleRouteBuildItem.builder()
+ .method("POST")
+ .handler(recorder.kafkaControlHandler())
+ .path(KAFKA_ADMIN_PATH)
+ .bodyHandlerRequired()
+ .build());
+ }
}
@BuildStep(onlyIf = IsDevelopment.class) | ['extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,816,867 | 5,289,835 | 681,221 | 6,285 | 668 | 115 | 15 | 1 | 2,833 | 196 | 695 | 67 | 0 | 1 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,172 | quarkusio/quarkus/33757/33744 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33744 | https://github.com/quarkusio/quarkus/pull/33757 | https://github.com/quarkusio/quarkus/pull/33757 | 1 | fixes | Tests run in DEV mode are now logged with short names, previously signature was present | ### Describe the bug
Before https://github.com/quarkusio/quarkus/pull/33685 our DEV mode test contained:
```
17:45:10,608 INFO [app] Running 1/1. Running: io.quarkus.ts.http.minimum.HelloResourceTest#HelloResourceTest
```
now it contains
```
17:53:53,032 INFO [app] Running 1/1. Running: #HelloResourceTest
```
I can so no information about this in PR description or note in migration guide or anything, therefore there is no way to tell whether this change is intentional or side effect.
### Expected behavior
Previous behavior was clearer, but I just need a confirmation this was intentional change, that's all.
### Actual behavior
`io.quarkus.ts.http.minimum.HelloResourceTest#HelloResourceTest` => `HelloResourceTest`
### How to Reproduce?
Reproducer:
1. `git clone git@github.com:michalvavrik/quarkus-test-suite.git`
2. `cd quarkus-test-suite/http/http-minimum-reactive`
3. `git checkout -b reproducer/domain-socket-vertx-bump`
4. `mvn clean verify -Dit.test=DevModeHttpMinimumReactiveIT`
### Output of `uname -a` or `ver`
Fedora 38
### Output of `java -version`
17
### GraalVM version (if different from Java)
22.3
### Quarkus version or git rev
999-SNAPSHOT
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.9.1
### Additional information
_No response_ | 8d4b3d135bfaffb6dfd6bc455c13eea6c2c026c2 | 2828c0a0a8b3225ba0ef61d4da3c735a84b0d2d3 | https://github.com/quarkusio/quarkus/compare/8d4b3d135bfaffb6dfd6bc455c13eea6c2c026c2...2828c0a0a8b3225ba0ef61d4da3c735a84b0d2d3 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java
index 51fddadc5f5..88453151ec3 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java
@@ -235,6 +235,9 @@ public void executionStarted(TestIdentifier testIdentifier) {
startTimes.put(testIdentifier, System.currentTimeMillis());
String testClassName = "";
Class<?> testClass = getTestClassFromSource(testIdentifier.getSource());
+ if (testClass != null) {
+ testClassName = testClass.getName();
+ }
for (TestRunListener listener : listeners) {
listener.testStarted(testIdentifier, testClassName);
} | ['core/deployment/src/main/java/io/quarkus/deployment/dev/testing/JunitTestRunner.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,796,881 | 5,286,158 | 680,782 | 6,284 | 166 | 19 | 3 | 1 | 1,372 | 160 | 372 | 53 | 1 | 2 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,174 | quarkusio/quarkus/33680/32963 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32963 | https://github.com/quarkusio/quarkus/pull/33680 | https://github.com/quarkusio/quarkus/pull/33680 | 1 | fix | Reactive Client - Mutiny Dropped Exception on Cancel (stream+json) | ### Describe the bug
After canceling a subscription to a Multi from the reactive client, I see error logs like
`2023-04-27 11:51:47,838 ERROR [io.qua.mut.run.MutinyInfrastructure] (vert.x-eventloop-thread-0) Mutiny had to drop the following exception: io.vertx.core.http.HttpClosedException: Connection was closed`
This error log looks identical to what was seen in https://github.com/quarkusio/quarkus/issues/27489 and fixed in a PR linked in that issue, but it is occurring in my code. The difference seems to be that my client is dealing with these media types
```
@Produces(RestMediaType.APPLICATION_STREAM_JSON)
@RestStreamElementType(MediaType.APPLICATION_JSON)
```
rather than `MediaType.SERVER_SENT_EVENTS`
### Expected behavior
The `Cancellable` will cancel gracefully/without lingering error logs in the client
### Actual behavior
error logs as copied in description
### How to Reproduce?
Reproducer: `service3` (client) and `service4` (server) in https://github.com/fleckware/quarkus-test
1. in one terminal `./gradlew service4:quarkusDev`
2. in a separate terminal `./gradlew service3:quarkusDev`
3. in a separate terminal `curl localhost:8080/service3/test/cancel`
It sleeps for 10 seconds before trying to cancel, then observe error logs in client
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
openjdk 11.0.10
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.0
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
gradle 7.4.2
### Additional information
_No response_ | 3212b8a6f87dd4860caeea91906824950554ed5f | 42edefe6f39af5ab6110950d7e817720a9eed970 | https://github.com/quarkusio/quarkus/compare/3212b8a6f87dd4860caeea91906824950554ed5f...42edefe6f39af5ab6110950d7e817720a9eed970 | diff --git a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/MultiInvoker.java b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/MultiInvoker.java
index e84f30da72e..9a0efc53b29 100644
--- a/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/MultiInvoker.java
+++ b/independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/MultiInvoker.java
@@ -241,7 +241,6 @@ public void handle(Buffer buffer) {
});
// this captures the end of the response
- // FIXME: won't this call complete twice()?
vertxClientResponse.endHandler(v -> {
multiRequest.emitter.complete();
});
@@ -265,9 +264,9 @@ public void handle(Buffer chunk) {
try {
R item = restClientRequestContext.readEntity(in, responseType, response.getMediaType(),
response.getMetadata());
- multiRequest.emitter.emit(item);
+ multiRequest.emit(item);
} catch (IOException e) {
- multiRequest.emitter.fail(e);
+ multiRequest.fail(e);
}
}
});
@@ -275,7 +274,7 @@ public void handle(Buffer chunk) {
if (t == ConnectionBase.CLOSED_EXCEPTION) {
// we can ignore this one since we registered a closeHandler
} else {
- multiRequest.emitter.fail(t);
+ multiRequest.fail(t);
}
});
vertxClientResponse.endHandler(new Handler<Void>() { | ['independent-projects/resteasy-reactive/client/runtime/src/main/java/org/jboss/resteasy/reactive/client/impl/MultiInvoker.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,605,040 | 5,247,713 | 676,518 | 6,251 | 332 | 54 | 7 | 1 | 1,612 | 204 | 410 | 53 | 2 | 1 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,175 | quarkusio/quarkus/33667/33623 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33623 | https://github.com/quarkusio/quarkus/pull/33667 | https://github.com/quarkusio/quarkus/pull/33667 | 1 | fix | Regression - Unable to build native binary when using quarkus-kafka-client extension | ### Describe the bug
See https://github.com/quarkusio/quarkus/issues/32968.
Steps to reproduce are the same.
Root cause differs for released Quarkus versions and snapshot:
- `3.0.2.Final` / `3.0.3.Final` / `3.0.4.Final` / `3.1.0.CR1`
```
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved method during parsing: io.quarkus.kafka.client.runtime.ui.KafkaUiUtils.<init>(io.quarkus.kafka.client.runtime.KafkaAdminClient, io.quarkus.kafka.client.runtime.ui.KafkaTopicClient, java.util.Map). This error is reported at image build time because class io.quarkus.kafka.client.runtime.ui.KafkaUiUtils_Bean is registered for linking at image build time by command line
```
- `999-SNAPSHOT` (2023-05-25)
```
Caused by: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: io.netty.util.internal.logging.Log4J2Logger. This error is reported at image build time because class io.netty.util.internal.logging.Log4J2LoggerFactory is registered for linking at image build time by command line
```
See attached logs:
[kafka-client-3-0-2-final.log](https://github.com/quarkusio/quarkus/files/11572911/kafka-client-3-0-2-final.log)
[kafka-client-3-0-3-final.log](https://github.com/quarkusio/quarkus/files/11572912/kafka-client-3-0-3-final.log)
[kafka-client-3-0-4-final.log](https://github.com/quarkusio/quarkus/files/11572913/kafka-client-3-0-4-final.log)
[kafka-client-3-1-0-cr1.log](https://github.com/quarkusio/quarkus/files/11572914/kafka-client-3-1-0-cr1.log)
[kafka-client-999-snapshot.log](https://github.com/quarkusio/quarkus/files/11572915/kafka-client-999-snapshot.log)
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
[code-with-quarkus.zip](https://github.com/quarkusio/quarkus/files/11575553/code-with-quarkus.zip)
unzip && cd && mvn clean verify -Dnative
Alternative reproducer for `999-SNAPSHOT`:
[code-with-quarkus_999-SNAPSHOT.zip](https://github.com/quarkusio/quarkus/files/11611945/code-with-quarkus_999-SNAPSHOT.zip)
### Output of `uname -a` or `ver`
Linux 6.2.15-200.fc37.x86_64
### Output of `java -version`
openjdk 17.0.7 2023-04-18
### GraalVM version (if different from Java)
GraalVM 22.3.2.1-Final Java 17 Mandrel Distribution
### Quarkus version or git rev
3.0.2.Final, 3.0.3.Final, 3.0.4.Final, 3.1.0.CR1, 999-SNAPSHOT (2023-05-25)
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
3.8.6
### Additional information
_No response_ | 7987b282516e6b32ec1dd1a2e2d9e7de12798d44 | 3a3acdf2d3fe651609ac41f0047ff8ca5c8c6739 | https://github.com/quarkusio/quarkus/compare/7987b282516e6b32ec1dd1a2e2d9e7de12798d44...3a3acdf2d3fe651609ac41f0047ff8ca5c8c6739 | diff --git a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
index 2c8f91193f6..d2ced26b180 100644
--- a/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
+++ b/extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java
@@ -539,12 +539,19 @@ void registerServiceBinding(Capabilities capabilities,
}
}
+ @BuildStep
+ public AdditionalBeanBuildItem kafkaAdmin() {
+ return AdditionalBeanBuildItem.builder()
+ .addBeanClass(KafkaAdminClient.class)
+ .setUnremovable()
+ .build();
+ }
+
// Kafka UI related stuff
- @BuildStep
+ @BuildStep(onlyIf = IsDevelopment.class)
public AdditionalBeanBuildItem kafkaClientBeans() {
return AdditionalBeanBuildItem.builder()
- .addBeanClass(KafkaAdminClient.class)
.addBeanClass(KafkaTopicClient.class)
.addBeanClass(KafkaUiUtils.class)
.setUnremovable() | ['extensions/kafka-client/deployment/src/main/java/io/quarkus/kafka/client/deployment/KafkaProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,611,282 | 5,248,802 | 676,636 | 6,251 | 359 | 75 | 11 | 1 | 2,594 | 195 | 767 | 64 | 8 | 2 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,176 | quarkusio/quarkus/33645/28971 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/28971 | https://github.com/quarkusio/quarkus/pull/33645 | https://github.com/quarkusio/quarkus/pull/33645 | 1 | fix | Quarkus Maven Plugin unable to handle maven exclusions | ### Describe the bug
One of the artifacts in my POM has `ehcache` as a dependency, but when I'm trying to exclude it as follows:
```
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-rt-ws-security</artifactId>
<exclusions>
<exclusion>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</exclusion>
</exclusions>
</dependency>
```
I'm getting this error:
```
[ERROR] [error]: Build step io.quarkus.deployment.index.ApplicationArchiveBuildStep#build threw an exception: java.lang.RuntimeException: Could not resolve artifact org.ehcache:ehcache::jar among the runtime dependencies of the application
[ERROR] at io.quarkus.deployment.index.ApplicationArchiveBuildStep.addIndexDependencyPaths(ApplicationArchiveBuildStep.java:188)
[ERROR] at io.quarkus.deployment.index.ApplicationArchiveBuildStep.scanForOtherIndexes(ApplicationArchiveBuildStep.java:151)
[ERROR] at io.quarkus.deployment.index.ApplicationArchiveBuildStep.build(ApplicationArchiveBuildStep.java:108)
[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:567)
[ERROR] at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
[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:835)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [Help 1]
```
Is it a known bug?
I tried to downgrade to the older version (from 2.13.0.Final to 2.12.1.Final) and it worked, so it must be a regression.
### Expected behavior
Successful build without an error.
### Actual behavior
Plugin throws java.lang.RuntimeException.
### 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_ | 2a867eea956cf5d83657541c4b60f8b3e426c112 | f79f2c2249c22cb404a6a5ec63299aadbc618a41 | https://github.com/quarkusio/quarkus/compare/2a867eea956cf5d83657541c4b60f8b3e426c112...f79f2c2249c22cb404a6a5ec63299aadbc618a41 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
index 89f62b23054..cb4b7289fe2 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java
@@ -6,7 +6,6 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -168,35 +167,28 @@ private void addIndexDependencyPaths(List<IndexDependencyBuildItem> indexDepende
if (indexDependencyBuildItems.isEmpty()) {
return;
}
- final Collection<ResolvedDependency> userDeps = curateOutcomeBuildItem.getApplicationModel()
- .getRuntimeDependencies();
- final Map<ArtifactKey, ResolvedDependency> userMap = new HashMap<>(userDeps.size());
- for (ResolvedDependency dep : userDeps) {
- userMap.put(dep.getKey(), dep);
+ final Set<ArtifactKey> indexDependencyKeys = new HashSet<>(indexDependencyBuildItems.size());
+ for (IndexDependencyBuildItem indexDependencyBuildItem : indexDependencyBuildItems) {
+ indexDependencyKeys.add(ArtifactKey.of(indexDependencyBuildItem.getGroupId(),
+ indexDependencyBuildItem.getArtifactId(),
+ indexDependencyBuildItem.getClassifier(),
+ ArtifactCoords.TYPE_JAR));
}
- try {
- for (IndexDependencyBuildItem indexDependencyBuildItem : indexDependencyBuildItems) {
- final ArtifactKey key = ArtifactKey.of(indexDependencyBuildItem.getGroupId(),
- indexDependencyBuildItem.getArtifactId(),
- indexDependencyBuildItem.getClassifier(),
- ArtifactCoords.TYPE_JAR);
- final ResolvedDependency artifact = userMap.get(key);
- if (artifact == null) {
- throw new RuntimeException(
- "Additional dependency to be indexed (added via 'quarkus.index-dependency' configuration) "
- + key
- + " could not be found among the runtime dependencies of the application. Either remove the indexing configuration or add the dependency to your build system.");
- }
- for (Path path : artifact.getContentTree().getRoots()) {
- if (!root.isExcludedFromIndexing(path) && !root.getResolvedPaths().contains(path)
+ for (ResolvedDependency dep : curateOutcomeBuildItem.getApplicationModel().getDependencies()) {
+ if (dep.isRuntimeCp() && indexDependencyKeys.contains(dep.getKey())) {
+ for (Path path : dep.getContentTree().getRoots()) {
+ if (!root.isExcludedFromIndexing(path)
+ && !root.getResolvedPaths().contains(path)
&& indexedDeps.add(path)) {
- appArchives.add(createApplicationArchive(buildCloseables, indexCache, path, key,
- removedResources));
+ try {
+ appArchives.add(createApplicationArchive(buildCloseables, indexCache, path, dep.getKey(),
+ removedResources));
+ } catch (IOException e) {
+ throw new UncheckedIOException(e);
+ }
}
}
}
- } catch (IOException e) {
- throw new RuntimeException(e);
}
}
| ['core/deployment/src/main/java/io/quarkus/deployment/index/ApplicationArchiveBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,592,600 | 5,245,139 | 676,204 | 6,249 | 2,919 | 487 | 42 | 1 | 2,890 | 208 | 676 | 74 | 0 | 2 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,177 | quarkusio/quarkus/33644/33501 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33501 | https://github.com/quarkusio/quarkus/pull/33644 | https://github.com/quarkusio/quarkus/pull/33644 | 1 | fix | gradle multi module project build fails when quarkus.bootstrap.workspace-discovery is enabled | ### Describe the bug
After upgrading Quarkus to 3.0.3, my multi-module gradle project fails to build with the following error when `quarkus.bootstrap.workspace-discovery` is set as `true`.
```
❯ ./gradlew clean build
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:quarkusBuild'.
> Could not copy file '/.../multi-module/code-with-quarkus/app/build/quarkus-build/dep/lib/main/org.acme.main' to '/.../multi-module/code-with-quarkus/app/build/quarkus-app/lib/main/org.acme.main'.
> Cannot create directory '/.../multi-module/code-with-quarkus/app/build/quarkus-app/lib/main/org.acme.main' as it already exists, but is not a directory
```
INFO logs show that the build fails at `quarkusBuild` task.
```
> Task :app:quarkusBuild FAILED
Caching disabled for task ':app:quarkusBuild' because:
Build cache is disabled
Task ':app:quarkusBuild' is not up-to-date because:
Task has failed previously.
Removing output files and directories (provide a clean state).
Synchronizing Quarkus build for jar packaging from /.../multi-module/code-with-quarkus/app/build/quarkus-build/app/quarkus-app and /.../multi-module/code-with-quarkus/app/build/quarkus-build/dep into /.../multi-module/code-with-quarkus/app/build/quarkus-app
```
If I set `quarkus.bootstrap.workspace-discovery` to `false`, the project builds successfully.
### Expected behavior
`./gradlew build` finishes successfully.
### Actual behavior
`./gradlew build` fails with the above error.
### How to Reproduce?
1. download and unzip [project.zip](https://github.com/quarkusio/quarkus/files/11518944/project.zip)
2. `cd code-with-quarkus`
3. run `./gradlew clean build` twice
### Output of `uname -a` or `ver`
Darwin KEFUJII-M-Q636 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 version "18.0.2.1" 2022-08-18
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.3
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 8.1
### Additional information
_No response_ | 2a867eea956cf5d83657541c4b60f8b3e426c112 | 30d8579297610f1f3a355b9ae0fc6cbab5c49bff | https://github.com/quarkusio/quarkus/compare/2a867eea956cf5d83657541c4b60f8b3e426c112...30d8579297610f1f3a355b9ae0fc6cbab5c49bff | diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java
index 10d841997ac..2e7b714ff72 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java
@@ -18,6 +18,7 @@
import io.quarkus.bootstrap.model.ApplicationModel;
import io.quarkus.deployment.pkg.PackageConfig;
+import io.quarkus.fs.util.ZipUtils;
import io.quarkus.gradle.QuarkusPlugin;
import io.quarkus.maven.dependency.ArtifactKey;
import io.quarkus.maven.dependency.DependencyFlags;
@@ -175,10 +176,22 @@ private void jarDependencies(Path libBoot, Path libMain) {
getLogger().debug("Dependency {} : copying {} to {}",
dep.toGACTVString(),
p, target);
- try {
- Files.copy(p, target);
- } catch (IOException e) {
- throw new GradleException(String.format("Failed to copy %s to %s", p, target), e);
+ if (Files.isDirectory(p)) {
+ // This case can happen when we are building a jar from inside the Quarkus repository
+ // and Quarkus Bootstrap's localProjectDiscovery has been set to true. In such a case
+ // the non-jar dependencies are the Quarkus dependencies picked up on the file system
+ try {
+ ZipUtils.zip(p, target);
+ } catch (IOException e) {
+ throw new GradleException(
+ String.format("Failed to archive classes at %s into %s", p, target), e);
+ }
+ } else {
+ try {
+ Files.copy(p, target);
+ } catch (IOException e) {
+ throw new GradleException(String.format("Failed to copy %s to %s", p, target), e);
+ }
}
}
}); | ['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,592,600 | 5,245,139 | 676,204 | 6,249 | 1,440 | 219 | 21 | 1 | 2,182 | 236 | 613 | 66 | 1 | 2 | 1970-01-01T00:28:05 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,548 | quarkusio/quarkus/22502/21265 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21265 | https://github.com/quarkusio/quarkus/pull/22502 | https://github.com/quarkusio/quarkus/pull/22502 | 1 | fixes | No instance of TenantResolver was found for persistence unit <default> | ### Describe the bug
After updating from quarkus 2.2.0 to version 2.3.1.Final (I tried also with version 2.4.1.Final) I added the annotation @PersistenceUnitExtension as mentioned in the migration guide here:
[Migration Guide 2.3 Quarkus](https://github.com/quarkusio/quarkus/wiki/Migration-Guide-2.3)
I am dynamically retrieving the schema. No named persistence Unit.
Quarkus is working with the new annotation and also the schema is correctly retrieved after quarkus has booted up, but **at startup** I get the following error message:
`HHH000342: Could not obtain connection to query metadata: java.lang.IllegalStateException: No instance of TenantResolver was found for persistence unit <default>. You need to create an implementation for this interface to allow resolving the current tenant identifier.`
But I get this error message only at startup. To me it looks like it's a startup order issue.
Can somebody approve this?
My Code:
```
import io.quarkus.hibernate.orm.PersistenceUnitExtension;
import io.quarkus.hibernate.orm.runtime.tenant.TenantResolver;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
@RequestScoped
@PersistenceUnitExtension
@Slf4j
public class CustomTenantResolver implements TenantResolver {
@PostConstruct
private void postConstruct() {
log.info( "CustomTenantResolver constructed!" );
}
@Override
public String getDefaultTenantId() {
log.info( "getDefaultTenantId" );
return "public";
}
@Override
public String resolveTenantId() {
log.info( "resolveTenantId" );
String schema = TenantContext.getCurrentTenant();
if ( schema == null ) {
return "public";
}
log.info( "current schema {}", schema );
return schema;
}
}
```
Only if needed my application.properties
```
# datasource settings
quarkus.http.port=8080
quarkus.hibernate-orm.multitenant=SCHEMA
quarkus.datasource.jdbc.url=jdbc:postgresql://localhost:5432/db
quarkus.datasource.db-kind=postgresql
quarkus.datasource.username=useraa
quarkus.datasource.password=myPassword
quarkus.datasource.jdbc.initial-size=2
quarkus.datasource.jdbc.min-size=2
quarkus.datasource.jdbc.max-size=8
quarkus.transaction-manager.default-transaction-timeout=300S
quarkus.flyway.migrate-at-start=false
quarkus.flyway.schemas=public
quarkus.package.type=uber-jar
# Logging
quarkus.log.level=INFO
quarkus.log.min-level=INFO
#%dev.quarkus.log.level=DEBUG
#%dev.quarkus.log.min-level=DEBUG
# Rest-api settings
portal-api/mp-rest/url=http://localhost:8180/
portal-api/mp-rest/scope=javax.inject.Singleton
org.eclipse.microprofile.rest.client.propagateHeaders=Authorization
# Rest-api settings
# OIDC Configuration
quarkus.oidc.auth-server-url=http://localhost:8280/auth/realms/software
quarkus.oidc.token.issuer=https://mywebsite.at/auth/realms/turniersoftware
quarkus.oidc.client-id=quarkus-pea
quarkus.oidc.credentials.secret=mySecretCode
# Enable Policy Enforcement
quarkus.keycloak.policy-enforcer.enable=false
# Dev variables
#quarkus.log.level=INFO
#quarkus.log.min-level=DEBUG
#quarkus.log.category."io.undertow".level=DEBUG
```
**//SOLUTION found by nmvr2600:**
Add `@default` annotation to your class from the package: `import javax.enterprise.inject.Default;`
```
import javax.enterprise.context.RequestScoped;
import javax.enterprise.inject.Default;
@Default
@RequestScoped
@PersistenceUnitExtension
@Slf4j
public class CustomTenantResolver implements TenantResolver {
...
```
### Expected behavior
No error message on startup.
### Actual behavior
I get the no instance of tenantResolver was found exception.
### How to Reproduce?
_No response_
### 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.4.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | a43f46e60adf656c67a3ea274094c21b857e9fbb | 7aab5f94836afef2c127197a7eec08b8e8532f9a | https://github.com/quarkusio/quarkus/compare/a43f46e60adf656c67a3ea274094c21b857e9fbb...7aab5f94836afef2c127197a7eec08b8e8532f9a | diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java
index c5fef6c9cc1..1455be9ea39 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java
@@ -7,7 +7,6 @@
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.SessionScoped;
-import javax.enterprise.inject.Default;
import org.hibernate.engine.jdbc.connections.spi.AbstractMultiTenantConnectionProvider;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
@@ -17,7 +16,6 @@
import io.quarkus.arc.InjectableInstance;
import io.quarkus.arc.InstanceHandle;
import io.quarkus.arc.ManagedContext;
-import io.quarkus.hibernate.orm.PersistenceUnit.PersistenceUnitLiteral;
import io.quarkus.hibernate.orm.runtime.PersistenceUnitUtil;
/**
@@ -107,20 +105,18 @@ private static ConnectionProvider resolveConnectionProvider(String persistenceUn
* @return Current tenant resolver.
*/
private static InstanceHandle<TenantResolver> tenantResolver(String persistenceUnitName) {
- InstanceHandle<TenantResolver> resolverInstance;
- if (PersistenceUnitUtil.isDefaultPersistenceUnit(persistenceUnitName)) {
- resolverInstance = Arc.container().instance(TenantResolver.class, Default.Literal.INSTANCE);
- } else {
- resolverInstance = Arc.container().instance(TenantResolver.class,
- new PersistenceUnitLiteral(persistenceUnitName));
- }
- if (!resolverInstance.isAvailable()) {
+ InjectableInstance<TenantResolver> instance = PersistenceUnitUtil
+ .legacySingleExtensionInstanceForPersistenceUnit(
+ TenantResolver.class, persistenceUnitName);
+
+ if (instance.isUnsatisfied()) {
throw new IllegalStateException(String.format(Locale.ROOT,
"No instance of %1$s was found for persistence unit %2$s. "
+ "You need to create an implementation for this interface to allow resolving the current tenant identifier.",
TenantResolver.class.getSimpleName(), persistenceUnitName));
}
- return resolverInstance;
+
+ return instance.getHandle();
}
} | ['extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/tenant/HibernateMultiTenantConnectionProvider.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,015,128 | 3,683,567 | 484,285 | 4,717 | 914 | 154 | 18 | 1 | 4,206 | 370 | 990 | 150 | 4 | 3 | 1970-01-01T00:27:20 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,211 | quarkusio/quarkus/32723/32591 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32591 | https://github.com/quarkusio/quarkus/pull/32723 | https://github.com/quarkusio/quarkus/pull/32723 | 1 | fixes | Unrecognized configuration key set by DevServices | ### Describe the bug
When starting a application that use the postgress jdbc dev services and an empty application.properties, this warning is printed in the startup log:
`Unrecognized configuration key "quarkus.datasource.jdbc.url" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo`
### Expected behavior
Dev Services should not set Unrecognized configuration keys or at least not show the warning
### Actual behavior
User are warned about something they can not do anything about
### How to Reproduce?
Reproducer: https://github.com/phillip-kruger/devui-example
1) clone the about repo and start the app, you should see the warning in the log
### Output of `uname -a` or `ver`
Linux pkruger-laptop 6.2.9-200.fc37.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 30 22:31:57 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
OpenJDK 64-Bit Server VM (Red_Hat-17.0.6.0.10-1.fc37) (build 17.0.6+10, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
999-SNAPSHOT
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.5 (3599d3414f046de2324203b78ddcf9b5e4388aa0)
### Additional information
As discussed here: https://github.com/quarkusio/quarkus/pull/32563#issuecomment-1505174872 | b422d5b26765a35839314f8f746b3b11e59bcdab | e20b37dae461d48094801ed6c325e328bcefec17 | https://github.com/quarkusio/quarkus/compare/b422d5b26765a35839314f8f746b3b11e59bcdab...e20b37dae461d48094801ed6c325e328bcefec17 | diff --git a/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java b/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java
index 83af2b468d6..bfeafc14aa2 100644
--- a/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java
+++ b/extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java
@@ -23,6 +23,8 @@
import io.quarkus.datasource.deployment.spi.DevServicesDatasourceResultBuildItem;
import io.quarkus.datasource.runtime.DataSourceBuildTimeConfig;
import io.quarkus.datasource.runtime.DataSourcesBuildTimeConfig;
+import io.quarkus.deployment.Capabilities;
+import io.quarkus.deployment.Capability;
import io.quarkus.deployment.IsNormal;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
@@ -57,7 +59,9 @@ public class DevServicesDatasourceProcessor {
static volatile boolean first = true;
@BuildStep
- DevServicesDatasourceResultBuildItem launchDatabases(CurateOutcomeBuildItem curateOutcomeBuildItem,
+ DevServicesDatasourceResultBuildItem launchDatabases(
+ Capabilities capabilities,
+ CurateOutcomeBuildItem curateOutcomeBuildItem,
DockerStatusBuildItem dockerStatusBuildItem,
List<DefaultDataSourceDbKindBuildItem> installedDrivers,
List<DevServicesDatasourceProviderBuildItem> devDBProviders,
@@ -133,7 +137,7 @@ DevServicesDatasourceResultBuildItem launchDatabases(CurateOutcomeBuildItem cura
Map<String, DevServicesDatasourceProvider> devDBProviderMap = devDBProviders.stream()
.collect(Collectors.toMap(DevServicesDatasourceProviderBuildItem::getDatabase,
DevServicesDatasourceProviderBuildItem::getDevServicesProvider));
- RunningDevService defaultDevService = startDevDb(null, curateOutcomeBuildItem, installedDrivers,
+ RunningDevService defaultDevService = startDevDb(null, capabilities, curateOutcomeBuildItem, installedDrivers,
!dataSourceBuildTimeConfig.namedDataSources.isEmpty(),
devDBProviderMap,
dataSourceBuildTimeConfig.defaultDataSource,
@@ -145,7 +149,7 @@ DevServicesDatasourceResultBuildItem launchDatabases(CurateOutcomeBuildItem cura
}
defaultResult = toDbResult(defaultDevService);
for (Map.Entry<String, DataSourceBuildTimeConfig> entry : dataSourceBuildTimeConfig.namedDataSources.entrySet()) {
- RunningDevService namedDevService = startDevDb(entry.getKey(), curateOutcomeBuildItem,
+ RunningDevService namedDevService = startDevDb(entry.getKey(), capabilities, curateOutcomeBuildItem,
installedDrivers, true,
devDBProviderMap, entry.getValue(), configHandlersByDbType, propertiesMap,
dockerStatusBuildItem,
@@ -192,7 +196,9 @@ private String trim(String optional) {
return optional.trim();
}
- private RunningDevService startDevDb(String dbName,
+ private RunningDevService startDevDb(
+ String dbName,
+ Capabilities capabilities,
CurateOutcomeBuildItem curateOutcomeBuildItem,
List<DefaultDataSourceDbKindBuildItem> installedDrivers,
boolean hasNamedDatasources,
@@ -314,8 +320,17 @@ private RunningDevService startDevDb(String dbName,
Map<String, String> devDebProperties = new HashMap<>();
for (DevServicesDatasourceConfigurationHandlerBuildItem devDbConfigurationHandlerBuildItem : configHandlers) {
- devDebProperties.putAll(devDbConfigurationHandlerBuildItem.getConfigProviderFunction()
- .apply(dbName, datasource));
+ Map<String, String> properties = devDbConfigurationHandlerBuildItem.getConfigProviderFunction().apply(dbName,
+ datasource);
+ for (Map.Entry<String, String> entry : properties.entrySet()) {
+ if (entry.getKey().contains(".jdbc.") && entry.getKey().endsWith(".url")) {
+ if (capabilities.isCapabilityWithPrefixPresent(Capability.AGROAL)) {
+ devDebProperties.put(entry.getKey(), entry.getValue());
+ }
+ } else {
+ devDebProperties.put(entry.getKey(), entry.getValue());
+ }
+ }
}
setDataSourceProperties(devDebProperties, dbName, "db-kind", defaultDbKind.get());
if (datasource.getUsername() != null) { | ['extensions/datasource/deployment/src/main/java/io/quarkus/datasource/deployment/devservices/DevServicesDatasourceProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,294,458 | 5,186,637 | 669,164 | 6,200 | 1,817 | 324 | 27 | 1 | 1,395 | 186 | 390 | 46 | 2 | 0 | 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 |
2,552 | quarkusio/quarkus/22318/21067 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21067 | https://github.com/quarkusio/quarkus/pull/22318 | https://github.com/quarkusio/quarkus/pull/22318 | 1 | fixes | Hibernate Panache sorting not working with Named Query | ### Describe the bug
Sorting not working with Named Query
```
@Entity
@NamedQueries({
@NamedQuery(name = "countFruit",
query = "FROM Fruit")
})
public class Fruit extends PanacheEntity {
@Column(length = 40, unique = true)
public String name;
public static List<Fruit> listSortedFruitsByNamedQuery() {
return list("#countFruit", Sort.by("name").ascending(), new HashMap<>()); // Not sorting
}
public static List<Fruit> listSortedFruits() {
return list("FROM Fruit", Sort.by("name").ascending(), new HashMap<>()); //Sorting is done
}
}
```
### Expected behavior
find, list and stream functions should support sorting for named queries also.
### Actual behavior
No errors, but the result list is not sorted if named query is used
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
openjdk version "11.0.11"
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.3.0.FINAL
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.6.3
### Additional information
Possible related issue: https://github.com/quarkusio/quarkus/issues/20758 | ab8818d486958a324ec83f55963086b916f47e7a | 0eb6caf4618dc8c6abfbfae5b633f49c5812f40a | https://github.com/quarkusio/quarkus/compare/ab8818d486958a324ec83f55963086b916f47e7a...0eb6caf4618dc8c6abfbfae5b633f49c5812f40a | diff --git a/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/AbstractJpaOperations.java b/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/AbstractJpaOperations.java
index 63f987a9f7e..717e433a4d7 100644
--- a/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/AbstractJpaOperations.java
+++ b/extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/AbstractJpaOperations.java
@@ -196,9 +196,13 @@ public PanacheQueryType find(Class<?> entityClass, String query, Object... param
public PanacheQueryType find(Class<?> entityClass, String query, Sort sort, Object... params) {
String findQuery = PanacheJpaUtil.createFindQuery(entityClass, query, paramCount(params));
EntityManager em = getEntityManager(entityClass);
- // FIXME: check for duplicate ORDER BY clause?
if (PanacheJpaUtil.isNamedQuery(query)) {
String namedQuery = query.substring(1);
+ if (sort != null) {
+ throw new IllegalArgumentException(
+ "Sort cannot be used with named query, add an \\"order by\\" clause to the named query \\"" + namedQuery
+ + "\\" instead");
+ }
NamedQueryUtil.checkNamedQuery(entityClass, namedQuery);
return createPanacheQuery(em, query, PanacheJpaUtil.toOrderBy(sort), params);
}
@@ -212,9 +216,13 @@ public PanacheQueryType find(Class<?> entityClass, String query, Map<String, Obj
public PanacheQueryType find(Class<?> entityClass, String query, Sort sort, Map<String, Object> params) {
String findQuery = PanacheJpaUtil.createFindQuery(entityClass, query, paramCount(params));
EntityManager em = getEntityManager(entityClass);
- // FIXME: check for duplicate ORDER BY clause?
if (PanacheJpaUtil.isNamedQuery(query)) {
String namedQuery = query.substring(1);
+ if (sort != null) {
+ throw new IllegalArgumentException(
+ "Sort cannot be used with named query, add an \\"order by\\" clause to the named query \\"" + namedQuery
+ + "\\" instead");
+ }
NamedQueryUtil.checkNamedQuery(entityClass, namedQuery);
return createPanacheQuery(em, query, PanacheJpaUtil.toOrderBy(sort), params);
}
diff --git a/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java b/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java
index 03e920604d2..b8c6e53508f 100644
--- a/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java
+++ b/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java
@@ -192,9 +192,13 @@ public PanacheQueryType find(Class<?> entityClass, String query, Object... param
public PanacheQueryType find(Class<?> entityClass, String query, Sort sort, Object... params) {
String findQuery = PanacheJpaUtil.createFindQuery(entityClass, query, paramCount(params));
Uni<Mutiny.Session> session = getSession();
- // FIXME: check for duplicate ORDER BY clause?
if (PanacheJpaUtil.isNamedQuery(query)) {
String namedQuery = query.substring(1);
+ if (sort != null) {
+ throw new IllegalArgumentException(
+ "Sort cannot be used with named query, add an \\"order by\\" clause to the named query \\"" + namedQuery
+ + "\\" instead");
+ }
NamedQueryUtil.checkNamedQuery(entityClass, namedQuery);
return createPanacheQuery(session, query, PanacheJpaUtil.toOrderBy(sort), params);
}
@@ -208,9 +212,13 @@ public PanacheQueryType find(Class<?> entityClass, String query, Map<String, Obj
public PanacheQueryType find(Class<?> entityClass, String query, Sort sort, Map<String, Object> params) {
String findQuery = PanacheJpaUtil.createFindQuery(entityClass, query, paramCount(params));
Uni<Mutiny.Session> session = getSession();
- // FIXME: check for duplicate ORDER BY clause?
if (PanacheJpaUtil.isNamedQuery(query)) {
String namedQuery = query.substring(1);
+ if (sort != null) {
+ throw new IllegalArgumentException(
+ "Sort cannot be used with named query, add an \\"order by\\" clause to the named query \\"" + namedQuery
+ + "\\" instead");
+ }
NamedQueryUtil.checkNamedQuery(entityClass, namedQuery);
return createPanacheQuery(session, query, PanacheJpaUtil.toOrderBy(sort), params);
}
diff --git a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java
index 1569e415ae2..2daf1aa31eb 100644
--- a/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java
+++ b/integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java
@@ -170,6 +170,8 @@ public String testModel() {
Assertions.assertEquals(person, persons.get(0));
Assertions.assertEquals(1, Person.find("#Person.getByName", Parameters.with("name", "stef")).count());
Assertions.assertThrows(PanacheQueryException.class, () -> Person.find("#Person.namedQueryNotFound").list());
+ Assertions.assertThrows(IllegalArgumentException.class,
+ () -> Person.find("#Person.getByName", Sort.by("name"), Parameters.with("name", "stef")));
NamedQueryEntity.find("#NamedQueryMappedSuperClass.getAll").list();
NamedQueryEntity.find("#NamedQueryEntity.getAll").list();
NamedQueryWith2QueriesEntity.find("#NamedQueryWith2QueriesEntity.getAll1").list();
@@ -711,6 +713,8 @@ public String testModelDao() {
Assertions.assertEquals(1, persons.size());
Assertions.assertEquals(person, persons.get(0));
Assertions.assertThrows(PanacheQueryException.class, () -> personDao.find("#Person.namedQueryNotFound").list());
+ Assertions.assertThrows(IllegalArgumentException.class,
+ () -> personDao.find("#Person.getByName", Sort.by("name"), Parameters.with("name", "stef")));
namedQueryRepository.find("#NamedQueryMappedSuperClass.getAll").list();
namedQueryRepository.find("#NamedQueryEntity.getAll").list();
namedQueryWith2QueriesRepository.find("#NamedQueryWith2QueriesEntity.getAll1").list();
diff --git a/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java b/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java
index aefb180316f..4a9ca0cb80f 100644
--- a/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java
+++ b/integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java
@@ -224,7 +224,10 @@ public Uni<String> testModel() {
return assertThrows(PanacheQueryException.class,
() -> Person.find("#Person.namedQueryNotFound").list(),
"singleResult should have thrown");
- }).flatMap(v -> NamedQueryEntity.list("#NamedQueryMappedSuperClass.getAll"))
+ }).flatMap(v -> assertThrows(IllegalArgumentException.class,
+ () -> Person.list("#Person.getByName", Sort.by("name"), Parameters.with("name", "stef")),
+ "Should have thrown sort exception"))
+ .flatMap(v -> NamedQueryEntity.list("#NamedQueryMappedSuperClass.getAll"))
.flatMap(v -> NamedQueryEntity.list("#NamedQueryEntity.getAll"))
.flatMap(v -> NamedQueryWith2QueriesEntity.list("#NamedQueryWith2QueriesEntity.getAll1"))
.flatMap(v -> NamedQueryWith2QueriesEntity.list("#NamedQueryWith2QueriesEntity.getAll2"))
@@ -966,7 +969,10 @@ public Uni<String> testModelDao() {
return assertThrows(PanacheQueryException.class,
() -> personDao.find("#Person.namedQueryNotFound").list(),
"singleResult should have thrown");
- }).flatMap(v -> namedQueryRepository.list("#NamedQueryMappedSuperClass.getAll"))
+ }).flatMap(v -> assertThrows(IllegalArgumentException.class,
+ () -> personDao.list("#Person.getByName", Sort.by("name"), Parameters.with("name", "stef")),
+ "Should have thrown sort exception"))
+ .flatMap(v -> namedQueryRepository.list("#NamedQueryMappedSuperClass.getAll"))
.flatMap(v -> namedQueryRepository.list("#NamedQueryEntity.getAll"))
.flatMap(v -> namedQueryWith2QueriesRepository.list("#NamedQueryWith2QueriesEntity.getAll1"))
.flatMap(v -> namedQueryWith2QueriesRepository.list("#NamedQueryWith2QueriesEntity.getAll2")) | ['extensions/panache/hibernate-orm-panache-common/runtime/src/main/java/io/quarkus/hibernate/orm/panache/common/runtime/AbstractJpaOperations.java', 'extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/AbstractJpaOperations.java', 'integration-tests/hibernate-orm-panache/src/main/java/io/quarkus/it/panache/TestEndpoint.java', 'integration-tests/hibernate-reactive-panache/src/main/java/io/quarkus/it/panache/reactive/TestEndpoint.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 18,981,216 | 3,676,500 | 483,408 | 4,708 | 1,334 | 228 | 24 | 2 | 1,272 | 159 | 310 | 61 | 1 | 1 | 1970-01-01T00:27:19 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,553 | quarkusio/quarkus/22303/22302 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22302 | https://github.com/quarkusio/quarkus/pull/22303 | https://github.com/quarkusio/quarkus/pull/22303 | 1 | fixes | QuarkusMainTest intercepts spurious strings | ### Describe the bug
The `QuarkusMainTest`s are spuriously intercepting output coming from different sources.
### Expected behavior
The `QuarkusMainTest`s report back only the output from the specific launched `Process`.
### Actual behavior
_No response_
### How to Reproduce?
I started reducing the error down to a test in this codebase.
In `io.quarkus.it.picocli.PicocliTest` add the following test:
```java
@Test
public void testLogCapturing(QuarkusMainLauncher launcher) {
org.jboss.logging.Logger.getLogger("test").error("error");
LaunchResult result = launcher.launch("with-method-sub-command", "hello", "-n", "World!");
assertThat(result.exitCode()).isZero();
assertThat(result.getOutput()).isEqualTo("Hello World!");
}
```
and the test will fail with an error similar to:
```bash
[ERROR] Failures:
[ERROR] PicocliTest.testLogCapturing:43
expected: "Hello World!"
but was: "2021-12-16 19:28:23,647 ERROR [test] (main) error
Hello World!"
[INFO]
[ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 0
```
The expectation is that the test should pass.
### 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
`main`
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 0357aae9eb34eeab48e1824c8098bbf1c312933d | 83b3c5d8edfc151a81a757d2b7fcce076fe2ba31 | https://github.com/quarkusio/quarkus/compare/0357aae9eb34eeab48e1824c8098bbf1c312933d...83b3c5d8edfc151a81a757d2b7fcce076fe2ba31 | diff --git a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
index 8e12135244a..72aef382f78 100644
--- a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
+++ b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
@@ -51,6 +51,9 @@ public abstract class QuarkusConsole {
public final static PrintStream ORIGINAL_OUT = System.out;
public final static PrintStream ORIGINAL_ERR = System.err;
+ public static PrintStream REDIRECT_OUT = null;
+ public static PrintStream REDIRECT_ERR = null;
+
public synchronized static void installRedirects() {
if (redirectsInstalled) {
return;
@@ -60,8 +63,31 @@ public synchronized static void installRedirects() {
//force console init
//otherwise you can get a stack overflow as it sees the redirected output
QuarkusConsole.INSTANCE.isInputSupported();
- System.setOut(new RedirectPrintStream(false));
- System.setErr(new RedirectPrintStream(true));
+ REDIRECT_OUT = new RedirectPrintStream(false);
+ REDIRECT_ERR = new RedirectPrintStream(true);
+ System.setOut(REDIRECT_OUT);
+ System.setErr(REDIRECT_ERR);
+ }
+
+ public synchronized static void uninstallRedirects() {
+ if (!redirectsInstalled) {
+ return;
+ }
+
+ if (REDIRECT_OUT != null) {
+ REDIRECT_OUT.flush();
+ REDIRECT_OUT.close();
+ REDIRECT_OUT = null;
+ }
+ if (REDIRECT_ERR != null) {
+ REDIRECT_ERR.flush();
+ REDIRECT_ERR.close();
+ REDIRECT_ERR = null;
+ }
+ System.setOut(ORIGINAL_OUT);
+ System.setErr(ORIGINAL_ERR);
+
+ redirectsInstalled = false;
}
public static boolean hasColorSupport() {
diff --git a/integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java b/integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java
index 43a97fc52c6..1c69b4baae3 100644
--- a/integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java
+++ b/integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java
@@ -35,6 +35,14 @@ public void testMethodSubCommand(QuarkusMainLauncher launcher) {
assertThat(result.getOutput()).isEqualTo("Goodbye Test?");
}
+ @Test
+ public void testLogCapturing(QuarkusMainLauncher launcher) {
+ org.jboss.logging.Logger.getLogger("test").error("error");
+ LaunchResult result = launcher.launch("with-method-sub-command", "hello", "-n", "World!");
+ assertThat(result.exitCode()).isZero();
+ assertThat(result.getOutput()).isEqualTo("Hello World!");
+ }
+
@Test
@Launch({ "command-used-as-parent", "-p", "testValue", "child" })
public void testParentCommand(LaunchResult result) {
diff --git a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusMainTestExtension.java b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusMainTestExtension.java
index d7609c833f1..1109eb78fdd 100644
--- a/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusMainTestExtension.java
+++ b/test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusMainTestExtension.java
@@ -93,7 +93,6 @@ private void ensurePrepared(ExtensionContext extensionContext, Class<? extends Q
private LaunchResult doLaunch(ExtensionContext context, Class<? extends QuarkusTestProfile> selectedProfile,
String[] arguments) throws Exception {
ensurePrepared(context, selectedProfile);
- QuarkusConsole.installRedirects();
LogCapturingOutputFilter filter = new LogCapturingOutputFilter(prepareResult.curatedApplication, false, false,
() -> true);
QuarkusConsole.addOutputFilter(filter);
@@ -138,6 +137,7 @@ private int doJavaStart(ExtensionContext context, Class<? extends QuarkusTestPro
try {
StartupAction startupAction = prepareResult.augmentAction.createInitialRuntimeApplication();
Thread.currentThread().setContextClassLoader(startupAction.getClassLoader());
+ QuarkusConsole.installRedirects();
QuarkusTestProfile profileInstance = prepareResult.profileInstance;
@@ -168,6 +168,7 @@ private int doJavaStart(ExtensionContext context, Class<? extends QuarkusTestPro
}
throw e;
} finally {
+ QuarkusConsole.uninstallRedirects();
if (originalCl != null) {
Thread.currentThread().setContextClassLoader(originalCl);
}
@@ -226,8 +227,6 @@ public void afterAll(ExtensionContext context) throws Exception {
@Override
public void beforeAll(ExtensionContext context) throws Exception {
- QuarkusConsole.installRedirects();
currentTestClassStack.push(context.getRequiredTestClass());
-
}
} | ['test-framework/junit5/src/main/java/io/quarkus/test/junit/QuarkusMainTestExtension.java', 'core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java', 'integration-tests/picocli-native/src/test/java/io/quarkus/it/picocli/PicocliTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 18,954,560 | 3,671,269 | 482,733 | 4,702 | 961 | 191 | 30 | 1 | 1,474 | 174 | 377 | 65 | 0 | 2 | 1970-01-01T00:27:19 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,554 | quarkusio/quarkus/22271/22251 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22251 | https://github.com/quarkusio/quarkus/pull/22271 | https://github.com/quarkusio/quarkus/pull/22271 | 1 | fixes | `IllegalStateException: The current thread cannot be blocked` using `quarkus-cache` with `quarkus-resteasy-reactive` | ### Describe the bug
Using `quarkus-cache` together with reactive execution model causes an `IllegalStateException`.
Calling e.g. a reactive endpoint:
```java
@NonBlocking
@Path("/value")
public class ReactiveResource {
public static final String CACHE_NAME = "mycache";
private static int counter = 0;
@CacheResult(cacheName = CACHE_NAME)
@GET
@Produces(MediaType.TEXT_PLAIN)
public Uni<String> getValue() {
return Uni.createFrom().item("Value: " + counter++);
}
}
```
results in:
```
java.lang.IllegalStateException: The current thread cannot be blocked: vert.x-eventloop-thread-14
```
### Expected behavior
OK response.
### Actual behavior
```
2021-12-15 16:26:55,525 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-14) HTTP Request to /value failed, error id: ec3dd35b-7d65-49bb-b718-8cddaeef8715-1: java.lang.IllegalStateException: The current thread cannot be blocked: vert.x-eventloop-thread-14
at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:30)
at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:62)
at io.smallrye.mutiny.groups.UniAwait.indefinitely(UniAwait.java:43)
at io.quarkus.cache.runtime.CacheResultInterceptor.intercept(CacheResultInterceptor.java:65)
at io.quarkus.cache.runtime.CacheResultInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at org.acme.ReactiveResource_Subclass.getValue(Unknown Source)
at org.acme.ReactiveResource$quarkusrestinvoker$getValue_8f786ee95084b5bc35ad81779e5d693d969db3a2.invoke(Unknown Source)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:7)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141)
at org.jboss.resteasy.reactive.server.handlers.RestInitialHandler.beginProcessing(RestInitialHandler.java:49)
at org.jboss.resteasy.reactive.server.vertx.ResteasyReactiveVertxHandler.handle(ResteasyReactiveVertxHandler.java:17)
at org.jboss.resteasy.reactive.server.vertx.ResteasyReactiveVertxHandler.handle(ResteasyReactiveVertxHandler.java:7)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1193)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:163)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$5.handle(VertxHttpRecorder.java:362)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$5.handle(VertxHttpRecorder.java:340)
at io.vertx.ext.web.impl.RouteState.handleContext(RouteState.java:1193)
at io.vertx.ext.web.impl.RoutingContextImplBase.iterateNext(RoutingContextImplBase.java:163)
at io.vertx.ext.web.impl.RoutingContextImpl.next(RoutingContextImpl.java:141)
at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:67)
at io.vertx.ext.web.impl.RouterImpl.handle(RouterImpl.java:37)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$12.handle(VertxHttpRecorder.java:486)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$12.handle(VertxHttpRecorder.java:483)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$1.handle(VertxHttpRecorder.java:152)
at io.quarkus.vertx.http.runtime.VertxHttpRecorder$1.handle(VertxHttpRecorder.java:134)
at io.vertx.core.http.impl.Http1xServerRequestHandler.handle(Http1xServerRequestHandler.java:67)
at io.vertx.core.http.impl.Http1xServerRequestHandler.handle(Http1xServerRequestHandler.java:30)
at io.vertx.core.impl.EventLoopContext.emit(EventLoopContext.java:50)
at io.vertx.core.impl.DuplicatedContext.emit(DuplicatedContext.java:168)
at io.vertx.core.http.impl.Http1xServerConnection.handleMessage(Http1xServerConnection.java:145)
at io.vertx.core.net.impl.ConnectionBase.read(ConnectionBase.java:156)
at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:153)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
at io.netty.handler.codec.http.websocketx.extensions.WebSocketServerExtensionHandler.channelRead(WebSocketServerExtensionHandler.java:99)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.vertx.core.http.impl.Http1xUpgradeToH2CHandler.channelRead(Http1xUpgradeToH2CHandler.java:116)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.vertx.core.http.impl.Http1xOrH2CHandler.end(Http1xOrH2CHandler.java:61)
at io.vertx.core.http.impl.Http1xOrH2CHandler.channelRead(Http1xOrH2CHandler.java:38)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
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:829)
```
### How to Reproduce?
[reactive-cache-reproducer.zip](https://github.com/quarkusio/quarkus/files/7720743/reactive-cache-reproducer.zip)
Use attached reproducer:
```
unzip reactive-cache-reproducer.zip
cd reactive-cache-reproducer
mvnw clean test
```
### Output of `uname -a` or `ver`
Linux 5.15.6-200.fc35.x86_64
### Output of `java -version`
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment AdoptOpenJDK-11.0.11+9 (build 11.0.11+9) OpenJDK 64-Bit Server VM AdoptOpenJDK-11.0.11+9 (build 11.0.11+9, mixed mode)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
999-SNAPSHOT (2.6 - main)
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
### Additional information
_No response_ | 3368ca81c09bef2d74ce8c10cd83a1c389587f7d | 17e42fa5a482c0c3cac8e0a2035d08a8ac3f348c | https://github.com/quarkusio/quarkus/compare/3368ca81c09bef2d74ce8c10cd83a1c389587f7d...17e42fa5a482c0c3cac8e0a2035d08a8ac3f348c | diff --git a/extensions/cache/deployment/src/test/java/io/quarkus/cache/test/runtime/UniValueTest.java b/extensions/cache/deployment/src/test/java/io/quarkus/cache/test/runtime/UniValueTest.java
index 824a65edde1..a75ec898955 100644
--- a/extensions/cache/deployment/src/test/java/io/quarkus/cache/test/runtime/UniValueTest.java
+++ b/extensions/cache/deployment/src/test/java/io/quarkus/cache/test/runtime/UniValueTest.java
@@ -33,17 +33,16 @@ public class UniValueTest {
public void test() {
// STEP 1
// Action: a method annotated with @CacheResult and returning a Uni is called.
- // Expected effect: the method is invoked and an UnresolvedUniValue is cached.
+ // Expected effect: the method is not invoked, as Uni is lazy
// Verified by: invocations counter and CacheResultInterceptor log.
Uni<String> uni1 = cachedService.cachedMethod(KEY);
- assertEquals(1, cachedService.getInvocations());
+ assertEquals(0, cachedService.getInvocations());
// STEP 2
// Action: same call as STEP 1.
- // Expected effect: the method is invoked because the key is associated with a cached UnresolvedUniValue.
- // Verified by: invocations counter and CacheResultInterceptor log.
+ // Expected effect: the method is not invoked, as Uni is lazy
Uni<String> uni2 = cachedService.cachedMethod(KEY);
- assertEquals(2, cachedService.getInvocations());
+ assertEquals(0, cachedService.getInvocations());
// STEP 3
// Action: the Uni returned in STEP 1 is subscribed to and we wait for an item event to be fired.
@@ -51,22 +50,25 @@ public void test() {
// Verified by: subscriptions counter and CaffeineCache log.
String emittedItem1 = uni1.await().indefinitely();
assertEquals("1", emittedItem1); // This checks the subscriptions counter value.
+ //the method would be called to resolve the value
+ assertEquals(1, cachedService.getInvocations());
// STEP 4
// Action: the Uni returned in STEP 2 is subscribed to and we wait for an item event to be fired.
// Expected effect: the emitted item from STEP 3 is replaced with the emitted item from this step in the cache.
// Verified by: subscriptions counter, CaffeineCache log and different objects references between STEPS 3 and 4 emitted items.
String emittedItem2 = uni2.await().indefinitely();
- assertTrue(emittedItem1 != emittedItem2);
- assertEquals("2", emittedItem2); // This checks the subscriptions counter value.
+ assertTrue(emittedItem1 == emittedItem2);
+ assertEquals("1", emittedItem2); // This checks the subscriptions counter value.
+ assertEquals(1, cachedService.getInvocations());
// STEP 5
// Action: same call as STEP 2 but we immediately subscribe to the returned Uni and wait for an item event to be fired.
// Expected effect: the method is not invoked and the emitted item cached during STEP 4 is returned.
// Verified by: invocations and subscriptions counters, same object reference between STEPS 4 and 5 emitted items.
String emittedItem3 = cachedService.cachedMethod(KEY).await().indefinitely();
- assertEquals(2, cachedService.getInvocations());
- assertEquals("2", emittedItem3); // This checks the subscriptions counter value.
+ assertEquals(1, cachedService.getInvocations());
+ assertEquals("1", emittedItem3); // This checks the subscriptions counter value.
assertTrue(emittedItem2 == emittedItem3);
// STEP 6
@@ -74,16 +76,16 @@ public void test() {
// Expected effect: the method is invoked and an UnresolvedUniValue is cached.
// Verified by: invocations and subscriptions counters, CacheResultInterceptor log and different objects references between STEPS 5 and 6 emitted items.
String emittedItem4 = cachedService.cachedMethod("another-key").await().indefinitely();
- assertEquals(3, cachedService.getInvocations());
- assertEquals("3", emittedItem4); // This checks the subscriptions counter value.
+ assertEquals(2, cachedService.getInvocations());
+ assertEquals("2", emittedItem4); // This checks the subscriptions counter value.
assertTrue(emittedItem3 != emittedItem4);
}
@ApplicationScoped
static class CachedService {
- private int invocations;
- private int subscriptions;
+ private volatile int invocations;
+ private volatile int subscriptions;
@CacheResult(cacheName = "test-cache")
public Uni<String> cachedMethod(String key) {
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 034dc77df89..e780bbda786 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
@@ -42,43 +42,71 @@ public Object intercept(InvocationContext invocationContext) throws Throwable {
}
try {
-
- Uni<Object> cacheValue = cache.get(key, new Function<Object, Object>() {
- @Override
- public Object apply(Object k) {
- try {
- if (Uni.class.isAssignableFrom(invocationContext.getMethod().getReturnType())) {
- LOGGER.debugf("Adding %s entry with key [%s] into cache [%s]",
- UnresolvedUniValue.class.getSimpleName(), key, binding.cacheName());
- return UnresolvedUniValue.INSTANCE;
- } else {
- return invocationContext.proceed();
+ final boolean isUni = Uni.class.isAssignableFrom(invocationContext.getMethod().getReturnType());
+ if (isUni) {
+ Uni<Object> ret = cache.get(key, new Function<Object, Object>() {
+ @Override
+ public Object apply(Object k) {
+ LOGGER.debugf("Adding %s entry with key [%s] into cache [%s]",
+ UnresolvedUniValue.class.getSimpleName(), key, binding.cacheName());
+ return UnresolvedUniValue.INSTANCE;
+ }
+ }).onItem().transformToUni(o -> {
+ if (o == UnresolvedUniValue.INSTANCE) {
+ try {
+ return ((Uni<Object>) invocationContext.proceed())
+ .onItem().call(emittedValue -> cache.replaceUniValue(key, emittedValue));
+ } catch (CacheException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new CacheException(e);
}
- } catch (Throwable e) {
- throw new CacheException(e);
+ } else {
+ return Uni.createFrom().item(o);
}
+ });
+ if (binding.lockTimeout() <= 0) {
+ return ret;
}
- });
+ return ret.ifNoItem().after(Duration.ofMillis(binding.lockTimeout())).recoverWithUni(() -> {
+ try {
+ return (Uni<?>) invocationContext.proceed();
+ } catch (CacheException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new CacheException(e);
+ }
+ });
- Object value;
- if (binding.lockTimeout() <= 0) {
- value = cacheValue.await().indefinitely();
} else {
- try {
- /*
- * If the current thread started the cache value computation, then the computation is already finished since
- * it was done synchronously and the following call will never time out.
- */
- value = cacheValue.await().atMost(Duration.ofMillis(binding.lockTimeout()));
- } catch (TimeoutException e) {
- // TODO: Add statistics here to monitor the timeout.
- return invocationContext.proceed();
+ Uni<Object> cacheValue = cache.get(key, new Function<Object, Object>() {
+ @Override
+ public Object apply(Object k) {
+ try {
+ return invocationContext.proceed();
+ } catch (CacheException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new CacheException(e);
+ }
+ }
+ });
+ Object value;
+ if (binding.lockTimeout() <= 0) {
+ value = cacheValue.await().indefinitely();
+ } else {
+ try {
+ /*
+ * If the current thread started the cache value computation, then the computation is already finished
+ * since
+ * it was done synchronously and the following call will never time out.
+ */
+ value = cacheValue.await().atMost(Duration.ofMillis(binding.lockTimeout()));
+ } catch (TimeoutException e) {
+ // TODO: Add statistics here to monitor the timeout.
+ return invocationContext.proceed();
+ }
}
- }
-
- if (Uni.class.isAssignableFrom(invocationContext.getMethod().getReturnType())) {
- return resolveUni(invocationContext, cache, key, value);
- } else {
return value;
}
@@ -90,14 +118,4 @@ public Object apply(Object k) {
}
}
}
-
- private Object resolveUni(InvocationContext invocationContext, AbstractCache cache, Object key, Object value)
- throws Exception {
- if (value == UnresolvedUniValue.INSTANCE) {
- return ((Uni<Object>) invocationContext.proceed())
- .onItem().call(emittedValue -> cache.replaceUniValue(key, emittedValue));
- } else {
- return Uni.createFrom().item(value);
- }
- }
} | ['extensions/cache/deployment/src/test/java/io/quarkus/cache/test/runtime/UniValueTest.java', 'extensions/cache/runtime/src/main/java/io/quarkus/cache/runtime/CacheResultInterceptor.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 18,992,204 | 3,678,523 | 483,685 | 4,712 | 5,244 | 831 | 100 | 1 | 9,470 | 351 | 2,151 | 150 | 1 | 4 | 1970-01-01T00:27:19 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,557 | quarkusio/quarkus/22229/22218 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22218 | https://github.com/quarkusio/quarkus/pull/22229 | https://github.com/quarkusio/quarkus/pull/22229 | 1 | fixes | Cannot download a large file using RESTEasy Reactive | ### Describe the bug
I recently switched to resteasy-reactive for my application, and I'm now unable to download large files.
If I try to create a response with the following syntax:
```java
response = Response.ok(file);
```
It fails for files larger than 2GB because it tries to buffer them but it is not possible to instantiate a ByteArrayOutputStream larger than MAX_INT (there is basically an integer overflow when calling the constructor and I end up with `Request failed: java.lang.IllegalArgumentException: Negative initial size`).
When I try to pass a FileInputStream as the response entity, it does work but my application maxes one of my CPU core during the download, and if the download gets interrupted the inputstream is never closed.
### Expected behavior
It should be possible to send large files as response entities using resteasy-reactive without maxing CPU usage.
### Actual behavior
Using a File type leads to integer overflow when instantiating the response outputstream, using an inputstream maxes a CPU core and never closes the file descriptor if interrupted.
### How to Reproduce?
1. Use resteasy-reactive
2. Build a service that sends a file
3. Request a file larger than Integer.MAX_INT bytes
### Output of `uname -a` or `ver`
Linux 5.13.13-arch1-1 #1 SMP PREEMPT Thu, 26 Aug 2021 19:14:36 +0000 x86_64 GNU/Linux
### Output of `java -version`
openjdk 11.0.12 2021-07-20
### GraalVM version (if different from Java)
GraalVM 21.3.0 Java 11 CE (Java Version 11.0.13+7-jvmci-21.3-b05)
### Quarkus version or git rev
2.5.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
### Additional information
_No response_ | 3eb3ee4eab8bbcb498cb0f166a6bc9c176728ec1 | 86978e875afb05352d453ccba393a82a94af0e09 | https://github.com/quarkusio/quarkus/compare/3eb3ee4eab8bbcb498cb0f166a6bc9c176728ec1...86978e875afb05352d453ccba393a82a94af0e09 | diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/providers/serialisers/InputStreamMessageBodyHandler.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/providers/serialisers/InputStreamMessageBodyHandler.java
index 88d6c1b4bb1..aba7b355d23 100644
--- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/providers/serialisers/InputStreamMessageBodyHandler.java
+++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/providers/serialisers/InputStreamMessageBodyHandler.java
@@ -30,9 +30,10 @@ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotat
public void writeTo(InputStream inputStream, Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType,
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) throws IOException, WebApplicationException {
try {
+ byte[] buffer = new byte[8192];
int c;
- while ((c = inputStream.read()) != -1) {
- entityStream.write(c);
+ while ((c = inputStream.read(buffer)) != -1) {
+ entityStream.write(buffer, 0, c);
}
} finally {
try {
@@ -40,6 +41,11 @@ public void writeTo(InputStream inputStream, Class<?> type, Type genericType, An
} catch (IOException e) {
// Drop the exception so we don't mask real IO errors
}
+ try {
+ entityStream.close();
+ } catch (IOException e) {
+ // Drop the exception so we don't mask real IO errors
+ }
}
}
}
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/providers/serialisers/ServerFileBodyHandler.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/providers/serialisers/ServerFileBodyHandler.java
index 29ee04f42fd..4cc98c58c3c 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/providers/serialisers/ServerFileBodyHandler.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/providers/serialisers/ServerFileBodyHandler.java
@@ -1,8 +1,6 @@
package org.jboss.resteasy.reactive.server.providers.serialisers;
-import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.Consumes;
@@ -12,12 +10,9 @@
import javax.ws.rs.ext.Provider;
import org.jboss.resteasy.reactive.common.providers.serialisers.FileBodyHandler;
import org.jboss.resteasy.reactive.server.spi.ResteasyReactiveResourceInfo;
-import org.jboss.resteasy.reactive.server.spi.ServerHttpResponse;
import org.jboss.resteasy.reactive.server.spi.ServerMessageBodyWriter;
import org.jboss.resteasy.reactive.server.spi.ServerRequestContext;
-// TODO: this is very simplistic at the moment
-
@Provider
@Produces("*/*")
@Consumes("*/*")
@@ -35,13 +30,6 @@ public boolean isWriteable(Class<?> type, Type genericType, ResteasyReactiveReso
@Override
public void writeResponse(File o, Type genericType, ServerRequestContext context) throws WebApplicationException {
- ServerHttpResponse vertxResponse = context.serverResponse();
- ByteArrayOutputStream baos = new ByteArrayOutputStream((int) o.length());
- try {
- doWrite(o, baos);
- } catch (IOException e) {
- throw new WebApplicationException(e);
- }
- vertxResponse.end(baos.toByteArray());
+ context.serverResponse().sendFile(o.getAbsolutePath(), 0, o.length());
}
} | ['independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/providers/serialisers/InputStreamMessageBodyHandler.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/providers/serialisers/ServerFileBodyHandler.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 18,953,646 | 3,671,110 | 482,743 | 4,707 | 1,040 | 200 | 24 | 2 | 1,757 | 263 | 452 | 50 | 0 | 1 | 1970-01-01T00:27:19 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,558 | quarkusio/quarkus/22181/21857 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21857 | https://github.com/quarkusio/quarkus/pull/22181 | https://github.com/quarkusio/quarkus/pull/22181 | 1 | resolves | Qute: bug in `if` test | ### Describe the bug
I have the following tag:
```html
{#if user && target.status == ContentStatus:NEW && !target.voted(user)}
User: {user}<br/>
Target.status: {target.status}<br/>
Target.voted(user): {target.voted(user)}<br/>
{/if}
```
When I call it with some values, I'm getting this output:
```
User: User<2>
Target.status: ACCEPTED
Target.voted(user): false
```
This can't be right. As you see `target.status` is `ACCEPTED` (that's the correct value) but the `if` condition specifies `target.status == ContentStatus:NEW` so in theory we should never be able to get into the `if` block and display this.
I can give you instructions for reproducing but it requires you build the vixen branch and checkout the aviouf demo app. Otherwise you can perhaps point me where to look in a debugger to help you narrow it down?
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
_No response_
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
_No response_
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 5430201e8df243a4d0c2dc7ee00d2628ee9fc30f | 9710961ae845ca84e96ead8955736cec56b53026 | https://github.com/quarkusio/quarkus/compare/5430201e8df243a4d0c2dc7ee00d2628ee9fc30f...9710961ae845ca84e96ead8955736cec56b53026 | diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java
index 2bfcaf27a64..ce693ba386d 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java
@@ -14,7 +14,6 @@
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
-import java.util.stream.Collectors;
/**
* Basic {@code if} statement.
@@ -422,18 +421,77 @@ static BigDecimal getDecimal(Object value) {
static List<Object> parseParams(List<Object> params, ParserDelegate parserDelegate) {
- int highestPrecedence = 0;
- // Replace operators and composite params if needed
+ replaceOperatorsAndCompositeParams(params, parserDelegate);
+ int highestPrecedence = getHighestPrecedence(params);
+
+ if (!isGroupingNeeded(params)) {
+ // No operators or all of the same precedence
+ return params;
+ }
+
+ // Take the operators with highest precedence and form groups
+ // For example "user.active && target.status == NEW && !target.voted" becomes "user.active && [target.status == NEW] && [!target.voted]"
+ // The algorithm used is not very robust and should be improved later
+ List<Object> highestGroup = null;
+ List<Object> ret = new ArrayList<>();
+ int lastGroupdIdx = 0;
+
+ for (ListIterator<Object> iterator = params.listIterator(); iterator.hasNext();) {
+ int prevIdx = iterator.previousIndex();
+ Object param = iterator.next();
+ if (param instanceof Operator) {
+ Operator op = (Operator) param;
+ if (op.precedence == highestPrecedence) {
+ if (highestGroup == null) {
+ highestGroup = new ArrayList<>();
+ if (op.isBinary()) {
+ highestGroup.add(params.get(prevIdx));
+ }
+ }
+ highestGroup.add(param);
+ // Add non-grouped elements
+ if (prevIdx > lastGroupdIdx) {
+ int from = lastGroupdIdx > 0 ? lastGroupdIdx + 1 : 0;
+ int to = op.isBinary() ? prevIdx : prevIdx + 1;
+ params.subList(from, to).forEach(ret::add);
+ }
+ } else if (op.precedence < highestPrecedence) {
+ if (highestGroup != null) {
+ ret.add(highestGroup);
+ lastGroupdIdx = prevIdx;
+ highestGroup = null;
+ }
+ } else {
+ throw new IllegalStateException();
+ }
+ } else if (highestGroup != null) {
+ highestGroup.add(param);
+ }
+ }
+ if (highestGroup != null) {
+ ret.add(highestGroup);
+ } else {
+ // Add all remaining non-grouped elements
+ if (lastGroupdIdx + 1 != params.size()) {
+ params.subList(lastGroupdIdx + 1, params.size()).forEach(ret::add);
+ }
+ }
+ return parseParams(ret, parserDelegate);
+ }
+
+ private static boolean isGroupingNeeded(List<Object> params) {
+ // No operators or all of the same precedence
+ return params.stream().filter(p -> (p instanceof Operator)).map(p -> ((Operator) p).getPrecedence()).distinct()
+ .count() > 1;
+ }
+
+ private static void replaceOperatorsAndCompositeParams(List<Object> params, ParserDelegate parserDelegate) {
for (ListIterator<Object> iterator = params.listIterator(); iterator.hasNext();) {
Object param = iterator.next();
if (param instanceof String) {
String stringParam = param.toString();
Operator operator = Operator.from(stringParam);
if (operator != null) {
- // Binary operator
- if (operator.getPrecedence() > highestPrecedence) {
- highestPrecedence = operator.getPrecedence();
- }
if (operator.isBinary() && !iterator.hasNext()) {
throw parserDelegate.createParserError(
"binary operator [" + operator + "] set but the second operand not present for {#if} section");
@@ -457,50 +515,19 @@ static List<Object> parseParams(List<Object> params, ParserDelegate parserDelega
}
}
}
+ }
- if (params.stream().filter(p -> p instanceof Operator).map(p -> ((Operator) p).getPrecedence())
- .collect(Collectors.toSet()).size() <= 1) {
- // No binary operators or all of the same precedence
- return params;
- }
-
- // Take the operators with highest precedence and form groups
- List<Object> highestGroup = null;
- List<Object> ret = new ArrayList<>();
- int lastGroupdIdx = 0;
-
- for (ListIterator<Object> iterator = params.listIterator(); iterator.hasNext();) {
- int prevIdx = iterator.previousIndex();
- Object param = iterator.next();
- if (isBinaryOperatorEq(param, highestPrecedence)) {
- if (highestGroup == null) {
- highestGroup = new ArrayList<>();
- highestGroup.add(params.get(prevIdx));
- }
- highestGroup.add(param);
- // Add non-grouped elements
- if (prevIdx > lastGroupdIdx) {
- params.subList(lastGroupdIdx > 0 ? lastGroupdIdx + 1 : 0, prevIdx).forEach(ret::add);
- }
- } else if (isBinaryOperatorLt(param, highestPrecedence)) {
- if (highestGroup != null) {
- ret.add(highestGroup);
- lastGroupdIdx = prevIdx;
- highestGroup = null;
+ private static int getHighestPrecedence(List<Object> params) {
+ int highestPrecedence = 0;
+ for (Object param : params) {
+ if (param instanceof Operator) {
+ Operator op = (Operator) param;
+ if (op.precedence > highestPrecedence) {
+ highestPrecedence = op.precedence;
}
- } else if (highestGroup != null) {
- highestGroup.add(param);
}
}
- if (highestGroup != null) {
- ret.add(highestGroup);
- } else {
- // Add all remaining non-grouped elements
- if (lastGroupdIdx + 1 != params.size()) {
- params.subList(lastGroupdIdx + 1, params.size()).forEach(ret::add);
- }
- }
- return parseParams(ret, parserDelegate);
+ return highestPrecedence;
}
static List<Object> processCompositeParam(String stringParam, ParserDelegate parserDelegate) {
@@ -514,14 +541,6 @@ static List<Object> processCompositeParam(String stringParam, ParserDelegate par
return parseParams(split, parserDelegate);
}
- private static boolean isBinaryOperatorEq(Object val, int precedence) {
- return val instanceof Operator && ((Operator) val).getPrecedence() == precedence;
- }
-
- private static boolean isBinaryOperatorLt(Object val, int precedence) {
- return val instanceof Operator && ((Operator) val).getPrecedence() < precedence;
- }
-
@SuppressWarnings("unchecked")
static Condition createCondition(Object param, SectionBlock block, Operator operator, SectionInitContext context) {
diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/IfSectionTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/IfSectionTest.java
index 5c057c1f1ea..a8a3dc5e227 100644
--- a/independent-projects/qute/core/src/test/java/io/quarkus/qute/IfSectionTest.java
+++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/IfSectionTest.java
@@ -73,6 +73,12 @@ public void testNestedIf() {
public void testCompositeParameters() {
Engine engine = Engine.builder().addDefaults().build();
assertEquals("OK", engine.parse("{#if (true || false) && true}OK{/if}").render());
+ assertEquals("OK", engine.parse("{#if (true || false) && true && !false}OK{/if}").render());
+ assertEquals("OK", engine.parse("{#if true && true && !(true || false)}NOK{#else}OK{/if}").render());
+ assertEquals("OK", engine.parse("{#if true && true && !(true && false)}OK{#else}NOK{/if}").render());
+ assertEquals("OK", engine.parse("{#if true && !true && (true || false)}NOK{#else}OK{/if}").render());
+ assertEquals("OK", engine.parse("{#if true && (true && ( true && false))}NOK{#else}OK{/if}").render());
+ assertEquals("OK", engine.parse("{#if true && (!false || false || (true || false))}OK{#else}NOK{/if}").render());
assertEquals("OK", engine.parse("{#if (foo.or(false) || false || true) && (true)}OK{/if}").render());
assertEquals("NOK", engine.parse("{#if foo.or(false) || false}OK{#else}NOK{/if}").render());
assertEquals("OK", engine.parse("{#if false || (foo.or(false) || (false || true))}OK{#else}NOK{/if}").render());
@@ -222,6 +228,38 @@ public void testSafeExpression() {
assertEquals("OK", engine.parse("{#if hero??}OK{#else}NOK{/if}").data("hero", true).render());
}
+ @Test
+ public void testFromageCondition() {
+ Engine engine = Engine.builder().addDefaults().addValueResolver(new ReflectionValueResolver())
+ .addNamespaceResolver(NamespaceResolver.builder("ContentStatus").resolve(ec -> ContentStatus.NEW).build())
+ .build();
+ assertEquals("OK",
+ engine.parse("{#if user && target.status == ContentStatus:NEW && !target.voted(user)}NOK{#else}OK{/if}")
+ .data("user", "Stef", "target", new Target(ContentStatus.ACCEPTED)).render());
+ assertEquals("OK",
+ engine.parse("{#if user && target.status == ContentStatus:NEW && !target.voted(user)}OK{#else}NOK{/if}")
+ .data("user", "Stef", "target", new Target(ContentStatus.NEW)).render());
+ }
+
+ public static class Target {
+
+ public ContentStatus status;
+
+ public Target(ContentStatus status) {
+ this.status = status;
+ }
+
+ public boolean voted(String user) {
+ return false;
+ }
+
+ }
+
+ public enum ContentStatus {
+ NEW,
+ ACCEPTED
+ }
+
private void assertParserError(String template, String message, int line) {
Engine engine = Engine.builder().addDefaultSectionHelpers().build();
try { | ['independent-projects/qute/core/src/test/java/io/quarkus/qute/IfSectionTest.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/IfSectionHelper.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 18,951,320 | 3,670,689 | 482,685 | 4,707 | 5,923 | 1,164 | 129 | 1 | 1,303 | 190 | 322 | 59 | 0 | 2 | 1970-01-01T00:27:19 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,559 | quarkusio/quarkus/22179/22158 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22158 | https://github.com/quarkusio/quarkus/pull/22179 | https://github.com/quarkusio/quarkus/pull/22179 | 1 | fixes | NPE in SmallRyeGraphQLProcessor#buildExecutionService when using quarkus-smallrye-graphql and quarkus-jdbc-oracle | ### Describe the bug
NPE in SmallRyeGraphQLProcessor#buildExecutionService when using `quarkus-smallrye-graphql` and `quarkus-jdbc-oracle`
Regression in Quarkus 2.5.2.Final.
```
java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.smallrye.graphql.deployment.SmallRyeGraphQLProcessor#buildExecutionService threw an exception: java.lang.NullPointerException: Cannot read the array length because "buf" is null
at java.base/java.io.ByteArrayInputStream.<init>(ByteArrayInputStream.java:108)
at io.quarkus.smallrye.graphql.deployment.SmallRyeGraphQLProcessor.buildExecutionService(SmallRyeGraphQLProcessor.java:200)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887)
at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
```
### Expected behavior
Application compiles
### Actual behavior
Build fails
### How to Reproduce?
Create application with quarkus-smallrye-graphql and quarkus-jdbc-oracle
e.g. https://code.quarkus.io/api/download?s=jjB.H95
or have this defined in your project:
```xml
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-graphql</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-oracle</artifactId>
</dependency>
```
Run `mvn quarkus:dev` or `mvn clean verify` to see the error
Running `mvn clean verify -Dquarkus.platform.version=2.5.1.Final` works fine
### 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.5.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1
### Additional information
_No response_ | 5f817a1c8d0faddd07da1a78fc69037fdc096bf6 | 358305c33df3d9bfc21c9dc661ea0f2f06e61eca | https://github.com/quarkusio/quarkus/compare/5f817a1c8d0faddd07da1a78fc69037fdc096bf6...358305c33df3d9bfc21c9dc661ea0f2f06e61eca | diff --git a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
index ffe95cb2673..84058828434 100644
--- a/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
+++ b/extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java
@@ -199,10 +199,12 @@ void buildExecutionService(
Map<String, byte[]> modifiedClases = graphQLIndexBuildItem.getModifiedClases();
for (Map.Entry<String, byte[]> kv : modifiedClases.entrySet()) {
- try (ByteArrayInputStream bais = new ByteArrayInputStream(kv.getValue())) {
- indexer.index(bais);
- } catch (IOException ex) {
- LOG.warn("Could not index [" + kv.getKey() + "] - " + ex.getMessage());
+ if (kv.getKey() != null && kv.getValue() != null) {
+ try (ByteArrayInputStream bais = new ByteArrayInputStream(kv.getValue())) {
+ indexer.index(bais);
+ } catch (IOException ex) {
+ LOG.warn("Could not index [" + kv.getKey() + "] - " + ex.getMessage());
+ }
}
}
| ['extensions/smallrye-graphql/deployment/src/main/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 18,951,222 | 3,670,671 | 482,683 | 4,707 | 611 | 112 | 10 | 1 | 2,635 | 179 | 665 | 75 | 1 | 2 | 1970-01-01T00:27:19 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,560 | quarkusio/quarkus/22168/22167 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22167 | https://github.com/quarkusio/quarkus/pull/22168 | https://github.com/quarkusio/quarkus/pull/22168 | 1 | fixes | quarkus-neo4j requires docker even if devservices are disabled | ### Describe the bug
quarkus-neo4j requires docker even if devservices are disabled
```
mvn quarkus:dev -Dquarkus.devservices.enabled=false
...
2021-12-13 21:07:55,423 INFO [com.git.doc.zer.sha.org.apa.hc.cli.htt.imp.cla.HttpRequestRetryExec] (ducttape-0) Recoverable I/O exception (java.io.IOException) caught when processing request to {}->unix://localhost:2375
2021-12-13 21:07:55,508 INFO [org.tes.doc.DockerMachineClientProviderStrategy] (main) docker-machine executable was not found on PATH ([/Users/rsvoboda/.jbang/bin, /Users/rsvoboda/.sdkman/candidates/mvnd/current/bin, /Users/rsvoboda/.sdkman/candidates/maven/current/bin, /Users/rsvoboda/.sdkman/candidates/jbang/current/bin, /Users/rsvoboda/.sdkman/candidates/java/current/bin, /Users/rsvoboda/bin, /Users/rsvoboda/go/bin, /usr/local/opt/llvm/bin, /Applications/Visual Studio Code.app/Contents/Resources/app/bin, /usr/local/bin, /usr/bin, /bin, /usr/sbin, /sbin, /usr/local/munki, /Library/Apple/usr/bin])
2021-12-13 21:07:55,509 ERROR [org.tes.doc.DockerClientProviderStrategy] (main) Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
2021-12-13 21:07:55,509 ERROR [org.tes.doc.DockerClientProviderStrategy] (main) UnixSocketClientProviderStrategy: failed with exception TimeoutException (Timeout waiting for result with exception). Root cause LastErrorException ([61] Connection refused)
2021-12-13 21:07:55,509 ERROR [org.tes.doc.DockerClientProviderStrategy] (main) As no valid configuration was found, execution cannot continue
...
```
### Expected behavior
quarkus-neo4j DOES NOT requires docker when devservices are disabled
### Actual behavior
quarkus-neo4j requires docker even if devservices are disabled
### How to Reproduce?
- Generate application with quarkus-neo4j
- e.g. https://code.quarkus.io/api/download?s=pDS
- Make sure Docker or Podman is not available/running
- Run `mvn quarkus:dev -Dquarkus.devservices.enabled=false`
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
Java 17
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.5.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1
### Additional information
_No response_ | 1e34199f2361c95dfce7060bab3afd735760645f | 27dde975f6e669f416eb6c08410f075202092d95 | https://github.com/quarkusio/quarkus/compare/1e34199f2361c95dfce7060bab3afd735760645f...27dde975f6e669f416eb6c08410f075202092d95 | diff --git a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java
index 946b5ce0eec..7abda98f407 100644
--- a/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java
+++ b/extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java
@@ -6,12 +6,12 @@
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-import java.util.function.BooleanSupplier;
import org.jboss.logging.Logger;
import org.testcontainers.containers.Neo4jContainer;
import org.testcontainers.utility.DockerImageName;
+import io.quarkus.deployment.IsDockerWorking;
import io.quarkus.deployment.IsNormal;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
@@ -36,18 +36,9 @@ class Neo4jDevServicesProcessor {
static volatile Neo4jDevServiceConfig runningConfiguration;
static volatile boolean first = true;
- static final class IsDockerWorking implements BooleanSupplier {
+ private final IsDockerWorking isDockerWorking = new IsDockerWorking(true);
- private final io.quarkus.deployment.IsDockerWorking delegate = new io.quarkus.deployment.IsDockerWorking(true);
-
- @Override
- public boolean getAsBoolean() {
-
- return delegate.getAsBoolean();
- }
- }
-
- @BuildStep(onlyIfNot = IsNormal.class, onlyIf = { IsDockerWorking.class, GlobalDevServicesConfig.Enabled.class })
+ @BuildStep(onlyIfNot = IsNormal.class, onlyIf = GlobalDevServicesConfig.Enabled.class)
public Neo4jDevServiceBuildItem startNeo4jDevService(
LaunchModeBuildItem launchMode,
Neo4jBuildTimeConfig neo4jBuildTimeConfig,
@@ -109,6 +100,11 @@ public Neo4jDevServiceBuildItem startNeo4jDevService(
private Neo4jContainer<?> startNeo4j(Neo4jDevServiceConfig configuration, Optional<Duration> timeout) {
+ if (!isDockerWorking.getAsBoolean()) {
+ log.debug("Not starting Dev Services for Neo4j, as Docker is not working.");
+ return null;
+ }
+
if (!configuration.devServicesEnabled) {
log.debug("Not starting Dev Services for Neo4j, as it has been disabled in the config.");
return null;
diff --git a/extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java b/extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java
index fa0e133045a..d483f5735cd 100644
--- a/extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java
+++ b/extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java
@@ -69,7 +69,6 @@ public void shouldBeAbleToConnect() {
}
}
- @Testcontainers(disabledWithoutDocker = true)
static class WithLocallyDisabledDevServicesTest {
@RegisterExtension
@@ -91,6 +90,25 @@ public void shouldNotBeAbleToConnect() {
}
}
+ static class WithGloballyDisabledDevServicesTest {
+
+ @RegisterExtension
+ static QuarkusUnitTest test = new QuarkusUnitTest()
+ .withEmptyApplication()
+ .setLogRecordPredicate(record -> true)
+ .withConfigurationResource("application.properties")
+ .overrideConfigKey("quarkus.devservices.enabled", "false");
+
+ @Inject
+ Driver driver;
+
+ @Test
+ public void shouldNotBeAbleToConnect() {
+
+ assertThatExceptionOfType(ServiceUnavailableException.class).isThrownBy(() -> driver.verifyConnectivity());
+ }
+ }
+
@Testcontainers(disabledWithoutDocker = true)
static class WithExplicitPropertyTest {
| ['extensions/neo4j/deployment/src/main/java/io/quarkus/neo4j/deployment/Neo4jDevServicesProcessor.java', 'extensions/neo4j/deployment/src/test/java/io/quarkus/neo4j/deployment/Neo4jDevModeTests.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,208,619 | 3,734,960 | 491,951 | 5,052 | 877 | 189 | 20 | 1 | 2,363 | 218 | 656 | 54 | 1 | 1 | 1970-01-01T00:27:19 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,561 | quarkusio/quarkus/22037/21864 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21864 | https://github.com/quarkusio/quarkus/pull/22037 | https://github.com/quarkusio/quarkus/pull/22037 | 1 | resolves | Qute: extension tags not registered | ### Describe the bug
I just tried the latest Quarkus/Qute to see if it would pick up my Vixen extension tags, declared in `extensions/vixen/runtime/src/main/resources/templates/tags` (in the runtime module) and they're not visible to the user application, I'm getting errors.
Perhaps I'm doing it wrong and they need to be in the deployment module?
### 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_ | 963e380f19aa087f1973ff9b5fd8d496aae9a5f4 | 965ec14aee9eb8e4a8aa5668d7e337f1f9785cd1 | https://github.com/quarkusio/quarkus/compare/963e380f19aa087f1973ff9b5fd8d496aae9a5f4...965ec14aee9eb8e4a8aa5668d7e337f1f9785cd1 | 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 3594df36ea8..1b91ef972fe 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
@@ -9,8 +9,9 @@
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
+import java.io.UncheckedIOException;
import java.lang.reflect.Modifier;
-import java.nio.charset.StandardCharsets;
+import java.nio.file.FileSystem;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
@@ -80,6 +81,7 @@
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.pkg.builditem.CurateOutcomeBuildItem;
import io.quarkus.deployment.util.JandexUtil;
+import io.quarkus.fs.util.ZipUtils;
import io.quarkus.gizmo.ClassOutput;
import io.quarkus.maven.dependency.Dependency;
import io.quarkus.maven.dependency.ResolvedDependency;
@@ -383,22 +385,17 @@ public CompletionStage<ResultNode> resolve(SectionResolutionContext context) {
public Optional<TemplateLocation> locate(String id) {
TemplatePathBuildItem found = templatePaths.stream().filter(p -> p.getPath().equals(id)).findAny().orElse(null);
if (found != null) {
- try {
- byte[] content = Files.readAllBytes(found.getFullPath());
- return Optional.of(new TemplateLocation() {
- @Override
- public Reader read() {
- return new StringReader(new String(content, StandardCharsets.UTF_8));
- }
+ return Optional.of(new TemplateLocation() {
+ @Override
+ public Reader read() {
+ return new StringReader(found.getContent());
+ }
- @Override
- public Optional<Variant> getVariant() {
- return Optional.empty();
- }
- });
- } catch (IOException e) {
- LOGGER.warn("Unable to read the template from path: " + found.getFullPath(), e);
- }
+ @Override
+ public Optional<Variant> getVariant() {
+ return Optional.empty();
+ }
+ });
}
return Optional.empty();
}
@@ -1234,15 +1231,27 @@ void collectTemplates(ApplicationArchivesBuildItem applicationArchives,
// Skip extension archives that are also application archives
continue;
}
- for (Path p : artifact.getResolvedPaths()) {
- if (Files.isDirectory(p)) {
+ for (Path path : artifact.getResolvedPaths()) {
+ if (Files.isDirectory(path)) {
// Try to find the templates in the root dir
- Path basePath = Files.list(p).filter(QuteProcessor::isBasePath).findFirst().orElse(null);
+ Path basePath = Files.list(path).filter(QuteProcessor::isBasePath).findFirst().orElse(null);
if (basePath != null) {
- LOGGER.debugf("Found extension templates dir: %s", p);
- basePaths.add(basePath);
+ LOGGER.debugf("Found extension templates dir: %s", path);
+ scan(basePath, basePath, BASE_PATH + "/", watchedPaths, templatePaths, nativeImageResources,
+ config.templatePathExclude);
break;
}
+ } else {
+ try (FileSystem artifactFs = ZipUtils.newFileSystem(path)) {
+ Path basePath = artifactFs.getPath(BASE_PATH);
+ if (Files.exists(basePath)) {
+ LOGGER.debugf("Found extension templates in: %s", path);
+ scan(basePath, basePath, BASE_PATH + "/", watchedPaths, templatePaths, nativeImageResources,
+ config.templatePathExclude);
+ }
+ } catch (IOException e) {
+ LOGGER.warnf(e, "Unable to create the file system from the path: %s", path);
+ }
}
}
}
@@ -1254,14 +1263,12 @@ void collectTemplates(ApplicationArchivesBuildItem applicationArchives,
if (basePath != null) {
LOGGER.debugf("Found templates dir: %s", basePath);
basePaths.add(basePath);
+ scan(basePath, basePath, BASE_PATH + "/", watchedPaths, templatePaths, nativeImageResources,
+ config.templatePathExclude);
break;
}
}
}
- for (Path base : basePaths) {
- scan(base, base, BASE_PATH + "/", watchedPaths, templatePaths, nativeImageResources,
- config.templatePathExclude);
- }
}
@BuildStep
@@ -2114,7 +2121,7 @@ private static void produceTemplateBuildItems(BuildProducer<TemplatePathBuildIte
// NOTE: we cannot just drop the template because a template param can be added
watchedPaths.produce(new HotDeploymentWatchedFileBuildItem(fullPath, true));
nativeImageResources.produce(new NativeImageResourceBuildItem(fullPath));
- templatePaths.produce(new TemplatePathBuildItem(filePath, originalPath));
+ templatePaths.produce(new TemplatePathBuildItem(filePath, originalPath, readTemplateContent(originalPath)));
}
private void scan(Path root, Path directory, String basePath, BuildProducer<HotDeploymentWatchedFileBuildItem> watchedPaths,
@@ -2191,6 +2198,14 @@ private boolean isApplicationArchive(ResolvedDependency dependency, Set<Applicat
return false;
}
+ static String readTemplateContent(Path path) {
+ try {
+ return Files.readString(path);
+ } catch (IOException e) {
+ throw new UncheckedIOException("Unable to read the template content from path: " + path, e);
+ }
+ }
+
/**
* Java members lookup config.
*
diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplatePathBuildItem.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplatePathBuildItem.java
index f10580ae2bd..c8dedb9539a 100644
--- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplatePathBuildItem.java
+++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplatePathBuildItem.java
@@ -13,10 +13,12 @@ public final class TemplatePathBuildItem extends MultiBuildItem {
private final String path;
private final Path fullPath;
+ private final String content;
- public TemplatePathBuildItem(String path, Path fullPath) {
+ public TemplatePathBuildItem(String path, Path fullPath, String content) {
this.path = path;
this.fullPath = fullPath;
+ this.content = content;
}
/**
@@ -49,4 +51,8 @@ public boolean isRegular() {
return !isTag();
}
+ public String getContent() {
+ return content;
+ }
+
}
diff --git a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devconsole/QuteDevConsoleProcessor.java b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devconsole/QuteDevConsoleProcessor.java
index 9dee337d5a1..2a1f8c67f0d 100644
--- a/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devconsole/QuteDevConsoleProcessor.java
+++ b/extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devconsole/QuteDevConsoleProcessor.java
@@ -3,11 +3,7 @@
import static io.netty.handler.codec.http.HttpHeaderNames.CONTENT_TYPE;
import static io.quarkus.deployment.annotations.ExecutionTime.STATIC_INIT;
-import java.io.IOException;
import java.net.URLConnection;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -124,18 +120,9 @@ private CheckedTemplateBuildItem findCheckedTemplate(String basePath, List<Check
private Map<String, String> processVariants(List<TemplatePathBuildItem> templatePaths, List<String> variants) {
Map<String, String> variantsMap = new HashMap<>();
for (String variant : variants) {
- String source = "";
- Path sourcePath = templatePaths.stream().filter(p -> p.getPath().equals(variant))
- .map(TemplatePathBuildItem::getFullPath).findFirst()
+ String source = templatePaths.stream().filter(p -> p.getPath().equals(variant))
+ .map(TemplatePathBuildItem::getContent).findFirst()
.orElse(null);
- if (sourcePath != null) {
- try {
- byte[] content = Files.readAllBytes(sourcePath);
- source = new String(content, StandardCharsets.UTF_8);
- } catch (IOException e) {
- LOG.warn("Unable to read the template from path: " + sourcePath, e);
- }
- }
source = source.replace("\\n", "\\\\n");
variantsMap.put(variant, source);
} | ['extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/devconsole/QuteDevConsoleProcessor.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/TemplatePathBuildItem.java', 'extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 18,981,616 | 3,676,533 | 483,538 | 4,731 | 4,942 | 816 | 92 | 3 | 798 | 120 | 187 | 41 | 0 | 0 | 1970-01-01T00:27:18 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,562 | quarkusio/quarkus/22036/21858 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21858 | https://github.com/quarkusio/quarkus/pull/22036 | https://github.com/quarkusio/quarkus/pull/22036 | 1 | resolves | Qute: bug in expression parser with spaces | ### Describe the bug
I can call a tag with no spaces between parameters of the following method call:
```html
{#form uri:PersonOrGroups.accept(personOrGroup.id,global:requestUrl)}
{/form}
```
But if I add a space between the parameters:
```html
{#form uri:PersonOrGroups.accept(personOrGroup.id, global:requestUrl)}
{/form}
```
I'm getting this error:
```
Caused by: io.quarkus.qute.TemplateException: Parser error in template [tags/votePersonOrGroup.html] on line 7: invalid virtual method in {uri:PersonOrGroups.accept(personOrGroup.id,}
at io.quarkus.qute.Parser.parserError(Parser.java:505)
at io.quarkus.qute.Expressions.parseVirtualMethodParams(Expressions.java:40)
at io.quarkus.qute.Parser.createPart(Parser.java:784)
at io.quarkus.qute.Parser.parseExpression(Parser.java:767)
at io.quarkus.qute.Parser.apply(Parser.java:840)
at io.quarkus.qute.Parser.apply(Parser.java:34)
at io.quarkus.qute.SectionBlock$Builder.addExpression(SectionBlock.java:168)
at io.quarkus.qute.UserTagSectionHelper$Factory.initializeBlock(UserTagSectionHelper.java:92)
at io.quarkus.qute.Parser.flushTag(Parser.java:434)
at io.quarkus.qute.Parser.tag(Parser.java:295)
at io.quarkus.qute.Parser.processCharacter(Parser.java:202)
at io.quarkus.qute.Parser.parse(Parser.java:134)
at io.quarkus.qute.EngineImpl.load(EngineImpl.java:138)
```
### 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_ | a95ed4536b15ef6d389fc290b766a050f586ff53 | 7e5f3e4480537e888ddd11c32d7f77cbb5af596e | https://github.com/quarkusio/quarkus/compare/a95ed4536b15ef6d389fc290b766a050f586ff53...7e5f3e4480537e888ddd11c32d7f77cbb5af596e | diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java
index fa4461a393a..f3a873c62c5 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java
@@ -640,6 +640,7 @@ static Iterator<String> splitSectionParams(String content, Function<String, Runt
boolean stringLiteral = false;
short composite = 0;
+ byte brackets = 0;
boolean space = false;
List<String> parts = new ArrayList<>();
StringBuilder buffer = new StringBuilder();
@@ -648,7 +649,7 @@ static Iterator<String> splitSectionParams(String content, Function<String, Runt
char c = content.charAt(i);
if (c == ' ') {
if (!space) {
- if (!stringLiteral && composite == 0) {
+ if (!stringLiteral && composite == 0 && brackets == 0) {
if (buffer.length() > 0) {
parts.add(buffer.toString());
buffer = new StringBuilder();
@@ -669,6 +670,12 @@ && isCompositeStart(c) && (i == 0 || space || composite > 0
} else if (!stringLiteral
&& isCompositeEnd(c) && composite > 0) {
composite--;
+ } else if (!stringLiteral
+ && Parser.isLeftBracket(c)) {
+ brackets++;
+ } else if (!stringLiteral
+ && Parser.isRightBracket(c) && brackets > 0) {
+ brackets--;
}
space = false;
buffer.append(c);
diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/ExpressionTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/ExpressionTest.java
index 1aa43522987..19e919b3172 100644
--- a/independent-projects/qute/core/src/test/java/io/quarkus/qute/ExpressionTest.java
+++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/ExpressionTest.java
@@ -70,7 +70,11 @@ public void testExpressions() throws InterruptedException, ExecutionException {
@Test
public void testNestedVirtualMethods() {
- Expression exp = ExpressionImpl.from("movie.findServices(movie.name,movie.toNumber(movie.getName))");
+ assertNestedVirtualMethod(ExpressionImpl.from("movie.findServices(movie.name,movie.toNumber(movie.getName))"));
+ assertNestedVirtualMethod(ExpressionImpl.from("movie.findServices(movie.name, movie.toNumber(movie.getName) )"));
+ }
+
+ private void assertNestedVirtualMethod(Expression exp) {
assertNull(exp.getNamespace());
List<Expression.Part> parts = exp.getParts();
assertEquals(2, parts.size());
diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java
index 1a12c2952f0..8b1b2c7b406 100644
--- a/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java
+++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java
@@ -188,6 +188,8 @@ public void testSectionParameters() {
"false");
assertParams("(item.name == 'foo') and (item.name is false)", "(item.name == 'foo')", "and", "(item.name is false)");
assertParams("(item.name != 'foo') || (item.name == false)", "(item.name != 'foo')", "||", "(item.name == false)");
+ assertParams("foo.codePointCount(0, foo.length) baz=bar", "foo.codePointCount(0, foo.length)", "baz=bar");
+ assertParams("foo.codePointCount( 0 , foo.length( 1)) baz=bar", "foo.codePointCount( 0 , foo.length( 1))", "baz=bar");
}
@Test
@@ -372,6 +374,15 @@ public void testInvalidParamDeclaration() {
"Parser error on line 1: invalid parameter declaration {@\\n}", 1);
}
+ @Test
+ public void testUserTagVirtualMethodParam() {
+ Engine engine = Engine.builder().addDefaults().addValueResolver(new ReflectionValueResolver())
+ .addSectionHelper(new UserTagSectionHelper.Factory("form", "form-template")).build();
+ engine.putTemplate("form-template", engine.parse("{it}"));
+ Template foo = engine.parse("{#form foo.codePointCount(0, foo.length) /}");
+ assertEquals("3", foo.data("foo", "foo").render());
+ }
+
public static class Foo {
public List<Item> getItems() { | ['independent-projects/qute/core/src/test/java/io/quarkus/qute/ExpressionTest.java', 'independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java', 'independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 18,954,298 | 3,671,548 | 482,876 | 4,725 | 445 | 78 | 9 | 1 | 1,864 | 154 | 463 | 70 | 0 | 3 | 1970-01-01T00:27:18 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,563 | quarkusio/quarkus/21986/21984 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21984 | https://github.com/quarkusio/quarkus/pull/21986 | https://github.com/quarkusio/quarkus/pull/21986 | 1 | fixes | OIDC closes its client after a successful JWK set read when the discovery is disabled | ### Describe the bug
@FroMage has discovered this bug.
As it happens this very code is tested to verify that if the JWK set read fails when the discovery is disabled then the recovery will be attempted during the client request. And all works - because an OIDC `service` application is tested and once JWKs are in, nothing else is needed if no further introspection is required.
But Steph tried it for Quarkus `web-app`... and also recommended how to fix it
### 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_ | 28207e2b3f0790ef584e36219fedf641530193b2 | 3b1a63570239097a667d1b12166d57cc69d8eb74 | https://github.com/quarkusio/quarkus/compare/28207e2b3f0790ef584e36219fedf641530193b2...3b1a63570239097a667d1b12166d57cc69d8eb74 | diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java
index 051fdbe3a86..2d4cf94ef62 100644
--- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java
+++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java
@@ -1,7 +1,6 @@
package io.quarkus.oidc.client.runtime;
import java.io.IOException;
-import java.time.Duration;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiFunction;
@@ -34,7 +33,6 @@ public class OidcClientRecorder {
private static final Logger LOG = Logger.getLogger(OidcClientRecorder.class);
private static final String DEFAULT_OIDC_CLIENT_ID = "Default";
- private static final Duration CONNECTION_BACKOFF_DURATION = Duration.ofSeconds(2);
public OidcClients setup(OidcClientsConfig oidcClientsConfig, TlsConfig tlsConfig, Supplier<Vertx> vertx) {
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 502554a93fc..5f6fbcccc38 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
@@ -259,6 +259,7 @@ protected static Uni<JsonWebKeySet> getJsonWebSetUni(OidcProviderClient client,
.expireIn(connectionDelayInMillisecs)
.onFailure()
.transform(t -> toOidcException(t, oidcConfig.authServerUrl.get()))
+ .onFailure()
.invoke(client::close);
} else {
return client.getJsonWebKeySet(); | ['extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcRecorder.java', 'extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/OidcClientRecorder.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,663,277 | 3,821,924 | 503,633 | 5,125 | 148 | 26 | 3 | 2 | 911 | 148 | 210 | 43 | 0 | 0 | 1970-01-01T00:27:18 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,564 | quarkusio/quarkus/21971/21949 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21949 | https://github.com/quarkusio/quarkus/pull/21971 | https://github.com/quarkusio/quarkus/pull/21971 | 1 | fixes | MongoDB BsonDateTime is not in the Jandex index | ### Describe the bug
When building a Quarkus application that is using mongodb-client and mongodb-panache extentions, ReflectiveHierarchyStep outputs:
```
WARN [io.qua.dep.ste.ReflectiveHierarchyStep] (build-7) Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- org.bson.BsonDateTime (source: <unknown>)
```
### Expected behavior
Expected behavior after looking at "MongoDB BSON types are not in the Jandex index #17893 " is that there should be NO warning!
### Actual behavior
A warning is logged stating the following:
```
WARN [io.qua.dep.ste.ReflectiveHierarchyStep] (build-7) Unable to properly register the hierarchy of the following classes for reflection as they are not in the Jandex index:
- org.bson.BsonDateTime (source: <unknown>)
```
### How to Reproduce?
To reproduce:
Create a sample application with the "mongodb-panache" extension
```
mvn io.quarkus:quarkus-maven-plugin:2.5.0.Final:create \\
-DprojectGroupId=com.example\\
-DprojectArtifactId=demo \\
-Dextensions=resteasy,mongodb-client,mongodb-panache
```
Add a sample entity:
```
package com.example;
import io.quarkus.mongodb.panache.common.MongoEntity;
import org.bson.BsonDateTime;
import org.bson.codecs.pojo.annotations.BsonProperty;
@MongoEntity
public class Entity {
@BsonProperty("time")
public BsonDateTime time;
}
```
Add sample repository:
```
package com.example;
import io.quarkus.mongodb.panache.PanacheMongoRepositoryBase;
public class Repo implements PanacheMongoRepositoryBase<Entity, String> {
}
```
Build project and observe mentioned message:
`mvn clean package -DskipTests
`
### Output of `uname -a` or `ver`
-
### Output of `java -version`
11
### GraalVM version (if different from Java)
-
### Quarkus version or git rev
2.5.0.final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
`Java version: 11, vendor: Oracle Corporation, runtime: /opt/jdk-11 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.10.0-693.17.1.el7.x86_64", arch: "amd64", family: "unix"`
### Additional information
_No response_ | 79e84c8693421244a63fd18d478b6ee8b44561f6 | 728a6c0d752ba447034d866fcb8b385b772f701c | https://github.com/quarkusio/quarkus/compare/79e84c8693421244a63fd18d478b6ee8b44561f6...728a6c0d752ba447034d866fcb8b385b772f701c | diff --git a/extensions/panache/mongodb-panache-common/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/BasePanacheMongoResourceProcessor.java b/extensions/panache/mongodb-panache-common/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/BasePanacheMongoResourceProcessor.java
index f7a190cf027..57cd219e5a1 100644
--- a/extensions/panache/mongodb-panache-common/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/BasePanacheMongoResourceProcessor.java
+++ b/extensions/panache/mongodb-panache-common/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/BasePanacheMongoResourceProcessor.java
@@ -42,6 +42,7 @@
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveHierarchyIgnoreWarningBuildItem;
import io.quarkus.deployment.util.JandexUtil;
import io.quarkus.gizmo.DescriptorUtils;
import io.quarkus.jackson.spi.JacksonModuleBuildItem;
@@ -68,8 +69,8 @@ public abstract class BasePanacheMongoResourceProcessor {
public static final DotName BSON_IGNORE = createSimple(BsonIgnore.class.getName());
public static final DotName BSON_PROPERTY = createSimple(BsonProperty.class.getName());
public static final DotName MONGO_ENTITY = createSimple(io.quarkus.mongodb.panache.common.MongoEntity.class.getName());
- public static final DotName OBJECT_ID = createSimple(ObjectId.class.getName());
public static final DotName PROJECTION_FOR = createSimple(io.quarkus.mongodb.panache.common.ProjectionFor.class.getName());
+ public static final String BSON_PACKAGE = "org.bson.";
@BuildStep
public void buildImperative(CombinedIndexBuildItem index,
@@ -381,8 +382,8 @@ protected void processTypes(CombinedIndexBuildItem index,
}
@BuildStep
- ReflectiveClassBuildItem registerForReflection() {
- return new ReflectiveClassBuildItem(true, true, OBJECT_ID.toString());
+ ReflectiveHierarchyIgnoreWarningBuildItem ignoreBsonTypes() {
+ return new ReflectiveHierarchyIgnoreWarningBuildItem(dotname -> dotname.toString().startsWith(BSON_PACKAGE));
}
@BuildStep | ['extensions/panache/mongodb-panache-common/deployment/src/main/java/io/quarkus/mongodb/panache/deployment/BasePanacheMongoResourceProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,645,641 | 3,818,068 | 503,283 | 5,123 | 561 | 112 | 7 | 1 | 2,261 | 255 | 569 | 92 | 0 | 5 | 1970-01-01T00:27:18 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,212 | quarkusio/quarkus/32717/32666 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32666 | https://github.com/quarkusio/quarkus/pull/32717 | https://github.com/quarkusio/quarkus/pull/32717 | 1 | fixes | Get java.nio.file.InvalidPathException on Windows when compile Quarkus 3.0.0.Final Spring Cloud Config Client | ### Describe the bug
mvn -e -Pquick-build
```log
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project quarkus-spring-cloud-config-client: Fatal error compiling: java.nio.file.InvalidPathException: Illegal char <<> at index 106: @io.smallrye.config.WithConverter(io.quarkus.runtime.configuration.PathConverter.class) java.util.Optional<java.nio.file.Path> -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0:compile (default-compile) on project quarkus-spring-cloud-config-client: Fatal error compiling
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:375)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
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:294)
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:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
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: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1143)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
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:294)
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:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
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: org.codehaus.plexus.compiler.CompilerException: java.nio.file.InvalidPathException: Illegal char <<> at index 106: @io.smallrye.config.WithConverter(io.quarkus.runtime.configuration.PathConverter.class) java.util.Optional<java.nio.file.Path>
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:198)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:183)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1140)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
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:294)
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:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
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.RuntimeException: java.nio.file.InvalidPathException: Illegal char <<> at index 106: @io.smallrye.config.WithConverter(io.quarkus.runtime.configuration.PathConverter.class) java.util.Optional<java.nio.file.Path>
at com.sun.tools.javac.api.JavacTaskImpl.invocationHelper (JavacTaskImpl.java:168)
at com.sun.tools.javac.api.JavacTaskImpl.doCall (JavacTaskImpl.java:100)
at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:94)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:136)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:183)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1140)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
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:294)
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:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
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.nio.file.InvalidPathException: Illegal char <<> at index 106: @io.smallrye.config.WithConverter(io.quarkus.runtime.configuration.PathConverter.class) java.util.Optional<java.nio.file.Path>
at sun.nio.fs.WindowsPathParser.normalize (WindowsPathParser.java:182)
at sun.nio.fs.WindowsPathParser.parse (WindowsPathParser.java:153)
at sun.nio.fs.WindowsPathParser.parse (WindowsPathParser.java:77)
at sun.nio.fs.WindowsPath.parse (WindowsPath.java:92)
at sun.nio.fs.WindowsFileSystem.getPath (WindowsFileSystem.java:232)
at java.nio.file.Path.resolve (Path.java:515)
at io.quarkus.annotation.processor.generate_doc.FsMap.hasKey (FsMap.java:44)
at io.quarkus.annotation.processor.generate_doc.ConfigDocItemFinder.isConfigGroup (ConfigDocItemFinder.java:394)
at io.quarkus.annotation.processor.generate_doc.ConfigDocItemFinder.recursivelyFindConfigItems (ConfigDocItemFinder.java:253)
at io.quarkus.annotation.processor.generate_doc.ConfigDocItemFinder.findInMemoryConfigurationItems (ConfigDocItemFinder.java:106)
at io.quarkus.annotation.processor.generate_doc.ConfigDocItemScanner.scanExtensionsConfigurationItems (ConfigDocItemScanner.java:127)
at io.quarkus.annotation.processor.ExtensionAnnotationProcessor.doFinish (ExtensionAnnotationProcessor.java:257)
at io.quarkus.annotation.processor.ExtensionAnnotationProcessor.process (ExtensionAnnotationProcessor.java:112)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor (JavacProcessingEnvironment.java:1023)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.runContributingProcs (JavacProcessingEnvironment.java:859)
at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run (JavacProcessingEnvironment.java:1265)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing (JavacProcessingEnvironment.java:1404)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations (JavaCompiler.java:1234)
at com.sun.tools.javac.main.JavaCompiler.compile (JavaCompiler.java:916)
at com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0 (JavacTaskImpl.java:104)
at com.sun.tools.javac.api.JavacTaskImpl.invocationHelper (JavacTaskImpl.java:152)
at com.sun.tools.javac.api.JavacTaskImpl.doCall (JavacTaskImpl.java:100)
at com.sun.tools.javac.api.JavacTaskImpl.call (JavacTaskImpl.java:94)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess (JavaxToolsCompiler.java:136)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile (JavacCompiler.java:183)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute (AbstractCompilerMojo.java:1140)
at org.apache.maven.plugin.compiler.CompilerMojo.execute (CompilerMojo.java:193)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:163)
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:294)
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:960)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:196)
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)
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :quarkus-spring-cloud-config-client
```
### 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_ | 89ca6e7913365f3b6407da18ae9b8ecdce8472c2 | 3e87a015d922cdddd8b5d2a9c921455a6692c31d | https://github.com/quarkusio/quarkus/compare/89ca6e7913365f3b6407da18ae9b8ecdce8472c2...3e87a015d922cdddd8b5d2a9c921455a6692c31d | diff --git a/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java b/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java
index 26035efd27f..0e5c0643f18 100644
--- a/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java
+++ b/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java
@@ -159,8 +159,6 @@ private List<ConfigDocItem> recursivelyFindConfigItems(Element element, String r
String name = null;
String defaultValue = NO_DEFAULT;
String defaultValueDoc = EMPTY;
- final TypeMirror typeMirror = unwrapTypeMirror(enclosedElement.asType());
- String type = typeMirror.toString();
List<String> acceptedValues = null;
final TypeElement clazz = (TypeElement) element;
final String fieldName = enclosedElement.getSimpleName().toString();
@@ -250,6 +248,9 @@ private List<ConfigDocItem> recursivelyFindConfigItems(Element element, String r
defaultValue = EMPTY;
}
+ TypeMirror typeMirror = unwrapTypeMirror(enclosedElement.asType());
+ String type = getType(typeMirror);
+
if (isConfigGroup(type)) {
List<ConfigDocItem> groupConfigItems = readConfigGroupItems(configPhase, rootName, name, type,
configSection, withinAMap, generateSeparateConfigGroupDocsFiles);
@@ -387,6 +388,15 @@ private TypeMirror unwrapTypeMirror(TypeMirror typeMirror) {
return typeMirror;
}
+ private String getType(TypeMirror typeMirror) {
+ if (typeMirror instanceof DeclaredType) {
+ DeclaredType declaredType = (DeclaredType) typeMirror;
+ TypeElement typeElement = (TypeElement) declaredType.asElement();
+ return typeElement.getQualifiedName().toString();
+ }
+ return typeMirror.toString();
+ }
+
private boolean isConfigGroup(String type) {
if (type.startsWith("java.") || PRIMITIVE_TYPES.contains(type)) {
return false; | ['core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,290,311 | 5,185,836 | 669,061 | 6,199 | 640 | 116 | 14 | 1 | 16,647 | 689 | 3,881 | 216 | 1 | 1 | 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 |
2,210 | quarkusio/quarkus/32752/32724 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32724 | https://github.com/quarkusio/quarkus/pull/32752 | https://github.com/quarkusio/quarkus/pull/32752 | 1 | fix | Undertow: Servlet context path failing with `_static` directory | ### Describe the bug
Running PrimeFaces Integration Tests with 999-SNAPSHOT nightly gets this..
```
An error occured while initializing MyFaces:
Unable to get listed resource _static from directory for path from underlying manager io.undertow.server.handlers.resource.ClassPathResourceManager@35c3d6e8
```
Caused by fix for: https://github.com/quarkusio/quarkus/issues/28028
### Expected behavior
No error to occur
### Actual behavior
```
An error occured while initializing MyFaces:
Unable to get listed resource _static from directory for path from underlying manager io.undertow.server.handlers.resource.ClassPathResourceManager@35c3d6e8
```
### How to Reproduce?
See PrimeFaces Extension nightly integration Test: https://github.com/quarkiverse/quarkus-primefaces/actions/runs/4728799924/jobs/8390684815
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
999-SNAPSHOT
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.9.1 (2e178502fcdbffc201671fb2537d0cb4b4cc58f8)
### Additional information
_No response_ | a26b6ec6be9bfda0d9225f62f767d304ff3e599c | 82cb5edc3a65cf190cf9c7aa224495a2ab5d486e | https://github.com/quarkusio/quarkus/compare/a26b6ec6be9bfda0d9225f62f767d304ff3e599c...82cb5edc3a65cf190cf9c7aa224495a2ab5d486e | diff --git a/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java b/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java
index f0db4f8b070..5846c627da3 100644
--- a/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java
+++ b/extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java
@@ -12,6 +12,8 @@
import java.util.List;
import java.util.Set;
+import io.quarkus.bootstrap.classloading.ClassPathElement;
+import io.quarkus.bootstrap.classloading.QuarkusClassLoader;
import io.quarkus.deployment.ApplicationArchive;
import io.quarkus.deployment.Capabilities;
import io.quarkus.deployment.Capability;
@@ -22,7 +24,6 @@
import io.quarkus.deployment.builditem.LaunchModeBuildItem;
import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
import io.quarkus.runtime.LaunchMode;
-import io.quarkus.runtime.util.ClassPathUtils;
/**
* NOTE: Shared with Resteasy standalone!
@@ -56,8 +57,8 @@ void scanStaticResources(Capabilities capabilities, ApplicationArchivesBuildItem
}
//we need to check for web resources in order to get welcome files to work
//this kinda sucks
- Set<String> knownFiles = new HashSet<>();
- Set<String> knownDirectories = new HashSet<>();
+ final Set<String> knownFiles = new HashSet<>();
+ final Set<String> knownDirectories = new HashSet<>();
for (ApplicationArchive i : applicationArchivesBuildItem.getAllApplicationArchives()) {
i.accept(tree -> {
Path resource = tree.getPath(META_INF_RESOURCES);
@@ -67,9 +68,14 @@ void scanStaticResources(Capabilities capabilities, ApplicationArchivesBuildItem
});
}
- ClassPathUtils.consumeAsPaths(META_INF_RESOURCES, resource -> {
- collectKnownPaths(resource, knownFiles, knownDirectories);
- });
+ for (ClassPathElement e : QuarkusClassLoader.getElements(META_INF_RESOURCES, false)) {
+ if (e.isRuntime()) {
+ e.apply(tree -> {
+ collectKnownPaths(tree.getPath(META_INF_RESOURCES), knownFiles, knownDirectories);
+ return null;
+ });
+ }
+ }
for (GeneratedWebResourceBuildItem genResource : generatedWebResources) {
String sub = genResource.getName();
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 440a8d6f5f2..8b653f334f3 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
@@ -39,19 +39,19 @@ public class QuarkusClassLoader extends ClassLoader implements Closeable {
registerAsParallelCapable();
}
- public static List<ClassPathElement> getElements(String resourceName, boolean localOnly) {
+ public static List<ClassPathElement> getElements(String resourceName, boolean onlyFromCurrentClassLoader) {
final ClassLoader ccl = Thread.currentThread().getContextClassLoader();
if (!(ccl instanceof QuarkusClassLoader)) {
throw new IllegalStateException("The current classloader is not an instance of "
+ QuarkusClassLoader.class.getName() + " but " + ccl.getClass().getName());
}
- return ((QuarkusClassLoader) ccl).getElementsWithResource(resourceName, localOnly);
+ return ((QuarkusClassLoader) ccl).getElementsWithResource(resourceName, onlyFromCurrentClassLoader);
}
- public List<ClassPathElement> getAllElements(boolean localOnly) {
+ public List<ClassPathElement> getAllElements(boolean onlyFromCurrentClassLoader) {
List<ClassPathElement> ret = new ArrayList<>();
- if (parent instanceof QuarkusClassLoader && !localOnly) {
- ret.addAll(((QuarkusClassLoader) parent).getAllElements(localOnly));
+ if (parent instanceof QuarkusClassLoader && !onlyFromCurrentClassLoader) {
+ ret.addAll(((QuarkusClassLoader) parent).getAllElements(onlyFromCurrentClassLoader));
}
ret.addAll(elements);
return ret; | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/QuarkusClassLoader.java', 'extensions/undertow/spi/src/main/java/io/quarkus/undertow/deployment/UndertowStaticResourcesBuildStep.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 26,301,098 | 5,187,902 | 669,324 | 6,200 | 1,807 | 346 | 28 | 2 | 1,301 | 139 | 339 | 49 | 2 | 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 |
2,208 | quarkusio/quarkus/32754/32696 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32696 | https://github.com/quarkusio/quarkus/pull/32754 | https://github.com/quarkusio/quarkus/pull/32754 | 1 | fix | Quarkus returns 404 on OPTIONS request for the static resources | ### Describe the bug
I have static resources under the `/src/resources/META-INF/resources` folder (ex.: /src/resources/META-INF/resources/img/document.png.
When I make a GET call for the resource - Qurkus responds with 200 OK and returns the resource
But when I make an OPTIONS call for the same resource - Quarkus responds with 404 Not found
### Expected behavior
I expected 200 OK on the OPTIONS request for the static resources.
### Actual behavior
Quarkus responds with 404 Not found on the OPTIONS request for the static resources
### How to Reproduce?
1. Add a static resource to the sample Quarkus project under the `/src/resources/META-INF/resources` folder
2. Try to call this resource with GET and OPTIONS requests.
Sample of RestAssured @QuarkusTest
- the following example returns image
```
RestAssured.given()
.contentType(ContentType.JSON)
.get("/img/document.png")
.then()
.statusCode(Matchers.equalTo(200))
```
- the following example failed with the error message [java.lang.AssertionError: 1 expectation failed. Expected status code <200> but was <404>.]
```
RestAssured.given()
.contentType(ContentType.JSON)
.options("/img/document.png")
.then()
.statusCode(Matchers.equalTo(200))
```
### Output of `uname -a` or `ver`
linux, macOS, Windows
### Output of `java -version`
openjdk 17.0.2 2022-01-18
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.16.5.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
### Additional information
_No response_ | bc8fb84fe2b6d027e55dc92c4413e2cda92a0d4a | 703ae09c3cdf7a18a3cc047f2e1eef986eae801a | https://github.com/quarkusio/quarkus/compare/bc8fb84fe2b6d027e55dc92c4413e2cda92a0d4a...703ae09c3cdf7a18a3cc047f2e1eef986eae801a | diff --git a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java
index a6a841e585b..7738d9bfe34 100644
--- a/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java
+++ b/extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java
@@ -113,6 +113,7 @@ public void accept(Route route) {
// No other HTTP methods should be used
route.method(HttpMethod.GET);
route.method(HttpMethod.HEAD);
+ route.method(HttpMethod.OPTIONS);
for (Handler<RoutingContext> i : handlers) {
route.handler(i);
} | ['extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/StaticResourcesRecorder.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,301,098 | 5,187,902 | 669,324 | 6,200 | 50 | 9 | 1 | 1 | 1,733 | 210 | 430 | 61 | 0 | 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 |
2,551 | quarkusio/quarkus/22403/22097 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22097 | https://github.com/quarkusio/quarkus/pull/22403 | https://github.com/quarkusio/quarkus/pull/22403 | 1 | fixes | integration-tests/awt fails with latest GraalVM 22.1-dev | ### Describe the bug
After the merge of https://github.com/quarkusio/quarkus/pull/20850 integration-tests/awt fails with latest GraalVM 22.0-dev
See https://github.com/oracle/graal/runs/4452553267?check_suite_focus=true#step:8:407
### Expected behavior
Test should pass.
### Actual behavior
Test fails with:
```
org.awaitility.core.ConditionTimeoutException:
Assertion condition defined as a lambda expression in io.quarkus.awt.it.TestUtil that uses java.nio.file.Path, java.nio.file.Pathjava.util.regex.Pattern, java.util.regex.Patternjava.lang.String Encoders: Log file must not contain blacklisted exceptions. See the offending lines:
Caused by: java.lang.NullPointerException
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
09:55:48 ERROR [io.qu.ve.ht.ru.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /topng/weird_230.bmp failed, error id: 5c3a314f-8975-4b29-a655-d98354c942e8-4: org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: java.lang.NullPointerException
in the context of the log: 09:55:44 INFO [io.qu.aw.it.Application] (main) Available image reader: Standard TIFF image reader
09:55:44 INFO [io.qu.aw.it.Application] (main) Available image reader: Standard WBMP Image Reader
09:55:44 INFO [io.qu.aw.it.Application] (main) Available image reader: Standard GIF image reader
09:55:44 INFO [io.qu.aw.it.Application] (main) Available image reader: Standard PNG image reader
09:55:44 INFO [io.qu.aw.it.Application] (main) Available image reader: Standard BMP Image Reader
09:55:44 INFO [io.qu.aw.it.Application] (main) Available image reader: Standard JPEG Image Reader
...
```
### How to Reproduce?
1. Grab latest GraalVM dev build from https://github.com/graalvm/graalvm-ce-dev-builds/releases/
2. `gu install native-image`
2. Set `GRAALVM_HOME` to point to the latest GraalVM
4. `./mvnw -Dnative -Dnative.surefire.skip -pl integration-tests/awt verify`
### 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_ | d9f25a2216c02ce63d7d6bbb11da6c79501cc39f | f07a9e7a51a024b53dee5b7b298acc111705db05 | https://github.com/quarkusio/quarkus/compare/d9f25a2216c02ce63d7d6bbb11da6c79501cc39f...f07a9e7a51a024b53dee5b7b298acc111705db05 | diff --git a/extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java b/extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java
index 4b8bef90827..cccab5cfe9a 100644
--- a/extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java
+++ b/extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java
@@ -1,7 +1,6 @@
package io.quarkus.awt.runtime;
import java.io.InputStream;
-import java.lang.invoke.MethodHandles;
import java.util.PropertyResourceBundle;
import com.oracle.svm.core.annotate.Substitute;
@@ -17,12 +16,10 @@ final class Target_com_sun_imageio_plugins_common_I18NImpl {
@Substitute
private static String getString(String className, String resource_name, String key) {
- // The property file is now stored in the root of the tree
- resource_name = "/" + resource_name;
PropertyResourceBundle bundle = null;
try {
// className ignored, there is only one such file in the imageio anyway
- InputStream stream = MethodHandles.lookup().lookupClass().getResourceAsStream(resource_name);
+ InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource_name);
bundle = new PropertyResourceBundle(stream);
} catch (Throwable e) {
throw new RuntimeException(e); | ['extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,000,164 | 3,680,292 | 483,913 | 4,714 | 377 | 62 | 5 | 1 | 2,288 | 236 | 601 | 59 | 3 | 1 | 1970-01-01T00:27:20 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,207 | quarkusio/quarkus/32757/32755 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32755 | https://github.com/quarkusio/quarkus/pull/32757 | https://github.com/quarkusio/quarkus/pull/32757 | 1 | fixes | [Quarkus 3.0.0.CR2] [quarkus-mailer] NullPointerException when sending with MailTemplateInstance | ### Description
Hello,
when sending an email with:
@CheckedTemplate
static class Templates {
public static native MailTemplate.MailTemplateInstance mailTemplate(String something);
}
via
`Templates.mailTemplate("This is an email").to("test@email.org").subject("Something happened").send()`
in a Resteasy Reactive resource I get a NullPointerException. It seems that no mailer gets injected.
### Stacktrace
java.lang.NullPointerException: Cannot invoke "io.quarkus.mailer.reactive.ReactiveMailer.send(io.quarkus.mailer.Mail[])" because "this.this$0.mailer" is null
at io.smallrye.mutiny.groups.UniOnFailure.lambda$call$3(UniOnFailure.java:108)
at io.smallrye.context.impl.wrappers.SlowContextualFunction.apply(SlowContextualFunction.java:21)
at io.smallrye.mutiny.operators.uni.UniOnFailureTransform$UniOnFailureTransformProcessor.onFailure(UniOnFailureTransform.java:54)
at io.smallrye.mutiny.operators.uni.UniOperatorProcessor.onFailure(UniOperatorProcessor.java:55)
at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.onFailure(UniOnItemOrFailureFlatMap.java:67)
at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.onFailure(UniOnItemOrFailureFlatMap.java:67)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownFailure$KnownFailureSubscription.forward(UniCreateFromKnownFailure.java:38)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromKnownFailure.subscribe(UniCreateFromKnownFailure.java:23)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.performInnerSubscription(UniOnItemOrFailureFlatMap.java:99)
at io.smallrye.mutiny.operators.uni.UniOnItemOrFailureFlatMap$UniOnItemOrFailureFlatMapProcessor.onItem(UniOnItemOrFailureFlatMap.java:54)
at io.smallrye.mutiny.operators.uni.UniOnItemTransform$UniOnItemTransformProcessor.onItem(UniOnItemTransform.java:43)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:60)
at io.smallrye.mutiny.operators.uni.UniOperatorProcessor.onItem(UniOperatorProcessor.java:47)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage$CompletionStageUniSubscription.forwardResult(UniCreateFromCompletionStage.java:63)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at org.hibernate.reactive.util.async.impl.AsyncTrampoline$TrampolineInternal.unroll(AsyncTrampoline.java:131)
at org.hibernate.reactive.util.async.impl.AsyncTrampoline$TrampolineInternal.lambda$unroll$0(AsyncTrampoline.java:126)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at io.vertx.core.Future.lambda$toCompletionStage$3(Future.java:384)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:100)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:34)
I am working in a reactive environment with following extensions:
### Environment
dependencies {
implementation(enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}"))
implementation("io.quarkus:quarkus-hibernate-reactive-panache")
implementation("io.quarkus:quarkus-resteasy-reactive-jackson")
implementation("io.smallrye.reactive:smallrye-mutiny-vertx-web-client")
implementation("io.quarkus:quarkus-reactive-mysql-client")
implementation("io.quarkus:quarkus-hibernate-validator")
implementation("io.quarkus:quarkus-smallrye-openapi")
implementation("io.quarkus:quarkus-config-yaml")
implementation("io.quarkus:quarkus-scheduler")
implementation("io.quarkus:quarkus-qute")
implementation("io.quarkus:quarkus-mailer")
implementation("io.quarkus:quarkus-arc")
testImplementation("io.quarkus:quarkus-junit5")
testImplementation("io.rest-assured:rest-assured")
}
#Gradle properties
#Tue Apr 18 20:56:58 CEST 2023
quarkusPluginVersion=3.0.0.CR2
quarkusPlatformArtifactId=quarkus-bom
quarkusPluginId=io.quarkus
quarkusPlatformGroupId=io.quarkus.platform
quarkusPlatformVersion=3.0.0.CR2
As a workaround I need to Inject an unused instance of ReactiveMailer to be able to send an email.
@Inject
ReactiveMailer reactiveMailer;
Using the bare reactiveMailer works, too.
If you need further information please tell me. | e21d108afef6bf1aa5da6b70d539aa0f57b2b791 | 5e58d94aed9b52b07d83010d15bbc5864b5c655e | https://github.com/quarkusio/quarkus/compare/e21d108afef6bf1aa5da6b70d539aa0f57b2b791...5e58d94aed9b52b07d83010d15bbc5864b5c655e | diff --git a/extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java b/extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java
index 4d5dc582cf7..26efb777517 100644
--- a/extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java
+++ b/extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java
@@ -27,6 +27,7 @@
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.ExtensionSslNativeSupportBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
@@ -45,6 +46,7 @@
import io.quarkus.mailer.runtime.Mailers;
import io.quarkus.mailer.runtime.MailersBuildTimeConfig;
import io.quarkus.mailer.runtime.MailersRuntimeConfig;
+import io.quarkus.qute.CheckedTemplate;
import io.quarkus.qute.deployment.CheckedTemplateAdapterBuildItem;
import io.quarkus.qute.deployment.QuteProcessor;
import io.quarkus.qute.deployment.TemplatePathBuildItem;
@@ -91,13 +93,15 @@ void registerBeans(BuildProducer<AdditionalBeanBuildItem> beans) {
@Record(ExecutionTime.STATIC_INIT)
@BuildStep
MailersBuildItem generateMailerSupportBean(MailerRecorder recorder,
+ CombinedIndexBuildItem index,
BeanDiscoveryFinishedBuildItem beans,
BuildProducer<SyntheticBeanBuildItem> syntheticBeans) {
List<InjectionPointInfo> mailerInjectionPoints = beans.getInjectionPoints().stream()
.filter(i -> SUPPORTED_INJECTION_TYPES.contains(i.getRequiredType().name()))
.collect(Collectors.toList());
- boolean hasDefaultMailer = mailerInjectionPoints.stream().anyMatch(i -> i.hasDefaultedQualifier());
+ boolean hasDefaultMailer = mailerInjectionPoints.stream().anyMatch(i -> i.hasDefaultedQualifier())
+ || !index.getIndex().getAnnotations(CheckedTemplate.class).isEmpty();
Set<String> namedMailers = mailerInjectionPoints.stream()
.map(i -> i.getRequiredQualifier(MAILER_NAME)) | ['extensions/mailer/deployment/src/main/java/io/quarkus/mailer/deployment/MailerProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,301,098 | 5,187,902 | 669,324 | 6,200 | 451 | 93 | 6 | 1 | 5,879 | 196 | 1,418 | 89 | 0 | 0 | 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 |
2,565 | quarkusio/quarkus/21947/21946 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21946 | https://github.com/quarkusio/quarkus/pull/21947 | https://github.com/quarkusio/quarkus/pull/21947 | 1 | resolves | StringIndexOutOfBoundsException in invalid parameter declaration Qute parsing | ### Describe the bug
Given this Qute template:
```
{@
}
```
When Qute parse this invalid content, it throws:
```
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: begin 1, end -1, length 1
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
at java.base/java.lang.String.substring(String.java:1874)
at io.quarkus.qute.Parser.flushTag(Parser.java:480)
at io.quarkus.qute.Parser.tag(Parser.java:293)
at io.quarkus.qute.Parser.processCharacter(Parser.java:200)
at io.quarkus.qute.Parser.parse(Parser.java:132)
at io.quarkus.qute.EngineImpl.parse(EngineImpl.java:56)
at io.quarkus.qute.Engine.parse(Engine.java:30)
```
It's annoying to have this error when you are using Qute parser in an editor.
### Expected behavior
Take acre of StringIndexOutOfBoundsException and report an error.
### Actual behavior
```
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: begin 1, end -1, length 1
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
at java.base/java.lang.String.substring(String.java:1874)
at io.quarkus.qute.Parser.flushTag(Parser.java:480)
at io.quarkus.qute.Parser.tag(Parser.java:293)
at io.quarkus.qute.Parser.processCharacter(Parser.java:200)
at io.quarkus.qute.Parser.parse(Parser.java:132)
at io.quarkus.qute.EngineImpl.parse(EngineImpl.java:56)
at io.quarkus.qute.Engine.parse(Engine.java:30)
```
### How to Reproduce?
Parse Qute template content:
```
{@
}
```
### 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_ | 4757a61b87556c456724ef63f9b8fd8068b8eacd | 6fdfa378438c2de195149409390237d4048d300d | https://github.com/quarkusio/quarkus/compare/4757a61b87556c456724ef63f9b8fd8068b8eacd...6fdfa378438c2de195149409390237d4048d300d | diff --git a/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java b/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java
index b69b5e9100c..fa4461a393a 100644
--- a/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java
+++ b/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java
@@ -477,9 +477,12 @@ private void flushTag() {
// Parameter declaration
// {@org.acme.Foo foo}
Scope currentScope = scopeStack.peek();
- int spaceIdx = content.indexOf(" ");
- String key = content.substring(spaceIdx + 1, content.length());
- String value = content.substring(1, spaceIdx);
+ String[] parts = content.substring(1).trim().split("[ ]{1,}");
+ if (parts.length != 2) {
+ throw parserError("invalid parameter declaration " + START_DELIMITER + buffer.toString() + END_DELIMITER);
+ }
+ String value = parts[0];
+ String key = parts[1];
currentScope.putBinding(key, Expressions.typeInfoFrom(value));
sectionStack.peek().currentBlock().addNode(new ParameterDeclarationNode(content, origin(0)));
} else {
diff --git a/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java b/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java
index aba4d4f4e63..1a12c2952f0 100644
--- a/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java
+++ b/independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java
@@ -358,6 +358,20 @@ public void testInvalidBracket() {
"Parser error on line 1: invalid bracket notation expression in {foo.baz[}", 1);
}
+ @Test
+ public void testInvalidParamDeclaration() {
+ assertParserError("{@com.foo }",
+ "Parser error on line 1: invalid parameter declaration {@com.foo }", 1);
+ assertParserError("{@ com.foo }",
+ "Parser error on line 1: invalid parameter declaration {@ com.foo }", 1);
+ assertParserError("{@com.foo.Bar bar baz}",
+ "Parser error on line 1: invalid parameter declaration {@com.foo.Bar bar baz}", 1);
+ assertParserError("{@}",
+ "Parser error on line 1: invalid parameter declaration {@}", 1);
+ assertParserError("{@\\n}",
+ "Parser error on line 1: invalid parameter declaration {@\\n}", 1);
+ }
+
public static class Foo {
public List<Item> getItems() { | ['independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java', 'independent-projects/qute/core/src/test/java/io/quarkus/qute/ParserTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,655,104 | 3,819,887 | 503,498 | 5,124 | 513 | 105 | 9 | 1 | 1,880 | 170 | 466 | 76 | 0 | 4 | 1970-01-01T00:27:18 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,194 | quarkusio/quarkus/33302/33284 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33284 | https://github.com/quarkusio/quarkus/pull/33302 | https://github.com/quarkusio/quarkus/pull/33302 | 1 | fix | quarkus with kubernetes and mongodb liquibase generate Job with name always the same | ### Describe the bug
Quarkus service with kubernetes and mongodb-liquibase extensions is generating deployment file with Job for running liquibase scripts. Job name is always `liquibase-mongodb-init`. Deploying 1 service is successfull. Deploying multiple services lead to error:
```
Job.batch "liquibase-mongodb-init" is invalid: spec.template: Invalid value: core.PodTemplateSpec{ObjectMeta:v1.ObjectMeta{Name:"", GenerateName:"", Namespace:"", SelfLink:"", UID:"", ResourceVersion:"", Generation:0, CreationTimestamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC), DeletionTimestamp:<nil>, DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string{"controller-uid":"***", "job-name":"liquibase-mongodb-init"}, Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Finalizers:[]string(nil), ManagedFields:[]v1.ManagedFieldsEntry(nil)}, Spec:core.PodSpec{Volumes:[]core.Volume{core.Volume{Name:"google-cloud-key", VolumeSource:core.VolumeSource{HostPath:(*core.HostPathVolumeSource)(nil), EmptyDir:(*core.EmptyDirVolumeSource)(nil), GCEPersistentDisk:(*core.GCEPersistentDiskVolumeSource)(nil), AWSElasticBlockStore:(*core.AWSElasticBlockStoreVolumeSource)(nil), GitRepo:(*core.GitRepoVolumeSource)(nil), Secret:(*core.SecretVolumeSource)(0x****), NFS:(*core.NFSVolumeSource)(nil), ISCSI:(*core.ISCSIVolumeSource)(nil), Glusterfs:(*core.GlusterfsVolumeSource)(nil), PersistentVolumeClaim:(*core.PersistentVolumeClaimVolumeSource)(nil), RBD:(*core.RBDVolumeSource)(nil), Quobyte:(*core.QuobyteVolumeSource)(nil), FlexVolume:(*core.FlexVolumeSource)(nil), Cinder:(*core.CinderVolumeSource)(nil), CephFS:(*core.CephFSVolumeSource)(nil), Flocker:(*core.FlockerVolumeSource)(nil), DownwardAPI:(*core.DownwardAPIVolumeSource)(nil), FC:(*core.FCVolumeSource)(nil), AzureFile:(*core.AzureFileVolumeSource)(nil), ConfigMap:(*core.ConfigMapVolumeSource)(nil), VsphereVolume:(*core.VsphereVirtualDiskVolumeSource)(nil), AzureDisk:(*core.AzureDiskVolumeSource)(nil), PhotonPersistentDisk:(*core.PhotonPersistentDiskVolumeSource)(nil), Projected:(*core.ProjectedVolumeSource)(nil), PortworxVolume:(*core.PortworxVolumeSource)(nil), ScaleIO:(*core.ScaleIOVolumeSource)(nil), StorageOS:(*core.StorageOSVolumeSource)(nil), CSI:(*core.CSIVolumeSource)(nil), Ephemeral:(*core.EphemeralVolumeSource)(nil)}}}, InitContainers:[]core.Container(nil), Containers:[]core.Container{core.Container{Name:"liquibase-mongodb-init", Image:"***", Command:[]string(nil), Args:[]string(nil), WorkingDir:"", Ports:[]core.ContainerPort(nil), EnvFrom:[]core.EnvFromSource{core.EnvFromSource{Prefix:"", ConfigMapRef:(*core.ConfigMapEnvSource)(nil), SecretRef:(*core.SecretEnvSource)(0x***)}, core.EnvFromSource{Prefix:"", ConfigMapRef:(*core.ConfigMapEnvSource)(0x***), SecretRef:(*core.SecretEnvSource)(nil)}}, Env:[]core.EnvVar{core.EnvVar{Name:"GOOGLE_APPLICATION_CREDENTIALS", Value:"/var/secrets/google/key.json", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:"QUARKUS_INIT_AND_EXIT", Value:"true", ValueFrom:(*core.EnvVarSource)(nil)}, core.EnvVar{Name:"QUARKUS_LIQUIBASE_MONGODB_ENABLED", Value:"true", ValueFrom:(*core.EnvVarSource)(nil)}}, Resources:core.ResourceRequirements{Limits:core.ResourceList(nil), Requests:core.ResourceList(nil)}, VolumeMounts:[]core.VolumeMount{core.VolumeMount{Name:"google-cloud-key", ReadOnly:false, MountPath:"/var/secrets/google", SubPath:"", MountPropagation:(*core.MountPropagationMode)(nil), SubPathExpr:""}}, VolumeDevices:[]core.VolumeDevice(nil), LivenessProbe:(*core.Probe)(nil), ReadinessProbe:(*core.Probe)(nil), StartupProbe:(*core.Probe)(nil), Lifecycle:(*core.Lifecycle)(nil), TerminationMessagePath:"/dev/termination-log", TerminationMessagePolicy:"File", ImagePullPolicy:"Always", SecurityContext:(*core.SecurityContext)(nil), Stdin:false, StdinOnce:false, TTY:false}}, EphemeralContainers:[]core.EphemeralContainer(nil), RestartPolicy:"OnFailure", TerminationGracePeriodSeconds:(*int64)(0x***), ActiveDeadlineSeconds:(*int64)(nil), DNSPolicy:"ClusterFirst", NodeSelector:map[string]string(nil), ServiceAccountName:"", AutomountServiceAccountToken:(*bool)(nil), NodeName:"", SecurityContext:(*core.PodSecurityContext)(0x***), ImagePullSecrets:[]core.LocalObjectReference(nil), Hostname:"", Subdomain:"", SetHostnameAsFQDN:(*bool)(nil), Affinity:(*core.Affinity)(nil), SchedulerName:"default-scheduler", Tolerations:[]core.Toleration(nil), HostAliases:[]core.HostAlias(nil), PriorityClassName:"", Priority:(*int32)(nil), PreemptionPolicy:(*core.PreemptionPolicy)(nil), DNSConfig:(*core.PodDNSConfig)(nil), ReadinessGates:[]core.PodReadinessGate(nil), RuntimeClassName:(*string)(nil), Overhead:core.ResourceList(nil), EnableServiceLinks:(*bool)(nil), TopologySpreadConstraints:[]core.TopologySpreadConstraint(nil), OS:(*core.PodOS)(nil)}}: field is immutable
```
Manual deleting Job with `kubectl delete job liquibase-mongodb-initubectl` after each deployment and redeploying services one by one is successfull.
### Expected behavior
Deployment success
### Actual behavior
Deployment failed with `The Job "liquibase-mongodb-init" is invalid...`
### How to Reproduce?
1. create project with multiple services, each with kubernetes and mongodb-liquibase extensions
2. build
3. deploy
### Output of `uname -a` or `ver`
Linux *** 6.1.0-1010-oem #10-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 19 10:47:35 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+10-Ubuntu-0ubuntu122.04) OpenJDK 64-Bit Server VM (build 17.0.6+10-Ubuntu-0ubuntu122.04, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
gradle 8.1.1
### Additional information
_No response_ | 936737b1243c84f08a7139416c74e9474defdbf4 | 5e6f02d0302392fe543540e1acc7f77353b72d1f | https://github.com/quarkusio/quarkus/compare/936737b1243c84f08a7139416c74e9474defdbf4...5e6f02d0302392fe543540e1acc7f77353b72d1f | diff --git a/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java b/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
index ce3fa9db00e..aa879715824 100644
--- a/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
+++ b/extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java
@@ -46,6 +46,7 @@
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Produce;
import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.ApplicationInfoBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.HotDeploymentWatchedFileBuildItem;
@@ -221,9 +222,9 @@ public ServiceStartBuildItem startActions(FlywayRecorder recorder,
}
@BuildStep
- public InitTaskBuildItem configureInitTask() {
+ public InitTaskBuildItem configureInitTask(ApplicationInfoBuildItem app) {
return InitTaskBuildItem.create()
- .withName("flyway-init")
+ .withName(app.getName() + "-flyway-init")
.withTaskEnvVars(Map.of("QUARKUS_INIT_AND_EXIT", "true", "QUARKUS_FLYWAY_ENABLED", "true"))
.withAppEnvVars(Map.of("QUARKUS_FLYWAY_ENABLED", "false"))
.withSharedEnvironment(true)
diff --git a/extensions/liquibase-mongodb/deployment/src/main/java/io/quarkus/liquibase/mongodb/deployment/LiquibaseMongodbProcessor.java b/extensions/liquibase-mongodb/deployment/src/main/java/io/quarkus/liquibase/mongodb/deployment/LiquibaseMongodbProcessor.java
index 462e0d5f6d6..0bd1ba82b37 100644
--- a/extensions/liquibase-mongodb/deployment/src/main/java/io/quarkus/liquibase/mongodb/deployment/LiquibaseMongodbProcessor.java
+++ b/extensions/liquibase-mongodb/deployment/src/main/java/io/quarkus/liquibase/mongodb/deployment/LiquibaseMongodbProcessor.java
@@ -30,6 +30,7 @@
import io.quarkus.deployment.annotations.Consume;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.ApplicationInfoBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.InitTaskBuildItem;
@@ -254,9 +255,9 @@ ServiceStartBuildItem startLiquibase(LiquibaseMongodbRecorder recorder,
}
@BuildStep
- public InitTaskBuildItem configureInitTask() {
+ public InitTaskBuildItem configureInitTask(ApplicationInfoBuildItem app) {
return InitTaskBuildItem.create()
- .withName("liquibase-mongodb-init")
+ .withName(app.getName() + "-liquibase-mongodb-init")
.withTaskEnvVars(
Map.of("QUARKUS_INIT_AND_EXIT", "true", "QUARKUS_LIQUIBASE_MONGODB_ENABLED", "true"))
.withAppEnvVars(Map.of("QUARKUS_LIQUIBASE_MONGODB_ENABLED", "false"))
diff --git a/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java
index 8666bf778b0..b1e35293535 100644
--- a/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java
+++ b/extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java
@@ -41,6 +41,7 @@
import io.quarkus.deployment.annotations.Consume;
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.ApplicationInfoBuildItem;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
import io.quarkus.deployment.builditem.FeatureBuildItem;
import io.quarkus.deployment.builditem.IndexDependencyBuildItem;
@@ -318,9 +319,9 @@ ServiceStartBuildItem startLiquibase(LiquibaseRecorder recorder,
}
@BuildStep
- public InitTaskBuildItem configureInitTask() {
+ public InitTaskBuildItem configureInitTask(ApplicationInfoBuildItem app) {
return InitTaskBuildItem.create()
- .withName("liquibase-init")
+ .withName(app.getName() + "-liquibase-init")
.withTaskEnvVars(Map.of("QUARKUS_INIT_AND_EXIT", "true", "QUARKUS_LIQUIBASE_ENABLED", "true"))
.withAppEnvVars(Map.of("QUARKUS_LIQUIBASE_ENABLED", "false"))
.withSharedEnvironment(true) | ['extensions/liquibase-mongodb/deployment/src/main/java/io/quarkus/liquibase/mongodb/deployment/LiquibaseMongodbProcessor.java', 'extensions/flyway/deployment/src/main/java/io/quarkus/flyway/FlywayProcessor.java', 'extensions/liquibase/deployment/src/main/java/io/quarkus/liquibase/deployment/LiquibaseProcessor.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,501,372 | 5,226,683 | 673,918 | 6,227 | 922 | 193 | 15 | 3 | 5,868 | 307 | 1,583 | 46 | 0 | 1 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,195 | quarkusio/quarkus/33300/33206 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33206 | https://github.com/quarkusio/quarkus/pull/33300 | https://github.com/quarkusio/quarkus/pull/33300 | 1 | fixes | Using duration with hibernate and postgres interval leads to error in native mode | ### Describe the bug
Using hibernate with duration, which now with hibernate 6.2 uses the postgres interval type leads to an error due to `PGInterval` not correctly registered for reflection:
```
Caused by: org.postgresql.util.PSQLException: Failed to create object for: interval.
at org.postgresql.jdbc.PgConnection.getObject(PgConnection.java:760)
at org.postgresql.jdbc.PgResultSet.getObject(PgResultSet.java:3020)
at io.agroal.pool.wrapper.ResultSetWrapper.getObject(ResultSetWrapper.java:472)
at io.hypersistence.utils.hibernate.type.interval.PostgreSQLIntervalType.get(PostgreSQLIntervalType.java:40)
at io.hypersistence.utils.hibernate.type.interval.PostgreSQLIntervalType.get(PostgreSQLIntervalType.java:24)
at io.hypersistence.utils.hibernate.type.ImmutableType.nullSafeGet(ImmutableType.java:97)
at org.hibernate.type.internal.UserTypeSqlTypeAdapter$ValueExtractorImpl.extract(UserTypeSqlTypeAdapter.java:110)
at org.hibernate.sql.results.jdbc.internal.JdbcValuesResultSetImpl.readCurrentRowValues(JdbcValuesResultSetImpl.java:262)
... 87 more
Caused by: java.lang.NoSuchMethodException: org.postgresql.util.PGInterval.<init>()
at java.base@17.0.7/java.lang.Class.getConstructor0(DynamicHub.java:3585)
at java.base@17.0.7/java.lang.Class.getDeclaredConstructor(DynamicHub.java:2754)
at org.postgresql.jdbc.PgConnection.getObject(PgConnection.java:739)
... 94 more
```
### Expected behavior
This probably should work out of the box as it is now in the standard hibernate implementation.
### 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)
Mandrel 22.3.2.1
### Quarkus version or git rev
3.0.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
gradlew 8.1.1
### Additional information
_No response_ | 8ac1024e4b1ff980adf18f0e5560d9bf9337ae0d | 214761792d5e132c28562e39e3414f2439f6b6fc | https://github.com/quarkusio/quarkus/compare/8ac1024e4b1ff980adf18f0e5560d9bf9337ae0d...214761792d5e132c28562e39e3414f2439f6b6fc | diff --git a/extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/PostgreSQLJDBCReflections.java b/extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/PostgreSQLJDBCReflections.java
index e0e455bb140..6b351c42071 100644
--- a/extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/PostgreSQLJDBCReflections.java
+++ b/extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/PostgreSQLJDBCReflections.java
@@ -20,6 +20,27 @@ void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
final String driverName = "org.postgresql.Driver";
reflectiveClass.produce(ReflectiveClassBuildItem.builder(driverName).build());
+ // We want to register these postgresql "object" types since they are used by a driver to build result set elements
+ // and reflection is used to create their instances. While ORM might only use a `PGInterval` if a @JdbcType(PostgreSQLIntervalSecondJdbcType.class)
+ // is applied to a Duration property, we still register other types as users might create their own JdbcTypes that
+ // would rely on some subtype of a PGobject:
+ final String[] pgObjectClasses = new String[] {
+ "org.postgresql.util.PGobject",
+ "org.postgresql.util.PGInterval",
+ "org.postgresql.util.PGmoney",
+ "org.postgresql.geometric.PGbox",
+ "org.postgresql.geometric.PGcircle",
+ "org.postgresql.geometric.PGline",
+ "org.postgresql.geometric.PGlseg",
+ "org.postgresql.geometric.PGpath",
+ "org.postgresql.geometric.PGpoint",
+ "org.postgresql.geometric.PGpolygon",
+ // One more subtype of the PGobject, it doesn't look like that this one will be instantiated through reflection,
+ // so let's not include it:
+ // "org.postgresql.jdbc.PgResultSet.NullObject"
+ };
+ reflectiveClass.produce(ReflectiveClassBuildItem.builder(pgObjectClasses).build());
+
// Needed when quarkus.datasource.jdbc.transactions=xa for the setting of the username and password
reflectiveClass.produce(ReflectiveClassBuildItem.builder("org.postgresql.ds.common.BaseDataSource").constructors(false)
.methods().build());
diff --git a/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java b/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java
index 6b2af30915a..0bc9b7d02b6 100644
--- a/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java
+++ b/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java
@@ -2,6 +2,7 @@
import java.io.IOException;
import java.io.PrintWriter;
+import java.time.Duration;
import java.util.List;
import java.util.UUID;
@@ -135,6 +136,7 @@ private static void persistNewPerson(EntityManager entityManager, String name) {
person.setName(name);
person.setStatus(Status.LIVING);
person.setAddress(new SequencedAddress("Street " + randomName()));
+ person.setLatestLunchBreakDuration(Duration.ofMinutes(30));
entityManager.persist(person);
}
diff --git a/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/Person.java b/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/Person.java
index 0393fd951f1..f8c82d346ee 100644
--- a/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/Person.java
+++ b/integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/Person.java
@@ -1,6 +1,9 @@
package io.quarkus.it.jpa.postgresql;
+import java.time.Duration;
+
import jakarta.persistence.CascadeType;
+import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
@@ -10,6 +13,9 @@
import jakarta.persistence.NamedQuery;
import jakarta.persistence.Table;
+import org.hibernate.annotations.JdbcType;
+import org.hibernate.dialect.PostgreSQLIntervalSecondJdbcType;
+
@Entity
@Table(schema = "myschema")
@NamedQuery(name = "get_person_by_name", query = "select p from Person p where name = :name")
@@ -19,6 +25,7 @@ public class Person {
private String name;
private SequencedAddress address;
private Status status;
+ private Duration latestLunchBreakDuration = Duration.ZERO;
public Person() {
}
@@ -64,8 +71,27 @@ public void setStatus(Status status) {
this.status = status;
}
+ /**
+ * Need to explicitly set the scale (and the precision so that the scale will actually be read from the annotation).
+ * Postgresql would only allow maximum scale of 6 for a `interval second`.
+ *
+ * @see org.hibernate.type.descriptor.sql.internal.Scale6IntervalSecondDdlType
+ */
+ @Column(precision = 5, scale = 5)
+ //NOTE: while https://hibernate.atlassian.net/browse/HHH-16591 is open we cannot replace the currently used @JdbcType annotation
+ // with a @JdbcTypeCode( INTERVAL_SECOND )
+ @JdbcType(PostgreSQLIntervalSecondJdbcType.class)
+ public Duration getLatestLunchBreakDuration() {
+ return latestLunchBreakDuration;
+ }
+
+ public void setLatestLunchBreakDuration(Duration duration) {
+ this.latestLunchBreakDuration = duration;
+ }
+
public void describeFully(StringBuilder sb) {
sb.append("Person with id=").append(id).append(", name='").append(name).append("', status='").append(status)
+ .append("', latestLunchBreakDuration='").append(latestLunchBreakDuration)
.append("', address { ");
getAddress().describeFully(sb);
sb.append(" }"); | ['integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/Person.java', 'integration-tests/jpa-postgresql/src/main/java/io/quarkus/it/jpa/postgresql/JPAFunctionalityTestEndpoint.java', 'extensions/jdbc/jdbc-postgresql/deployment/src/main/java/io/quarkus/jdbc/postgresql/deployment/PostgreSQLJDBCReflections.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,820,998 | 5,290,696 | 681,313 | 6,285 | 1,380 | 284 | 21 | 1 | 1,941 | 154 | 465 | 58 | 0 | 1 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,196 | quarkusio/quarkus/33252/33006 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33006 | https://github.com/quarkusio/quarkus/pull/33252 | https://github.com/quarkusio/quarkus/pull/33252 | 1 | fix | get NPE when force restarting with kubernets dev service running | ### Describe the bug
startup with kubernets-cliet devservice.
Then press 's' for forced restart and I get this error:
```
2023-04-29 01:15:23,961 ERROR [io.qua.kub.cli.dep.DevServicesKubernetesProcessor] (build-5) Failed to stop the Kubernetes cluster [Error Occurred After Shutdown]: java.lang.NullPointerException: Cannot invoke "java.io.Closeable.close()" because "this.closeable" is null
at io.quarkus.deployment.builditem.DevServicesResultBuildItem$RunningDevService.close(DevServicesResultBuildItem.java:90)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.shutdownCluster(DevServicesKubernetesProcessor.java:153)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.setupKubernetesDevService(DevServicesKubernetesProcessor.java:101)
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:282)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
```
### 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_ | 5611919e07deb189c5d414c36a91a432ce9431b2 | 885a3cf640837cbe57a9808d8d0ed42ec21efbe4 | https://github.com/quarkusio/quarkus/compare/5611919e07deb189c5d414c36a91a432ce9431b2...885a3cf640837cbe57a9808d8d0ed42ec21efbe4 | diff --git a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java
index 54ca2c89d41..b4ffb1df00d 100644
--- a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java
+++ b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java
@@ -148,7 +148,7 @@ public DevServicesResultBuildItem setupKubernetesDevService(
}
private void shutdownCluster() {
- if (devService != null) {
+ if (devService != null && devService.isOwner()) {
try {
devService.close();
} catch (Throwable e) { | ['extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,486,946 | 5,224,177 | 673,613 | 6,224 | 93 | 23 | 2 | 1 | 2,218 | 140 | 512 | 59 | 0 | 1 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,197 | quarkusio/quarkus/33216/33150 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33150 | https://github.com/quarkusio/quarkus/pull/33216 | https://github.com/quarkusio/quarkus/pull/33216 | 1 | fixes | quarkus-hibernate-validator HV000149: http 500 error caused by IllegalArgumentException if accept-language is invalid | ### Describe the bug
Here is a simple endpoint with accept-language header checked with hibernate validator. Header is mandatory and checked with a pattern regex
```java
@GET
@Produces({ "application/json;charset=utf-8" })
public Response hello(@HeaderParam("Accept-Language") @NotNull @Pattern(regexp = "[a-z]{2}") String acceptLanguage) {
return Response.accepted().build();
}
```
application.properties set a default lang for validation
```properties
quarkus.default-locale=en
```
if acceptLanguage is omit, validation works and http status 400 response is return with appropriate body
```json
{"exception":null,"propertyViolations":[],"classViolations":[],"parameterViolations":[{"constraintType":"PARAMETER","path":"hello.acceptLanguage","message":"must not be null","value":""}],"returnValueViolations":[]}
```
if acceptLanguage is invalid (don't respect regexp), for bad example value "X77". Http response status is 500 with this stacktrace.
```
023-05-05 13:57:27,805 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-1) HTTP Request to /hello failed, error id: 710c999c-92b3-45e6-81cc-a3ca52ff3010-1: jakarta.validation.ValidationException: HV000149: An exception occurred during message interpolation
at org.hibernate.validator.internal.engine.validationcontext.AbstractValidationContext.interpolate(AbstractValidationContext.java:336)
at org.hibernate.validator.internal.engine.validationcontext.AbstractValidationContext.addConstraintFailure(AbstractValidationContext.java:236)
at org.hibernate.validator.internal.engine.validationcontext.ParameterExecutableValidationContext.addConstraintFailure(ParameterExecutableValidationContext.java:38)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:79)
at org.hibernate.validator.internal.metadata.core.MetaConstraint.doValidateConstraint(MetaConstraint.java:130)
at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:123)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:555)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraints(ValidatorImpl.java:537)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersForSingleGroup(ValidatorImpl.java:991)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersForGroup(ValidatorImpl.java:932)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateParametersInContext(ValidatorImpl.java:863)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:283)
at org.hibernate.validator.internal.engine.ValidatorImpl.validateParameters(ValidatorImpl.java:235)
at io.quarkus.hibernate.validator.runtime.interceptor.AbstractMethodValidationInterceptor.validateMethodInvocation(AbstractMethodValidationInterceptor.java:63)
at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor.validateMethodInvocation(JaxrsEndPointValidationInterceptor.java:38)
at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor_Bean.intercept(Unknown Source)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:42)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:38)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:26)
at com.example.ExampleResource_Subclass.hello(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 org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:170)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:660)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:524)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:474)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:476)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:434)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:408)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:69)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:492)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:261)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:82)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:147)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:93)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
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:833)
Caused by: java.lang.IllegalArgumentException: range=x77
at java.base/java.util.Locale$LanguageRange.<init>(Locale.java:3099)
at java.base/sun.util.locale.LocaleMatcher.parse(LocaleMatcher.java:525)
at java.base/java.util.Locale$LanguageRange.parse(Locale.java:3214)
at io.quarkus.hibernate.validator.runtime.locale.AbstractLocaleResolver.getAcceptableLanguages(AbstractLocaleResolver.java:35)
at io.quarkus.hibernate.validator.runtime.locale.AbstractLocaleResolver.resolve(AbstractLocaleResolver.java:17)
at io.quarkus.hibernate.validator.runtime.locale.ResteasyClassicLocaleResolver.resolve(ResteasyClassicLocaleResolver.java:11)
at io.quarkus.hibernate.validator.runtime.locale.LocaleResolversWrapper.resolve(LocaleResolversWrapper.java:27)
at org.hibernate.validator.messageinterpolation.AbstractMessageInterpolator.interpolate(AbstractMessageInterpolator.java:343)
at org.hibernate.validator.internal.engine.validationcontext.AbstractValidationContext.interpolate(AbstractValidationContext.java:327)
... 49 more
```
### Expected behavior
If accept-language is not usable, fall back to default lang defined in application.properties.
Expected behavior is to have a 400 http status with a body which indicate an error on hello.acceptLanguage field with message `must match [a-z]{2}`
### Actual behavior
_No response_
### How to Reproduce?
I've created a minimal maven demo project to show the problem.
see ExampleResourceTest.testHelloEndpointInvalidAcceptLanguage unit test
[demo.zip](https://github.com/quarkusio/quarkus/files/11406025/demo.zip)
### Output of `uname -a` or `ver`
Linux xtream-pc 6.1.25-1-MANJARO #1 SMP PREEMPT_DYNAMIC Thu Apr 20 13:48:36 UTC 2023 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.6" 2023-01-17
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29)
### Additional information
_No response_ | d13348b008c5f329333cd6b419b1b7401abade2e | 557058a52dca1e7a54cecc4978ddf48e8b17a22a | https://github.com/quarkusio/quarkus/compare/d13348b008c5f329333cd6b419b1b7401abade2e...557058a52dca1e7a54cecc4978ddf48e8b17a22a | diff --git a/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/locale/AbstractLocaleResolver.java b/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/locale/AbstractLocaleResolver.java
index 9e541214089..2c5674b07e8 100644
--- a/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/locale/AbstractLocaleResolver.java
+++ b/extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/locale/AbstractLocaleResolver.java
@@ -7,20 +7,23 @@
import org.hibernate.validator.spi.messageinterpolation.LocaleResolver;
import org.hibernate.validator.spi.messageinterpolation.LocaleResolverContext;
+import org.jboss.logging.Logger;
abstract class AbstractLocaleResolver implements LocaleResolver {
+ private static final Logger log = Logger.getLogger(AbstractLocaleResolver.class);
+ private static final String ACCEPT_HEADER = "Accept-Language";
+
protected abstract Map<String, List<String>> getHeaders();
@Override
public Locale resolve(LocaleResolverContext context) {
Optional<List<Locale.LanguageRange>> localePriorities = getAcceptableLanguages();
- if (!localePriorities.isPresent()) {
+ if (localePriorities.isEmpty()) {
return null;
}
-
List<Locale> resolvedLocales = Locale.filter(localePriorities.get(), context.getSupportedLocales());
- if (resolvedLocales.size() > 0) {
+ if (!resolvedLocales.isEmpty()) {
return resolvedLocales.get(0);
}
@@ -30,9 +33,17 @@ public Locale resolve(LocaleResolverContext context) {
private Optional<List<Locale.LanguageRange>> getAcceptableLanguages() {
Map<String, List<String>> httpHeaders = getHeaders();
if (httpHeaders != null) {
- List<String> acceptLanguageList = httpHeaders.get("Accept-Language");
+ List<String> acceptLanguageList = httpHeaders.get(ACCEPT_HEADER);
if (acceptLanguageList != null && !acceptLanguageList.isEmpty()) {
- return Optional.of(Locale.LanguageRange.parse(acceptLanguageList.get(0)));
+ try {
+ return Optional.of(Locale.LanguageRange.parse(acceptLanguageList.get(0)));
+ } catch (IllegalArgumentException e) {
+ // this can happen when parsing malformed locale range string
+ if (log.isDebugEnabled()) {
+ log.debug("Unable to parse the \\"Accept-Language\\" header. \\"" + acceptLanguageList.get(0)
+ + "\\" is not a valid language range string.", e);
+ }
+ }
}
}
diff --git a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLLocaleResolver.java b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLLocaleResolver.java
index f4a1f658dc0..d34dc2d8678 100644
--- a/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLLocaleResolver.java
+++ b/extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLLocaleResolver.java
@@ -9,6 +9,7 @@
import org.hibernate.validator.spi.messageinterpolation.LocaleResolver;
import org.hibernate.validator.spi.messageinterpolation.LocaleResolverContext;
+import org.jboss.logging.Logger;
import graphql.schema.DataFetchingEnvironment;
import io.smallrye.graphql.execution.context.SmallRyeContext;
@@ -20,12 +21,13 @@
@Singleton
public class SmallRyeGraphQLLocaleResolver implements LocaleResolver {
+ private static final Logger log = Logger.getLogger(SmallRyeGraphQLLocaleResolver.class);
private static final String ACCEPT_HEADER = "Accept-Language";
@Override
public Locale resolve(LocaleResolverContext context) {
Optional<List<Locale.LanguageRange>> localePriorities = getAcceptableLanguages();
- if (!localePriorities.isPresent()) {
+ if (localePriorities.isEmpty()) {
return null;
}
List<Locale> resolvedLocales = Locale.filter(localePriorities.get(), context.getSupportedLocales());
@@ -41,7 +43,15 @@ private Optional<List<Locale.LanguageRange>> getAcceptableLanguages() {
if (httpHeaders != null) {
List<String> acceptLanguageList = httpHeaders.get(ACCEPT_HEADER);
if (acceptLanguageList != null && !acceptLanguageList.isEmpty()) {
- return Optional.of(Locale.LanguageRange.parse(acceptLanguageList.get(0)));
+ try {
+ return Optional.of(Locale.LanguageRange.parse(acceptLanguageList.get(0)));
+ } catch (IllegalArgumentException e) {
+ // this can happen when parsing malformed locale range string
+ if (log.isDebugEnabled()) {
+ log.debug("Unable to parse the \\"Accept-Language\\" header. \\"" + acceptLanguageList.get(0)
+ + "\\" is not a valid language range string.", e);
+ }
+ }
}
}
return Optional.empty();
diff --git a/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java b/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java
index e8ffd244f84..880841201ec 100644
--- a/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java
+++ b/integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java
@@ -367,6 +367,16 @@ public void testValidationMessageLocale() {
.body(containsString("Vrijednost ne zadovoljava uzorak"));
}
+ @Test
+ public void testValidationMessageInvalidAcceptLanguageHeaderLeadsToDefaultLocaleBeingUsed() {
+ RestAssured.given()
+ .header("Accept-Language", "invalid string")
+ .when()
+ .get("/hibernate-validator/test/test-validation-message-locale/1")
+ .then()
+ .body(containsString("Value is not in line with the pattern"));
+ }
+
@Test
public void testValidationMessageDefaultLocale() {
RestAssured.given() | ['extensions/smallrye-graphql/runtime/src/main/java/io/quarkus/smallrye/graphql/runtime/SmallRyeGraphQLLocaleResolver.java', 'extensions/hibernate-validator/runtime/src/main/java/io/quarkus/hibernate/validator/runtime/locale/AbstractLocaleResolver.java', 'integration-tests/hibernate-validator/src/test/java/io/quarkus/it/hibernate/validator/HibernateValidatorFunctionalityTest.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,464,063 | 5,219,973 | 673,013 | 6,219 | 2,025 | 349 | 35 | 2 | 8,561 | 378 | 1,834 | 133 | 1 | 4 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,198 | quarkusio/quarkus/33140/33170 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33170 | https://github.com/quarkusio/quarkus/pull/33140 | https://github.com/quarkusio/quarkus/pull/33140 | 1 | fixes | Panache Reactive + Reloads | ### Describe the bug
I have a very trivial project using:
```
✬ ArtifactId Extension Name
✬ quarkus-hibernate-reactive-panache Hibernate Reactive with Panache
✬ quarkus-reactive-pg-client Reactive PostgreSQL client
✬ quarkus-resteasy-reactive RESTEasy Reactive
✬ quarkus-resteasy-reactive-jsonb RESTEasy Reactive JSON-B
```
And I have an `@ApplicationScoped` `FruitResource` using Panache as in this page:
<https://quarkus.io/guides/getting-started-reactive>
I *also* have a second `FruitResource` that uses Hibernate Reactive *without* Panache:
```java
@Path("/fruits")
@ApplicationScoped
public class FruitResource {
@Inject
Mutiny.SessionFactory factory;
@GET
public Uni<List<Fruit>> get() {
return factory.withStatelessSession(s -> s.createQuery("from Fruit order by name", Fruit.class).getResultList());
}
@GET
@Path("/{id}")
public Uni<Fruit> getSingle(Long id) {
return factory.withStatelessSession(s-> s.get(Fruit.class, id));
}
@POST
public Uni<Response> create(Fruit fruit) {
return factory.withStatelessTransaction(s -> s.insert(fruit))
.replaceWith(Response.created(URI.create("/fruits/" + fruit.id)).build());
}
}
```
After editing the `Fruit` class, to trigger a reload, the Panache resource is in a broken state, but the non-Panache resource keeps working perfectly. The error is:
```
java.lang.IllegalStateException: EntityManagerFactory is closed
at org.hibernate.internal.SessionFactoryImpl.validateNotClosed(SessionFactoryImpl.java:641)
at org.hibernate.internal.SessionFactoryImpl.getCache(SessionFactoryImpl.java:900)
at org.hibernate.internal.AbstractSharedSessionContract.<init>(AbstractSharedSessionContract.java:166)
at org.hibernate.internal.SessionImpl.<init>(SessionImpl.java:218)
at org.hibernate.reactive.session.impl.ReactiveSessionImpl.<init>(ReactiveSessionImpl.java:173)
at org.hibernate.reactive.mutiny.impl.MutinySessionFactoryImpl.lambda$openSession$1(MutinySessionFactoryImpl.java:111)
at io.smallrye.context.impl.wrappers.SlowContextualSupplier.get(SlowContextualSupplier.java:21)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromItemSupplier.subscribe(UniCreateFromItemSupplier.java:28)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniOnFailureFlatMap.subscribe(UniOnFailureFlatMap.java:31)
at io.smallrye.mutiny.operators.AbstractUni.subscribe(AbstractUni.java:36)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.performInnerSubscription(UniOnItemTransformToUni.java:81)
at io.smallrye.mutiny.operators.uni.UniOnItemTransformToUni$UniOnItemTransformToUniProcessor.onItem(UniOnItemTransformToUni.java:57)
at io.smallrye.mutiny.operators.uni.UniOperatorProcessor.onItem(UniOperatorProcessor.java:47)
at io.smallrye.mutiny.operators.uni.builders.UniCreateFromCompletionStage$CompletionStageUniSubscription.forwardResult(UniCreateFromCompletionStage.java:63)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at io.vertx.core.Future.lambda$toCompletionStage$3(Future.java:384)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.Mapping.onSuccess(Mapping.java:40)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:167)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569)
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:833)
```
It looks like Panache Reactive somehow retains a reference to the old `EntityManagerFactory` after a reload.
### 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_ | 0021217a410f873f784e9eeeef406180dc479dcd | fcd28088b154c6bc5c1348e7c018409f4bdbf60d | https://github.com/quarkusio/quarkus/compare/0021217a410f873f784e9eeeef406180dc479dcd...fcd28088b154c6bc5c1348e7c018409f4bdbf60d | diff --git a/extensions/panache/hibernate-reactive-panache-common/deployment/src/main/java/io/quarkus/hibernate/reactive/panache/common/deployment/PanacheJpaCommonResourceProcessor.java b/extensions/panache/hibernate-reactive-panache-common/deployment/src/main/java/io/quarkus/hibernate/reactive/panache/common/deployment/PanacheJpaCommonResourceProcessor.java
index f2ab103f76e..8faf7a2510d 100644
--- a/extensions/panache/hibernate-reactive-panache-common/deployment/src/main/java/io/quarkus/hibernate/reactive/panache/common/deployment/PanacheJpaCommonResourceProcessor.java
+++ b/extensions/panache/hibernate-reactive-panache-common/deployment/src/main/java/io/quarkus/hibernate/reactive/panache/common/deployment/PanacheJpaCommonResourceProcessor.java
@@ -41,6 +41,7 @@
import io.quarkus.deployment.annotations.ExecutionTime;
import io.quarkus.deployment.annotations.Record;
import io.quarkus.deployment.builditem.CombinedIndexBuildItem;
+import io.quarkus.deployment.builditem.ShutdownContextBuildItem;
import io.quarkus.deployment.util.JandexUtil;
import io.quarkus.gizmo.ClassCreator;
import io.quarkus.hibernate.orm.deployment.HibernateOrmEnabled;
@@ -208,6 +209,12 @@ void buildNamedQueryMap(List<PanacheNamedQueryEntityClassBuildStep> namedQueryEn
panacheHibernateRecorder.setNamedQueryMap(namedQueryMap);
}
+ @BuildStep
+ @Record(ExecutionTime.RUNTIME_INIT)
+ public void shutdown(ShutdownContextBuildItem shutdownContextBuildItem, PanacheHibernateRecorder panacheHibernateRecorder) {
+ panacheHibernateRecorder.clear(shutdownContextBuildItem);
+ }
+
private void lookupNamedQueries(CombinedIndexBuildItem index, DotName name, Set<String> namedQueries) {
ClassInfo classInfo = index.getComputingIndex().getClassByName(name);
if (classInfo == null) {
diff --git a/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/PanacheHibernateRecorder.java b/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/PanacheHibernateRecorder.java
index 3a1083a57e0..7774ff96348 100644
--- a/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/PanacheHibernateRecorder.java
+++ b/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/PanacheHibernateRecorder.java
@@ -3,6 +3,7 @@
import java.util.Map;
import java.util.Set;
+import io.quarkus.runtime.ShutdownContext;
import io.quarkus.runtime.annotations.Recorder;
@Recorder
@@ -10,4 +11,13 @@ public class PanacheHibernateRecorder {
public void setNamedQueryMap(Map<String, Set<String>> namedQueryMap) {
NamedQueryUtil.setNamedQueryMap(namedQueryMap);
}
+
+ public void clear(ShutdownContext shutdownContext) {
+ shutdownContext.addShutdownTask(new Runnable() {
+ @Override
+ public void run() {
+ SessionOperations.clear();
+ }
+ });
+ }
}
diff --git a/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/SessionOperations.java b/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/SessionOperations.java
index 7f5655acf0c..99c15a8691d 100644
--- a/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/SessionOperations.java
+++ b/extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/SessionOperations.java
@@ -205,4 +205,8 @@ static Mutiny.SessionFactory getSessionFactory() {
return SESSION_FACTORY.get();
}
+ static void clear() {
+ SESSION_FACTORY.clear();
+ SESSION_KEY.clear();
+ }
} | ['extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/PanacheHibernateRecorder.java', 'extensions/panache/hibernate-reactive-panache-common/deployment/src/main/java/io/quarkus/hibernate/reactive/panache/common/deployment/PanacheJpaCommonResourceProcessor.java', 'extensions/panache/hibernate-reactive-panache-common/runtime/src/main/java/io/quarkus/hibernate/reactive/panache/common/runtime/SessionOperations.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,462,733 | 5,219,695 | 672,990 | 6,219 | 721 | 138 | 21 | 3 | 5,291 | 297 | 1,200 | 121 | 1 | 3 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,199 | quarkusio/quarkus/33100/33089 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33089 | https://github.com/quarkusio/quarkus/pull/33100 | https://github.com/quarkusio/quarkus/pull/33100 | 1 | fixes | new Info Log since Q3 HHH000157: Lazy property fetching available for | ### Describe the bug
I am currently preparing our migration to quarkus 3.
I noticed a new info log, which was not present in 2.16.6.
Can this please be removed?
This might be distracting in our bigger applications.
```
2023-05-03 10:13:50,149 INFO [org.hib.tup.ent.EntityMetamodel] (JPA Startup Thread) HHH000157: Lazy property fetching available for: <packagename>.RuleActionExecutionLog
2023-05-03 10:13:50,172 INFO [org.hib.tup.ent.EntityMetamodel] (JPA Startup Thread) HHH000157: Lazy property fetching available for: <packagename>.Rule
2023-05-03 10:13:50,206 INFO [org.hib.tup.ent.EntityMetamodel] (JPA Startup Thread) HHH000157: Lazy property fetching available for: <packagename>.RuleExecutionLog
```
For example, the RuleExecutionLog entity has the following fields.
```
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "rule_execution_log_id_generator")
@SequenceGenerator(name = "rule_execution_log_id_generator", schema = "webruleservice", sequenceName = "seq_rule_execution_log_id", allocationSize = 1, initialValue = 1000)
@Column(name = "id")
private Long id;
@Convert(converter = YesNoConverter.class)
@Column(name = "dry_run", nullable = false)
private Boolean dryRun;
@Column(name = "execution_date_time", nullable = false)
private LocalDateTime executionDateTime;
@Enumerated(EnumType.STRING)
@Column(name = "rule_execution_state", nullable = false)
private RuleExecutionState state;
@JdbcTypeCode(java.sql.Types.VARCHAR)
@Column(name = "correlation_id", nullable = false)
private UUID correlationId;
@Type(JsonNodeBinaryType.class)
@Column(name = "data")
@Basic(fetch = FetchType.LAZY)
private JsonNode data;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "fk_rule_id", nullable = false)
private Rule rule;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "ruleExecutionLog")
@BatchSize(size = 30)
@OrderBy("actionType asc, fk_action_id asc")
private List<RuleActionExecutionLog> ruleActionExecutionLogs;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "ruleExecutionLog")
@BatchSize(size = 30)
@OrderBy("key asc")
private List<RuleExecutionLogSearchNumber> searchNumbers;
```
I believe this might be caused by the `@Basic(fetch = FetchType.LAZY)` annotation.
This corresponds to the info log in:
https://github.com/hibernate/hibernate-orm/blob/18ddbe15d6a8b83f3bae25183518640b8c615cc7/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java#L397-L399
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
MINGW64_NT-10.0-19045 NANBCHL9NG3 3.3.6-341.x86_64 2022-09-05 20:28 UTC x86_64 Msys
### Output of `java -version`
openjdk 17.0.4 2022-07-19 OpenJDK Runtime Environment Temurin-17.0.4+8 (build 17.0.4+8) OpenJDK 64-Bit Server VM Temurin-17.0.4+8 (build 17.0.4+8, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.1.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_ | 53a0bc30d63c6f4f72f3c678a3ea3305d4829b89 | 37d2a6c04b1675a8d63ae0d9aa72f24f2e26dfe0 | https://github.com/quarkusio/quarkus/compare/53a0bc30d63c6f4f72f3c678a3ea3305d4829b89...37d2a6c04b1675a8d63ae0d9aa72f24f2e26dfe0 | diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java
index 77e9b82f537..46a3844e672 100644
--- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java
+++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java
@@ -30,5 +30,7 @@ void setupLogFilters(BuildProducer<LogCleanupFilterBuildItem> filters) {
// Silence incubating settings warnings as we will use some for compatibility
filters.produce(new LogCleanupFilterBuildItem("org.hibernate.orm.incubating",
"HHH90006001"));
+ // https://hibernate.atlassian.net/browse/HHH-16546
+ filters.produce(new LogCleanupFilterBuildItem("org.hibernate.tuple.entity.EntityMetamodel", "HHH000157"));
}
} | ['extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,458,690 | 5,218,972 | 672,897 | 6,218 | 176 | 44 | 2 | 1 | 3,628 | 358 | 1,021 | 100 | 1 | 2 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,200 | quarkusio/quarkus/33086/33085 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33085 | https://github.com/quarkusio/quarkus/pull/33086 | https://github.com/quarkusio/quarkus/pull/33086 | 1 | fix | quarkus kubernetes creates job with unsupported `on spec.completionMode` | ### Describe the bug
Project containing kubernetes and liquibase extensions creates kubernetes.yml deployment file. Liquibase migration scripts are run inside job defined in this file as following:
```apiVersion: batch/v1
kind: Job
metadata:
name: liquibase-mongodb-init
spec:
completionMode: OnFailure
```
Kuberentes job specification does not define such completion mode: https://kubernetes.io/docs/concepts/workloads/controllers/job/#completion-mode
### Expected behavior
Deployment success
### Actual behavior
Deployment to kubernetes failed with
`The Job "liquibase-mongodb-init" is invalid: spec.completionMode: Unsupported value: "OnFailure": supported values: "NonIndexed", "Indexed"`
### How to Reproduce?
1. create quarkus 3 project with kubernetes and liquibase extensions
2. build
3. deploy generated kubernetes.yml
### Output of `uname -a` or `ver`
Linux palo-liska 6.1.0-1009-oem #9-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 31 09:59:10 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.6" 2023-01-17 OpenJDK Runtime Environment (build 17.0.6+10-Ubuntu-0ubuntu122.04) OpenJDK 64-Bit Server VM (build 17.0.6+10-Ubuntu-0ubuntu122.04, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
3.0.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 7.5.1
### Additional information
_No response_ | 6d6ff21d78a944ab9b59ca4c189e36e4156e1444 | adb04e996d20c77c5e9edbf089afe5b68265a148 | https://github.com/quarkusio/quarkus/compare/6d6ff21d78a944ab9b59ca4c189e36e4156e1444...adb04e996d20c77c5e9edbf089afe5b68265a148 | diff --git a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/CreateJobResourceFromImageDecorator.java b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/CreateJobResourceFromImageDecorator.java
index 307f810095e..c69ca855c51 100644
--- a/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/CreateJobResourceFromImageDecorator.java
+++ b/extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/CreateJobResourceFromImageDecorator.java
@@ -6,6 +6,8 @@
import java.util.List;
+import io.dekorate.kubernetes.annotation.JobCompletionMode;
+import io.dekorate.kubernetes.annotation.JobRestartPolicy;
import io.dekorate.kubernetes.decorator.ResourceProvidingDecorator;
import io.fabric8.kubernetes.api.model.KubernetesListBuilder;
import io.fabric8.kubernetes.api.model.batch.v1.JobBuilder;
@@ -15,8 +17,8 @@
**/
public class CreateJobResourceFromImageDecorator extends ResourceProvidingDecorator<KubernetesListBuilder> {
- private static final String DEFAULT_RESTART_POLICY = "OnFailure";
- private static final String DEFAULT_COMPLETION_MODE = "OnFailure";
+ private static final String DEFAULT_RESTART_POLICY = JobRestartPolicy.OnFailure.name();
+ private static final String DEFAULT_COMPLETION_MODE = JobCompletionMode.NonIndexed.name();
private final String name;
private final String image;
diff --git a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithFlywayInitTest.java b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithFlywayInitTest.java
index 827c7b3c0c7..328352faae6 100644
--- a/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithFlywayInitTest.java
+++ b/integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithFlywayInitTest.java
@@ -79,8 +79,10 @@ public void assertGeneratedResources() throws IOException {
assertThat(job.get()).satisfies(j -> {
assertThat(j.getSpec()).satisfies(jobSpec -> {
+ assertThat(jobSpec.getCompletionMode()).isEqualTo("NonIndexed");
assertThat(jobSpec.getTemplate()).satisfies(t -> {
assertThat(t.getSpec()).satisfies(podSpec -> {
+ assertThat(podSpec.getRestartPolicy()).isEqualTo("OnFailure");
assertThat(podSpec.getContainers()).singleElement().satisfies(container -> {
assertThat(container.getName()).isEqualTo("flyway-init");
assertThat(container.getEnv()).filteredOn(env -> "QUARKUS_FLYWAY_ENABLED".equals(env.getName())) | ['extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/CreateJobResourceFromImageDecorator.java', 'integration-tests/kubernetes/quarkus-standard-way/src/test/java/io/quarkus/it/kubernetes/KubernetesWithFlywayInitTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 26,458,690 | 5,218,972 | 672,897 | 6,218 | 452 | 88 | 6 | 1 | 1,465 | 174 | 407 | 50 | 1 | 1 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,201 | quarkusio/quarkus/33084/32990 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32990 | https://github.com/quarkusio/quarkus/pull/33084 | https://github.com/quarkusio/quarkus/pull/33084 | 1 | fixes | ClassNotFoundException when scheduler calls static @Transactional PanacheEntity method | ### Describe the bug
The following method cannot be called from a `@Scheduled` annotated method, if the entity class is imported from a lib and not part of the same source:
```java
@Entity
public class ExternalEntity extends PanacheEntity {
...
@Transactional
public static long doStuff() { ... }
}
```
### Expected behavior
This call should work without throwing an exception:
```java
@Scheduled(every = "1h")
public void run() {
ExternalEntity.doStuff();
}
```
### Actual behavior
Class not found:
```
2023-04-28 15:31:41,012 ERROR [io.qua.sch.com.run.StatusEmitterInvoker] (vert.x-worker-thread-0) Error occurred while executing task for trigger IntervalTrigger [id=1_org.acme.Reproducer_ScheduledInvoker_run_72e66771a77415a7284d3ae42331659c186071de, interval=3600000]: java.util.concurrent.CompletionException: java.lang.NoClassDefFoundError: org/acme/entity/Entity_InterceptorInitializer
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:332)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:347)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:874)
at java.base/java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:887)
at java.base/java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2325)
at java.base/java.util.concurrent.CompletableFuture$MinimalStage.whenComplete(CompletableFuture.java:2902)
at io.quarkus.scheduler.common.runtime.DefaultInvoker.invoke(DefaultInvoker.java:24)
at io.quarkus.scheduler.common.runtime.StatusEmitterInvoker.invoke(StatusEmitterInvoker.java:35)
at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask.doInvoke(SimpleScheduler.java:333)
at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask$1.handle(SimpleScheduler.java:314)
at io.quarkus.scheduler.runtime.SimpleScheduler$ScheduledTask$1.handle(SimpleScheduler.java:310)
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:1452)
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:833)
Caused by: java.lang.NoClassDefFoundError: org/acme/entity/Entity_InterceptorInitializer
at org.acme.entity.Entity.deleteByField(Entity.java)
at org.acme.Reproducer.run(Reproducer.java:13)
at org.acme.Reproducer_ClientProxy.run(Unknown Source)
at org.acme.Reproducer_ScheduledInvoker_run_72e66771a77415a7284d3ae42331659c186071de.invokeBean(Unknown Source)
... 15 more
Caused by: java.lang.ClassNotFoundException: org.acme.entity.Entity_InterceptorInitializer
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
... 19 more
```
### How to Reproduce?
1. Download & unzip [reproducer.zip](https://github.com/quarkusio/quarkus/files/11353916/reproducer.zip)
2. `mvn -f entity/pom.xml install`
3. `mvn -f app/pom.xml quarkus:dev`
### Output of `uname -a` or `ver`
Microsoft Windows [Version 10.0.19045.2728]
### Output of `java -version`
openjdk version "17.0.6" 2023-01-17
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.16.6.Final & 3.0.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Maven 3.8.1
### Additional information
Tested with:
JDBC extension: `quarkus-jdbc-h2` & `quarkus-jdbc-mysql`
Panache extension: `quarkus-hibernate-orm-panache` (reactive untested)
Scheduler extension: `quarkus-scheduler`
Possible workarounds:
Move the entity class or the `@Transactional` annotation into the main project. | 6d6ff21d78a944ab9b59ca4c189e36e4156e1444 | fd48630e1e28a13731d3268d6e2cc0ff6492b0be | https://github.com/quarkusio/quarkus/compare/6d6ff21d78a944ab9b59ca4c189e36e4156e1444...fd48630e1e28a13731d3268d6e2cc0ff6492b0be | diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodBuildItem.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodBuildItem.java
index 991405d1cfd..bc565c4bf15 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodBuildItem.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodBuildItem.java
@@ -60,4 +60,12 @@ public String getHash() {
return hash;
}
+ /**
+ *
+ * @return the name of the generated forwarding method
+ */
+ public String getForwardingMethodName() {
+ return "_" + hash;
+ }
+
}
diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodsProcessor.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodsProcessor.java
index 6e5f32ac07e..0e20e735c60 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodsProcessor.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodsProcessor.java
@@ -17,6 +17,7 @@
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.BiFunction;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
import jakarta.enterprise.context.spi.Contextual;
@@ -39,6 +40,7 @@
import io.quarkus.arc.deployment.BeanArchiveIndexBuildItem;
import io.quarkus.arc.deployment.BeanContainerBuildItem;
import io.quarkus.arc.deployment.BeanRegistrationPhaseBuildItem;
+import io.quarkus.arc.deployment.CompletedApplicationClassPredicateBuildItem;
import io.quarkus.arc.deployment.InterceptorResolverBuildItem;
import io.quarkus.arc.deployment.TransformedAnnotationsBuildItem;
import io.quarkus.arc.deployment.UnremovableBeanBuildItem;
@@ -146,6 +148,7 @@ void collectInterceptedStaticMethods(BeanArchiveIndexBuildItem beanArchiveIndex,
void processInterceptedStaticMethods(BeanArchiveIndexBuildItem beanArchiveIndex,
BeanRegistrationPhaseBuildItem phase,
List<InterceptedStaticMethodBuildItem> interceptedStaticMethods,
+ CompletedApplicationClassPredicateBuildItem applicationClassPredicate,
BuildProducer<GeneratedClassBuildItem> generatedClasses,
BuildProducer<BytecodeTransformerBuildItem> transformers,
BuildProducer<ReflectiveMethodBuildItem> reflectiveMethods) {
@@ -154,7 +157,27 @@ void processInterceptedStaticMethods(BeanArchiveIndexBuildItem beanArchiveIndex,
return;
}
- ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClasses, true);
+ // org.acme.Foo -> org.acme.Foo_InterceptorInitializer
+ Map<DotName, String> baseToGeneratedInitializer = new HashMap<>();
+ ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClasses, new Predicate<String>() {
+
+ @Override
+ public boolean test(String name) {
+ // For example, for base org.acme.Foo we generate org.acme.Foo_InterceptorInitializer
+ // and possibly anonymous classes like org.acme.Foo_InterceptorInitializer$$function$$1
+ name = name.replace('/', '.');
+ DotName base = null;
+ for (Entry<DotName, String> e : baseToGeneratedInitializer.entrySet()) {
+ if (e.getValue().equals(name) || name.startsWith(e.getValue())) {
+ base = e.getKey();
+ }
+ }
+ if (base == null) {
+ throw new IllegalStateException("Unable to find the base class for the generated: " + name);
+ }
+ return applicationClassPredicate.test(base);
+ }
+ });
// declaring class -> intercepted static methods
Map<DotName, List<InterceptedStaticMethodBuildItem>> interceptedStaticMethodsMap = new HashMap<>();
@@ -172,14 +195,14 @@ void processInterceptedStaticMethods(BeanArchiveIndexBuildItem beanArchiveIndex,
// 1. registers all interceptor chains inside an "init_static_intercepted_methods" method
// 2. adds static methods to invoke the interceptor chain and delegate to the copy of the original static method
// declaring class -> initializer class
- Map<DotName, String> initializers = new HashMap<>();
+
String initAllMethodName = "init_static_intercepted_methods";
for (Entry<DotName, List<InterceptedStaticMethodBuildItem>> entry : interceptedStaticMethodsMap.entrySet()) {
String packageName = DotNames.internalPackageNameWithTrailingSlash(entry.getKey());
String initializerName = packageName.replace("/", ".") + entry.getKey().withoutPackagePrefix()
+ INITIALIZER_CLASS_SUFFIX;
- initializers.put(entry.getKey(), initializerName);
+ baseToGeneratedInitializer.put(entry.getKey(), initializerName);
ClassCreator initializer = ClassCreator.builder().classOutput(classOutput)
.className(initializerName).setFinal(true).build();
@@ -206,16 +229,17 @@ void processInterceptedStaticMethods(BeanArchiveIndexBuildItem beanArchiveIndex,
// For each intercepted static methods create a copy and modify the original method to delegate to the relevant initializer
for (Entry<DotName, List<InterceptedStaticMethodBuildItem>> entry : interceptedStaticMethodsMap.entrySet()) {
transformers.produce(new BytecodeTransformerBuildItem(entry.getKey().toString(),
- new InterceptedStaticMethodsEnhancer(initializers.get(entry.getKey()), entry.getValue())));
+ new InterceptedStaticMethodsEnhancer(baseToGeneratedInitializer.get(entry.getKey()), entry.getValue())));
}
- // Generate a global initializer that calls all other initializers
- ClassCreator globalInitializer = ClassCreator.builder().classOutput(classOutput)
+ // Generate a global initializer that calls all other initializers; this initializer must be loaded by the runtime ClassLoader
+ ClassCreator globalInitializer = ClassCreator.builder()
+ .classOutput(new GeneratedClassGizmoAdaptor(generatedClasses, true))
.className(InterceptedStaticMethodsRecorder.INITIALIZER_CLASS_NAME.replace('.', '/')).setFinal(true).build();
MethodCreator staticInit = globalInitializer.getMethodCreator("<clinit>", void.class)
.setModifiers(ACC_STATIC);
- for (String initializerClass : initializers.values()) {
+ for (String initializerClass : baseToGeneratedInitializer.values()) {
staticInit.invokeStaticMethod(
MethodDescriptor.ofMethod(initializerClass, initAllMethodName, void.class));
}
@@ -242,7 +266,8 @@ private void implementForward(ClassCreator initializer,
paramTypes[i] = DescriptorUtils.typeToString(params.get(i));
}
MethodCreator forward = initializer
- .getMethodCreator(interceptedStaticMethod.getHash(), DescriptorUtils.typeToString(method.returnType()),
+ .getMethodCreator(interceptedStaticMethod.getForwardingMethodName(),
+ DescriptorUtils.typeToString(method.returnType()),
paramTypes)
.setModifiers(ACC_PUBLIC | ACC_FINAL | ACC_STATIC);
ResultHandle argArray = forward.newArray(Object.class, params.size());
@@ -491,7 +516,7 @@ public void visitEnd() {
paramSlot += AsmUtil.getParameterSize(paramType);
}
superVisitor.visitMethodInsn(Opcodes.INVOKESTATIC,
- initializerClassName.replace('.', '/'), interceptedStaticMethod.getHash(),
+ initializerClassName.replace('.', '/'), interceptedStaticMethod.getForwardingMethodName(),
descriptor.getDescriptor().toString(),
false);
superVisitor.visitInsn(AsmUtil.getReturnInstruction(interceptedStaticMethod.getMethod().returnType()));
diff --git a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/InterceptedStaticMethodsRecorder.java b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/InterceptedStaticMethodsRecorder.java
index 2c62ba21a54..86a993c174a 100644
--- a/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/InterceptedStaticMethodsRecorder.java
+++ b/extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/InterceptedStaticMethodsRecorder.java
@@ -5,6 +5,7 @@
@Recorder
public class InterceptedStaticMethodsRecorder {
+ // This class is generated and calls all generated static interceptor initializers to register metadata in the InterceptedStaticMethods class
public static final String INITIALIZER_CLASS_NAME = "io.quarkus.arc.runtime.InterceptedStaticMethodsInitializer";
public void callInitializer() { | ['extensions/arc/runtime/src/main/java/io/quarkus/arc/runtime/InterceptedStaticMethodsRecorder.java', 'extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodsProcessor.java', 'extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/staticmethods/InterceptedStaticMethodBuildItem.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,458,690 | 5,218,972 | 672,897 | 6,218 | 3,280 | 579 | 52 | 3 | 4,850 | 276 | 1,167 | 98 | 1 | 3 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,202 | quarkusio/quarkus/33042/33007 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33007 | https://github.com/quarkusio/quarkus/pull/33042 | https://github.com/quarkusio/quarkus/pull/33042 | 1 | fix | kubernetes dev service weird error when flavor is kind and setting api value | ### Describe the bug
```
quarkus.kubernetes-client.devservices.flavor=kind
quarkus.kubernetes-client.devservices.api-version=1.22
```
gives:
```
2023-04-29 01:18:07,639 INFO [org.tes.uti.ImageNameSubstitutor] (build-4) Image name substitution will be performed by: DefaultImageNameSubstitutor (composite of 'ConfigurationFileImageNameSubstitutor' and 'PrefixingImageNameSubstitutor')
2023-04-29 01:18:07,643 INFO [org.tes.DockerClientFactory] (build-4) Checking the system...
2023-04-29 01:18:07,644 INFO [org.tes.DockerClientFactory] (build-4) ✔︎ Docker server version should be at least 1.6.0
2023-04-29 01:18:07,688 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2023-04-29 01:18:07,906 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.kubernetes.client.deployment.DevServicesKubernetesProcessor#setupKubernetesDevService threw an exception: java.lang.RuntimeException: java.util.NoSuchElementException: No value present
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.setupKubernetesDevService(DevServicesKubernetesProcessor.java:119)
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:282)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.orElseThrow(Optional.java:377)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.findOrElseThrow(DevServicesKubernetesProcessor.java:249)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.lambda$startKubernetes$5(DevServicesKubernetesProcessor.java:212)
at java.base/java.util.Optional.map(Optional.java:260)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.lambda$startKubernetes$7(DevServicesKubernetesProcessor.java:212)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.startKubernetes(DevServicesKubernetesProcessor.java:241)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.setupKubernetesDevService(DevServicesKubernetesProcessor.java:109)
... 11 more
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:335)
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:86)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:447)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:59)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:149)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:104)
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.kubernetes.client.deployment.DevServicesKubernetesProcessor#setupKubernetesDevService threw an exception: java.lang.RuntimeException: java.util.NoSuchElementException: No value present
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.setupKubernetesDevService(DevServicesKubernetesProcessor.java:119)
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:282)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.orElseThrow(Optional.java:377)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.findOrElseThrow(DevServicesKubernetesProcessor.java:249)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.lambda$startKubernetes$5(DevServicesKubernetesProcessor.java:212)
at java.base/java.util.Optional.map(Optional.java:260)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.lambda$startKubernetes$7(DevServicesKubernetesProcessor.java:212)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.startKubernetes(DevServicesKubernetesProcessor.java:241)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.setupKubernetesDevService(DevServicesKubernetesProcessor.java:109)
... 11 more
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)
... 9 more
Caused by: java.lang.RuntimeException: java.util.NoSuchElementException: No value present
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.setupKubernetesDevService(DevServicesKubernetesProcessor.java:119)
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:282)
at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
at java.base/java.lang.Thread.run(Thread.java:833)
at org.jboss.threads.JBossThread.run(JBossThread.java:501)
Caused by: java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.orElseThrow(Optional.java:377)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.findOrElseThrow(DevServicesKubernetesProcessor.java:249)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.lambda$startKubernetes$5(DevServicesKubernetesProcessor.java:212)
at java.base/java.util.Optional.map(Optional.java:260)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.lambda$startKubernetes$7(DevServicesKubernetesProcessor.java:212)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.startKubernetes(DevServicesKubernetesProcessor.java:241)
at io.quarkus.kubernetes.client.deployment.DevServicesKubernetesProcessor.setupKubernetesDevService(DevServicesKubernetesProcessor.java:109)
... 11 more
```
if I comment out API version then it does not hit this errorr.
### 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_ | 8dd43a487db045d7ad3b0bd9edb33385eb95f24b | 4e32f4a617cb50168a27fe0ac4c07d249266cef6 | https://github.com/quarkusio/quarkus/compare/8dd43a487db045d7ad3b0bd9edb33385eb95f24b...4e32f4a617cb50168a27fe0ac4c07d249266cef6 | diff --git a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java
index 8deaab773cc..48e507f6126 100644
--- a/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java
+++ b/extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java
@@ -15,7 +15,7 @@
import java.util.Objects;
import java.util.Optional;
import java.util.function.Supplier;
-import java.util.stream.Stream;
+import java.util.stream.Collectors;
import org.jboss.logging.Logger;
import org.testcontainers.DockerClientFactory;
@@ -199,17 +199,19 @@ private RunningDevService startKubernetes(DockerStatusBuildItem dockerStatusBuil
switch (config.flavor) {
case API_ONLY:
container = new ApiServerContainer(
- config.apiVersion.map(version -> findOrElseThrow(version, ApiServerContainerVersion.class))
+ config.apiVersion
+ .map(version -> findOrElseThrow(config.flavor, version, ApiServerContainerVersion.class))
.orElseGet(() -> latest(ApiServerContainerVersion.class)));
break;
case K3S:
container = new K3sContainer(
- config.apiVersion.map(version -> findOrElseThrow(version, K3sContainerVersion.class))
+ config.apiVersion.map(version -> findOrElseThrow(config.flavor, version, K3sContainerVersion.class))
.orElseGet(() -> latest(K3sContainerVersion.class)));
break;
case KIND:
container = new KindContainer(
- config.apiVersion.map(version -> findOrElseThrow(version, KindContainerVersion.class))
+ config.apiVersion
+ .map(version -> findOrElseThrow(config.flavor, version, KindContainerVersion.class))
.orElseGet(() -> latest(KindContainerVersion.class)));
break;
default:
@@ -241,12 +243,17 @@ private RunningDevService startKubernetes(DockerStatusBuildItem dockerStatusBuil
.orElseGet(defaultKubernetesClusterSupplier);
}
- <T extends KubernetesVersionEnum<T>> T findOrElseThrow(final String version, final Class<T> versions) {
+ <T extends KubernetesVersionEnum<T>> T findOrElseThrow(final Flavor flavor, final String version, final Class<T> versions) {
final String versionWithPrefix = !version.startsWith("v") ? "v" + version : version;
- return Stream.of(versions.getEnumConstants())
- .filter(v -> v.descriptor().getKubernetesVersion().equalsIgnoreCase(versionWithPrefix))
+ return KubernetesVersionEnum.ascending(versions)
+ .stream()
+ .filter(v -> v.descriptor().getKubernetesVersion().startsWith(versionWithPrefix))
.findFirst()
- .orElseThrow();
+ .orElseThrow(() -> new IllegalArgumentException(
+ String.format("Invalid API version '%s' for flavor '%s'. Options are: [%s]", versionWithPrefix, flavor,
+ KubernetesVersionEnum.ascending(versions).stream()
+ .map(v -> v.descriptor().getKubernetesVersion())
+ .collect(Collectors.joining(", ")))));
}
private Map<String, String> getKubernetesClientConfigFromKubeConfig(KubeConfig kubeConfig) { | ['extensions/kubernetes-client/deployment/src/main/java/io/quarkus/kubernetes/client/deployment/DevServicesKubernetesProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,449,217 | 5,217,170 | 672,745 | 6,218 | 1,959 | 324 | 23 | 1 | 9,806 | 389 | 2,254 | 142 | 0 | 2 | 1970-01-01T00:28:03 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,203 | quarkusio/quarkus/32935/32927 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32927 | https://github.com/quarkusio/quarkus/pull/32935 | https://github.com/quarkusio/quarkus/pull/32935 | 1 | fix | RESTEasy Rective rest client injection into resource fails in native mode over NoSuchMethodException | ### Describe the bug
I have RR app and rest client injection into resource in native mode fails.
```Java
@Inject
@RestClient
MultipartService service;
```
It worked with 3.0.1.Final.
### Expected behavior
Rest client injection to the resource works.
### Actual behavior
```
20:37:40,850 INFO [app] 20:37:39,659 HTTP Request to /client/multipart failed, error id: b24cbcf8-7197-4d2d-ab94-c4e6a8454a55-1: java.lang.RuntimeException: Error injecting io.quarkus.ts.http.jakartarest.reactive.client.MultipartService io.quarkus.ts.http.jakartarest.reactive.client.MultipartClientResource.service
20:37:40,852 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartClientResource_Bean.doCreate(Unknown Source)
20:37:40,853 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartClientResource_Bean.create(Unknown Source)
20:37:40,854 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartClientResource_Bean.create(Unknown Source)
20:37:40,855 INFO [app] at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:113)
20:37:40,856 INFO [app] at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:37)
20:37:40,857 INFO [app] at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:34)
20:37:40,858 INFO [app] at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
20:37:40,859 INFO [app] at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
20:37:40,860 INFO [app] at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:34)
20:37:40,861 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartClientResource_Bean.get(Unknown Source)
20:37:40,862 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartClientResource_Bean.get(Unknown Source)
20:37:40,862 INFO [app] at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:485)
20:37:40,864 INFO [app] at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:498)
20:37:40,865 INFO [app] at io.quarkus.arc.impl.ArcContainerImpl$2.get(ArcContainerImpl.java:282)
20:37:40,866 INFO [app] at io.quarkus.arc.impl.ArcContainerImpl$2.get(ArcContainerImpl.java:279)
20:37:40,866 INFO [app] at io.quarkus.arc.runtime.BeanContainerImpl$1.create(BeanContainerImpl.java:46)
20:37:40,867 INFO [app] at io.quarkus.resteasy.reactive.common.runtime.ArcBeanFactory.createInstance(ArcBeanFactory.java:27)
20:37:40,868 INFO [app] at org.jboss.resteasy.reactive.server.handlers.InstanceHandler.handle(InstanceHandler.java:26)
20:37:40,869 INFO [app] at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:139)
20:37:40,870 INFO [app] at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
20:37:40,870 INFO [app] at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
20:37:40,871 INFO [app] at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
20:37:40,872 INFO [app] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
20:37:40,872 INFO [app] at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
20:37:40,873 INFO [app] at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
20:37:40,873 INFO [app] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
20:37:40,873 INFO [app] at java.base@17.0.7/java.lang.Thread.run(Thread.java:833)
20:37:40,874 INFO [app] at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:775)
20:37:40,874 INFO [app] at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:203)
20:37:40,875 INFO [app] Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: org.jboss.resteasy.reactive.client.interceptors.ClientGZIPDecodingInterceptor.<init>()
20:37:40,875 INFO [app] at org.jboss.resteasy.reactive.common.jaxrs.ConfigurationImpl.register(ConfigurationImpl.java:203)
20:37:40,876 INFO [app] at org.jboss.resteasy.reactive.client.impl.ClientBuilderImpl.build(ClientBuilderImpl.java:285)
20:37:40,876 INFO [app] at io.quarkus.rest.client.reactive.runtime.RestClientBuilderImpl.build(RestClientBuilderImpl.java:358)
20:37:40,877 INFO [app] at io.quarkus.rest.client.reactive.runtime.QuarkusRestClientBuilderImpl.build(QuarkusRestClientBuilderImpl.java:222)
20:37:40,877 INFO [app] at io.quarkus.rest.client.reactive.runtime.RestClientCDIDelegateBuilder.build(RestClientCDIDelegateBuilder.java:60)
20:37:40,878 INFO [app] at io.quarkus.rest.client.reactive.runtime.RestClientCDIDelegateBuilder.createDelegate(RestClientCDIDelegateBuilder.java:42)
20:37:40,878 INFO [app] at io.quarkus.rest.client.reactive.runtime.RestClientReactiveCDIWrapperBase.<init>(RestClientReactiveCDIWrapperBase.java:20)
20:37:40,878 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartService$$CDIWrapper.<init>(Unknown Source)
20:37:40,879 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartService$$CDIWrapper_ClientProxy.<init>(Unknown Source)
20:37:40,879 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartService$$CDIWrapper_Bean.proxy(Unknown Source)
20:37:40,879 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartService$$CDIWrapper_Bean.get(Unknown Source)
20:37:40,880 INFO [app] at io.quarkus.ts.http.jakartarest.reactive.client.MultipartService$$CDIWrapper_Bean.get(Unknown Source)
20:37:40,880 INFO [app] ... 29 more
20:37:40,880 INFO [app] Caused by: java.lang.NoSuchMethodException: org.jboss.resteasy.reactive.client.interceptors.ClientGZIPDecodingInterceptor.<init>()
20:37:40,881 INFO [app] at java.base@17.0.7/java.lang.Class.getConstructor0(DynamicHub.java:3585)
20:37:40,881 INFO [app] at java.base@17.0.7/java.lang.Class.getDeclaredConstructor(DynamicHub.java:2754)
20:37:40,881 INFO [app] at org.jboss.resteasy.reactive.common.jaxrs.ConfigurationImpl.register(ConfigurationImpl.java:201)
20:37:40,881 INFO [app] ... 40 more
```
### How to Reproduce?
Reproducer:
1. `git clone git@github.com:quarkus-qe/quarkus-test-suite.git`
2. `cd quarkus-test-suite`
3. `git checkout -b repro/rr-injection`
4. `cd http/jakarta-rest-reactive`
5. `mvn clean verify -Dnative -Dit.test=MultipartClientIT`
### Output of `uname -a` or `ver`
Fedora
### Output of `java -version`
openjdk 11.0.18 2023-01-17
### GraalVM version (if different from Java)
22.3
### Quarkus version or git rev
999-SNAPSHOT
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
mvn 3.8.6
### Additional information
N/A | 2c39693556444f5d0ab9677445b8dd358c34f196 | 985f9daac6be97b9e971c781a77a46ca40066db9 | https://github.com/quarkusio/quarkus/compare/2c39693556444f5d0ab9677445b8dd358c34f196...985f9daac6be97b9e971c781a77a46ca40066db9 | diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java
index 0af9df3ca2d..558dbfe0468 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java
@@ -52,6 +52,7 @@
import org.jboss.jandex.MethodInfo;
import org.jboss.jandex.Type;
import org.jboss.logging.Logger;
+import org.jboss.resteasy.reactive.client.interceptors.ClientGZIPDecodingInterceptor;
import org.jboss.resteasy.reactive.client.spi.MissingMessageBodyReaderErrorMessageContextualizer;
import org.jboss.resteasy.reactive.common.processor.ResteasyReactiveDotNames;
import org.jboss.resteasy.reactive.common.processor.transformation.AnnotationStore;
@@ -108,6 +109,7 @@ class RestClientReactiveProcessor {
private static final DotName KOTLIN_METADATA_ANNOTATION = DotName.createSimple("kotlin.Metadata");
private static final String DISABLE_SMART_PRODUCES_QUARKUS = "quarkus.rest-client.disable-smart-produces";
+ private static final String ENABLE_COMPRESSION = "quarkus.http.enable-compression";
private static final String KOTLIN_INTERFACE_DEFAULT_IMPL_SUFFIX = "$DefaultImpls";
private static final Set<DotName> SKIP_COPYING_ANNOTATIONS_TO_GENERATED_CLASS = Set.of(
@@ -352,6 +354,19 @@ AdditionalBeanBuildItem registerProviderBeans(CombinedIndexBuildItem combinedInd
return builder.build();
}
+ @BuildStep
+ void registerCompressionInterceptors(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses) {
+ Boolean enableCompression = ConfigProvider.getConfig()
+ .getOptionalValue(ENABLE_COMPRESSION, Boolean.class)
+ .orElse(false);
+ if (enableCompression) {
+ reflectiveClasses.produce(ReflectiveClassBuildItem
+ .builder(ClientGZIPDecodingInterceptor.class)
+ .serialization(false)
+ .build());
+ }
+ }
+
@BuildStep
@Record(ExecutionTime.STATIC_INIT)
void addRestClientBeans(Capabilities capabilities, | ['extensions/resteasy-reactive/rest-client-reactive/deployment/src/main/java/io/quarkus/rest/client/reactive/deployment/RestClientReactiveProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,431,910 | 5,213,834 | 672,419 | 6,217 | 721 | 130 | 15 | 1 | 7,101 | 391 | 2,124 | 103 | 0 | 2 | 1970-01-01T00:28:02 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,205 | quarkusio/quarkus/32812/32210 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32210 | https://github.com/quarkusio/quarkus/pull/32812 | https://github.com/quarkusio/quarkus/pull/32812 | 1 | fixes | Use of the `quarkus-opentelemetry` extension yields config warnings | ### Describe the bug
When running the `opentelemetr-quickstart` using Quarkus from 2d2e1cf4d3c15c250fdd960f868371757b5f77fe, one seems the following warnings:
```posh
2023-03-29 11:14:50,109 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.opentelemetry.tracer.enabled" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2023-03-29 11:14:50,109 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.opentelemetry.tracer.sampler" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
2023-03-29 11:14:50,109 WARN [io.qua.config] (Quarkus Main Thread) Unrecognized configuration key "quarkus.opentelemetry.enabled" was provided; it will be ignored; verify that the dependency extension for this configuration is set or that you did not make a typo
```
which no user action can remove.
### Expected behavior
No config warnings
### Actual behavior
_No response_
### How to Reproduce?
Just run the `opentelemetry-quickstart` from the `development` branch.
### 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
https://github.com/quarkusio/quarkus/commit/2d2e1cf4d3c15c250fdd960f868371757b5f77fe
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | d1c71a8e9c6222b8b52e32c47ae515ef60e05341 | b12088147b80748c5388b00a9a410bb26658e1c0 | https://github.com/quarkusio/quarkus/compare/d1c71a8e9c6222b8b52e32c47ae515ef60e05341...b12088147b80748c5388b00a9a410bb26658e1c0 | diff --git a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryLegacyConfigurationTest.java b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryLegacyConfigurationTest.java
index 79cd04d59c3..6ae06be3500 100644
--- a/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryLegacyConfigurationTest.java
+++ b/extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryLegacyConfigurationTest.java
@@ -5,7 +5,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import java.util.Arrays;
+import java.util.List;
import jakarta.inject.Inject;
@@ -24,6 +24,7 @@ class OpenTelemetryLegacyConfigurationTest {
.overrideConfigKey("quarkus.opentelemetry.enabled", "false")
.overrideConfigKey("quarkus.opentelemetry.tracer.enabled", "false")
.overrideConfigKey("quarkus.opentelemetry.propagators", "tracecontext")
+ .overrideConfigKey("quarkus.opentelemetry.tracer.resource-attributes", "service.name=authservice")
.overrideConfigKey("quarkus.opentelemetry.tracer.suppress-non-application-uris", "false")
.overrideConfigKey("quarkus.opentelemetry.tracer.include-static-resources", "true")
.overrideConfigKey("quarkus.opentelemetry.tracer.sampler", "off")
@@ -46,7 +47,9 @@ void config() {
assertEquals(FALSE, oTelBuildConfig.enabled());
assertTrue(oTelBuildConfig.traces().enabled().isPresent());
assertEquals(FALSE, oTelBuildConfig.traces().enabled().get());
- assertEquals(Arrays.asList("tracecontext"), oTelBuildConfig.propagators()); // will not include the default baggagge
+ assertEquals(List.of("tracecontext"), oTelBuildConfig.propagators()); // will not include the default baggagge
+ assertTrue(oTelRuntimeConfig.resourceAttributes().isPresent());
+ assertEquals("service.name=authservice", oTelRuntimeConfig.resourceAttributes().get().get(0));
assertEquals(FALSE, oTelRuntimeConfig.traces().suppressNonApplicationUris());
assertEquals(TRUE, oTelRuntimeConfig.traces().includeStaticResources());
assertEquals("always_off", oTelBuildConfig.traces().sampler());
diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/OTelFallbackConfigSourceInterceptor.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/OTelFallbackConfigSourceInterceptor.java
index ce1ea166938..9d97991d4ca 100644
--- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/OTelFallbackConfigSourceInterceptor.java
+++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/OTelFallbackConfigSourceInterceptor.java
@@ -1,5 +1,6 @@
package io.quarkus.opentelemetry.runtime.config;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
@@ -15,21 +16,27 @@
@Priority(Priorities.LIBRARY + 300 + 5)
public class OTelFallbackConfigSourceInterceptor extends FallbackConfigSourceInterceptor {
+ private final static Map<String, String> FALLBACKS = new HashMap<>();
private final static LegacySamplerNameConverter LEGACY_SAMPLER_NAME_CONVERTER = new LegacySamplerNameConverter();
+ static {
+ FALLBACKS.put("quarkus.otel.enabled", "quarkus.opentelemetry.enabled");
+ FALLBACKS.put("quarkus.otel.traces.enabled", "quarkus.opentelemetry.tracer.enabled");
+ FALLBACKS.put("quarkus.otel.propagators", "quarkus.opentelemetry.propagators");
+ FALLBACKS.put("quarkus.otel.resource.attributes", "quarkus.opentelemetry.tracer.resource-attributes");
+ FALLBACKS.put("quarkus.otel.traces.suppress-non-application-uris",
+ "quarkus.opentelemetry.tracer.suppress-non-application-uris");
+ FALLBACKS.put("quarkus.otel.traces.include-static-resources", "quarkus.opentelemetry.tracer.include-static-resources");
+ FALLBACKS.put("quarkus.otel.traces.sampler", "quarkus.opentelemetry.tracer.sampler");
+ FALLBACKS.put("quarkus.otel.traces.sampler.arg", "quarkus.opentelemetry.tracer.sampler.ratio");
+ FALLBACKS.put("quarkus.otel.exporter.otlp.enabled", "quarkus.opentelemetry.tracer.exporter.otlp.enabled");
+ FALLBACKS.put("quarkus.otel.exporter.otlp.traces.legacy-endpoint",
+ "quarkus.opentelemetry.tracer.exporter.otlp.endpoint");
+ FALLBACKS.put("quarkus.otel.exporter.otlp.traces.headers", "quarkus.opentelemetry.tracer.exporter.otlp.headers");
+ }
+
public OTelFallbackConfigSourceInterceptor() {
- super(Map.of(
- "quarkus.otel.enabled", "quarkus.opentelemetry.enabled",
- "quarkus.otel.traces.enabled", "quarkus.opentelemetry.tracer.enabled",
- "quarkus.otel.propagators", "quarkus.opentelemetry.propagators",
- "quarkus.otel.traces.suppress-non-application-uris",
- "quarkus.opentelemetry.tracer.suppress-non-application-uris",
- "quarkus.otel.traces.include-static-resources", "quarkus.opentelemetry.tracer.include-static-resources",
- "quarkus.otel.traces.sampler", "quarkus.opentelemetry.tracer.sampler",
- "quarkus.otel.traces.sampler.arg", "quarkus.opentelemetry.tracer.sampler.ratio",
- "quarkus.otel.exporter.otlp.enabled", "quarkus.opentelemetry.tracer.exporter.otlp.enabled",
- "quarkus.otel.exporter.otlp.traces.headers", "quarkus.opentelemetry.tracer.exporter.otlp.headers",
- "quarkus.otel.exporter.otlp.traces.legacy-endpoint", "quarkus.opentelemetry.tracer.exporter.otlp.endpoint"));
+ super(FALLBACKS);
}
@Override
@@ -44,10 +51,28 @@ public ConfigValue getValue(final ConfigSourceInterceptorContext context, final
@Override
public Iterator<String> iterateNames(final ConfigSourceInterceptorContext context) {
Set<String> names = new HashSet<>();
- Iterator<String> namesIterator = super.iterateNames(context);
+ Iterator<String> namesIterator = context.iterateNames();
while (namesIterator.hasNext()) {
- names.add(namesIterator.next());
+ String name = namesIterator.next();
+ String fallback = FALLBACKS.get(name);
+ // We only include the used property, so if it is a fallback (not mapped), it will be reported as unknown
+ if (fallback != null) {
+ ConfigValue nameValue = context.proceed(name);
+ ConfigValue fallbackValue = context.proceed(fallback);
+ if (nameValue == null) {
+ names.add(fallback);
+ } else if (fallbackValue == null) {
+ names.add(name);
+ } else if (nameValue.getConfigSourceOrdinal() >= fallbackValue.getConfigSourceOrdinal()) {
+ names.add(name);
+ } else {
+ names.add(fallback);
+ }
+ } else {
+ names.add(name);
+ }
}
+
// TODO - Required because the defaults ConfigSource for mappings does not provide configuration names.
names.add("quarkus.otel.enabled");
names.add("quarkus.otel.metrics.exporter");
diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/OtelConfigRelocateConfigSourceInterceptor.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/OtelConfigRelocateConfigSourceInterceptor.java
deleted file mode 100644
index e69de29bb2d..00000000000 | ['extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/OtelConfigRelocateConfigSourceInterceptor.java', 'extensions/opentelemetry/deployment/src/test/java/io/quarkus/opentelemetry/deployment/OpenTelemetryLegacyConfigurationTest.java', 'extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/config/OTelFallbackConfigSourceInterceptor.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,371,882 | 5,201,916 | 670,982 | 6,210 | 3,534 | 821 | 53 | 2 | 1,637 | 203 | 443 | 47 | 1 | 1 | 1970-01-01T00:28:02 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,206 | quarkusio/quarkus/32762/32690 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/32690 | https://github.com/quarkusio/quarkus/pull/32762 | https://github.com/quarkusio/quarkus/pull/32762 | 1 | fix | Quarkus dev mode is not working with a certain type of folder tree due to dependency injection | ### Describe the bug
I found a very odd bug. I have a multimodule project and I use maven. I have 2 modules, A and B, with B depending on A. A contains a @ApplicationScoped annotated bean.
If I use this tree, everything is fine:
```
- pom.xml
- A folder
- pom.xml
- B folder
- pom.xml
```
But if I use this tree, the quarkus dev mode is not working:
```
- parent folder
- pom.xml
- A folder
- pom.xml
- B folder
- pom.xml
```
There is a UnsatisfiedResolutionException, the bean from A is not found. But the project is still working if I use the command "java -jar quarkus-run.jar, it's only in dev mode.
### Expected behavior
The dev mode should be working for every kind of tree.
### Actual behavior
_No response_
### How to Reproduce?
I created a small project to reproduce the problem:
https://github.com/jakwarrior/quarkus-2-multi-module-project-quickstart
The main branch is working. You can use `mvn quarkus:dev` in the root of the project and everything is fine.
You can see the problem with the branch named "not_working". Go to the "quickstart-parent" folder and do `mvn quarkus:dev`. You will see this stacktrace:
```
2023-04-17 16:26:24,033 WARN [io.qua.arc.pro.BeanArchives] (build-39) Failed to index com.github.bgizdov.multimodule.entities.User: Class does not exist in ClassLoader QuarkusClassLoader:Deployment Class Loader: DEV@53fb3dab
2023-04-17 16:26:24,043 WARN [io.sma.ope.run.scanner] (build-39) SROAP04005: Could not find schema class in index: com.github.bgizdov.multimodule.entities.User
2023-04-17 16:26:24,076 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure
2023-04-17 16:26:24,564 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.github.bgizdov.multimodule.service.TestService and qualifiers [@Default]
- java member: com.github.bgizdov.multimodule.resources.UserResource#injectService
- declared on CLASS bean [types=[com.github.bgizdov.multimodule.resources.UserResource, java.lang.Object], qualifiers=[@Default, @Any], target=com.github.bgizdov.multimodule.resources.UserResource]
at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:1223)
at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:288)
at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:148)
at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:526)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
```
The "quickstart-core" module contains a simple bean that cannot be injected.
```
@ApplicationScoped
@Getter
public class TestService {
private final String test = "Hello inject !";
}
```
### Output of `uname -a` or `ver`
Windows 11
### Output of `java -version`
openjdk version "11.0.15"
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.16.6
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
maven 3.8.5
### Additional information
_No response_ | eaf0e8d631b73ea7b63216fbe1ee387af5fc72e9 | 66b06bb1c11f66da9912997f7e1b081073c8d4d4 | https://github.com/quarkusio/quarkus/compare/eaf0e8d631b73ea7b63216fbe1ee387af5fc72e9...66b06bb1c11f66da9912997f7e1b081073c8d4d4 | diff --git a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java
index 0cab46d8b25..d3772143e0d 100644
--- a/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java
+++ b/independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java
@@ -153,7 +153,11 @@ private LocalProject loadAndCacheProject(Path pomFile) throws BootstrapMavenExce
}
private Model rawModel(Path pomFile) throws BootstrapMavenException {
- final Path moduleDir = pomFile.getParent();
+ var moduleDir = pomFile.getParent();
+ if (moduleDir != null) {
+ // the path might not be normalized, while the modelProvider below would typically recognize normalized absolute paths
+ moduleDir = moduleDir.normalize().toAbsolutePath();
+ }
Model rawModel = rawModelCache.get(moduleDir);
if (rawModel != null) {
return rawModel; | ['independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,302,966 | 5,188,238 | 669,363 | 6,200 | 340 | 62 | 6 | 1 | 3,522 | 388 | 913 | 87 | 1 | 4 | 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 |
2,162 | quarkusio/quarkus/33924/33875 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33875 | https://github.com/quarkusio/quarkus/pull/33924 | https://github.com/quarkusio/quarkus/pull/33924 | 1 | fix | quarkus-rest-client-reactive-jaxb does not support direct marshalling of JAXBElement<T> | ### Describe the bug
After writing the below explanation, I'm unsure if this should have been filed as a _Feature request_ or I'm just pointing out an implicit inconsistency in the support of JAXB. But anyway:
I'm doing a port of an old SB/camel service and I'm defining a REST client interface and need XML serialisation support. My "Xml" classes are generated with `xsdtojava` from a couple of xsd-files. I'm providing my own `JAXBContext` like described in this [guide](https://quarkus.io/guides/resteasy-reactive#customize-the-jaxb-configuration).
Because I'm just using the supplied xsd-files, my request model object is is in the form of `JAXBElement<eu.request.SomeType>`. I would have assumed that defining a method like this
```java
@POST
@Produces(MediaType.APPLICATION_XML)
@Consumes(MediaType.APPLICATION_XML)
eu.response.Response getVehicleByRegno(JAXBElement<eu.request.SomeType> request)
```
that the http-client would correctly serialize this xml element:
```
JAXBElement<eu.request.SomeType> req = objectFactory.createKehys(messageType);
```
as
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<kehys>
...
</kehys>
```
However the element is marshalled as
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<JAXBElement>
<kehys>
...
</kehys>
</JAXBElement>
```
After looking into the [implementation](https://github.com/quarkusio/quarkus/blob/main/extensions/resteasy-reactive/rest-client-reactive-jaxb/runtime/src/main/java/io/quarkus/rest/client/reactive/jaxb/runtime/ClientMessageBodyWriter.java) of JAXB/Xml `MessageBodyWriter` I can see that only classes annotated with `XmlRootElement` are supported (the [server](https://github.com/quarkusio/quarkus/blob/main/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyWriter.java) version has the same limitation). If not annotated, the object in question is wrapped in a JAXBElement ([client implementation](https://github.com/quarkusio/quarkus/blob/main/extensions/resteasy-reactive/rest-client-reactive-jaxb/runtime/src/main/java/io/quarkus/rest/client/reactive/jaxb/runtime/ClientMessageBodyWriter.java#L49-L54)):
```java
Object jaxbObject = o;
Class<?> clazz = o.getClass();
XmlRootElement jaxbElement = clazz.getAnnotation(XmlRootElement.class);
if (jaxbElement == null) {
jaxbObject = new JAXBElement(new QName(Introspector.decapitalize(clazz.getSimpleName())), clazz, o);
}
```
This explains the extra `<JAXBElement>` in my generated xml above.
So my question or issue:
Now that I can define my own JAXBContext that may include classes not annotated with `XmlRootElement`, shouldn't I be able to serialise them as well? 😃
(As I'm porting a Camel service I checked how Camel checks if a Object is serialisable: [Camel](https://github.com/apache/camel/blob/main/components/camel-jaxb/src/main/java/org/apache/camel/converter/jaxb/JaxbDataFormat.java#L204) uses `JAXBIntrospector.isElement(element)`)
### Expected behavior
Being able to generate XML based on classes in a provided JAXBContext.
### Actual behavior
Only classes annotated with `XmlRootElement` are probably supported. This is could be seen as "inconsistent" with the ability to provide your own JAXBContext.
### How to Reproduce?
If needed, I will provide a project that demonstrate the issue, but until then I think the explanation above sufficiently explains the issue.
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
openjdk version "17.0.5" 2022-10-18 OpenJDK Runtime Environment Temurin-17.0.5+8 (build 17.0.5+8) OpenJDK 64-Bit Server VM Temurin-17.0.5+8 (build 17.0.5+8, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.16.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 44cea45a45c8b1afa8f5f501d55b42db32c35936 | a8c3c5aa7bbc5f348b624c2cfeab87e423d83141 | https://github.com/quarkusio/quarkus/compare/44cea45a45c8b1afa8f5f501d55b42db32c35936...a8c3c5aa7bbc5f348b624c2cfeab87e423d83141 | diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/deployment/src/test/java/io/quarkus/resteasy/reactive/jaxb/deployment/test/SimpleXmlTest.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/deployment/src/test/java/io/quarkus/resteasy/reactive/jaxb/deployment/test/SimpleXmlTest.java
index 214d074bad7..4cfe409be76 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/deployment/src/test/java/io/quarkus/resteasy/reactive/jaxb/deployment/test/SimpleXmlTest.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/deployment/src/test/java/io/quarkus/resteasy/reactive/jaxb/deployment/test/SimpleXmlTest.java
@@ -7,6 +7,8 @@
import java.io.StringWriter;
+import javax.xml.namespace.QName;
+
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.ws.rs.Consumes;
@@ -18,6 +20,7 @@
import jakarta.ws.rs.container.Suspended;
import jakarta.ws.rs.core.MediaType;
import jakarta.xml.bind.JAXB;
+import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;
import jakarta.xml.bind.annotation.XmlRootElement;
@@ -178,6 +181,19 @@ public void testResourceUsingModelWithSameName() {
.body(is("bb"));
}
+ @Test
+ public void testSupportReturningJaxbElement() {
+ Person response = RestAssured
+ .get("/simple/person-as-jaxb-element")
+ .then()
+ .statusCode(200)
+ .contentType(ContentType.XML)
+ .extract().as(Person.class);
+
+ assertEquals("Bob", response.getFirst());
+ assertEquals("Builder", response.getLast());
+ }
+
private String toXml(Object person) {
StringWriter sw = new StringWriter();
JAXB.marshal(person, sw);
@@ -246,6 +262,13 @@ public Person getPerson() {
return person;
}
+ @GET
+ @Produces(MediaType.APPLICATION_XML)
+ @Path("/person-as-jaxb-element")
+ public JAXBElement<Person> getPersonAsJaxbElement() {
+ return new JAXBElement<>(new QName("person"), Person.class, getPerson());
+ }
+
@POST
@Path("/person")
@Produces(MediaType.APPLICATION_XML)
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyWriter.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyWriter.java
index b5a91eec309..924e8113ec0 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyWriter.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyWriter.java
@@ -55,11 +55,15 @@ public void writeResponse(Object o, Type genericType, ServerRequestContext conte
protected void marshal(Object o, OutputStream outputStream) {
try {
- Object jaxbObject = o;
Class<?> clazz = o.getClass();
- XmlRootElement jaxbElement = clazz.getAnnotation(XmlRootElement.class);
- if (jaxbElement == null) {
- jaxbObject = new JAXBElement(new QName(Introspector.decapitalize(clazz.getSimpleName())), clazz, o);
+ Object jaxbObject = o;
+ if (o instanceof JAXBElement) {
+ clazz = ((JAXBElement<?>) o).getDeclaredType();
+ } else {
+ XmlRootElement jaxbElement = clazz.getAnnotation(XmlRootElement.class);
+ if (jaxbElement == null) {
+ jaxbObject = new JAXBElement(new QName(Introspector.decapitalize(clazz.getSimpleName())), clazz, o);
+ }
}
getMarshall(clazz).marshal(jaxbObject, outputStream);
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 4efea63bf3f..2897be131bb 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
@@ -5,12 +5,18 @@
import java.net.URI;
import java.util.Objects;
+import javax.xml.namespace.QName;
+
+import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.GET;
+import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.Produces;
import jakarta.ws.rs.core.MediaType;
+import jakarta.xml.bind.JAXBElement;
import jakarta.xml.bind.annotation.XmlRootElement;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
@@ -26,18 +32,24 @@ public class SimpleJaxbTest {
@TestHTTPResource
URI uri;
+ XmlClient client;
+
+ @BeforeEach
+ public void setup() {
+ client = QuarkusRestClientBuilder.newBuilder().baseUri(uri).build(XmlClient.class);
+ }
+
@Test
void shouldConsumeXMLEntity() {
- var dto = QuarkusRestClientBuilder.newBuilder().baseUri(uri).build(XmlClient.class)
- .dto();
- assertThat(dto).isEqualTo(new Dto("foo", "bar"));
+ assertThat(client.dto()).isEqualTo(new Dto("foo", "bar"));
+ assertThat(client.createDto(new Dto("foo", "bar"))).isEqualTo(new Dto("foo", "bar"));
+ assertThat(client.createDto(new JAXBElement<>(new QName("Dto"), Dto.class, new Dto("foo", "bar"))))
+ .isEqualTo(new Dto("foo", "bar"));
}
@Test
void shouldConsumePlainXMLEntity() {
- var dto = QuarkusRestClientBuilder.newBuilder().baseUri(uri).build(XmlClient.class)
- .plain();
- assertThat(dto).isEqualTo(new Dto("foo", "bar"));
+ assertThat(client.plain()).isEqualTo(new Dto("foo", "bar"));
}
@Path("/xml")
@@ -48,6 +60,18 @@ public interface XmlClient {
@Produces(MediaType.APPLICATION_XML)
Dto dto();
+ @POST
+ @Path("/dto")
+ @Consumes(MediaType.APPLICATION_XML)
+ @Produces(MediaType.APPLICATION_XML)
+ Dto createDto(Dto dto);
+
+ @POST
+ @Path("/dto")
+ @Consumes(MediaType.APPLICATION_XML)
+ @Produces(MediaType.APPLICATION_XML)
+ Dto createDto(JAXBElement<Dto> dto);
+
@GET
@Path("/plain")
@Produces(MediaType.TEXT_XML)
@@ -67,6 +91,14 @@ public String dto() {
return DTO_FOO_BAR;
}
+ @POST
+ @Consumes(MediaType.APPLICATION_XML)
+ @Produces(MediaType.APPLICATION_XML)
+ @Path("/dto")
+ public String dto(String dto) {
+ return dto;
+ }
+
@GET
@Produces(MediaType.TEXT_XML)
@Path("/plain")
diff --git a/extensions/resteasy-reactive/rest-client-reactive-jaxb/runtime/src/main/java/io/quarkus/rest/client/reactive/jaxb/runtime/ClientMessageBodyWriter.java b/extensions/resteasy-reactive/rest-client-reactive-jaxb/runtime/src/main/java/io/quarkus/rest/client/reactive/jaxb/runtime/ClientMessageBodyWriter.java
index 9d1b1f90438..5cb016a42b5 100644
--- a/extensions/resteasy-reactive/rest-client-reactive-jaxb/runtime/src/main/java/io/quarkus/rest/client/reactive/jaxb/runtime/ClientMessageBodyWriter.java
+++ b/extensions/resteasy-reactive/rest-client-reactive-jaxb/runtime/src/main/java/io/quarkus/rest/client/reactive/jaxb/runtime/ClientMessageBodyWriter.java
@@ -46,11 +46,13 @@ private void setContentTypeIfNecessary(MultivaluedMap<String, Object> httpHeader
protected void marshal(Object o, OutputStream outputStream) {
try {
- Object jaxbObject = o;
Class<?> clazz = o.getClass();
- XmlRootElement jaxbElement = clazz.getAnnotation(XmlRootElement.class);
- if (jaxbElement == null) {
- jaxbObject = new JAXBElement(new QName(Introspector.decapitalize(clazz.getSimpleName())), clazz, o);
+ Object jaxbObject = o;
+ if (!(o instanceof JAXBElement)) {
+ XmlRootElement jaxbElement = clazz.getAnnotation(XmlRootElement.class);
+ if (jaxbElement == null) {
+ jaxbObject = new JAXBElement(new QName(Introspector.decapitalize(clazz.getSimpleName())), clazz, o);
+ }
}
marshaller.marshal(jaxbObject, outputStream); | ['extensions/resteasy-reactive/quarkus-resteasy-reactive-jaxb/runtime/src/main/java/io/quarkus/resteasy/reactive/jaxb/runtime/serialisers/ServerJaxbMessageBodyWriter.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/deployment/src/test/java/io/quarkus/resteasy/reactive/jaxb/deployment/test/SimpleXmlTest.java', 'extensions/resteasy-reactive/rest-client-reactive-jaxb/runtime/src/main/java/io/quarkus/rest/client/reactive/jaxb/runtime/ClientMessageBodyWriter.java'] | {'.java': 4} | 4 | 4 | 0 | 0 | 4 | 26,835,262 | 5,293,430 | 681,519 | 6,284 | 1,356 | 263 | 22 | 2 | 4,112 | 420 | 1,015 | 95 | 5 | 5 | 1970-01-01T00:28:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,160 | quarkusio/quarkus/33970/33966 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33966 | https://github.com/quarkusio/quarkus/pull/33970 | https://github.com/quarkusio/quarkus/pull/33970 | 1 | fixes | Quarkus crashing with dev-mode with Qute (on a specific situation) | ### Describe the bug
```
java.lang.ClassNotFoundException: io.quarkus.qute.runtime.extensions.NumberTemplateExtensions_Extension_ValueResolver_mod_bd066910099671b808afec3771a44518fddd2bc9
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:516)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.loadClass(QuarkusClassLoader.java:466)
at io.quarkus.qute.runtime.EngineProducer.createResolver(EngineProducer.java:314)
at io.quarkus.qute.runtime.EngineProducer.<init>(EngineProducer.java:185)
at io.quarkus.qute.runtime.EngineProducer_Bean.doCreate(Unknown Source)
at io.quarkus.qute.runtime.EngineProducer_Bean.create(Unknown Source)
at io.quarkus.qute.runtime.EngineProducer_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 io.quarkus.qute.runtime.EngineProducer_Bean.get(Unknown Source)
at io.quarkus.qute.runtime.EngineProducer_Bean.get(Unknown Source)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:499)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:479)
at io.quarkus.arc.impl.ArcContainerImpl.beanInstanceHandle(ArcContainerImpl.java:512)
at io.quarkus.arc.impl.ArcContainerImpl.instance(ArcContainerImpl.java:295)
```
This happens on this project
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
https://github.com/ia3andy/quarkus-blast
1. change a typesafe variable to something that doesn't exists (i.e: `game -> something` in index.html)
2. start devmode
3. fix problem and reload browser
4. boom
### 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
3.1.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 35e0f9c21c1e0a7f994d5b4fd590280a23693600 | 1cbfb462c4777bcf3fa349b4c7856c2bbb6dd9df | https://github.com/quarkusio/quarkus/compare/35e0f9c21c1e0a7f994d5b4fd590280a23693600...1cbfb462c4777bcf3fa349b4c7856c2bbb6dd9df | 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 e362d555376..11047be4925 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
@@ -1711,12 +1711,18 @@ void generateValueResolvers(QuteConfig config, BuildProducer<GeneratedClassBuild
List<PanacheEntityClassesBuildItem> panacheEntityClasses,
List<TemplateDataBuildItem> templateData,
List<TemplateGlobalBuildItem> templateGlobals,
+ List<IncorrectExpressionBuildItem> incorrectExpressions,
LiveReloadBuildItem liveReloadBuildItem,
CompletedApplicationClassPredicateBuildItem applicationClassPredicate,
BuildProducer<GeneratedValueResolverBuildItem> generatedResolvers,
BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
BuildProducer<GeneratedTemplateInitializerBuildItem> generatedInitializers) {
+ if (!incorrectExpressions.isEmpty()) {
+ // Skip generation if a validation error occurs
+ return;
+ }
+
IndexView index = beanArchiveIndex.getIndex();
ClassOutput classOutput = new GeneratedClassGizmoAdaptor(generatedClasses, new Function<String, String>() {
@Override | ['extensions/qute/deployment/src/main/java/io/quarkus/qute/deployment/QuteProcessor.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,830,597 | 5,292,355 | 681,383 | 6,279 | 212 | 34 | 6 | 1 | 2,860 | 158 | 694 | 72 | 1 | 1 | 1970-01-01T00:28:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,532 | quarkusio/quarkus/22850/22847 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22847 | https://github.com/quarkusio/quarkus/pull/22850 | https://github.com/quarkusio/quarkus/pull/22850 | 1 | fix | RESTEasy Reactive: null fields in multipart responses cause NullPointerException | ### Describe the bug
When trying to return a multipart response with null fields (see the code below), MultipartMessageBodyWriter throws a NullPointerException
### Expected behavior
_No response_
### Actual behavior
```java
2022-01-12 23:13:34,634 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /give-me-file/empty failed, error id: d54b7825-d1ce-4881-a049-01b23da53ee4-1: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "entity" is null
at org.jboss.resteasy.reactive.server.core.multipart.MultipartMessageBodyWriter.serialiseEntity(MultipartMessageBodyWriter.java:120)
at org.jboss.resteasy.reactive.server.core.multipart.MultipartMessageBodyWriter.write(MultipartMessageBodyWriter.java:83)
at org.jboss.resteasy.reactive.server.core.multipart.MultipartMessageBodyWriter.writeMultiformData(MultipartMessageBodyWriter.java:57)
at org.jboss.resteasy.reactive.server.core.multipart.MultipartMessageBodyWriter.writeResponse(MultipartMessageBodyWriter.java:44)
at org.jboss.resteasy.reactive.server.core.ServerSerialisers.invokeWriter(ServerSerialisers.java:207)
at org.jboss.resteasy.reactive.server.core.ServerSerialisers.invokeWriter(ServerSerialisers.java:178)
at org.jboss.resteasy.reactive.server.core.serialization.FixedEntityWriter.write(FixedEntityWriter.java:26)
at org.jboss.resteasy.reactive.server.handlers.ResponseWriterHandler.handle(ResponseWriterHandler.java:32)
at org.jboss.resteasy.reactive.server.handlers.ResponseWriterHandler.handle(ResponseWriterHandler.java:15)
at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:141)
at io.quarkus.vertx.core.runtime.VertxCoreRecorder$13.runWith(VertxCoreRecorder.java:543)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:833)
```
### How to Reproduce?
```java
@Path("/give-me-file")
public static class Resource {
@GET
@Produces(MediaType.MULTIPART_FORM_DATA)
@Path("/empty")
public MultipartData getEmptyData() {
return new MultipartData(null, null, null);
}
}
public static class MultipartData {
@RestForm
@PartType(MediaType.TEXT_PLAIN)
public String name;
@RestForm
@PartType(MediaType.APPLICATION_OCTET_STREAM)
public File file;
@RestForm
@PartType(MediaType.APPLICATION_JSON)
public Panda panda;
public MultipartData() {
}
public MultipartData(String name, File file, Panda panda) {
this.name = name;
this.file = file;
this.panda = panda;
}
}
public static class Panda {
public String weight;
public String height;
public String mood;
public Panda() {
}
public Panda(String weight, String height, String mood) {
this.weight = weight;
this.height = height;
this.mood = mood;
}
}
```
### Output of `uname -a` or `ver`
Linux ryzen 5.15.12-200.fc35.x86_64 #1 SMP Wed Dec 29 15:03:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12) OpenJDK 64-Bit Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)
### GraalVM version (if different from Java)
n/a
### Quarkus version or git rev
main
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739) Maven home: /home/michal/.sdkman/candidates/maven/current Java version: 17.0.1, vendor: Eclipse Adoptium, runtime: /home/michal/.sdkman/candidates/java/17.0.1-tem Default locale: pl_PL, platform encoding: UTF-8 OS name: "linux", version: "5.15.12-200.fc35.x86_64", arch: "amd64", family: "unix"
### Additional information
_No response_ | a02661469ef1764127e74e7e5f10847e279e19c9 | d3e3ad5c3668f3652ff2748989c1796514941244 | https://github.com/quarkusio/quarkus/compare/a02661469ef1764127e74e7e5f10847e279e19c9...d3e3ad5c3668f3652ff2748989c1796514941244 | diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputResource.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputResource.java
index 8f5cfcb2006..9288930b311 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputResource.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputResource.java
@@ -49,4 +49,14 @@ public MultipartOutputFileResponse complex() {
return response;
}
+ @GET
+ @Path("/with-null-fields")
+ @Produces(MediaType.MULTIPART_FORM_DATA)
+ public MultipartOutputFileResponse nullFields() {
+ MultipartOutputFileResponse response = new MultipartOutputFileResponse();
+ response.name = null;
+ response.file = null;
+ return response;
+ }
+
}
diff --git a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputUsingBlockingEndpointsTest.java b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputUsingBlockingEndpointsTest.java
index b1333f243d2..b33a1cd1a7c 100644
--- a/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputUsingBlockingEndpointsTest.java
+++ b/extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputUsingBlockingEndpointsTest.java
@@ -67,6 +67,17 @@ public void testWithFiles() {
assertContainsFile(response, "file", MediaType.APPLICATION_OCTET_STREAM, "lorem.txt");
}
+ @Test
+ public void testWithNullFields() {
+ RestAssured
+ .given()
+ .get("/multipart/output/with-null-fields")
+ .then()
+ .contentType(ContentType.MULTIPART)
+ .log().all()
+ .statusCode(200); // should return 200 with no parts
+ }
+
private void assertContainsFile(String response, String name, String contentType, String fileName) {
String[] lines = response.split("--");
assertThat(lines).anyMatch(line -> line.contains(String.format(EXPECTED_CONTENT_DISPOSITION_FILE_PART, name, fileName))
diff --git a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultipartMessageBodyWriter.java b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultipartMessageBodyWriter.java
index efcfcc83eed..b836994dc4d 100644
--- a/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultipartMessageBodyWriter.java
+++ b/independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultipartMessageBodyWriter.java
@@ -69,20 +69,22 @@ private void write(List<PartItem> parts, String boundary, OutputStream outputStr
Charset charset = requestContext.getDeployment().getRuntimeConfiguration().body().defaultCharset();
String boundaryLine = "--" + boundary;
for (PartItem part : parts) {
- // write boundary: --...
- writeLine(outputStream, boundaryLine, charset);
- // write content disposition header
- writeLine(outputStream, HttpHeaders.CONTENT_DISPOSITION + ": form-data; name=\\"" + part.getName() + "\\""
- + getFileNameIfFile(part.getValue()), charset);
- // write content content type
- writeLine(outputStream, HttpHeaders.CONTENT_TYPE + ": " + part.getType(), charset);
- // extra line
- writeLine(outputStream, charset);
-
- // write content
- write(outputStream, serialiseEntity(part.getValue(), part.getType(), requestContext));
- // extra line
- writeLine(outputStream, charset);
+ if (part.getValue() != null) {
+ // write boundary: --...
+ writeLine(outputStream, boundaryLine, charset);
+ // write content disposition header
+ writeLine(outputStream, HttpHeaders.CONTENT_DISPOSITION + ": form-data; name=\\"" + part.getName() + "\\""
+ + getFileNameIfFile(part.getValue()), charset);
+ // write content content type
+ writeLine(outputStream, HttpHeaders.CONTENT_TYPE + ": " + part.getType(), charset);
+ // extra line
+ writeLine(outputStream, charset);
+
+ // write content
+ write(outputStream, serialiseEntity(part.getValue(), part.getType(), requestContext));
+ // extra line
+ writeLine(outputStream, charset);
+ }
}
// write boundary: -- ... -- | ['extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputUsingBlockingEndpointsTest.java', 'independent-projects/resteasy-reactive/server/runtime/src/main/java/org/jboss/resteasy/reactive/server/core/multipart/MultipartMessageBodyWriter.java', 'extensions/resteasy-reactive/quarkus-resteasy-reactive/deployment/src/test/java/io/quarkus/resteasy/reactive/server/test/multipart/MultipartOutputResource.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 19,227,578 | 3,724,492 | 490,135 | 4,758 | 1,620 | 278 | 30 | 1 | 4,547 | 301 | 1,121 | 108 | 0 | 2 | 1970-01-01T00:27:22 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,153 | quarkusio/quarkus/34105/34104 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/34104 | https://github.com/quarkusio/quarkus/pull/34105 | https://github.com/quarkusio/quarkus/pull/34105 | 1 | fixes | OIDC will request UserInfo and TokenIntrospection even if they are cached | ### Describe the bug
Users have discovered that even if OIDC caches UserInfo it will still request UserInfo remotely, thus making cache ineffective as far as the performance savings are concerned. Same applies to caching TokenIntrospection
### Expected behavior
If UserInfo is required and the cache is enabled then repeatedly calling the Quarkus endpoint with the same token should result in a single remote UserInfo call only until the cache entry has expired or the cache limit has been reached.
### 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_ | 4cc7319595df7b3bfe4bed09d1848777d17f3886 | e2cb17cf9ca1d5c05ec2786f41b796e18e823544 | https://github.com/quarkusio/quarkus/compare/4cc7319595df7b3bfe4bed09d1848777d17f3886...e2cb17cf9ca1d5c05ec2786f41b796e18e823544 | diff --git a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java
index 2202a7cc74a..5d61792865d 100644
--- a/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java
+++ b/extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java
@@ -447,7 +447,7 @@ private Uni<TokenVerificationResult> refreshJwksAndVerifyTokenUni(TenantConfigCo
.recoverWithUni(f -> introspectTokenUni(resolvedContext, token));
}
- private Uni<TokenVerificationResult> introspectTokenUni(TenantConfigContext resolvedContext, String token) {
+ private Uni<TokenVerificationResult> introspectTokenUni(TenantConfigContext resolvedContext, final String token) {
TokenIntrospectionCache tokenIntrospectionCache = tenantResolver.getTokenIntrospectionCache();
Uni<TokenIntrospection> tokenIntrospectionUni = tokenIntrospectionCache == null ? null
: tokenIntrospectionCache
@@ -456,7 +456,12 @@ private Uni<TokenVerificationResult> introspectTokenUni(TenantConfigContext reso
tokenIntrospectionUni = newTokenIntrospectionUni(resolvedContext, token);
} else {
tokenIntrospectionUni = tokenIntrospectionUni.onItem().ifNull()
- .switchTo(newTokenIntrospectionUni(resolvedContext, token));
+ .switchTo(new Supplier<Uni<? extends TokenIntrospection>>() {
+ @Override
+ public Uni<TokenIntrospection> get() {
+ return newTokenIntrospectionUni(resolvedContext, token);
+ }
+ });
}
return tokenIntrospectionUni.onItem().transform(t -> new TokenVerificationResult(null, t));
}
@@ -501,10 +506,8 @@ private Uni<UserInfo> getUserInfoUni(RoutingContext vertxContext, TokenAuthentic
}
LOG.debug("Requesting UserInfo");
- String accessToken = vertxContext.get(OidcConstants.ACCESS_TOKEN_VALUE);
- if (accessToken == null) {
- accessToken = request.getToken().getToken();
- }
+ String contextAccessToken = vertxContext.get(OidcConstants.ACCESS_TOKEN_VALUE);
+ final String accessToken = contextAccessToken != null ? contextAccessToken : request.getToken().getToken();
UserInfoCache userInfoCache = tenantResolver.getUserInfoCache();
Uni<UserInfo> userInfoUni = userInfoCache == null ? null
@@ -513,7 +516,12 @@ private Uni<UserInfo> getUserInfoUni(RoutingContext vertxContext, TokenAuthentic
userInfoUni = newUserInfoUni(resolvedContext, accessToken);
} else {
userInfoUni = userInfoUni.onItem().ifNull()
- .switchTo(newUserInfoUni(resolvedContext, accessToken));
+ .switchTo(new Supplier<Uni<? extends UserInfo>>() {
+ @Override
+ public Uni<UserInfo> get() {
+ return newUserInfoUni(resolvedContext, accessToken);
+ }
+ });
}
return userInfoUni;
}
diff --git a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CodeFlowUserInfoResource.java b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CodeFlowUserInfoResource.java
index a653e097e34..ddc772b6feb 100644
--- a/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CodeFlowUserInfoResource.java
+++ b/integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CodeFlowUserInfoResource.java
@@ -31,11 +31,9 @@ public class CodeFlowUserInfoResource {
@GET
@Path("/code-flow-user-info-only")
public String access() {
- int cacheSize = tokenCache.getCacheSize();
- tokenCache.clearCache();
return identity.getPrincipal().getName() + ":" + userInfo.getPreferredUserName() + ":" + accessToken.getName()
+ ", cache size: "
- + cacheSize;
+ + tokenCache.getCacheSize();
}
@GET
diff --git a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java
index 0a3536eeb0d..2fd589694bc 100644
--- a/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java
+++ b/integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java
@@ -3,8 +3,10 @@
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.matching;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
@@ -214,9 +216,11 @@ public void testCodeFlowUserInfo() throws Exception {
defineCodeFlowAuthorizationOauth2TokenStub();
doTestCodeFlowUserInfo("code-flow-user-info-only", 300);
+ clearCache();
doTestCodeFlowUserInfo("code-flow-user-info-github", 360);
+ clearCache();
doTestCodeFlowUserInfo("code-flow-user-info-dynamic-github", 301);
-
+ clearCache();
doTestCodeFlowUserInfoCashedInIdToken();
}
@@ -256,6 +260,13 @@ private void doTestCodeFlowUserInfo(String tenantId, long internalIdTokenLifetim
page = form.getInputByValue("login").click();
assertEquals("alice:alice:alice, cache size: 1", page.getBody().asNormalizedText());
+ page = webClient.getPage("http://localhost:8081/" + tenantId);
+ assertEquals("alice:alice:alice, cache size: 1", page.getBody().asNormalizedText());
+ page = webClient.getPage("http://localhost:8081/" + tenantId);
+ assertEquals("alice:alice:alice, cache size: 1", page.getBody().asNormalizedText());
+
+ wireMockServer.verify(1, getRequestedFor(urlPathMatching("/auth/realms/quarkus/protocol/openid-connect/userinfo")));
+ wireMockServer.resetRequests();
JsonObject idTokenClaims = decryptIdToken(webClient, tenantId);
assertNull(idTokenClaims.getJsonObject(OidcUtils.USER_INFO_ATTRIBUTE)); | ['integration-tests/oidc-wiremock/src/test/java/io/quarkus/it/keycloak/CodeFlowAuthorizationTest.java', 'extensions/oidc/runtime/src/main/java/io/quarkus/oidc/runtime/OidcIdentityProvider.java', 'integration-tests/oidc-wiremock/src/main/java/io/quarkus/it/keycloak/CodeFlowUserInfoResource.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 26,896,738 | 5,305,205 | 682,822 | 6,291 | 1,402 | 233 | 22 | 1 | 909 | 142 | 192 | 39 | 0 | 0 | 1970-01-01T00:28:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,154 | quarkusio/quarkus/34092/34087 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/34087 | https://github.com/quarkusio/quarkus/pull/34092 | https://github.com/quarkusio/quarkus/pull/34092 | 1 | fixes | quarkus run not working for gradle | ### Describe the bug
quarkus run does not work with gradle apps.
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
```
jbang app install --name qss io.quarkus:quarkus-cli:999-SNAPSHOT:runner
qss create app --gradle -P io.quarkus:quarkus-bom:999-SNAPSHOT latestapp
cd latestapp
gradle build
qss run
```
fails.
should actually run the app.
`gradle quarkusRun` does work.
### 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_ | 388cdf961a90be64ff1ad33a6a510aaf32fdcb49 | 999a9b1cb5e1c7dd6527a6dc0081a7668ad4c80d | https://github.com/quarkusio/quarkus/compare/388cdf961a90be64ff1ad33a6a510aaf32fdcb49...999a9b1cb5e1c7dd6527a6dc0081a7668ad4c80d | diff --git a/devtools/cli/src/main/java/io/quarkus/cli/Run.java b/devtools/cli/src/main/java/io/quarkus/cli/Run.java
index 34a5e3edfb1..de6553f6217 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/Run.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/Run.java
@@ -9,7 +9,7 @@
public class Run extends BuildToolDelegatingCommand {
private static final Map<BuildTool, String> ACTION_MAPPING = Map.of(BuildTool.MAVEN, "quarkus:run",
- BuildTool.GRADLE, "run");
+ BuildTool.GRADLE, "quarkusRun");
@CommandLine.Option(names = { "--target" }, description = "Run target.")
String target; | ['devtools/cli/src/main/java/io/quarkus/cli/Run.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,896,064 | 5,305,066 | 682,807 | 6,291 | 84 | 23 | 2 | 1 | 811 | 108 | 214 | 54 | 0 | 1 | 1970-01-01T00:28:06 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,513 | quarkusio/quarkus/23295/22833 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22833 | https://github.com/quarkusio/quarkus/pull/23295 | https://github.com/quarkusio/quarkus/pull/23295 | 1 | fixes | org.objectweb.asm.ClassTooLargeException when building a project with 2K+ Hibernate entities (hbm.xmls). | ### Describe the bug
When we are trying to build our project with 2K+ Hibernate Entities (hbm.xmls) we are getting below exception.
```
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 57.961 s
[INFO] Finished at: 2022-01-12T16:57:23+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:999-SNAPSHOT:build (quarkus-final-build-before-package) on project dna-wireless-service: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR] [error]: Build step io.quarkus.deployment.steps.MainClassBuildStep#build threw an exception: org.objectweb.asm.ClassTooLargeException: Class too large: io/quarkus/deployment/steps/HibernateOrmProcessor$build1373687952
[ERROR] at org.objectweb.asm.ClassWriter.toByteArray(ClassWriter.java:599)
[ERROR] at io.quarkus.gizmo.ClassCreator.writeTo(ClassCreator.java:214)
[ERROR] at io.quarkus.gizmo.ClassCreator.close(ClassCreator.java:225)
[ERROR] at io.quarkus.deployment.recording.BytecodeRecorderImpl.writeBytecode(BytecodeRecorderImpl.java:595)
[ERROR] at io.quarkus.deployment.steps.MainClassBuildStep.writeRecordedBytecode(MainClassBuildStep.java:436)
[ERROR] at io.quarkus.deployment.steps.MainClassBuildStep.build(MainClassBuildStep.java:168)
[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:887)
[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)
```
### Expected behavior
Build to go through successfully.
### Actual behavior
Build failure.
### How to Reproduce?
1. Compile a project with large set of entities (2K+)
### Output of `uname -a` or `ver`
Linux ubuntu 4.15.0-159-generic #167-Ubuntu SMP Tue Sep 21 08:55:05 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.18.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.18.04, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.6.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
### Additional information
_No response_ | 644e46fb11603edbc130d77830597e15fd7b4f88 | 0b7a4b458229182ec92fe95b2a6f887da8b600c4 | https://github.com/quarkusio/quarkus/compare/644e46fb11603edbc130d77830597e15fd7b4f88...0b7a4b458229182ec92fe95b2a6f887da8b600c4 | 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 0cfef746ae1..9ce8bf24ff3 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
@@ -108,6 +108,7 @@ public class BytecodeRecorderImpl implements RecorderContext {
private static final MethodDescriptor COLLECTION_ADD = ofMethod(Collection.class, "add", boolean.class, Object.class);
private static final MethodDescriptor MAP_PUT = ofMethod(Map.class, "put", Object.class, Object.class, Object.class);
+ public static final String CREATE_ARRAY = "$quarkus$createArray";
private final boolean staticInit;
private final ClassLoader classLoader;
@@ -517,7 +518,10 @@ ResultHandle createValue(MethodContext context, MethodCreator method, ResultHand
//when this is true it is no longer possible to allocate items in the array. this is a guard against programmer error
loadComplete = true;
//now we now know many items we have, create the array
- ResultHandle array = mainMethod.newArray(Object.class, deferredParameterCount);
+
+ MethodDescriptor createArrayDescriptor = ofMethod(mainMethod.getMethodDescriptor().getDeclaringClass(), CREATE_ARRAY,
+ "[Ljava/lang/Object;");
+ ResultHandle array = mainMethod.invokeVirtualMethod(createArrayDescriptor, mainMethod.getThis());
//this context manages the creation of new methods
//it tracks the number of instruction groups and when they hit a threshold it
@@ -592,6 +596,8 @@ public void write(MethodContext context, MethodCreator method, ResultHandle arra
}
context.close();
mainMethod.returnValue(null);
+ var createArray = file.getMethodCreator(createArrayDescriptor);
+ createArray.returnValue(createArray.newArray(Object.class, deferredParameterCount));
file.close();
}
@@ -1516,8 +1522,6 @@ void doPrepare(MethodContext context) {
for (SerializationStep i : setupSteps) {
//then prepare the steps (i.e. creating the values to be placed into this object)
i.prepare(context);
- }
- for (SerializationStep i : setupSteps) {
//now actually run the steps (i.e. actually stick the values into the object)
context.writeInstruction(new InstructionGroup() {
@Override
@@ -1866,7 +1870,7 @@ abstract class DeferredParameter {
/**
* The function that is called to read the value for use. This may be by reading the value from the Object[]
- * array, or is may be a direct ldc instruction in the case of primitives.
+ * array, or is can be a direct ldc instruction in the case of primitives.
* <p>
* Code in this method is run in a single instruction group, so large objects should be serialized in the
* {@link #doPrepare(MethodContext)} method instead
@@ -1894,15 +1898,17 @@ void doPrepare(MethodContext context) {
abstract class DeferredArrayStoreParameter extends DeferredParameter {
- final int arrayIndex;
+ int arrayIndex = -1;
final String returnType;
+ ResultHandle originalResultHandle;
+ ResultHandle originalArrayResultHandle;
+ MethodCreator originalRhMethod;
DeferredArrayStoreParameter(String expectedType) {
returnType = expectedType;
if (loadComplete) {
throw new RuntimeException("Cannot create new DeferredArrayStoreParameter after array has been allocated");
}
- arrayIndex = deferredParameterCount++;
}
DeferredArrayStoreParameter(Object target, Class<?> expectedType) {
@@ -1918,7 +1924,6 @@ abstract class DeferredArrayStoreParameter extends DeferredParameter {
if (loadComplete) {
throw new RuntimeException("Cannot create new DeferredArrayStoreParameter after array has been allocated");
}
- arrayIndex = deferredParameterCount++;
}
/**
@@ -1933,8 +1938,9 @@ void doPrepare(MethodContext context) {
context.writeInstruction(new InstructionGroup() {
@Override
public void write(MethodContext context, MethodCreator method, ResultHandle array) {
- ResultHandle val = createValue(context, method, array);
- method.writeArrayValue(array, arrayIndex, val);
+ originalResultHandle = createValue(context, method, array);
+ originalRhMethod = method;
+ originalArrayResultHandle = array;
}
});
prepared = true;
@@ -1942,6 +1948,16 @@ public void write(MethodContext context, MethodCreator method, ResultHandle arra
@Override
final ResultHandle doLoad(MethodContext context, MethodCreator method, ResultHandle array) {
+ if (!prepared) {
+ prepare(context);
+ }
+ if (method == originalRhMethod) {
+ return originalResultHandle;
+ }
+ if (arrayIndex == -1) {
+ arrayIndex = deferredParameterCount++;
+ originalRhMethod.writeArrayValue(originalArrayResultHandle, arrayIndex, originalResultHandle);
+ }
ResultHandle resultHandle = method.readArrayValue(array, arrayIndex);
if (returnType == null) {
return resultHandle;
@@ -2050,10 +2066,14 @@ public ResultHandle loadDeferred(DeferredParameter parameter) {
//we don't want to have to go back to the array every time
//so we cache the result handles within the scope of the current method
int arrayIndex = ((DeferredArrayStoreParameter) parameter).arrayIndex;
- if (currentMethodCache.containsKey(arrayIndex)) {
+ if (arrayIndex > 0 && currentMethodCache.containsKey(arrayIndex)) {
return currentMethodCache.get(arrayIndex);
}
ResultHandle loaded = parameter.doLoad(this, currentMethod, currentMethod.getMethodParam(1));
+ arrayIndex = ((DeferredArrayStoreParameter) parameter).arrayIndex;
+ if (arrayIndex < 0) {
+ return loaded;
+ }
if (parent.currentMethod == currentMethod) {
currentMethodCache.put(arrayIndex, loaded);
return loaded;
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 6fa3cbc65e3..499e7e8e310 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
@@ -189,7 +189,7 @@ public String get() {
public void testLargeCollection() throws Exception {
List<TestJavaBean> beans = new ArrayList<>();
- for (int i = 0; i < 10000; ++i) {
+ for (int i = 0; i < 100000; ++i) {
beans.add(new TestJavaBean("A string", 99));
}
| ['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 | 19,608,956 | 3,796,406 | 499,491 | 4,826 | 2,216 | 389 | 40 | 1 | 3,302 | 238 | 892 | 67 | 0 | 1 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,512 | quarkusio/quarkus/23298/23217 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23217 | https://github.com/quarkusio/quarkus/pull/23298 | https://github.com/quarkusio/quarkus/pull/23298 | 1 | fixes | Dev mode captures console input destined to the application | ### Describe the bug
Running an interactive CLI (Quarkus command mode) in Quarkus dev mode (`mvn quarkus:dev`), Quarkus dev mode partially captures the keystrokes.
### Expected behavior
I would expect the dev mode to capture the keystrokes only if the application didn't consume them before. Or if this is not possible, then I would expect a way to configure a modifier key to access the dev mode shortcuts, and the application to get everything when the modifier key is not pressed.
### Actual behavior
The pattern I found is that:
* for an input that is part of the dev mode shortcuts (eg `h`): the keystroke is captured by the dev mode and doesn't go to the application
* for an input that is not part of those shortcuts (eg `m`): the keystroke goes once to the application and is lost once (so if I type `m` twice, it appears only once for the application).
### How to Reproduce?
Please find a reproducer in https://github.com/PierreBtz/quarkus-termio-bug.
Steps to reproduce:
* Build the project (`mvn package`).
* Verify that it works properly with the uber-jar, you have two commands:
`java -jar target/quarkus-textio-bug-1.0.0-SNAPSHOT-runner.jar textio` and
`java -jar target/quarkus-textio-bug-1.0.0-SNAPSHOT-runner.jar reader` reading an input from Console and displaying it.
One command uses a basic `InputStreamReader`, the other [TextIO](https://text-io.beryx.org/releases/latest/) (which is
how I noticed the problem initially...).
* You can also verify it works with a native executable.
* Run `mvn quarkus:dev -Dquarkus.args="textio"` and observe how part of the inputs are captured by the Quarkus dev mode.
### Output of `uname -a` or `ver`
Darwin Pierres-MacBook-Pro-2.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021; root:xnu-8019.61.5~1/RELEASE_ARM64_T6000 x86_64
### Output of `java -version`
openjdk version "11.0.13" 2021-10-19 LTS OpenJDK Runtime Environment Zulu11.52+13-CA (build 11.0.13+8-LTS) OpenJDK 64-Bit Server VM Zulu11.52+13-CA (build 11.0.13+8-LTS, mixed mode)
### GraalVM version (if different from Java)
gu --version
GraalVM Updater 21.3.0
### Quarkus version or git rev
2.6.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
### Additional information
_No response_ | e32f01e310eb7e08099edc73982a1b0bc6cea4e0 | cd7bc3a4d18afdb1385896bfcf08271a9b3b772e | https://github.com/quarkusio/quarkus/compare/e32f01e310eb7e08099edc73982a1b0bc6cea4e0...cd7bc3a4d18afdb1385896bfcf08271a9b3b772e | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java b/core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java
index 3eb446e39c0..b7e144bbbdd 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java
@@ -86,6 +86,7 @@ public void run() {
}
}, "Console Shutdown Hook"));
prompt = registerStatusLine(0);
+
}
private void updatePromptOnChange(StringBuilder buffer, int newLines) {
@@ -222,6 +223,26 @@ public void run() {
});
// Keyboard handling
conn.setStdinHandler(keys -> {
+
+ QuarkusConsole.StateChangeInputStream redirectIn = QuarkusConsole.REDIRECT_IN;
+ //see if the users application wants to read the keystrokes:
+ int pos = 0;
+ while (pos < keys.length) {
+ if (!redirectIn.acceptInput(keys[pos])) {
+ break;
+ }
+ ++pos;
+ }
+ if (pos > 0) {
+ if (pos == keys.length) {
+ return;
+ }
+ //the app only consumed some keys
+ //stick the rest in a new array
+ int[] newKeys = new int[keys.length - pos];
+ System.arraycopy(keys, pos, newKeys, 0, newKeys.length);
+ keys = newKeys;
+ }
try {
if (delegateConnection != null) {
//console mode
diff --git a/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleHelper.java b/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleHelper.java
index b9710dc97a4..06c2e574642 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleHelper.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleHelper.java
@@ -47,8 +47,11 @@ public void accept(Connection connection) {
connection.setStdinHandler(new Consumer<int[]>() {
@Override
public void accept(int[] ints) {
+ QuarkusConsole.StateChangeInputStream redirectIn = QuarkusConsole.REDIRECT_IN;
for (int i : ints) {
- queue.add(i);
+ if (redirectIn != null && !redirectIn.acceptInput(i)) {
+ queue.add(i);
+ }
}
}
});
diff --git a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
index bc6b3766e88..faca9f2dc0e 100644
--- a/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
+++ b/core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java
@@ -1,9 +1,13 @@
package io.quarkus.dev.console;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InterruptedIOException;
import java.io.PrintStream;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.LinkedBlockingDeque;
import java.util.function.BiPredicate;
import java.util.function.Consumer;
@@ -52,9 +56,12 @@ public abstract class QuarkusConsole {
public final static PrintStream ORIGINAL_OUT = System.out;
public final static PrintStream ORIGINAL_ERR = System.err;
+ public final static InputStream ORIGINAL_IN = System.in;
public static PrintStream REDIRECT_OUT = null;
public static PrintStream REDIRECT_ERR = null;
+ public static StateChangeInputStream REDIRECT_IN;
+ protected volatile boolean userReadInProgress;
public synchronized static void installRedirects() {
if (redirectsInstalled) {
@@ -67,8 +74,10 @@ public synchronized static void installRedirects() {
QuarkusConsole.INSTANCE.isInputSupported();
REDIRECT_OUT = new RedirectPrintStream(false);
REDIRECT_ERR = new RedirectPrintStream(true);
+ REDIRECT_IN = new StateChangeInputStream();
System.setOut(REDIRECT_OUT);
System.setErr(REDIRECT_ERR);
+ System.setIn(REDIRECT_IN);
}
public synchronized static void uninstallRedirects() {
@@ -86,8 +95,10 @@ public synchronized static void uninstallRedirects() {
REDIRECT_ERR.close();
REDIRECT_ERR = null;
}
+ REDIRECT_IN = null;
System.setOut(ORIGINAL_OUT);
System.setErr(ORIGINAL_ERR);
+ System.setIn(ORIGINAL_IN);
redirectsInstalled = false;
}
@@ -176,4 +187,69 @@ public boolean isAnsiSupported() {
return false;
}
+ protected void userReadStart() {
+
+ }
+
+ protected void userReadStop() {
+
+ }
+
+ public static class StateChangeInputStream extends InputStream {
+
+ private final LinkedBlockingDeque<Integer> queue = new LinkedBlockingDeque<>();
+
+ private volatile boolean reading;
+
+ public synchronized boolean acceptInput(int input) {
+ if (reading) {
+ queue.add(input);
+ notifyAll();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public synchronized int read() throws IOException {
+ reading = true;
+ try {
+ while (queue.isEmpty()) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ throw new InterruptedIOException();
+ }
+ }
+ return queue.pollFirst();
+ } finally {
+ reading = false;
+ }
+ }
+
+ @Override
+ public synchronized int read(byte[] b, int off, int len) throws IOException {
+ reading = true;
+ int read = 0;
+ try {
+ while (read < len) {
+ while (queue.isEmpty()) {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ throw new InterruptedIOException();
+ }
+ }
+ byte byteValue = queue.poll().byteValue();
+ b[read++] = byteValue;
+ if (byteValue == '\\n' || byteValue == '\\r') {
+ return read;
+ }
+ }
+ return read;
+ } finally {
+ reading = false;
+ }
+ }
+ }
} | ['core/devmode-spi/src/main/java/io/quarkus/dev/console/QuarkusConsole.java', 'core/deployment/src/main/java/io/quarkus/deployment/console/AeshConsole.java', 'core/deployment/src/main/java/io/quarkus/deployment/console/ConsoleHelper.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 19,608,956 | 3,796,406 | 499,491 | 4,826 | 3,629 | 589 | 102 | 3 | 2,396 | 337 | 685 | 54 | 2 | 0 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,511 | quarkusio/quarkus/23322/23315 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23315 | https://github.com/quarkusio/quarkus/pull/23322 | https://github.com/quarkusio/quarkus/pull/23322 | 1 | close | Gradle Task quarkusRemoteDev not working with version 2.6.3 | ### Describe the bug
`./gradlew quarkusRemoteDev` not working on Quarkus version 2.6.3 (also same on 2.6.1 and 2.6.2)
### Expected behavior
`./gradlew quarkusRemoteDev` runs quarkus in remote dev mode
### Actual behavior
```
18:27:54: Executing 'quarkusRemoteDev'...
> Task :compileJava
> Task :processResources
> Task :classes
> Task :quarkusRemoteDev FAILED
3 actionable tasks: 3 executed
FAILURE: Build failed with an exception.
* What went wrong:
A problem was found with the configuration of task ':quarkusRemoteDev' (type 'QuarkusRemoteDev').
- In plugin 'io.quarkus' type 'io.quarkus.gradle.tasks.QuarkusRemoteDev' property 'quarkusDevConfiguration' doesn't have a configured value.
Reason: This property isn't marked as optional and no value has been configured.
Possible solutions:
1. Assign a value to 'quarkusDevConfiguration'.
2. Mark property 'quarkusDevConfiguration' as optional.
Please refer to https://docs.gradle.org/7.3.3/userguide/validation_problems.html#value_not_set for more details about this problem.
* 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 1s
18:27:56: Execution finished 'quarkusRemoteDev'.
```
### How to Reproduce?
Steps to reproduce the behaviour:
1. Download and unpack empty project with gradle from code.quarkus.io
2. Run `./gradlew quarkusRemoteDev` inside the folder
### Output of `uname -a` or `ver`
Microsoft Windows [Version 10.0.18363.2037]
### Output of `java -version`
openjdk version "11.0.13" 2021-10-19
### GraalVM version (if different from Java)
OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 11.0.13+7-jvmci-21.3-b05, mixed mode, sharing)
### Quarkus version or git rev
2.6.3
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 7.3.3
### Additional information
_No response_ | c70a2478580b43b348f2b1b6cfa77a2d7e3264b4 | 54c8cdb872f2897c6e451bddbe42fea8971d5590 | https://github.com/quarkusio/quarkus/compare/c70a2478580b43b348f2b1b6cfa77a2d7e3264b4...54c8cdb872f2897c6e451bddbe42fea8971d5590 | diff --git a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
index 2a801469594..a914d10adea 100644
--- a/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
+++ b/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java
@@ -205,7 +205,10 @@ public void execute(Task test) {
quarkusGenerateCodeTests);
task.setQuarkusDevConfiguration(devModeConfiguration);
});
- quarkusRemoteDev.configure(task -> task.dependsOn(classesTask, resourcesTask));
+ quarkusRemoteDev.configure(task -> {
+ task.dependsOn(classesTask, resourcesTask);
+ task.setQuarkusDevConfiguration(devModeConfiguration);
+ });
quarkusTest.configure(task -> {
task.dependsOn(classesTask, resourcesTask, testClassesTask, testResourcesTask,
quarkusGenerateCode, | ['devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/QuarkusPlugin.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,585,704 | 3,791,947 | 498,811 | 4,819 | 332 | 54 | 5 | 1 | 2,074 | 263 | 580 | 75 | 2 | 1 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,510 | quarkusio/quarkus/23333/23318 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23318 | https://github.com/quarkusio/quarkus/pull/23333 | https://github.com/quarkusio/quarkus/pull/23333 | 1 | resolves | A @Disposes @Named method doesn't work / is not invoked | ### Describe the bug
With this simple configuration
```
@Singleton
@Named("myInput")
public Input input() {
return new Input();
}
public void startInput(
@Observes StartupEvent evt,
@Named("myInput") Input input
) {
log.info("Started input...");
}
public void stopInput(
@Disposes @Named("myInput") AutoCloseable input
) throws Exception {
log.info("Stopping input...");
input.close();
}
```
The `stopInput` method is never invoked when the app is stopped.
### Expected behavior
The `stopInput` method should be invoked when the app / test is stopped.
### Actual behavior
The `stopInput` method is NOT invoked when the app / test is stopped.
### How to Reproduce?
Run this repo's SimpleTest from IDE
* https://github.com/alesj/quarkus_cl130/tree/named1
You should see this stacktrace
```
Jan 31, 2022 5:21:39 PM io.quarkus.test.junit.QuarkusTestExtension$ExtensionState close
ERROR: Failed to shutdown Quarkus
java.lang.RuntimeException: Unable to stop Quarkus test resource com.alesj.qcl.test.SimpleTestResource@3eee3e2b
at io.quarkus.test.common.TestResourceManager.close(TestResourceManager.java:152)
at io.quarkus.test.junit.QuarkusTestExtension$4.close(QuarkusTestExtension.java:290)
at io.quarkus.test.junit.QuarkusTestExtension$ExtensionState.close(QuarkusTestExtension.java:1189)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.execution.ExtensionValuesStore.lambda$closeAllStoredCloseableValues$3(ExtensionValuesStore.java:68)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at org.junit.jupiter.engine.execution.ExtensionValuesStore.closeAllStoredCloseableValues(ExtensionValuesStore.java:68)
at org.junit.jupiter.engine.descriptor.AbstractExtensionContext.close(AbstractExtensionContext.java:77)
at org.junit.jupiter.engine.execution.JupiterEngineExecutionContext.close(JupiterEngineExecutionContext.java:53)
at org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.cleanUp(JupiterEngineDescriptor.java:67)
at org.junit.jupiter.engine.descriptor.JupiterEngineDescriptor.cleanUp(JupiterEngineDescriptor.java:29)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$cleanUp$10(NodeTestTask.java:167)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.cleanUp(NodeTestTask.java:167)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:98)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.lang.IllegalStateException
at com.alesj.qcl.test.SimpleTestResource.stop(SimpleTestResource.java:22)
at io.quarkus.test.common.TestResourceManager.close(TestResourceManager.java:150)
```
### 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.6.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 651c3d3fbf891f7c00412f04020f6d49f69fe77f | 26f64ca9ac9e996c4cc5def9472933f4b6d6366a | https://github.com/quarkusio/quarkus/compare/651c3d3fbf891f7c00412f04020f6d49f69fe77f...26f64ca9ac9e996c4cc5def9472933f4b6d6366a | diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
index 0cabd420434..66f0320e880 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
@@ -1029,8 +1029,9 @@ private List<BeanInfo> findBeans(Collection<DotName> beanDefiningAnnotations, Li
for (MethodInfo producerMethod : producerMethods) {
BeanInfo declaringBean = beanClassToBean.get(producerMethod.declaringClass());
if (declaringBean != null) {
- BeanInfo producerMethodBean = Beans.createProducerMethod(producerMethod, declaringBean, this,
- findDisposer(declaringBean, producerMethod, disposers), injectionPointTransformer);
+ Set<Type> beanTypes = Types.getProducerMethodTypeClosure(producerMethod, this);
+ BeanInfo producerMethodBean = Beans.createProducerMethod(beanTypes, producerMethod, declaringBean, this,
+ findDisposer(beanTypes, declaringBean, producerMethod, disposers), injectionPointTransformer);
if (producerMethodBean != null) {
beans.add(producerMethodBean);
injectionPoints.addAll(producerMethodBean.getAllInjectionPoints());
@@ -1041,8 +1042,9 @@ private List<BeanInfo> findBeans(Collection<DotName> beanDefiningAnnotations, Li
for (FieldInfo producerField : producerFields) {
BeanInfo declaringBean = beanClassToBean.get(producerField.declaringClass());
if (declaringBean != null) {
+ Set<Type> beanTypes = Types.getProducerFieldTypeClosure(producerField, this);
BeanInfo producerFieldBean = Beans.createProducerField(producerField, declaringBean, this,
- findDisposer(declaringBean, producerField, disposers));
+ findDisposer(beanTypes, declaringBean, producerField, disposers));
if (producerFieldBean != null) {
beans.add(producerFieldBean);
}
@@ -1102,20 +1104,11 @@ private void registerObserverMethods(Collection<ClassInfo> beanClasses,
}
}
- private DisposerInfo findDisposer(BeanInfo declaringBean, AnnotationTarget annotationTarget, List<DisposerInfo> disposers) {
+ private DisposerInfo findDisposer(Set<Type> beanTypes, BeanInfo declaringBean, AnnotationTarget annotationTarget,
+ List<DisposerInfo> disposers) {
List<DisposerInfo> found = new ArrayList<>();
- Type beanType;
Set<AnnotationInstance> qualifiers = new HashSet<>();
- List<AnnotationInstance> allAnnotations;
- if (Kind.FIELD.equals(annotationTarget.kind())) {
- allAnnotations = annotationTarget.asField().annotations();
- beanType = annotationTarget.asField().type();
- } else if (Kind.METHOD.equals(annotationTarget.kind())) {
- allAnnotations = annotationTarget.asMethod().annotations();
- beanType = annotationTarget.asMethod().returnType();
- } else {
- throw new RuntimeException("Unsupported annotation target: " + annotationTarget);
- }
+ Collection<AnnotationInstance> allAnnotations = getAnnotations(annotationTarget);
allAnnotations.forEach(a -> extractQualifiers(a).forEach(qualifiers::add));
for (DisposerInfo disposer : disposers) {
if (disposer.getDeclaringBean().equals(declaringBean)) {
@@ -1125,8 +1118,14 @@ private DisposerInfo findDisposer(BeanInfo declaringBean, AnnotationTarget annot
hasQualifier = false;
}
}
- if (hasQualifier && beanResolver.matches(disposer.getDisposedParameterType(), beanType)) {
- found.add(disposer);
+ if (hasQualifier) {
+ Type disposedParamType = disposer.getDisposedParameterType();
+ for (Type beanType : beanTypes) {
+ if (beanResolver.matches(disposedParamType, beanType)) {
+ found.add(disposer);
+ break;
+ }
+ }
}
}
}
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java
index 765b196b2df..fcfe9841063 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java
@@ -69,11 +69,11 @@ private static ScopeInfo inheritScope(ClassInfo beanClass, BeanDeployment beanDe
return null;
}
- static BeanInfo createProducerMethod(MethodInfo producerMethod, BeanInfo declaringBean, BeanDeployment beanDeployment,
+ static BeanInfo createProducerMethod(Set<Type> beanTypes, MethodInfo producerMethod, BeanInfo declaringBean,
+ BeanDeployment beanDeployment,
DisposerInfo disposer, InjectionPointModifier transformer) {
Set<AnnotationInstance> qualifiers = new HashSet<>();
List<ScopeInfo> scopes = new ArrayList<>();
- Set<Type> types = Types.getProducerMethodTypeClosure(producerMethod, beanDeployment);
Integer priority = null;
boolean isAlternative = false;
boolean isDefaultBean = false;
@@ -169,7 +169,7 @@ static BeanInfo createProducerMethod(MethodInfo producerMethod, BeanInfo declari
}
List<Injection> injections = Injection.forBean(producerMethod, declaringBean, beanDeployment, transformer);
- BeanInfo bean = new BeanInfo(producerMethod, beanDeployment, scope, types, qualifiers, injections, declaringBean,
+ BeanInfo bean = new BeanInfo(producerMethod, beanDeployment, scope, beanTypes, qualifiers, injections, declaringBean,
disposer, isAlternative, stereotypes, name, isDefaultBean, null, priority);
for (Injection injection : injections) {
injection.init(bean);
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 705516ecc6b..af2f4e4960d 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
@@ -102,13 +102,13 @@ static class StringProducer {
static final AtomicInteger DESTROYED = new AtomicInteger();
- static final AtomicReference<String> DISPOSED = new AtomicReference<>();
+ static final AtomicReference<CharSequence> DISPOSED = new AtomicReference<>();
@MyQualifier
@Produces
String produce = toString();
- void dipose(@Disposes @MyQualifier String value) {
+ void dipose(@Disposes @MyQualifier CharSequence value) {
DISPOSED.set(value);
}
| ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/producer/disposer/DisposerTest.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 19,585,656 | 3,791,941 | 498,807 | 4,819 | 2,974 | 536 | 39 | 2 | 5,854 | 270 | 1,287 | 116 | 1 | 2 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,509 | quarkusio/quarkus/23397/23269 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23269 | https://github.com/quarkusio/quarkus/pull/23397 | https://github.com/quarkusio/quarkus/pull/23397 | 1 | fixes | Hibernate Reactive Session/EntityManager is closed | ### Describe the bug
This may look similar to #22433 (which was fixed in `2.6.3.Final`) but this time the reproducer includes a resteasy-reactive request filter (see `RequestFilter` in the reproducer).
Here's the exception which is thrown randomly when the app is processing concurrent requests:
```
2022-01-28 15:11:21,411 ERROR [org.hib.rea.errors] (vert.x-eventloop-thread-4) HR000057: Failed to execute statement [$1select fruit0_.id as id1_0_, fruit0_.name as name2_0_ from known_fruits fruit0_ order by fruit0_.name]: $2could not execute query: java.util.concurrent.CompletionException: java.lang.IllegalStateException: Session/EntityManager is closed
at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:314)
at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:319)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1081)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
at io.vertx.core.Future.lambda$toCompletionStage$2(Future.java:360)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:102)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:35)
at io.vertx.core.Promise.complete(Promise.java:66)
at io.vertx.core.Promise.handle(Promise.java:51)
at io.vertx.core.Promise.handle(Promise.java:29)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
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:829)
Caused by: java.lang.IllegalStateException: Session/EntityManager is closed
at org.hibernate.internal.AbstractSharedSessionContract.checkOpen(AbstractSharedSessionContract.java:407)
at org.hibernate.engine.spi.SharedSessionContractImplementor.checkOpen(SharedSessionContractImplementor.java:148)
at org.hibernate.reactive.session.impl.ReactiveSessionImpl.checkOpen(ReactiveSessionImpl.java:1558)
at org.hibernate.internal.AbstractSharedSessionContract.checkOpenOrWaitingForAutoClose(AbstractSharedSessionContract.java:413)
at org.hibernate.internal.SessionImpl.getEntityUsingInterceptor(SessionImpl.java:603)
at org.hibernate.loader.Loader.getRow(Loader.java:1610)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:748)
at org.hibernate.loader.Loader.getRowsFromResultSet(Loader.java:1047)
at org.hibernate.reactive.loader.hql.impl.ReactiveQueryLoader.getRowsFromResultSet(ReactiveQueryLoader.java:223)
at org.hibernate.reactive.loader.ReactiveLoaderBasedResultSetProcessor.reactiveExtractResults(ReactiveLoaderBasedResultSetProcessor.java:73)
at org.hibernate.reactive.loader.hql.impl.ReactiveQueryLoader$1.reactiveExtractResults(ReactiveQueryLoader.java:72)
at org.hibernate.reactive.loader.ReactiveLoader.reactiveProcessResultSet(ReactiveLoader.java:145)
at org.hibernate.reactive.loader.ReactiveLoader.lambda$doReactiveQueryAndInitializeNonLazyCollections$0(ReactiveLoader.java:77)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
... 21 more
2022-01-28 15:11:21,413 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (vert.x-eventloop-thread-4) HTTP Request to /fruits failed, error id: 51fc210d-cc94-487b-bfb9-5c5b593badfb-17: java.lang.IllegalStateException: Session/EntityManager is closed
at org.hibernate.internal.AbstractSharedSessionContract.checkOpen(AbstractSharedSessionContract.java:407)
at org.hibernate.engine.spi.SharedSessionContractImplementor.checkOpen(SharedSessionContractImplementor.java:148)
at org.hibernate.reactive.session.impl.ReactiveSessionImpl.checkOpen(ReactiveSessionImpl.java:1558)
at org.hibernate.internal.AbstractSharedSessionContract.checkOpenOrWaitingForAutoClose(AbstractSharedSessionContract.java:413)
at org.hibernate.internal.SessionImpl.getEntityUsingInterceptor(SessionImpl.java:603)
at org.hibernate.loader.Loader.getRow(Loader.java:1610)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:748)
at org.hibernate.loader.Loader.getRowsFromResultSet(Loader.java:1047)
at org.hibernate.reactive.loader.hql.impl.ReactiveQueryLoader.getRowsFromResultSet(ReactiveQueryLoader.java:223)
at org.hibernate.reactive.loader.ReactiveLoaderBasedResultSetProcessor.reactiveExtractResults(ReactiveLoaderBasedResultSetProcessor.java:73)
at org.hibernate.reactive.loader.hql.impl.ReactiveQueryLoader$1.reactiveExtractResults(ReactiveQueryLoader.java:72)
at org.hibernate.reactive.loader.ReactiveLoader.reactiveProcessResultSet(ReactiveLoader.java:145)
at org.hibernate.reactive.loader.ReactiveLoader.lambda$doReactiveQueryAndInitializeNonLazyCollections$0(ReactiveLoader.java:77)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
at io.vertx.core.Future.lambda$toCompletionStage$2(Future.java:360)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:102)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:35)
at io.vertx.core.Promise.complete(Promise.java:66)
at io.vertx.core.Promise.handle(Promise.java:51)
at io.vertx.core.Promise.handle(Promise.java:29)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
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:829)
2022-01-28 15:11:21,414 ERROR [org.jbo.res.rea.com.cor.AbstractResteasyReactiveContext] (vert.x-eventloop-thread-4) Request failed: java.lang.IllegalStateException: Session/EntityManager is closed
at org.hibernate.internal.AbstractSharedSessionContract.checkOpen(AbstractSharedSessionContract.java:407)
at org.hibernate.engine.spi.SharedSessionContractImplementor.checkOpen(SharedSessionContractImplementor.java:148)
at org.hibernate.reactive.session.impl.ReactiveSessionImpl.checkOpen(ReactiveSessionImpl.java:1558)
at org.hibernate.internal.AbstractSharedSessionContract.checkOpenOrWaitingForAutoClose(AbstractSharedSessionContract.java:413)
at org.hibernate.internal.SessionImpl.getEntityUsingInterceptor(SessionImpl.java:603)
at org.hibernate.loader.Loader.getRow(Loader.java:1610)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:748)
at org.hibernate.loader.Loader.getRowsFromResultSet(Loader.java:1047)
at org.hibernate.reactive.loader.hql.impl.ReactiveQueryLoader.getRowsFromResultSet(ReactiveQueryLoader.java:223)
at org.hibernate.reactive.loader.ReactiveLoaderBasedResultSetProcessor.reactiveExtractResults(ReactiveLoaderBasedResultSetProcessor.java:73)
at org.hibernate.reactive.loader.hql.impl.ReactiveQueryLoader$1.reactiveExtractResults(ReactiveQueryLoader.java:72)
at org.hibernate.reactive.loader.ReactiveLoader.reactiveProcessResultSet(ReactiveLoader.java:145)
at org.hibernate.reactive.loader.ReactiveLoader.lambda$doReactiveQueryAndInitializeNonLazyCollections$0(ReactiveLoader.java:77)
at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2073)
at io.vertx.core.Future.lambda$toCompletionStage$2(Future.java:360)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
at io.vertx.core.impl.future.FutureImpl.tryComplete(FutureImpl.java:211)
at io.vertx.core.impl.future.PromiseImpl.tryComplete(PromiseImpl.java:23)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:102)
at io.vertx.sqlclient.impl.QueryResultBuilder.tryComplete(QueryResultBuilder.java:35)
at io.vertx.core.Promise.complete(Promise.java:66)
at io.vertx.core.Promise.handle(Promise.java:51)
at io.vertx.core.Promise.handle(Promise.java:29)
at io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
at io.vertx.core.impl.future.FutureBase.lambda$emitSuccess$0(FutureBase.java:54)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:503)
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:829)
```
### Expected behavior
_No response_
### Actual behavior
_No response_
### How to Reproduce?
Reproducer: https://github.com/gwenneg/quarkus-hibernate-reactive-server-request-filter
Steps to reproduce the behavior:
- Start the app with `./mvnw clean quarkus:dev`
- Run [jmeter.test.plan.zip](https://github.com/quarkusio/quarkus/files/7959301/jmeter.test.plan.zip) with JMeter
- The exception should show up in the log eventually
⚠️ If you change the Quarkus version to `2.3.1.Final`, the exception should never be thrown. As a consequence, this looks like a regression to us but I'll wait for a confirmation on that specific point before tagging the issue as a regression.
### Output of `uname -a` or `ver`
Linux glepage.remote.csb 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 8 13:30:15 EST 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "11.0.13" 2021-10-19 LTS
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.6.3.Final and 2.7.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 047180b5b3d1916de98bca121fd8f9b3b723eeab | 96c64fd8f09c02a497e2db366c64dd9196582442 | https://github.com/quarkusio/quarkus/compare/047180b5b3d1916de98bca121fd8f9b3b723eeab...96c64fd8f09c02a497e2db366c64dd9196582442 | diff --git a/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java b/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java
index 0157be32611..692fba4f7c2 100644
--- a/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java
+++ b/independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java
@@ -60,26 +60,14 @@ public VertxResteasyReactiveRequestContext(Deployment deployment, ProvidersImpl
this.devModeTccl = devModeTccl;
context.addHeadersEndHandler(this);
String expect = request.getHeader(HttpHeaderNames.EXPECT);
- ContextInternal internal = ((ConnectionBase) context.request().connection()).getContext();
- if (!vertxContextPropsToCopy.isEmpty()) {
- ContextInternal current = (ContextInternal) Vertx.currentContext();
- Map<Object, Object> internalLocalContextData = internal.localContextData();
- Map<Object, Object> currentLocalContextData = current.localContextData();
- for (int i = 0; i < vertxContextPropsToCopy.size(); i++) {
- String name = vertxContextPropsToCopy.get(i);
- Object value = currentLocalContextData.get(name);
- if (value != null) {
- internalLocalContextData.put(name, value);
- }
- }
- }
+ ContextInternal current = (ContextInternal) Vertx.currentContext();
if (expect != null && expect.equalsIgnoreCase(CONTINUE)) {
continueState = ContinueState.REQUIRED;
}
this.contextExecutor = new Executor() {
@Override
public void execute(Runnable command) {
- internal.runOnContext(new Handler<Void>() {
+ current.runOnContext(new Handler<Void>() {
@Override
public void handle(Void unused) {
command.run(); | ['independent-projects/resteasy-reactive/server/vertx/src/main/java/org/jboss/resteasy/reactive/server/vertx/VertxResteasyReactiveRequestContext.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,616,742 | 3,797,951 | 499,638 | 4,828 | 954 | 178 | 16 | 1 | 11,977 | 485 | 2,720 | 169 | 2 | 1 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,507 | quarkusio/quarkus/23512/23511 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23511 | https://github.com/quarkusio/quarkus/pull/23512 | https://github.com/quarkusio/quarkus/pull/23512 | 1 | fixes | ClassLoader can't find resource since 2.7.0 | ### Describe the bug
Hi,
After updating from 2.6.3-Final to 2.7.0-FInal, I've been trying to load a certificate file with property:
`quarkus.http.ssl.certificate.file=META-INF/certs/server.pem` (I know it's deprecated)
but it ended with a "FileNotFoundException".
After digging a bit, using this property then calls `Thread.currentThread().getContextClassLoader().getResourceAsStream(path);` in VertxHttpRecorder.java
I used this same code in a simple OnStart and observed the same behaviour.
I tried to dig further using debgger but only found that getResourceAsStream() from QuarkusClassLoader.java behaviour differs :
- 2.6.3 : 'elements' property contains [MemoryClassPathElement, DirectoryClassPathElement]
- 2.7.0 : 'elements' property contains [MemoryClassPathElement, PathTreeClassPathElement]
### Expected behavior
File's loaded
### Actual behavior
File's not found, FileNotFoundException
### How to Reproduce?
1 - Download default zip from https://code.quarkus.io/
2 - Add class
```
@ApplicationScoped
public class AppLifecycleBean {
void onStart(@Observes StartupEvent ev) {
// Method invoked by VertxHttpRecorder to initialize property "quarkus.http.ssl.certificate.file"
// Works in 2.6.3 but null in 2.7.0
var pathValue = "META-INF/certs/server.pem";
var path = Path.of(pathValue);
var inputStreamNullResult = Thread.currentThread().getContextClassLoader().getResourceAsStream(path.toString());
// Works with any version using String directly
// Maybe something to do with Windows path somewhere ?
var inputStreamOkResult = Thread.currentThread().getContextClassLoader().getResourceAsStream(pathValue);
/* Note that might help digging: using debugger during getResourceAsStream() in QuarkusClassLoader.java:
- 2.6.3 : 'elements' property contains [MemoryClassPathElement, DirectoryClassPathElement]
- 2.7.0 : 'elements' property contains [MemoryClassPathElement, PathTreeClassPathElement]
*/
}
}
```
3 - Add any file in resources directory, "META-INF/certs/server.pem"
4 - Switch from version 2.6.3-Final and 2.7.0-Final to observe that `inputStream` is null in 2.7.0-Final.
### Output of `uname -a` or `ver`
Windows 10
### Output of `java -version`
openjdk 11.0.10 2021-01-19
### 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
### Additional information
_No response_ | b8ad9658f99026d80a67805b6d4b44d20dbd34c3 | 3825aeb273fc5cb883711d79c85834ecbb1cc5e3 | https://github.com/quarkusio/quarkus/compare/b8ad9658f99026d80a67805b6d4b44d20dbd34c3...3825aeb273fc5cb883711d79c85834ecbb1cc5e3 | diff --git a/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java b/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java
index 3782c79581b..c8301db988f 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java
@@ -22,6 +22,23 @@ public class ClassPathUtils {
private static final String FILE = "file";
private static final String JAR = "jar";
+ /**
+ * Translates a file system-specific path to a Java classpath resource name
+ * that uses '/' as a separator.
+ *
+ * @param path file system path
+ * @return Java classpath resource name
+ */
+ public static String toResourceName(Path path) {
+ if (path == null) {
+ return null;
+ }
+ if (path.getFileSystem().getSeparator().equals("/")) {
+ return path.toString();
+ }
+ return path.toString().replace(path.getFileSystem().getSeparator(), "/");
+ }
+
/**
* Invokes {@link #consumeAsStreams(ClassLoader, String, Consumer)} passing in
* an instance of the current thread's context classloader as the classloader
diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcSslUtils.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcSslUtils.java
index 47673ac5e57..a26af11d2f5 100644
--- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcSslUtils.java
+++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcSslUtils.java
@@ -13,6 +13,7 @@
import io.quarkus.grpc.runtime.config.GrpcServerConfiguration;
import io.quarkus.grpc.runtime.config.SslServerConfig;
+import io.quarkus.runtime.util.ClassPathUtils;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.core.http.HttpVersion;
@@ -126,7 +127,7 @@ static boolean applySslOptions(GrpcServerConfiguration config, HttpServerOptions
private static byte[] getFileContent(Path path) throws IOException {
byte[] data;
final InputStream resource = Thread.currentThread().getContextClassLoader()
- .getResourceAsStream(path.toString());
+ .getResourceAsStream(ClassPathUtils.toResourceName(path));
if (resource != null) {
try (InputStream is = resource) {
data = doRead(is);
diff --git a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java
index 4d974f74e17..9704fab557f 100644
--- a/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java
+++ b/extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java
@@ -42,6 +42,7 @@
import io.quarkus.grpc.runtime.config.GrpcServerConfiguration;
import io.quarkus.grpc.runtime.config.SslClientConfig;
import io.quarkus.runtime.LaunchMode;
+import io.quarkus.runtime.util.ClassPathUtils;
import io.smallrye.stork.Stork;
@SuppressWarnings({ "OptionalIsPresent", "Convert2Lambda" })
@@ -223,7 +224,7 @@ private static GrpcClientConfiguration testConfig(GrpcServerConfiguration server
private static InputStream streamFor(Path path, String resourceName) {
final InputStream resource = Thread.currentThread().getContextClassLoader()
- .getResourceAsStream(path.toString());
+ .getResourceAsStream(ClassPathUtils.toResourceName(path));
if (resource != null) {
return resource;
} else {
diff --git a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java
index 8c73ab2b1ad..28c847fa573 100644
--- a/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java
+++ b/extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java
@@ -61,7 +61,7 @@ class InfinispanClientProcessor {
private static final Log log = LogFactory.getLog(InfinispanClientProcessor.class);
private static final String META_INF = "META-INF";
- private static final String HOTROD_CLIENT_PROPERTIES = META_INF + File.separator + "hotrod-client.properties";
+ private static final String HOTROD_CLIENT_PROPERTIES = "hotrod-client.properties";
private static final String PROTO_EXTENSION = ".proto";
private static final String SASL_SECURITY_PROVIDER = "com.sun.security.sasl.Provider";
@@ -85,13 +85,14 @@ InfinispanPropertiesBuildItem setup(ApplicationArchivesBuildItem applicationArch
feature.produce(new FeatureBuildItem(Feature.INFINISPAN_CLIENT));
additionalBeans.produce(AdditionalBeanBuildItem.unremovableOf(InfinispanClientProducer.class));
systemProperties.produce(new SystemPropertyBuildItem("io.netty.noUnsafe", "true"));
- hotDeployment.produce(new HotDeploymentWatchedFileBuildItem(HOTROD_CLIENT_PROPERTIES));
+ hotDeployment.produce(new HotDeploymentWatchedFileBuildItem(META_INF + File.separator + HOTROD_CLIENT_PROPERTIES));
// Enable SSL support by default
sslNativeSupport.produce(new ExtensionSslNativeSupportBuildItem(Feature.INFINISPAN_CLIENT));
nativeImageSecurityProviders.produce(new NativeImageSecurityProviderBuildItem(SASL_SECURITY_PROVIDER));
- InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(HOTROD_CLIENT_PROPERTIES);
+ InputStream stream = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(META_INF + "/" + HOTROD_CLIENT_PROPERTIES);
Properties properties;
if (stream == null) {
properties = new Properties();
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 e92b7881ffb..744dcc9e6e1 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
@@ -32,6 +32,7 @@
import io.quarkus.oidc.common.runtime.OidcCommonConfig.Tls.Verification;
import io.quarkus.runtime.TlsConfig;
import io.quarkus.runtime.configuration.ConfigurationException;
+import io.quarkus.runtime.util.ClassPathUtils;
import io.smallrye.jwt.algorithm.SignatureAlgorithm;
import io.smallrye.jwt.build.Jwt;
import io.smallrye.jwt.build.JwtSignatureBuilder;
@@ -401,7 +402,8 @@ public static Uni<JsonObject> discoverMetadata(WebClient client, String authServ
private static byte[] getFileContent(Path path) throws IOException {
byte[] data;
- final InputStream resource = Thread.currentThread().getContextClassLoader().getResourceAsStream(path.toString());
+ final InputStream resource = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(ClassPathUtils.toResourceName(path));
if (resource != null) {
try (InputStream is = resource) {
data = doRead(is);
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 e2a6e0bbc44..b719ad95ec6 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
@@ -65,11 +65,11 @@
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.deployment.logging.LogCleanupFilterBuildItem;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
-import io.quarkus.paths.PathUtils;
import io.quarkus.resteasy.common.spi.ResteasyDotNames;
import io.quarkus.resteasy.server.common.spi.AllowedJaxRsAnnotationPrefixBuildItem;
import io.quarkus.resteasy.server.common.spi.ResteasyJaxrsConfigBuildItem;
import io.quarkus.runtime.LaunchMode;
+import io.quarkus.runtime.util.ClassPathUtils;
import io.quarkus.smallrye.openapi.common.deployment.SmallRyeOpenApiConfig;
import io.quarkus.smallrye.openapi.deployment.filter.AutoRolesAllowedFilter;
import io.quarkus.smallrye.openapi.deployment.filter.AutoTagFilter;
@@ -172,7 +172,7 @@ void configFiles(BuildProducer<HotDeploymentWatchedFileBuildItem> watchedFiles,
List<Path> additionalStaticDocuments = openApiConfig.additionalDocsDirectory.get();
for (Path path : additionalStaticDocuments) {
// Scan all yaml and json files
- List<String> filesInDir = getResourceFiles(PathUtils.asString(path, "/"),
+ List<String> filesInDir = getResourceFiles(ClassPathUtils.toResourceName(path),
outputTargetBuildItem.getOutputDirectory());
for (String possibleFile : filesInDir) {
watchedFiles.produce(new HotDeploymentWatchedFileBuildItem(possibleFile));
@@ -795,7 +795,7 @@ private List<Result> findStaticModels(SmallRyeOpenApiConfig openApiConfig, Path
for (Path path : additionalStaticDocuments) {
// Scan all yaml and json files
try {
- List<String> filesInDir = getResourceFiles(PathUtils.asString(path, "/"), target);
+ List<String> filesInDir = getResourceFiles(ClassPathUtils.toResourceName(path), target);
for (String possibleModelFile : filesInDir) {
addStaticModelIfExist(results, possibleModelFile);
}
diff --git a/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java b/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java
index 081a525469e..5b08792f7ab 100644
--- a/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java
+++ b/extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java
@@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.runtime.TlsConfig;
+import io.quarkus.runtime.util.ClassPathUtils;
import io.smallrye.mutiny.Uni;
import io.vertx.core.net.JksOptions;
import io.vertx.core.net.KeyStoreOptionsBase;
@@ -130,7 +131,7 @@ private static String determineStoreType(Path keyStorePath) {
private static byte[] storeBytes(Path keyStorePath)
throws Exception {
InputStream classPathResource = Thread.currentThread().getContextClassLoader()
- .getResourceAsStream(keyStorePath.toString());
+ .getResourceAsStream(ClassPathUtils.toResourceName(keyStorePath));
if (classPathResource != null) {
try (InputStream is = classPathResource) {
return allBytes(is);
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 b6385ef98a3..e800959e190 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
@@ -59,6 +59,7 @@
import io.quarkus.runtime.configuration.ConfigurationException;
import io.quarkus.runtime.configuration.MemorySize;
import io.quarkus.runtime.shutdown.ShutdownConfig;
+import io.quarkus.runtime.util.ClassPathUtils;
import io.quarkus.vertx.core.runtime.VertxCoreRecorder;
import io.quarkus.vertx.core.runtime.config.VertxConfiguration;
import io.quarkus.vertx.http.runtime.HttpConfiguration.InsecureRequests;
@@ -762,7 +763,8 @@ private static KeyStoreOptions createKeyStoreOptions(Path path, String password,
private static byte[] getFileContent(Path path) throws IOException {
byte[] data;
- final InputStream resource = Thread.currentThread().getContextClassLoader().getResourceAsStream(path.toString());
+ final InputStream resource = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(ClassPathUtils.toResourceName(path));
if (resource != null) {
try (InputStream is = resource) {
data = doRead(is);
diff --git a/integration-tests/bouncycastle-fips-jsse/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleFipsJsseTestCase.java b/integration-tests/bouncycastle-fips-jsse/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleFipsJsseTestCase.java
index 1e42e7fde2f..f60e9b3ec12 100644
--- a/integration-tests/bouncycastle-fips-jsse/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleFipsJsseTestCase.java
+++ b/integration-tests/bouncycastle-fips-jsse/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleFipsJsseTestCase.java
@@ -23,6 +23,7 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
+import io.quarkus.runtime.util.ClassPathUtils;
import io.quarkus.test.common.http.TestHTTPResource;
import io.quarkus.test.junit.QuarkusTest;
import io.vertx.core.Vertx;
@@ -130,7 +131,8 @@ public void run() throws Throwable {
private static byte[] getFileContent(Path path) throws IOException {
byte[] data;
- final InputStream resource = Thread.currentThread().getContextClassLoader().getResourceAsStream(path.toString());
+ final InputStream resource = Thread.currentThread().getContextClassLoader()
+ .getResourceAsStream(ClassPathUtils.toResourceName(path));
if (resource != null) {
try (InputStream is = resource) {
data = doRead(is); | ['extensions/oidc-common/runtime/src/main/java/io/quarkus/oidc/common/runtime/OidcCommonUtils.java', 'extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/supports/Channels.java', 'extensions/smallrye-openapi/deployment/src/main/java/io/quarkus/smallrye/openapi/deployment/SmallRyeOpenApiProcessor.java', 'extensions/spring-cloud-config-client/runtime/src/main/java/io/quarkus/spring/cloud/config/client/runtime/VertxSpringCloudConfigGateway.java', 'extensions/vertx-http/runtime/src/main/java/io/quarkus/vertx/http/runtime/VertxHttpRecorder.java', 'core/runtime/src/main/java/io/quarkus/runtime/util/ClassPathUtils.java', 'extensions/grpc/runtime/src/main/java/io/quarkus/grpc/runtime/GrpcSslUtils.java', 'integration-tests/bouncycastle-fips-jsse/src/test/java/io/quarkus/it/bouncycastle/BouncyCastleFipsJsseTestCase.java', 'extensions/infinispan-client/deployment/src/main/java/io/quarkus/infinispan/client/deployment/InfinispanClientProcessor.java'] | {'.java': 9} | 9 | 9 | 0 | 0 | 9 | 19,660,542 | 3,805,738 | 500,532 | 4,833 | 2,959 | 537 | 47 | 8 | 2,672 | 290 | 629 | 84 | 1 | 1 | 1970-01-01T00:27:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,506 | quarkusio/quarkus/23542/23517 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23517 | https://github.com/quarkusio/quarkus/pull/23542 | https://github.com/quarkusio/quarkus/pull/23542 | 1 | fix | Quarkus' DiagnosticPrinter incompatible with GraalVM / Mandrel 22.1-dev | ### Describe the bug
A [recent GraalVM refactoring](https://github.com/oracle/graal/commit/56804e7227510acbfac9c658905cb614eec57d73) moved `com.oracle.svm.core.posix.thread.PosixJavaThreads#getPthreadIdentifier` and `com.oracle.svm.core.posix.thread.PosixJavaThreads#hasThreadIdentifier` to a new class `com.oracle.svm.core.posix.thread.PosixPlatformJavaThreads` making the following code to cause native-image failures since GraalVM fails to find the corresponding methods: https://github.com/quarkusio/quarkus/blob/5036e2f94f71f88f3e0a7415c7b2c519861a267c/core/runtime/src/main/java/io/quarkus/runtime/graal/DiagnosticPrinter.java#L18-L26
### Expected behavior
Quarkus should work with the upcoming 22.1 GraalVM release
### Actual behavior
Quarkus fails with:
```
Error: Could not find target method: static native com.oracle.svm.core.posix.headers.Pthread$pthread_t io.quarkus.runtime.graal.DiagnosticPrinter$Target_PosixJavaThreads.getPthreadIdentifier(java.lang.Thread)
com.oracle.svm.core.util.UserError$UserException: Could not find target method: static native com.oracle.svm.core.posix.headers.Pthread$pthread_t io.quarkus.runtime.graal.DiagnosticPrinter$Target_PosixJavaThreads.getPthreadIdentifier(java.lang.Thread)
at com.oracle.svm.core.util.UserError.abort(UserError.java:72)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findOriginalMethod(AnnotationSubstitutionProcessor.java:764)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleMethodInAliasClass(AnnotationSubstitutionProcessor.java:381)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleAliasClass(AnnotationSubstitutionProcessor.java:353)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:323)
at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:279)
at com.oracle.svm.hosted.NativeImageGenerator.createAnnotationSubstitutionProcessor(NativeImageGenerator.java:923)
at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:836)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:551)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:511)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:423)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:598)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:628)
```
See https://github.com/graalvm/mandrel/runs/5103314555?check_suite_focus=true#step:11:177
### How to Reproduce?
1. Download latest nightly build of GraalVM from https://github.com/graalvm/graalvm-ce-dev-builds/releases/
2. Try to create a native Quarkus application or integration test with it
### Output of `uname -a` or `ver`
GH runner
### Output of `java -version`
11.0.14 and 17.0.2
### GraalVM version (if different from Java)
22.1.0-deva0db6e1
### Quarkus version or git rev
8de379736da497e2b971be853ec2c076509779b0
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
### Additional information
This issue is related to the discussion in https://github.com/oracle/graal/discussions/4146. `DiagnosticsPrinter` is relying on GraalVM internals, as a result it's expected for such code segments to cause issues from time to time.
The question is: Do Quarkus users and devs use the `DiagnosticsPrinter`? Is it worth performing version checks (and complicating things by not using public APIs) to make it work or is it something we could remove?
cc @geoand @gsmet @stuartwdouglas | e85b6fece0eb6df0c62a70f0c5d2173b0f7a6460 | d928f25a9ccb2ba8956638498ddb234662fd4d3e | https://github.com/quarkusio/quarkus/compare/e85b6fece0eb6df0c62a70f0c5d2173b0f7a6460...d928f25a9ccb2ba8956638498ddb234662fd4d3e | diff --git a/core/runtime/src/main/java/io/quarkus/runtime/graal/DiagnosticPrinter.java b/core/runtime/src/main/java/io/quarkus/runtime/graal/DiagnosticPrinter.java
index b925372a100..98f5e5d9dba 100644
--- a/core/runtime/src/main/java/io/quarkus/runtime/graal/DiagnosticPrinter.java
+++ b/core/runtime/src/main/java/io/quarkus/runtime/graal/DiagnosticPrinter.java
@@ -4,27 +4,10 @@
import java.time.Instant;
import java.util.Map;
-import org.graalvm.nativeimage.Platform;
-import org.graalvm.nativeimage.Platforms;
-
-import com.oracle.svm.core.annotate.Alias;
-import com.oracle.svm.core.annotate.TargetClass;
-import com.oracle.svm.core.posix.headers.Pthread;
-
/**
* A signal handler that prints diagnostic thread info to standard output.
*/
public final class DiagnosticPrinter {
- @TargetClass(className = "com.oracle.svm.core.posix.thread.PosixJavaThreads")
- @Platforms({ Platform.LINUX.class, Platform.DARWIN.class })
- static final class Target_PosixJavaThreads {
- @Alias
- static native Pthread.pthread_t getPthreadIdentifier(Thread thread);
-
- @Alias
- static native boolean hasThreadIdentifier(Thread thread);
- }
-
public static void printDiagnostics(PrintStream w) {
Map<Thread, StackTraceElement[]> allStackTraces = Thread.getAllStackTraces();
w.println(Instant.now().toString());
@@ -42,15 +25,6 @@ public static void printDiagnostics(PrintStream w) {
w.print("daemon ");
w.print("prio=");
w.print(thread.getPriority());
- w.print(" tid=");
- if ((Platform.includedIn(Platform.LINUX.class) || Platform.includedIn(Platform.DARWIN.class))
- && Target_PosixJavaThreads.hasThreadIdentifier(thread)) {
- final long nativeId = Target_PosixJavaThreads.getPthreadIdentifier(thread).rawValue();
- w.print("0x");
- w.println(Long.toHexString(nativeId));
- } else {
- w.println("(unknown)");
- }
w.print(" java.lang.thread.State: ");
w.println(thread.getState());
for (StackTraceElement element : stackTrace) { | ['core/runtime/src/main/java/io/quarkus/runtime/graal/DiagnosticPrinter.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,661,105 | 3,805,852 | 500,548 | 4,833 | 1,106 | 222 | 26 | 1 | 3,913 | 251 | 991 | 65 | 5 | 1 | 1970-01-01T00:27:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,505 | quarkusio/quarkus/23556/23445 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23445 | https://github.com/quarkusio/quarkus/pull/23556 | https://github.com/quarkusio/quarkus/pull/23556 | 1 | fixes | Hibernate post-boot schema-validation fails after upgrade to Quarkus 2.6.3 | ### Describe the bug
After upgrade to 2.6.3.Final, post boot schema validation emits some warnings about missing table(s).
Migrations are managed by Flyway and database contains:
1. schema _postboot1_ holds Flyway schema history table
2. schema _postboot_ contains table _product_
Flyway is configured to use _postboot1_ as its own schema and _postboot_ as managed schema.
Hibernate is configured to use _postboot_ as default schema.
A single PanacheEntity _@Entity_ is mapped as:
```
@Entity
@Table(name="product")
class Product extends PanacheEntity {
// properties
}
```
### Expected behavior
No warnings at all (as before the upgrade)
### Actual behavior
```
2022-02-04 16:26:25,945 ERROR [io.qua.hib.orm.run.sch.SchemaManagementIntegrator] (Hibernate post-boot validation thread for <default>) Failed to validate Schema: Schema-validation: missing table [product]
2022-02-04 16:26:25,992 ERROR [io.qua.hib.orm.run.sch.SchemaManagementIntegrator] (Hibernate post-boot validation thread for <default>) The following SQL may resolve the database issues, as generated by the Hibernate schema migration tool. WARNING: You must manually verify this SQL is correct, this is a best effort guess, do not copy/paste it without verifying that it does what you expect.
create table product (id bigint not null, code varchar(255), marketArea varchar(255), primary key (id));
```
### How to Reproduce?
https://github.com/luca-bassoricci/hibernate-postboot-validator
Repo is configured to use version 2.7.0 of Quarkus
### Output of `uname -a` or `ver`
Link to repo with sample
### Output of `java -version`
Link to repo with sample
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.6.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
### Additional information
_No response_ | c7c39f6882cf07352cc5bfebd6e46af5714add07 | ab7a7e8253d65eb3a8e534d8500c76e29d6a33bc | https://github.com/quarkusio/quarkus/compare/c7c39f6882cf07352cc5bfebd6e46af5714add07...ab7a7e8253d65eb3a8e534d8500c76e29d6a33bc | diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java
index aed4b79b258..a6c5918dd53 100644
--- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java
+++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java
@@ -3,14 +3,15 @@
import java.io.StringWriter;
import java.util.Collections;
import java.util.EnumSet;
-import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.hibernate.boot.Metadata;
+import org.hibernate.engine.config.spi.ConfigurationService;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.integrator.spi.Integrator;
+import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.spi.SessionFactoryServiceRegistry;
import org.hibernate.tool.schema.SourceType;
import org.hibernate.tool.schema.TargetType;
@@ -71,9 +72,9 @@ static String defaultName(SessionFactoryImplementor sf) {
if (name != null) {
return name;
}
- Object prop = sf.getProperties().get("hibernate.ejb.persistenceUnitName");
- if (prop != null) {
- return prop.toString();
+ Object persistenceUnitName = sf.getProperties().get("hibernate.ejb.persistenceUnitName");
+ if (persistenceUnitName != null) {
+ return persistenceUnitName.toString();
}
return DataSourceUtil.DEFAULT_DATASOURCE_NAME;
}
@@ -91,24 +92,24 @@ public static void recreateDatabase(String name) {
if (!LaunchMode.current().isDevOrTest()) {
throw new IllegalStateException("Can only be used in dev or test mode");
}
- Holder val = metadataMap.get(name);
+ Holder holder = metadataMap.get(name);
- Object prop = val.sessionFactory.getProperties().get("javax.persistence.schema-generation.database.action");
- if (prop != null && !(prop.toString().equals("none"))) {
+ ServiceRegistry serviceRegistry = holder.sessionFactory.getServiceRegistry();
+ SimpleExecutionOptions executionOptions = new SimpleExecutionOptions(serviceRegistry);
+ Object schemaGenerationDatabaseAction = executionOptions.getConfigurationValues()
+ .get("javax.persistence.schema-generation.database.action");
+ if (schemaGenerationDatabaseAction != null && !(schemaGenerationDatabaseAction.toString().equals("none"))) {
//if this is none we assume another framework is doing this (e.g. flyway)
- SchemaManagementTool schemaManagementTool = val.sessionFactory.getServiceRegistry()
+ SchemaManagementTool schemaManagementTool = serviceRegistry
.getService(SchemaManagementTool.class);
- SchemaDropper schemaDropper = schemaManagementTool.getSchemaDropper(new HashMap());
- schemaDropper
- .doDrop(val.metadata, new SimpleExecutionOptions(), new SimpleSourceDescriptor(),
- new SimpleTargetDescriptor());
- schemaManagementTool.getSchemaCreator(new HashMap())
- .doCreation(val.metadata, new SimpleExecutionOptions(), new SimpleSourceDescriptor(),
- new SimpleTargetDescriptor());
+ SchemaDropper schemaDropper = schemaManagementTool.getSchemaDropper(executionOptions.getConfigurationValues());
+ schemaDropper.doDrop(holder.metadata, executionOptions, new SimpleSourceDescriptor(), new SimpleTargetDescriptor());
+ schemaManagementTool.getSchemaCreator(executionOptions.getConfigurationValues())
+ .doCreation(holder.metadata, executionOptions, new SimpleSourceDescriptor(), new SimpleTargetDescriptor());
}
//we still clear caches though
- val.sessionFactory.getCache().evictAll();
- val.sessionFactory.getCache().evictQueries();
+ holder.sessionFactory.getCache().evictAll();
+ holder.sessionFactory.getCache().evictQueries();
}
public static void runPostBootValidation(String name) {
@@ -123,17 +124,19 @@ public static void runPostBootValidation(String name) {
}
//if this is none we assume another framework is doing this (e.g. flyway)
- SchemaManagementTool schemaManagementTool = val.sessionFactory.getServiceRegistry()
+ ServiceRegistry serviceRegistry = val.sessionFactory.getServiceRegistry();
+ SchemaManagementTool schemaManagementTool = serviceRegistry
.getService(SchemaManagementTool.class);
- SchemaValidator validator = schemaManagementTool.getSchemaValidator(new HashMap());
+ SimpleExecutionOptions executionOptions = new SimpleExecutionOptions(serviceRegistry);
+ SchemaValidator validator = schemaManagementTool.getSchemaValidator(executionOptions.getConfigurationValues());
try {
- validator.doValidation(val.metadata, new SimpleExecutionOptions());
+ validator.doValidation(val.metadata, executionOptions);
} catch (SchemaManagementException e) {
log.error("Failed to validate Schema: " + e.getMessage());
- SchemaMigrator migrator = schemaManagementTool.getSchemaMigrator(new HashMap());
+ SchemaMigrator migrator = schemaManagementTool.getSchemaMigrator(executionOptions.getConfigurationValues());
StringWriter writer = new StringWriter();
- migrator.doMigration(val.metadata, new SimpleExecutionOptions(), new TargetDescriptor() {
+ migrator.doMigration(val.metadata, executionOptions, new TargetDescriptor() {
@Override
public EnumSet<TargetType> getTargetTypes() {
return EnumSet.of(TargetType.SCRIPT);
@@ -186,9 +189,15 @@ static class Holder {
}
private static class SimpleExecutionOptions implements ExecutionOptions {
+ private final Map<?, ?> configurationValues;
+
+ public SimpleExecutionOptions(ServiceRegistry serviceRegistry) {
+ configurationValues = serviceRegistry.getService(ConfigurationService.class).getSettings();
+ }
+
@Override
- public Map getConfigurationValues() {
- return Collections.emptyMap();
+ public Map<?, ?> getConfigurationValues() {
+ return configurationValues;
}
@Override | ['extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,663,334 | 3,806,297 | 500,611 | 4,835 | 4,210 | 692 | 57 | 1 | 1,948 | 256 | 497 | 62 | 1 | 2 | 1970-01-01T00:27:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,503 | quarkusio/quarkus/23585/23548 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23548 | https://github.com/quarkusio/quarkus/pull/23585 | https://github.com/quarkusio/quarkus/pull/23585 | 1 | fix | (vert.x-eventloop-thread-1) Unable to look up TXT record for host serverlessinstance0.oagmp.mongodb.net | ### Describe the bug
I get the error:
(vert.x-eventloop-thread-1) Unable to look up TXT record for host serverlessinstance0.oagmp.mongodb.net.
In my contaiver resolv.conf file:
bash-4.4$ cat /etc/resolv.conf
nameserver 127.0.0.11
options ndots:0
I'm using the native image quay.io/quarkus/quarkus-micro-image:1.0.
It comes with ndots:0 by default.
Thanks in advance!
### Expected behavior
It find in native mode the look up TXT record for host serverlessinstance0.oagmp.mongodb.net.
### Actual behavior
It doesn't find the look up TXT record for host serverlessinstance0.oagmp.mongodb.net.
### How to Reproduce?
Steps to reproduce:
1) Configure the application.properties
application.properties
quarkus.mongodb.connection-string=
quarkus.mongodb.database=
quarkus.mongodb.native.dns.use-vertx-dns-resolver=true
quarkus.mongodb.native.dns.lookup-timeout=10s
2) Build in native mode
3) Start the application
### Output of `uname -a` or `ver`
Linux 25cf03bb9077 5.10.16.3-microsoft-standard-WSL2 #1 SMP Fri Apr 2 22:23:49 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
command not found
### GraalVM version (if different from Java)
I'm using quay.io/quarkus/centos-quarkus-maven:21.3.0-java11 to generate the native image
### Quarkus version or git rev
2.7.0.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 7.3.3
### Additional information
I'm using a mongo on Atlas cloud and it is a serverless instance. | 98e3a0baecdbc28adb88efae42bcefd958b4e276 | 22264638fcdba026c991761f732095d2a0ed8acc | https://github.com/quarkusio/quarkus/compare/98e3a0baecdbc28adb88efae42bcefd958b4e276...22264638fcdba026c991761f732095d2a0ed8acc | diff --git a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/MongodbConfig.java b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/MongodbConfig.java
index c251966e883..d32223bbb02 100644
--- a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/MongodbConfig.java
+++ b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/MongodbConfig.java
@@ -71,11 +71,17 @@ public class MongodbConfig {
@ConfigItem(name = "native.dns.server-port", defaultValue = "53")
public OptionalInt dnsServerPortInNativeMode;
- // mongo.dns.lookup-timeout
/**
* If {@code native.dns.use-vertx-dns-resolver} is set to {@code true}, this property configures the DNS lookup timeout
* duration.
*/
@ConfigItem(name = "native.dns.lookup-timeout", defaultValue = "5s")
public Duration dnsLookupTimeoutInNativeMode;
+
+ /**
+ * If {@code native.dns.use-vertx-dns-resolver} is set to {@code true}, this property enables the logging ot the
+ * DNS lookup. It can be useful to understand why the lookup fails.
+ */
+ @ConfigItem(name = "native.dns.log-activity", defaultValue = "false")
+ public Optional<Boolean> dnsLookupLogActivityInNativeMode;
}
diff --git a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/DnsClientProducer.java b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/DnsClientProducer.java
index 50f9b8d7d35..d1239265cf4 100644
--- a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/DnsClientProducer.java
+++ b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/DnsClientProducer.java
@@ -14,8 +14,10 @@
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
+import org.jboss.logging.Logger;
import io.quarkus.arc.Arc;
+import io.vertx.core.dns.DnsClientOptions;
import io.vertx.mutiny.core.Vertx;
import io.vertx.mutiny.core.dns.DnsClient;
@@ -29,6 +31,7 @@ public abstract class DnsClientProducer {
private static final String DNS_SERVER = "quarkus.mongodb.native.dns.server-host";
private static final String DNS_SERVER_PORT = "quarkus.mongodb.native.dns.server-port";
+ private static final String DNS_SERVER_ACTIVITY = "quarkus.mongodb.native.dns.log-activity";
public static final String LOOKUP_TIMEOUT = "quarkus.mongodb.native.dns.lookup-timeout";
@@ -39,6 +42,8 @@ public static synchronized io.vertx.mutiny.core.dns.DnsClient createDnsClient()
if (client == null) {
Vertx vertx = Arc.container().instance(Vertx.class).get();
+ boolean activity = config.getOptionalValue(DNS_SERVER_ACTIVITY, Boolean.class).orElse(false);
+
// If the server is not set, we attempt to read the /etc/resolv.conf. If it does not exist, we use the default
// configuration.
String server = config.getOptionalValue(DNS_SERVER, String.class).orElseGet(() -> {
@@ -50,9 +55,9 @@ public static synchronized io.vertx.mutiny.core.dns.DnsClient createDnsClient()
});
if (server != null) {
int port = config.getOptionalValue(DNS_SERVER_PORT, Integer.class).orElse(53);
- client = vertx.createDnsClient(port, server);
+ client = vertx.createDnsClient(new DnsClientOptions().setLogActivity(activity).setPort(port).setHost(server));
} else {
- client = vertx.createDnsClient();
+ client = vertx.createDnsClient(new DnsClientOptions().setLogActivity(activity));
}
}
@@ -64,19 +69,23 @@ public static List<String> nameServers() {
if (!new File(file).isFile()) {
return Collections.emptyList();
}
-
Path p = Paths.get(file);
List<String> nameServers = new ArrayList<>();
String line;
try (BufferedReader br = new BufferedReader(new InputStreamReader(Files.newInputStream(p)))) {
while ((line = br.readLine()) != null) {
StringTokenizer st = new StringTokenizer(line);
- if (st.nextToken().startsWith("nameserver")) {
- nameServers.add(st.nextToken());
+ if (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ if (token.startsWith("nameserver")) {
+ // If we do not have another token it means that the line is not formatted correctly.
+ // So, throwing an exception is ok.
+ nameServers.add(st.nextToken().trim());
+ }
}
}
} catch (IOException e) {
- e.printStackTrace();
+ Logger.getLogger(DnsClientProducer.class).error("Unable to read the /etc/resolv.conf file", e);
}
return nameServers;
}
diff --git a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/graal/MongoClientSubstitutions.java b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/graal/MongoClientSubstitutions.java
index ca3f5e26d3f..2186a4c9384 100644
--- a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/graal/MongoClientSubstitutions.java
+++ b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/graal/MongoClientSubstitutions.java
@@ -116,7 +116,7 @@ final class CompressorSubstitute {
}
@TargetClass(InternalStreamConnection.class)
-final class InternalStreamConnectionSubtitution {
+final class InternalStreamConnectionSubstitution {
@Substitute
private CompressorSubstitute createCompressor(final MongoCompressor mongoCompressor) {
throw new UnsupportedOperationException("Unsupported compressor in native mode");
@@ -179,7 +179,6 @@ public List<String> resolveHostFromSrvRecords(final String srvHost) {
if (srvRecords.isEmpty()) {
throw new MongoConfigurationException("No SRV records available for host " + "_mongodb._tcp." + srvHost);
}
-
for (SrvRecord srvRecord : srvRecords) {
String resolvedHost = srvRecord.target().endsWith(".")
? srvRecord.target().substring(0, srvRecord.target().length() - 1) | ['extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/MongodbConfig.java', 'extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/dns/DnsClientProducer.java', 'extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/graal/MongoClientSubstitutions.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 19,663,270 | 3,806,242 | 500,597 | 4,835 | 1,787 | 352 | 32 | 3 | 1,516 | 181 | 434 | 65 | 0 | 0 | 1970-01-01T00:27:24 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,152 | quarkusio/quarkus/34142/33897 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/33897 | https://github.com/quarkusio/quarkus/pull/34142 | https://github.com/quarkusio/quarkus/pull/34142 | 1 | fixes | NPE with shared Keycloak dev services when exiting Quarkus dev mode | ### Describe the bug
I have two Quarkus apps with separate Gradle builds and I am using shared Keycloak dev services. When I exit the Quarkus dev mode with `q + ENTER` I get the following error message with the app that is reusing the shared Keycloak dev service from the other one:
```
2023-06-08 09:12:52,339 ERROR [io.qua.oid.dep.dev.key.KeycloakDevServicesProcessor] (Quarkus Shutdown Thread) Failed to stop Keycloak container [Error Occurred After Shutdown]: java.lang.NullPointerException: Cannot invoke "java.io.Closeable.close()" because "this.closeable" is null
at io.quarkus.deployment.builditem.DevServicesResultBuildItem$RunningDevService.close(DevServicesResultBuildItem.java:90)
at io.quarkus.oidc.deployment.devservices.keycloak.KeycloakDevServicesProcessor$1.run(KeycloakDevServicesProcessor.java:217)
at io.quarkus.deployment.builditem.CuratedApplicationShutdownBuildItem$1.run(CuratedApplicationShutdownBuildItem.java:48)
at io.quarkus.bootstrap.classloading.QuarkusClassLoader.close(QuarkusClassLoader.java:617)
at io.quarkus.bootstrap.app.CuratedApplication.close(CuratedApplication.java:418)
at io.quarkus.deployment.dev.IsolatedDevModeMain.close(IsolatedDevModeMain.java:356)
at io.quarkus.deployment.dev.IsolatedDevModeMain$6.run(IsolatedDevModeMain.java:466)
at java.base/java.lang.Thread.run(Thread.java:833)
```
### Expected behavior
I would not expect it to throw an exception.
### Actual behavior
It throws an NPE.
### How to Reproduce?
_No response_
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
openjdk 17.0.7 2023-04-18 OpenJDK Runtime Environment Temurin-17.0.7+7 (build 17.0.7+7) OpenJDK 64-Bit Server VM Temurin-17.0.7+7 (build 17.0.7+7, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.16.6.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 7.6.1
### Additional information
_No response_ | 2971d5345d4d5acb1b38347ee325c866aaee0f3b | 28034bbf81db8f5f7199dc98b133a662dcab7b51 | https://github.com/quarkusio/quarkus/compare/2971d5345d4d5acb1b38347ee325c866aaee0f3b...28034bbf81db8f5f7199dc98b133a662dcab7b51 | diff --git a/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java b/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java
index 5ed1385142e..560a9d1f49e 100644
--- a/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java
+++ b/core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java
@@ -87,7 +87,9 @@ public boolean isOwner() {
@Override
public void close() throws IOException {
- this.closeable.close();
+ if (this.closeable != null) {
+ this.closeable.close();
+ }
}
public DevServicesResultBuildItem toBuildItem() { | ['core/deployment/src/main/java/io/quarkus/deployment/builditem/DevServicesResultBuildItem.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,898,361 | 5,305,543 | 682,871 | 6,291 | 135 | 24 | 4 | 1 | 2,048 | 187 | 547 | 51 | 0 | 1 | 1970-01-01T00:28:07 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,214 | quarkusio/quarkus/32681/13464 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/13464 | https://github.com/quarkusio/quarkus/pull/32681 | https://github.com/quarkusio/quarkus/pull/32681 | 1 | resolves | Indexing error with unhelpful error message when a generated class is registered as an additional bean instead of a generated bean | **Describe the bug**
An indexing error with an unhelpful error message is displayed if you add a generated class
as an additional bean at build message
**Expected behavior**
An error message that suggests to use GeneratedBeanGizmoAdaptor .
Ex: "Unable to find class file for ${className}. Maybe ${className} was registered as an additional bean via `AdditionalBeanBuildItem`. In that case, remove the producer of `AdditionalBeanBuildItem` and use a GeneratedBeanGizmoAdaptor as the class output for ClassCreator."
**Actual behavior**
An unhelpful "java.lang.IllegalArgumentException: stream cannot be null" is shown
```
java.lang.IllegalArgumentException: stream cannot be null
[ERROR] at org.jboss.jandex.Indexer.index(Indexer.java:1584)
[ERROR] at io.quarkus.deployment.index.IndexingUtil.indexClass(IndexingUtil.java:32)
[ERROR] at io.quarkus.arc.deployment.BeanArchiveProcessor.build(BeanArchiveProcessor.java:73)
[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:936)
[ERROR] at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR] at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
[ERROR] at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR] at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR] at org.jboss.threads.JBossThread.run(JBossThread.java:479)
```
**To Reproduce**
https://github.com/Christopher-Chianelli/issue-reproducer/tree/gizmo-cannot-be-indexed-error
`mvn clean install`; the error will occur during the build of the example project.
**Configuration**
```properties
# Add your application.properties here, if applicable.
```
**Screenshots**
(If applicable, add screenshots to help explain your problem.)
**Environment (please complete the following information):**
- Output of `uname -a` or `ver`:
- Output of `java -version`:
```
openjdk 11.0.9 2020-10-20
OpenJDK Runtime Environment 18.9 (build 11.0.9+11)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.9+11, mixed mode, sharing)
```
- GraalVM version (if different from Java):
- Quarkus version or git rev: 1.9.2.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.)
| b687fbb7ba8678d99433be71aca5dd1f358fb6e6 | c9422dc7d5d5c7da6b6e61c48fcce67b0f6d56fc | https://github.com/quarkusio/quarkus/compare/b687fbb7ba8678d99433be71aca5dd1f358fb6e6...c9422dc7d5d5c7da6b6e61c48fcce67b0f6d56fc | diff --git a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AdditionalBeanBuildItem.java b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AdditionalBeanBuildItem.java
index 23afa839228..a2dcde480ed 100644
--- a/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AdditionalBeanBuildItem.java
+++ b/extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AdditionalBeanBuildItem.java
@@ -21,6 +21,11 @@
* An additional bean may have the scope defaulted via {@link #defaultScope} and {@link Builder#setDefaultScope(DotName)}. The
* default scope is only used if there is no scope declared on the bean class. The default scope should be used in cases where a
* bean class source is not controlled by the extension and the scope annotation cannot be declared directly on the class.
+ *
+ * <h2>Generated Classes</h2>
+ *
+ * This build item should never be produced for a generated class - {@link GeneratedBeanBuildItem} and
+ * {@link GeneratedBeanGizmoAdaptor} should be used instead.
*/
public final class AdditionalBeanBuildItem extends MultiBuildItem {
| ['extensions/arc/deployment/src/main/java/io/quarkus/arc/deployment/AdditionalBeanBuildItem.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 26,284,459 | 5,184,751 | 668,924 | 6,198 | 204 | 51 | 5 | 1 | 3,021 | 254 | 778 | 61 | 1 | 4 | 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 |
2,531 | quarkusio/quarkus/22879/22507 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22507 | https://github.com/quarkusio/quarkus/pull/22879 | https://github.com/quarkusio/quarkus/pull/22879 | 1 | close | Qute: "No template found for path ..." only in Eclipse IDE | ### Describe the bug
When I run a Quarkus app from within Eclipse, I get an io.quarkus.qute.TemplateException that the specified template can not be found.
On the other hand, if I run `./gradlew quarkusDev` from the command line, it works perfectly. Also when I build the app and then run the compiled quarkus-app.jar
### Expected behavior
Quarkus (or Eclipse) should find the existing template in `src/main/resources/templates`.
### Actual behavior
A "io.quarkus.qute.TemplateException: No template found for path ..." exception is thrown.
### How to Reproduce?
I created a minimal project here https://github.com/mailq/qutebug
Run it as Java Application from within the Eclipse IDE (2021-12) and experience the exception.
Run it with `./gradlew quarkusDev` at the command prompt and you get the correct output from the rendered template.
### Output of `uname -a` or `ver`
Linux desktop 5.11.0-41-generic #45-Ubuntu SMP Fri Nov 5 11:37:01 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment (build 17.0.1+12-Ubuntu-121.04) OpenJDK 64-Bit Server VM (build 17.0.1+12-Ubuntu-121.04, mixed mode, sharing)
### GraalVM version (if different from Java)
none
### Quarkus version or git rev
2.6.0-Final, wasn't also working with 2.5
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 7.3.2 (wrapper)
### Additional information
Eclipse IDE for Enterprise Java and Web Developers (includes Incubating components)
Version: 2021-12 (4.22.0)
Build id: 20211202-1639 | 43a9ef753db6e9c167b79f7cd7deb482097a0734 | 4602c59fe031bc354358a274c59aa4bf43b45857 | https://github.com/quarkusio/quarkus/compare/43a9ef753db6e9c167b79f7cd7deb482097a0734...4602c59fe031bc354358a274c59aa4bf43b45857 | diff --git a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java
index 3f90687f610..b0390e2bc91 100644
--- a/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java
+++ b/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java
@@ -4,6 +4,7 @@
import io.quarkus.bootstrap.app.CuratedApplication;
import io.quarkus.bootstrap.app.QuarkusBootstrap;
import io.quarkus.bootstrap.model.ApplicationModel;
+import io.quarkus.bootstrap.model.PathsCollection;
import io.quarkus.bootstrap.resolver.maven.BootstrapMavenContext;
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver;
import io.quarkus.bootstrap.util.BootstrapUtils;
@@ -15,6 +16,8 @@
import java.io.Closeable;
import java.io.IOException;
import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
/**
@@ -45,12 +48,20 @@ public static Closeable launch(Path classesDir, Map<String, Object> context) {
final ApplicationModel quarkusModel = BuildToolHelper.enableGradleAppModelForDevMode(classesDir);
context.put(BootstrapConstants.SERIALIZED_APP_MODEL, BootstrapUtils.serializeAppModel(quarkusModel, false));
- final Path launchingModulePath = quarkusModel.getApplicationModule().getMainSources().getSourceDirs().iterator()
+ ArtifactSources mainSources = quarkusModel.getApplicationModule().getMainSources();
+
+ final Path launchingModulePath = mainSources.getSourceDirs().iterator()
.next().getOutputDir();
+ List<Path> applicationRoots = new ArrayList<>();
+ applicationRoots.add(launchingModulePath);
+ for (SourceDir resourceDir : mainSources.getResourceDirs()) {
+ applicationRoots.add(resourceDir.getOutputDir());
+ }
+
// Gradle uses a different output directory for classes, we override the one used by the IDE
builder.setProjectRoot(launchingModulePath)
- .setApplicationRoot(launchingModulePath)
+ .setApplicationRoot(PathsCollection.from(applicationRoots))
.setTargetDirectory(quarkusModel.getApplicationModule().getBuildDir().toPath());
for (ResolvedDependency dep : quarkusModel.getDependencies()) { | ['independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/IDELauncherImpl.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,359,535 | 3,750,056 | 493,312 | 4,773 | 874 | 149 | 15 | 1 | 1,589 | 224 | 453 | 46 | 1 | 0 | 1970-01-01T00:27:22 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,516 | quarkusio/quarkus/23207/21905 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/21905 | https://github.com/quarkusio/quarkus/pull/23207 | https://github.com/quarkusio/quarkus/pull/23207 | 1 | fixes | Adding first registry in CLI erases the default one | ### Describe the bug
By default, registry list in CLI contains a default registry `registry.quarkus.io` and there is an option to add new registries. Although, if user adds a new registry, e.g. `registry.quarkus.redhat.com`, then the default registry will be silently removed from the list and became inaccessible.
### Expected behavior
Default registry stays in the list, registries are never removed without explicit user request.
### Actual behavior
Default registry is removed from the list.
### How to Reproduce?
1. Install quarkus afresh or remove/rename file ~/.quarkus/config.yaml
2. Check default registry.
```
$ quarkus registry list
Configured Quarkus extension registries:
registry.quarkus.io
```
3. Check existing extensions.
```
$ quarkus ext list | wc -l
920
```
4. Add non-default registry: ` quarkus registry add registry.quarkus.redhat.com`
5. Check registry list:
```
$ quarkus registry list
Configured Quarkus extension registries:
registry.quarkus.redhat.com #registry.quarkus.io is not in the list
(Read from ~/.quarkus/config.yaml)
```
6. Check existing extensions.
```
$ quarkus ext list | wc -l
170 # at least some extensions are not accessible any more
```
### Output of `uname -a` or `ver`
5.14.17-201.fc34.x86_64
### Output of `java -version`
Java version: 11.0.13, vendor: Eclipse Adoptium
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.5.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4
### Additional information
_No response_ | 0171a9bc8796297eb0d0d9056dccaf0ec39c5f6f | 208e848060f8c4ade8ebd583a70700d665bde770 | https://github.com/quarkusio/quarkus/compare/0171a9bc8796297eb0d0d9056dccaf0ec39c5f6f...208e848060f8c4ade8ebd583a70700d665bde770 | diff --git a/devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java b/devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java
index f9f2c5fc46a..c9d7449d4b9 100644
--- a/devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java
+++ b/devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java
@@ -1,5 +1,7 @@
package io.quarkus.cli;
+import static io.quarkus.registry.Constants.DEFAULT_REGISTRY_ID;
+
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -48,7 +50,16 @@ public Integer call() throws Exception {
if (persist) {
output.printText("Configured registries:");
for (RegistryConfig rc : config.getRegistries()) {
- output.printText("- " + rc.getId());
+ if (!existingConfig && config.getRegistries().size() == 1
+ && !rc.getId().equals(DEFAULT_REGISTRY_ID)) {
+ output.warn(
+ rc.getId() + " is the only registry configured in the config file.\\n" + rc.getId()
+ + " replaced the Default registry: "
+ + DEFAULT_REGISTRY_ID);
+ } else {
+ output.printText("- " + rc.getId());
+ }
+
}
if (configYaml != null) {
config.persist(configYaml); | ['devtools/cli/src/main/java/io/quarkus/cli/RegistryAddCommand.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,603,107 | 3,795,284 | 499,361 | 4,825 | 653 | 109 | 13 | 1 | 1,596 | 226 | 414 | 63 | 0 | 4 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,517 | quarkusio/quarkus/23185/23167 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23167 | https://github.com/quarkusio/quarkus/pull/23185 | https://github.com/quarkusio/quarkus/pull/23185 | 1 | fixes | LinkageError when hot reloading project using classes in external dependencies | ### Describe the bug
I have following structure in my reproducer project:
External dependency:
* A class called Configuration. This is a simple pojo, no cdi bean
* META-INF/beans.xml file
Quarkus project:
* ConfigurationProducer - a cdi producer, creating an applicationscoped instance of the Configuration
* ConfigurationValidator - Startup bean, which validates the produced Configuration in an PostConstruct
* GreetingResource - a simple inject of the Configuration
On first quarkus:dev, this app starts flawlessly.
If I now hot reload, I get the exception from below.
This only happens with 2.7.0.CR1.
With 2.6.3.Final, this exception did not happen.
### Expected behavior
No exceptions when hot reloading, like in 2.6.3.Final
### Actual behavior
```
2022-01-25 09:30:46,446 INFO [io.quarkus] (Quarkus Main Thread) hot-reload-producer stopped in 0.013s
__ ____ __ _____ ___ __ ____ ______
--/ __ \\/ / / / _ | / _ \\/ //_/ / / / __/
-/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\\ \\
--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/
2022-01-25 09:30:48,222 ERROR [io.qua.run.Application] (Quarkus Main Thread) Failed to start application (with profile dev): java.lang.LinkageError: loader constraint violation: when r
esolving method 'void com.acme.spi.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_ClientProxy.<init>(org.acme.ConfigurationProducer_ProducerMet
hod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean)' the class loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @73843e83 of the current class, org/acme/Configurati
onProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean, and the class loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @4461c7e3 for the method's
defining class, com/acme/spi/ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_ClientProxy, have different Class objects for the type org/acme/Con
figurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean used in the signature (org.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125
f3f16fd0e1923dbf7b49ecb1a_Bean is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @73843e83, parent loader io.quarkus.bootstrap.classloading.QuarkusCla
ssLoader @4461c7e3; com.acme.spi.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_ClientProxy is in unnamed module of loader io.quarkus.bootstrap
.classloading.QuarkusClassLoader @4461c7e3, parent loader 'app')
at org.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean.proxy(Unknown Source)
at org.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean.get(Unknown Source)
at org.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean.get(Unknown Source)
at org.acme.ConfigurationValidator_Bean.create(Unknown Source)
at org.acme.ConfigurationValidator_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:101)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:18)
at org.acme.ConfigurationValidator_ClientProxy.arc$delegate(Unknown Source)
at org.acme.ConfigurationValidator_ClientProxy.arc_contextualInstance(Unknown Source)
at org.acme.ConfigurationValidator_Observer_Synthetic_d70cd75bf32ab6598217b9a64a8473d65e248c05.notify(Unknown Source)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:320)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:302)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:73)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:128)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:97)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.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:104)
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)
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:103)
at java.base/java.lang.Thread.run(Thread.java:833)
2022-01-25 09:30:48,223 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (Aesh InputStream Reader) Failed to start quarkus: java.lang.RuntimeException: java.lang.RuntimeException: Failed to
start quarkus
at io.quarkus.dev.appstate.ApplicationStateNotification.waitForApplicationStart(ApplicationStateNotification.java:51)
at io.quarkus.runner.bootstrap.StartupActionImpl.runMainClass(StartupActionImpl.java:122)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartApp(IsolatedDevModeMain.java:233)
at io.quarkus.deployment.dev.IsolatedDevModeMain.restartCallback(IsolatedDevModeMain.java:214)
at io.quarkus.deployment.dev.RuntimeUpdatesProcessor.doScan(RuntimeUpdatesProcessor.java:522)
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:249)
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:104)
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)
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:103)
... 1 more
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method 'void com.acme.spi.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7
b49ecb1a_ClientProxy.<init>(org.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean)' the class loader io.quarkus.bootstrap.classloading.Q
uarkusClassLoader @73843e83 of the current class, org/acme/ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean, and the class loader io.quarkus
.bootstrap.classloading.QuarkusClassLoader @4461c7e3 for the method's defining class, com/acme/spi/ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb
1a_ClientProxy, have different Class objects for the type org/acme/ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean used in the signature (o
rg.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader
@73843e83, parent loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @4461c7e3; com.acme.spi.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b4
9ecb1a_ClientProxy is in unnamed module of loader io.quarkus.bootstrap.classloading.QuarkusClassLoader @4461c7e3, parent loader 'app')
at org.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean.proxy(Unknown Source)
at org.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean.get(Unknown Source)
at org.acme.ConfigurationProducer_ProducerMethod_configure_583a1d0f9a47125f3f16fd0e1923dbf7b49ecb1a_Bean.get(Unknown Source)
at org.acme.ConfigurationValidator_Bean.create(Unknown Source)
at org.acme.ConfigurationValidator_Bean.create(Unknown Source)
at io.quarkus.arc.impl.AbstractSharedContext.createInstanceHandle(AbstractSharedContext.java:101)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:29)
at io.quarkus.arc.impl.AbstractSharedContext$1.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.LazyValue.get(LazyValue.java:26)
at io.quarkus.arc.impl.ComputingCache.computeIfAbsent(ComputingCache.java:69)
at io.quarkus.arc.impl.AbstractSharedContext.get(AbstractSharedContext.java:26)
at io.quarkus.arc.impl.ClientProxies.getApplicationScopedDelegate(ClientProxies.java:18)
at org.acme.ConfigurationValidator_ClientProxy.arc$delegate(Unknown Source)
at org.acme.ConfigurationValidator_ClientProxy.arc_contextualInstance(Unknown Source)
at org.acme.ConfigurationValidator_Observer_Synthetic_d70cd75bf32ab6598217b9a64a8473d65e248c05.notify(Unknown Source)
at io.quarkus.arc.impl.EventImpl$Notifier.notifyObservers(EventImpl.java:320)
at io.quarkus.arc.impl.EventImpl$Notifier.notify(EventImpl.java:302)
at io.quarkus.arc.impl.EventImpl.fire(EventImpl.java:73)
at io.quarkus.arc.runtime.ArcRecorder.fireLifecycleEvent(ArcRecorder.java:128)
at io.quarkus.arc.runtime.ArcRecorder.handleLifecycleEvents(ArcRecorder.java:97)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy_0(Unknown Source)
at io.quarkus.deployment.steps.LifecycleEventsBuildStep$startupEvent1144526294.deploy(Unknown Source)
... 13 more
2022-01-25 09:30:48,243 INFO [io.qua.dep.dev.RuntimeUpdatesProcessor] (Aesh InputStream Reader) Live reload total time: 1.817s
```
### How to Reproduce?
1. Download the reproducer:
[hot-reload-reproducer-spi.zip](https://github.com/quarkusio/quarkus/files/7931939/hot-reload-reproducer-spi.zip)
2. cd spi
3. mvn clean install
4. cd ../hot-reload-producer
5. mvn clean compile quarkus:dev
6. press s for a force restart
7. exception form above happens. The same exception happens on a normal hot reload as well.
8. downgrade to 2.6.3.Final, and start again
9. No exception on force restart
### Output of `uname -a` or `ver`
MSYS_NT-10.0-19043 NANB7NLNVP2 3.1.7-340.x86_64 2021-03-26 22:17 UTC x86_64 Msys
### Output of `java -version`
openjdk 17 2021-09-14 OpenJDK Runtime Environment Temurin-17+35 (build 17+35) OpenJDK 64-Bit Server VM Temurin-17+35 (build 17+35, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.7.0.CR1
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739) Maven home: C:\\eclipse\\tools\\apache-maven Java version: 17, vendor: Eclipse Adoptium, runtime: C:\\eclipse\\tools\\java\\17 Default locale: de_DE, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
### Additional information
_No response_ | 70074316e385e2f3c07c8058e376b76e007fbed2 | 903202f1fac88ce7e1f21dd25b6acc2b92b38750 | https://github.com/quarkusio/quarkus/compare/70074316e385e2f3c07c8058e376b76e007fbed2...903202f1fac88ce7e1f21dd25b6acc2b92b38750 | diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/ProducerReturnTypePackagePrivateNoArgsConstructorTest.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/ProducerReturnTypePackagePrivateNoArgsConstructorTest.java
deleted file mode 100644
index 4ebf0abe4de..00000000000
--- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/ProducerReturnTypePackagePrivateNoArgsConstructorTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package io.quarkus.arc.test.unproxyable;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import java.io.IOException;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Instance;
-import javax.enterprise.inject.Produces;
-import javax.inject.Inject;
-import javax.inject.Singleton;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-import io.quarkus.arc.test.unproxyable.some.Resource;
-import io.quarkus.test.QuarkusUnitTest;
-
-// This test aims to test the https://github.com/quarkusio/quarkus/issues/22815 in Quarkus integration
-// There is a duplicate test for ArC standalone: io.quarkus.arc.test.clientproxy.constructor.ProducerReturnTypePackagePrivateNoArgsConstructorTest
-public class ProducerReturnTypePackagePrivateNoArgsConstructorTest {
-
- @RegisterExtension
- static final QuarkusUnitTest config = new QuarkusUnitTest()
- .withApplicationRoot(root -> root
- .addClasses(ProducerReturnTypePackagePrivateNoArgsConstructorTest.class, ResourceProducer.class,
- Resource.class));
-
- @Inject
- Instance<Resource> instance;
-
- @Test
- public void testProducer() throws IOException {
- assertTrue(instance.isResolvable());
- assertEquals(5, instance.get().ping());
- }
-
- @Singleton
- static class ResourceProducer {
-
- @ApplicationScoped
- @Produces
- Resource resource() {
- return Resource.from(5);
- }
-
- }
-
-}
diff --git a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/some/Resource.java b/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/some/Resource.java
deleted file mode 100644
index de4455f18f6..00000000000
--- a/extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/some/Resource.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package io.quarkus.arc.test.unproxyable.some;
-
-public abstract class Resource {
-
- Resource() {
- }
-
- public static Resource from(int ping) {
- return new Resource() {
-
- @Override
- public int ping() {
- return ping;
- }
- };
- }
-
- public abstract int ping();
-
-}
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
index 786837e2c0b..8c34ecf0969 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java
@@ -895,7 +895,7 @@ private List<BeanInfo> findBeans(Collection<DotName> beanDefiningAnnotations, Li
// non-inherited stuff:
for (MethodInfo method : beanClass.methods()) {
- if (method.isSynthetic()) {
+ if (Methods.isSynthetic(method)) {
continue;
}
if (annotationStore.getAnnotations(method).isEmpty()) {
@@ -922,7 +922,7 @@ private List<BeanInfo> findBeans(Collection<DotName> beanDefiningAnnotations, Li
while (aClass != null) {
for (MethodInfo method : aClass.methods()) {
Methods.MethodKey methodDescriptor = new Methods.MethodKey(method);
- if (method.isSynthetic() || Methods.isOverriden(methodDescriptor, methods)) {
+ if (Methods.isSynthetic(method) || Methods.isOverriden(methodDescriptor, methods)) {
continue;
}
methods.add(methodDescriptor);
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java
index 8c012e64800..678eb0f7018 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.java
@@ -1793,7 +1793,7 @@ protected void implementIsSuppressed(BeanInfo bean, ClassCreator beanCreator) {
private String getProxyTypeName(BeanInfo bean, String baseName) {
StringBuilder proxyTypeName = new StringBuilder();
- proxyTypeName.append(bean.getClientProxyPackageName());
+ proxyTypeName.append(bean.getTargetPackageName());
if (proxyTypeName.length() > 0) {
proxyTypeName.append(".");
}
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 d9f1bc15ca8..98a89c8cacc 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
@@ -492,22 +492,6 @@ public String getTargetPackageName() {
return packageName;
}
- public String getClientProxyPackageName() {
- if (isProducerField() || isProducerMethod()) {
- AnnotationTarget target = getTarget().get();
- DotName typeName = target.kind() == Kind.FIELD ? target.asField().type().name()
- : target.asMethod().returnType().name();
- String packageName = DotNames.packageName(typeName);
- if (packageName.startsWith("java.")) {
- // It is not possible to place a class in a JDK package
- packageName = AbstractGenerator.DEFAULT_PACKAGE;
- }
- return packageName;
- } else {
- return getTargetPackageName();
- }
- }
-
void validate(List<Throwable> errors, List<BeanDeploymentValidator> validators,
Consumer<BytecodeTransformer> bytecodeTransformerConsumer, Set<DotName> classesReceivingNoArgsCtor) {
Beans.validateBean(this, errors, validators, bytecodeTransformerConsumer, classesReceivingNoArgsCtor);
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 3e8ebe33560..62a7320b42b 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
@@ -78,22 +78,13 @@ public ClientProxyGenerator(Predicate<DotName> applicationClassPredicate, boolea
Collection<Resource> generate(BeanInfo bean, String beanClassName,
Consumer<BytecodeTransformer> bytecodeTransformerConsumer, boolean transformUnproxyableClasses) {
- DotName testedName;
- // For producers we need to test the produced type
- if (bean.isProducerField()) {
- testedName = bean.getTarget().get().asField().type().name();
- } else if (bean.isProducerMethod()) {
- testedName = bean.getTarget().get().asMethod().returnType().name();
- } else {
- testedName = bean.getBeanClass();
- }
- ResourceClassOutput classOutput = new ResourceClassOutput(applicationClassPredicate.test(testedName),
+ ResourceClassOutput classOutput = new ResourceClassOutput(applicationClassPredicate.test(bean.getBeanClass()),
generateSources);
ProviderType providerType = new ProviderType(bean.getProviderType());
ClassInfo providerClass = getClassByName(bean.getDeployment().getBeanArchiveIndex(), providerType.name());
String baseName = getBaseName(bean, beanClassName);
- String targetPackage = bean.getClientProxyPackageName();
+ String targetPackage = bean.getTargetPackageName();
String generatedName = generatedNameFromTarget(targetPackage, baseName, CLIENT_PROXY_SUFFIX);
if (existingClasses.contains(generatedName)) {
return Collections.emptyList();
diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java
index e43012e89b1..f2e4453b343 100644
--- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java
+++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java
@@ -42,9 +42,10 @@ final class Methods {
public static final String INIT = "<init>";
// static initializer
public static final String CLINIT = "<clinit>";
+ // copied from java.lang.reflect.Modifier.SYNTHETIC
+ static final int SYNTHETIC = 0x00001000;
// copied from java.lang.reflect.Modifier.BRIDGE
static final int BRIDGE = 0x00000040;
-
public static final String TO_STRING = "toString";
private static final List<String> IGNORED_METHODS = initIgnoredMethods();
@@ -59,6 +60,10 @@ private static List<String> initIgnoredMethods() {
private Methods() {
}
+ static boolean isSynthetic(MethodInfo method) {
+ return (method.flags() & SYNTHETIC) != 0;
+ }
+
static boolean isBridge(MethodInfo method) {
return (method.flags() & BRIDGE) != 0;
}
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ProducerReturnTypePackagePrivateNoArgsConstructorTest.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ProducerReturnTypePackagePrivateNoArgsConstructorTest.java
deleted file mode 100644
index 8fa51503cc2..00000000000
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ProducerReturnTypePackagePrivateNoArgsConstructorTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package io.quarkus.arc.test.clientproxy.constructor;
-
-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.ClientProxy;
-import io.quarkus.arc.test.ArcTestContainer;
-import io.quarkus.arc.test.clientproxy.constructor.some.Resource;
-import java.io.IOException;
-import javax.enterprise.context.ApplicationScoped;
-import javax.enterprise.inject.Produces;
-import javax.inject.Singleton;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.RegisterExtension;
-
-// This test aims to test the https://github.com/quarkusio/quarkus/issues/22815 in ArC standalone
-// There is a duplicate test for Quarkus integration: io.quarkus.arc.test.unproxyable.ProducerReturnTypePackagePrivateNoArgsConstructorTest
-public class ProducerReturnTypePackagePrivateNoArgsConstructorTest {
-
- @RegisterExtension
- public ArcTestContainer container = new ArcTestContainer(ResourceProducer.class);
-
- @Test
- public void testProducer() throws IOException {
- Resource res = Arc.container().instance(Resource.class).get();
- assertNotNull(res);
- assertTrue(res instanceof ClientProxy);
- assertEquals(5, res.ping());
- }
-
- @Singleton
- static class ResourceProducer {
-
- @ApplicationScoped
- @Produces
- Resource resource() {
- return Resource.from(5);
- }
-
- }
-
-}
diff --git a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/some/Resource.java b/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/some/Resource.java
deleted file mode 100644
index e45ce995299..00000000000
--- a/independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/some/Resource.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package io.quarkus.arc.test.clientproxy.constructor.some;
-
-public abstract class Resource {
-
- Resource() {
- }
-
- public static Resource from(int ping) {
- return new Resource() {
-
- @Override
- public int ping() {
- return ping;
- }
- };
- }
-
- public abstract int ping();
-
-} | ['independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanDeployment.java', 'extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/some/Resource.java', 'independent-projects/arc/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/some/Resource.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/BeanGenerator.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/tests/src/test/java/io/quarkus/arc/test/clientproxy/constructor/ProducerReturnTypePackagePrivateNoArgsConstructorTest.java', 'independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Methods.java', 'extensions/arc/deployment/src/test/java/io/quarkus/arc/test/unproxyable/ProducerReturnTypePackagePrivateNoArgsConstructorTest.java'] | {'.java': 9} | 9 | 9 | 0 | 0 | 9 | 19,612,500 | 3,798,435 | 499,529 | 4,823 | 2,109 | 406 | 42 | 5 | 13,747 | 733 | 3,725 | 185 | 1 | 1 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,518 | quarkusio/quarkus/23178/23113 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23113 | https://github.com/quarkusio/quarkus/pull/23178 | https://github.com/quarkusio/quarkus/pull/23178 | 1 | fixes | Native build with quarkus-jdbc-oracle + quarkus-jdbc-db2 extension dependencies fails | ### Describe the bug
Usage of the JDBC Driver extension for Oracle is causing the native build to fail when used together with the JDBC Driver extension for DB2 as following:
```
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM 21.3.0 Java 17 CE (Java Version 17.0.1+12-jvmci-21.3-b05)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] /mnt/c/Develop/graalvm-17-linux/bin/native-image -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-DQuarkusWithJcc=true -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country= -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:NativeLinkerOption=-no-pie -H:-UseServiceLoaderFeature -H:+StackTrace -J--add-exports=java.base/sun.security.action=ALL-UNNAMED --exclude-config .*com\\.oracle\\.database\\.jdbc.* /META-INF/native-image/(?:native-image\\.properties|reflect-config\\.json) -J--add-exports=java.management/sun.management=ALL-UNNAMED code-with-quarkus-1.0.0-SNAPSHOT-runner -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269] classlist: 5,771.23 ms, 0.94 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269] (cap): 4,138.60 ms, 0.93 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269] setup: 8,837.75 ms, 0.94 GB
The bundle named: com/sun/rowset/RowSetResourceBundle, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
00:45:15,392 INFO [org.jbo.threads] JBoss Threads version 3.4.2.Final
To see how the classes got initialized, use --trace-class-initialization=oracle.jdbc.driver.OracleDriver,oracle.jdbc.OracleDriver
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269] analysis: 56,966.08 ms, 5.26 GB
Error: Classes that should be initialized at run time got initialized during image building:
oracle.jdbc.driver.OracleDriver the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'OracleDriver.class'). To see why oracle.jdbc.driver.OracleDriver got initialized use --trace-class-initialization=oracle.jdbc.driver.OracleDriver
oracle.jdbc.OracleDriver the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'OracleDriver.class' and subtype of oracle.jdbc.driver.OracleDriver). To see why oracle.jdbc.OracleDriver got initialized use --trace-class-initialization=oracle.jdbc.OracleDriver
com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
oracle.jdbc.driver.OracleDriver the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'OracleDriver.class'). To see why oracle.jdbc.driver.OracleDriver got initialized use --trace-class-initialization=oracle.jdbc.driver.OracleDriver
oracle.jdbc.OracleDriver the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis with 'OracleDriver.class' and subtype of oracle.jdbc.driver.OracleDriver). To see why oracle.jdbc.OracleDriver got initialized use --trace-class-initialization=oracle.jdbc.OracleDriver
at com.oracle.svm.core.util.UserError.abort(UserError.java:73)
at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:555)
at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:168)
at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$12(NativeImageGenerator.java:727)
at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:73)
at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:727)
at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:529)
at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
[code-with-quarkus-1.0.0-SNAPSHOT-runner:1269] [total]: 72,514.57 ms, 5.26 GB
# Printing build artifacts to: /mnt/c/Develop/workspace/code-with-quarkus/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner.build_artifacts.txt
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:00 min
[INFO] Finished at: 2022-01-23T00:45:51+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.6.3.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: java.lang.RuntimeException: Failed to build native image
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:250)
[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$2.execute(ExtensionLoader.java:887)
[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] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:386)
[ERROR] at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:229)
[ERROR] ... 11 more
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
```
### Expected behavior
I expect to be able to build natively using both extensions by the same application.
### Actual behavior
The native build is failing.
### How to Reproduce?
- Clone https://github.com/bvahdat/code-with-quarkus2
- Run `./mvnw package -Pnative`
### Output of `uname -a` or `ver`
Linux XYZ 4.4.0-18362-Microsoft #1801-Microsoft Sat Sep 11 15:28:00 PST 2021 x86_64 x86_64 x86_64 GNU/Linux
### Output of `java -version`
openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)
### GraalVM version (if different from Java)
_No response_
### Quarkus version or git rev
2.6.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
### Additional information
_No response_ | fedc0698d0ae0a1de62354a7f649eb0077346ead | 66cd29ef9af47263dad98958e368a33b03f5da1e | https://github.com/quarkusio/quarkus/compare/fedc0698d0ae0a1de62354a7f649eb0077346ead...66cd29ef9af47263dad98958e368a33b03f5da1e | 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 4717048d953..87376ec0425 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
@@ -67,8 +67,12 @@ void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
@BuildStep
void runtimeInitializeDriver(BuildProducer<RuntimeInitializedClassBuildItem> runtimeInitialized) {
//These re-implement all the "--initialize-at-build-time" arguments found in the native-image.properties :
- runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.OracleDriver"));
- runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.driver.OracleDriver"));
+
+ // Override: the original metadata marks the drivers as "runtime initialized" but this makes it incompatible with
+ // other systems (e.g. DB2 drivers) as it makes them incompatible with the JDK DriverManager integrations:
+ // the DriverManager will typically (and most likely) need to load all drivers in a different phase.
+ // runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.OracleDriver"));
+ // runtimeInitialized.produce(new RuntimeInitializedClassBuildItem("oracle.jdbc.driver.OracleDriver"));
// The Oracle driver's metadata hints to require java.sql.DriverManager to be initialized at runtime, but:
// A) I disagree with the fact that a driver makes changes outside of its scope (java.sql in this case) | ['extensions/jdbc/jdbc-oracle/deployment/src/main/java/io/quarkus/jdbc/oracle/deployment/OracleMetadataOverrides.java'] | {'.java': 1} | 1 | 1 | 0 | 0 | 1 | 19,613,450 | 3,798,734 | 499,475 | 4,823 | 782 | 144 | 8 | 1 | 9,213 | 627 | 2,378 | 106 | 2 | 1 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,519 | quarkusio/quarkus/23160/23055 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23055 | https://github.com/quarkusio/quarkus/pull/23160 | https://github.com/quarkusio/quarkus/pull/23160 | 1 | fixes | Resource method String param annotated with @RestForm not decoded automatically | ### Describe the bug
It seems that a String resource method param annotated with `@RestForm` is not decoded automatically. AFAIK the spec version of this annotation, i.e. `@FormParam` is decoded unless used together with `@Encoded`.
### 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_ | a78f749866954756bcbdb8b6895aedd29786d452 | 41f2d2092d7f3a8e238554e65dd74bd7b15539f2 | https://github.com/quarkusio/quarkus/compare/a78f749866954756bcbdb8b6895aedd29786d452...41f2d2092d7f3a8e238554e65dd74bd7b15539f2 | diff --git a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/form/FormParamTest.java b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/form/FormParamTest.java
index 935c5524811..15537bae367 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/form/FormParamTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/form/FormParamTest.java
@@ -32,15 +32,15 @@ public class FormParamTest {
@Test
void shouldPassFormParam() {
FormClient formClient = RestClientBuilder.newBuilder().baseUri(baseUri).build(FormClient.class);
- String result = formClient.directForm("par1", "par2");
- assertThat(result).isEqualTo("root formParam1:par1,formParam2:par2");
+ String result = formClient.directForm("par1", "par 2");
+ assertThat(result).isEqualTo("root formParam1:par1,formParam2:par 2");
}
@Test
void shouldPassFormParamFromSubResource() {
FormClient formClient = RestClientBuilder.newBuilder().baseUri(baseUri).build(FormClient.class);
- String result = formClient.subForm("par1", "par2").form("spar1", "spar2");
- assertThat(result).isEqualTo("sub rootParam1:par1,rootParam2:par2,subParam1:spar1,subParam2:spar2");
+ String result = formClient.subForm("par1", "par 2").form("spar1", "spar 2");
+ assertThat(result).isEqualTo("sub rootParam1:par1,rootParam2:par 2,subParam1:spar1,subParam2:spar 2");
}
public interface FormClient {
diff --git a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/URLUtils.java b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/URLUtils.java
index 147ed710da7..853aec49f10 100644
--- a/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/URLUtils.java
+++ b/independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/URLUtils.java
@@ -99,35 +99,13 @@ public static String decode(String s, Charset enc, boolean decodeSlash, boolean
if (buffer != null) {
buffer.setLength(0);
}
- boolean needToChange = false;
int numChars = s.length();
int i = 0;
while (i < numChars) {
char c = s.charAt(i);
- if (c == '+') {
- if (formEncoding) {
- if (!needToChange) {
- if (buffer == null) {
- buffer = new StringBuilder();
- }
- buffer.append(s, 0, i);
- }
- buffer.append(' ');
- i++;
- } else {
- i++;
- if (needToChange) {
- buffer.append(c);
- }
- }
- } else if (c == '%' || c > 127) {
- if (!needToChange) {
- if (buffer == null) {
- buffer = new StringBuilder();
- }
- buffer.append(s, 0, i);
- needToChange = true;
- }
+ if (c == '%' || c > 127 || c == '+') {
+ buffer = new StringBuilder();
+ buffer.append(s, 0, i);
/*
* Starting with this instance of a character
* that needs to be encoded, process all
@@ -232,16 +210,16 @@ public static String decode(String s, Charset enc, boolean decodeSlash, boolean
String decoded = new String(bytes, 0, pos, enc);
buffer.append(decoded);
+ return buffer.toString();
} catch (NumberFormatException e) {
throw failedToDecodeURL(s, enc, e);
}
- break;
} else {
i++;
}
}
- return (needToChange ? buffer.toString() : s);
+ return s;
}
private static RuntimeException failedToDecodeURL(String s, Charset enc, Throwable o) { | ['independent-projects/resteasy-reactive/common/runtime/src/main/java/org/jboss/resteasy/reactive/common/util/URLUtils.java', 'extensions/resteasy-reactive/rest-client-reactive/deployment/src/test/java/io/quarkus/rest/client/reactive/form/FormParamTest.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,608,573 | 3,797,837 | 499,398 | 4,823 | 1,194 | 207 | 32 | 1 | 679 | 102 | 160 | 39 | 0 | 0 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,521 | quarkusio/quarkus/23123/23110 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23110 | https://github.com/quarkusio/quarkus/pull/23123 | https://github.com/quarkusio/quarkus/pull/23123 | 1 | fixes | quarkus-resteasy-reactive PathMatcher allows any extra character in the end of valid path | ### Describe the bug
when using **quarkus-resteasy-reactive**, appending any extra character in the end of a valid path doesn't result in 404 but instead gets to the existing valid route
making simple `@Path("hello")` resource, will return a response when calling /hello, but also /helloX (X = any character) and /helloX/, while the invalid paths should result in 404
appending more than 1 character results in a valid behaviour and returns 404
seems that the `PathMatcher` treats the last character as if it was a trailing slash since in some places in the code only the length of the remaining path part is checked (I suppose for performance reasons?)
**quarkus-resteasy** PathMatcher does behave as expected
### Expected behavior
`/hello` should return a response
`/helloX` and `/helloX/` should return 404 (X == any character)
### Actual behavior
`/hello` should return a response
`/helloX` and `/helloX/` return same response as `/hello`
### How to Reproduce?
create a starter quarkus project with quarkus-resteasy-reactive extension
add a simple hello resource
(kotlin version)
```
@Path("hello")
class HelloResource {
@GET
@Produces(MediaType.TEXT_PLAIN)
fun hello() : String {
return "Hello"
}
}
```
### Output of `uname -a` or `ver`
Darwin MacBook-Pro.local 20.6.0 Darwin Kernel Version 20.6.0; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64
### Output of `java -version`
openjdk version "16.0.2" 2021-07-20; OpenJDK Runtime Environment Corretto-16.0.2.7.1 (build 16.0.2+7)
### GraalVM version (if different from Java)
-
### Quarkus version or git rev
2.6.3.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
Gradle 6.9
### Additional information
_No response_ | 5d51dfe58c802953790b76056ce160acfd745673 | bf677b08faacad5aae8963a1a224aeb4907c1bc5 | https://github.com/quarkusio/quarkus/compare/5d51dfe58c802953790b76056ce160acfd745673...bf677b08faacad5aae8963a1a224aeb4907c1bc5 | 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 b2baf6c67dc..62b9c71d3f7 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
@@ -104,11 +104,13 @@ public RequestMatch<T> map(String path) {
params[paramCount] = null;
}
boolean fullMatch = matchPos == pathLength;
- if (!prefixAllowed && !fullMatch) {
+ boolean doPrefixMatch = false;
+ if (!fullMatch) {
//according to the spec every template ends with (/.*)?
- prefixAllowed = path.charAt(matchPos) == '/' && matchPos == pathLength - 1;
+ doPrefixMatch = (matchPos == 1 || path.charAt(matchPos) == '/') //matchPos == 1 corresponds to '/' as a root level match
+ && (prefixAllowed || matchPos == pathLength - 1); //if prefix is allowed, or the remainder is only a trailing /
}
- if (matched && (fullMatch || prefixAllowed)) {
+ if (matched && (fullMatch || doPrefixMatch)) {
String remaining;
if (fullMatch) {
remaining = "";
diff --git a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/path/RestPathTestCase.java b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/path/RestPathTestCase.java
index 4cbf79afa1f..e7261aeac94 100644
--- a/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/path/RestPathTestCase.java
+++ b/independent-projects/resteasy-reactive/server/vertx/src/test/java/org/jboss/resteasy/reactive/server/vertx/test/path/RestPathTestCase.java
@@ -24,8 +24,9 @@ public void accept(ResteasyReactiveDeploymentManager.ScanStep scanStep) {
@Test
public void testRestPath() {
RestAssured.basePath = "/";
- RestAssured.when().get("/foo/hello").then().statusCode(200).body(Matchers.is("hello"));
RestAssured.when().get("/foo/hello/nested").then().statusCode(200).body(Matchers.is("world hello"));
+ RestAssured.when().get("/foo/helloX").then().statusCode(404);
+ RestAssured.when().get("/foo/hello").then().statusCode(200).body(Matchers.is("hello"));
}
@Test | ['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/path/RestPathTestCase.java'] | {'.java': 2} | 2 | 2 | 0 | 0 | 2 | 19,616,012 | 3,799,084 | 499,616 | 4,823 | 611 | 137 | 8 | 1 | 1,757 | 248 | 476 | 59 | 0 | 1 | 1970-01-01T00:27:23 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,523 | quarkusio/quarkus/23040/23011 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/23011 | https://github.com/quarkusio/quarkus/pull/23040 | https://github.com/quarkusio/quarkus/pull/23040 | 1 | fix | Warnings about MetricCollectingClientInterceptor and MetricCollectingServerInterceptor when using grpc and micrometer | ### Describe the bug
Warnings about `MetricCollectingClientInterceptor` and `MetricCollectingServerInterceptor` when using grpc and micrometer
Warnings:
- At least one unused gRPC client interceptor found: io.micrometer.core.instrument.binder.grpc.MetricCollectingClientInterceptor. If there are meant to be used globally, annotate them with @GlobalInterceptor.
- At least one unused gRPC interceptor found: io.micrometer.core.instrument.binder.grpc.MetricCollectingServerInterceptor. If there are meant to be used globally, annotate them with @GlobalInterceptor.
These warnings should be fixed or at least silenced using `LogCleanupFilterBuildItem`
```
[INFO] --- quarkus-maven-plugin:2.6.2.Final:build (default) @ code-with-quarkus ---
[INFO] [org.jboss.threads] JBoss Threads version 3.4.2.Final
[WARNING] [io.quarkus.grpc.deployment.GrpcClientProcessor] At least one unused gRPC client interceptor found: io.micrometer.core.instrument.binder.grpc.MetricCollectingClientInterceptor. If there are meant to be used globally, annotate them with @GlobalInterceptor.
[WARNING] [io.quarkus.grpc.deployment.GrpcServerProcessor] At least one unused gRPC interceptor found: io.micrometer.core.instrument.binder.grpc.MetricCollectingServerInterceptor. If there are meant to be used globally, annotate them with @GlobalInterceptor.
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 921ms
```
### Expected behavior
No warnings
### Actual behavior
Warnings
```
[INFO] --- quarkus-maven-plugin:2.6.2.Final:build (default) @ code-with-quarkus ---
[INFO] [org.jboss.threads] JBoss Threads version 3.4.2.Final
[WARNING] [io.quarkus.grpc.deployment.GrpcClientProcessor] At least one unused gRPC client interceptor found: io.micrometer.core.instrument.binder.grpc.MetricCollectingClientInterceptor. If there are meant to be used globally, annotate them with @GlobalInterceptor.
[WARNING] [io.quarkus.grpc.deployment.GrpcServerProcessor] At least one unused gRPC interceptor found: io.micrometer.core.instrument.binder.grpc.MetricCollectingServerInterceptor. If there are meant to be used globally, annotate them with @GlobalInterceptor.
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 921ms
```
### How to Reproduce?
- select `Micrometer` and `gRPC` on https://code.quarkus.io/
- download the app
- run `mvn clean package`
### 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.6.2.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | ad516dc3ead0e8efcda412068201eb0011a47807 | ef6d5f2821d94b27e721e247ef2e4b72f9e7c6cd | https://github.com/quarkusio/quarkus/compare/ad516dc3ead0e8efcda412068201eb0011a47807...ef6d5f2821d94b27e721e247ef2e4b72f9e7c6cd | diff --git a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientProcessor.java b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientProcessor.java
index 54953a2aea2..862779c9b4a 100644
--- a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientProcessor.java
+++ b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientProcessor.java
@@ -5,6 +5,7 @@
import static io.quarkus.grpc.deployment.GrpcDotNames.CONFIGURE_STUB;
import static io.quarkus.grpc.deployment.GrpcDotNames.CREATE_CHANNEL_METHOD;
import static io.quarkus.grpc.deployment.GrpcDotNames.RETRIEVE_CHANNEL_METHOD;
+import static io.quarkus.grpc.deployment.GrpcInterceptors.MICROMETER_INTERCEPTORS;
import static io.quarkus.grpc.deployment.ResourceRegistrationUtils.registerResourcesForProperties;
import java.util.ArrayList;
@@ -359,6 +360,11 @@ SyntheticBeanBuildItem clientInterceptorStorage(GrpcClientRecorder recorder, Rec
// The rest, if anything stays, should be logged as problematic
Set<String> superfluousInterceptors = new HashSet<>(interceptors.nonGlobalInterceptors);
+ // Remove the metrics interceptors
+ for (String MICROMETER_INTERCEPTOR : MICROMETER_INTERCEPTORS) {
+ superfluousInterceptors.remove(MICROMETER_INTERCEPTOR);
+ }
+
List<AnnotationInstance> found = new ArrayList<>(index.getAnnotations(GrpcDotNames.REGISTER_CLIENT_INTERCEPTOR));
for (AnnotationInstance annotation : index.getAnnotations(GrpcDotNames.REGISTER_CLIENT_INTERCEPTOR_LIST)) {
for (AnnotationInstance nested : annotation.value().asNestedArray()) {
diff --git a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcInterceptors.java b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcInterceptors.java
index 0e154ea4394..0722cf9d445 100644
--- a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcInterceptors.java
+++ b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcInterceptors.java
@@ -5,6 +5,7 @@
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.jboss.jandex.ClassInfo;
@@ -13,6 +14,10 @@
final class GrpcInterceptors {
+ static final List<String> MICROMETER_INTERCEPTORS = List.of(
+ "io.micrometer.core.instrument.binder.grpc.MetricCollectingClientInterceptor",
+ "io.micrometer.core.instrument.binder.grpc.MetricCollectingServerInterceptor");
+
final Set<String> globalInterceptors;
final Set<String> nonGlobalInterceptors;
diff --git a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcServerProcessor.java b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcServerProcessor.java
index 4c0ad8692e3..7b440777f96 100644
--- a/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcServerProcessor.java
+++ b/extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcServerProcessor.java
@@ -4,6 +4,7 @@
import static io.quarkus.grpc.deployment.GrpcDotNames.BLOCKING;
import static io.quarkus.grpc.deployment.GrpcDotNames.NON_BLOCKING;
import static io.quarkus.grpc.deployment.GrpcDotNames.TRANSACTIONAL;
+import static io.quarkus.grpc.deployment.GrpcInterceptors.MICROMETER_INTERCEPTORS;
import static java.util.Arrays.asList;
import java.lang.reflect.Modifier;
@@ -385,6 +386,11 @@ void gatherGrpcInterceptors(BeanArchiveIndexBuildItem indexBuildItem,
// the rest, if anything stays, should be logged as problematic
Set<String> superfluousInterceptors = new HashSet<>(interceptors.nonGlobalInterceptors);
+ // Remove the metrics interceptors
+ for (String MICROMETER_INTERCEPTOR : MICROMETER_INTERCEPTORS) {
+ superfluousInterceptors.remove(MICROMETER_INTERCEPTOR);
+ }
+
List<AnnotationInstance> found = new ArrayList<>(index.getAnnotations(GrpcDotNames.REGISTER_INTERCEPTOR));
for (AnnotationInstance annotation : index.getAnnotations(GrpcDotNames.REGISTER_INTERCEPTORS)) {
for (AnnotationInstance nested : annotation.value().asNestedArray()) { | ['extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcInterceptors.java', 'extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcServerProcessor.java', 'extensions/grpc/deployment/src/main/java/io/quarkus/grpc/deployment/GrpcClientProcessor.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 19,586,976 | 3,793,599 | 498,874 | 4,818 | 840 | 187 | 17 | 3 | 2,737 | 282 | 673 | 62 | 1 | 2 | 1970-01-01T00:27:22 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,524 | quarkusio/quarkus/23038/22595 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22595 | https://github.com/quarkusio/quarkus/pull/23038 | https://github.com/quarkusio/quarkus/pull/23038 | 1 | fix | Quarkus doesn’t send X-Ray traces to AWS for sub-segments in Native build while using RESTEasy “controller” based approach | ### Describe the bug
I an using "Controller" based approach using RESTEasy. I have added Quarkus AWS Xray dependency in my POM.xml..
And then we are instrumenting calls to AWS Services using below dependency:
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-xray-recorder-sdk-aws-sdk-v2-instrumentor</artifactId>
<version>2.10.0</version>
</dependency>
Also, we create manual sub-segment for external API calls..
However, Quarkus send sub-segment traces to XRay in the JVM build..
But in Native build, it does not send any sub-segments... also, there is no error thrown. In cloudwatch logs, it says "TRACE_ID missing.
It works for native build in AWS Lambda "Handler" based approach but not in "Controller" based approach in RESTEasy.
Attaching the screenshots of JVM and Native Build below:
### Expected behavior
It should create and show sub-segments in the graph also.
### Actual behavior
It does not show the sub-segments in Native build.
### How to Reproduce?
[https://github.com/amitkumar7566/xray-native-image-test](url)
### Output of `uname -a` or `ver`
_No response_
### Output of `java -version`
java 11
### GraalVM version (if different from Java)
21.3-java11
### Quarkus version or git rev
2.6.1.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
maven
### Additional information
_No response_ | d959a1f1c772622db5933a71d623ebf2b71b8388 | c34afc71358ce289112ede25bdb089a9e52f7805 | https://github.com/quarkusio/quarkus/compare/d959a1f1c772622db5933a71d623ebf2b71b8388...c34afc71358ce289112ede25bdb089a9e52f7805 | diff --git a/extensions/amazon-lambda-xray/runtime/src/main/java/io/quarkus/amazon/lambda/xray/graal/LambdaSegmentContextSubstitution.java b/extensions/amazon-lambda-xray/runtime/src/main/java/io/quarkus/amazon/lambda/xray/graal/LambdaSegmentContextSubstitution.java
deleted file mode 100644
index bd68ad06ee1..00000000000
--- a/extensions/amazon-lambda-xray/runtime/src/main/java/io/quarkus/amazon/lambda/xray/graal/LambdaSegmentContextSubstitution.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package io.quarkus.amazon.lambda.xray.graal;
-
-import com.amazonaws.xray.contexts.LambdaSegmentContext;
-import com.amazonaws.xray.entities.TraceHeader;
-import com.oracle.svm.core.annotate.Substitute;
-import com.oracle.svm.core.annotate.TargetClass;
-
-import io.quarkus.amazon.lambda.runtime.TraceId;
-
-@TargetClass(LambdaSegmentContext.class)
-public final class LambdaSegmentContextSubstitution {
-
- @Substitute
- private static TraceHeader getTraceHeaderFromEnvironment() {
- return TraceHeader.fromString(TraceId.getTraceId());
- }
-
-}
diff --git a/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AbstractLambdaPollLoop.java b/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AbstractLambdaPollLoop.java
index 4bb45bba97e..03d2883bb28 100644
--- a/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AbstractLambdaPollLoop.java
+++ b/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AbstractLambdaPollLoop.java
@@ -25,6 +25,7 @@ public abstract class AbstractLambdaPollLoop {
private final ObjectReader cognitoIdReader;
private final ObjectReader clientCtxReader;
private final LaunchMode launchMode;
+ private static final String LAMBDA_TRACE_HEADER_PROP = "com.amazonaws.xray.traceHeader";
public AbstractLambdaPollLoop(ObjectMapper objectMapper, ObjectReader cognitoIdReader, ObjectReader clientCtxReader,
LaunchMode launchMode) {
@@ -102,7 +103,9 @@ public void run() {
}
}
String traceId = requestConnection.getHeaderField(AmazonLambdaApi.LAMBDA_TRACE_HEADER_KEY);
- TraceId.setTraceId(traceId);
+ if (traceId != null) {
+ System.setProperty(LAMBDA_TRACE_HEADER_PROP, traceId);
+ }
URL url = AmazonLambdaApi.invocationResponse(baseUrl, requestId);
if (isStream()) {
HttpURLConnection responseConnection = responseStream(url);
diff --git a/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/TraceId.java b/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/TraceId.java
deleted file mode 100644
index 60fc529c20b..00000000000
--- a/extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/TraceId.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package io.quarkus.amazon.lambda.runtime;
-
-public class TraceId {
- private static ThreadLocal<String> traceHeader = new ThreadLocal<>();
-
- public static void setTraceId(String id) {
- traceHeader.set(id);
- }
-
- public static String getTraceId() {
- return traceHeader.get();
- }
-
- public static void clearTraceId() {
- traceHeader.set(null);
- }
-} | ['extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AbstractLambdaPollLoop.java', 'extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/TraceId.java', 'extensions/amazon-lambda-xray/runtime/src/main/java/io/quarkus/amazon/lambda/xray/graal/LambdaSegmentContextSubstitution.java'] | {'.java': 3} | 3 | 3 | 0 | 0 | 3 | 19,587,392 | 3,793,699 | 498,897 | 4,820 | 1,300 | 250 | 40 | 3 | 1,448 | 188 | 358 | 62 | 1 | 0 | 1970-01-01T00:27:22 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |
2,527 | quarkusio/quarkus/22942/22862 | quarkusio | quarkus | https://github.com/quarkusio/quarkus/issues/22862 | https://github.com/quarkusio/quarkus/pull/22942 | https://github.com/quarkusio/quarkus/pull/22942 | 1 | resolves | Rest Client exausts Threads. | ### Describe the bug
This is a major issue for us.
I have dozens of services in prod that from time to time they freeze due to thread exhaustion. The vertex event loop stalls.
his can be traced back to unconfigured timeouts on rest clients that hog connections.
We need to go to all rest clients and specify connection and read timeouts on configurations, like:
```
com.td.wfm.common.client.SomeRestClientClass/mp-rest/connectTimeout=500
com.td.wfm.common.client.SomeRestClientClass/mp-rest/readTimeout=1000
```
If you use programatic rest creation you must:
```
return RestClientBuilder.newBuilder()
.baseUri(URI.create(uri))
.connectTimeout(connectionTimeout, TimeUnit.MILLISECONDS)
.readTimeout(readTimeout, TimeUnit.MILLISECONDS)
//...
```
There are many issues related with this. See:
https://github.com/quarkusio/quarkus/issues/15056
https://github.com/quarkusio/quarkus/issues/15383
https://github.com/quarkusio/quarkus/issues/15191
This happens on 1.13.7.Final but I believe 2.* suffers from the same problem.
### Expected behavior
If the REST Client connection is half closed in the other side, it will timeout after a default amount of time.
### Actual behavior
If the REST Client connection is half closed in the other side it will never timeout.
### How to Reproduce?
You need a rest client calling an endpoint in a loop, in different threads. The other side must hold the connection and not reply.
### 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
1.13.7.Final
### Build tool (ie. output of `mvnw --version` or `gradlew --version`)
_No response_
### Additional information
_No response_ | 7813adb7dc24384d3bf9a7224f5e1882c888316e | dfe9cc709ad6c5062b855c04d1e404034ad1a605 | https://github.com/quarkusio/quarkus/compare/7813adb7dc24384d3bf9a7224f5e1882c888316e...dfe9cc709ad6c5062b855c04d1e404034ad1a605 | diff --git a/extensions/resteasy-classic/rest-client-config/runtime/src/main/java/io/quarkus/restclient/config/RestClientsConfig.java b/extensions/resteasy-classic/rest-client-config/runtime/src/main/java/io/quarkus/restclient/config/RestClientsConfig.java
index 10e0d804735..ce58a3a5bf0 100644
--- a/extensions/resteasy-classic/rest-client-config/runtime/src/main/java/io/quarkus/restclient/config/RestClientsConfig.java
+++ b/extensions/resteasy-classic/rest-client-config/runtime/src/main/java/io/quarkus/restclient/config/RestClientsConfig.java
@@ -95,6 +95,20 @@ public class RestClientsConfig {
public RestClientLoggingConfig logging;
+ /**
+ * Global default connect timeout for automatically generated REST Clients. The attribute specifies a timeout
+ * in milliseconds that a client should wait to connect to the remote endpoint.
+ */
+ @ConfigItem(defaultValue = "15000", defaultValueDocumentation = "15000 ms")
+ public Long connectTimeout;
+
+ /**
+ * Global default read timeout for automatically generated REST Clients. The attribute specifies a timeout
+ * in milliseconds that a client should wait for a response from the remote endpoint.
+ */
+ @ConfigItem(defaultValue = "30000", defaultValueDocumentation = "30000 ms")
+ public Long readTimeout;
+
public RestClientConfig getClientConfig(String configKey) {
if (configKey == null) {
return RestClientConfig.EMPTY;
diff --git a/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java b/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java
index 5a00ee54881..4600ff79c6f 100644
--- a/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java
+++ b/extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java
@@ -269,16 +269,16 @@ private Class<?> providerClassForName(String name) {
}
void configureTimeouts(RestClientBuilder builder) {
- Optional<Long> connectTimeout = oneOf(clientConfigByClassName().connectTimeout,
- clientConfigByConfigKey().connectTimeout);
- if (connectTimeout.isPresent()) {
- builder.connectTimeout(connectTimeout.get(), TimeUnit.MILLISECONDS);
+ Long connectTimeout = oneOf(clientConfigByClassName().connectTimeout,
+ clientConfigByConfigKey().connectTimeout).orElse(this.configRoot.connectTimeout);
+ if (connectTimeout != null) {
+ builder.connectTimeout(connectTimeout, TimeUnit.MILLISECONDS);
}
- Optional<Long> readTimeout = oneOf(clientConfigByClassName().readTimeout,
- clientConfigByConfigKey().readTimeout);
- if (readTimeout.isPresent()) {
- builder.readTimeout(readTimeout.get(), TimeUnit.MILLISECONDS);
+ Long readTimeout = oneOf(clientConfigByClassName().readTimeout,
+ clientConfigByConfigKey().readTimeout).orElse(this.configRoot.readTimeout);
+ if (readTimeout != null) {
+ builder.readTimeout(readTimeout, TimeUnit.MILLISECONDS);
}
}
@@ -322,10 +322,13 @@ private RestClientConfig clientConfigByClassName() {
return this.configRoot.getClientConfig(this.proxyType);
}
- private static <T> Optional<T> oneOf(Optional<T> o1, Optional<T> o2) {
- if (o1.isPresent()) {
- return o1;
+ @SafeVarargs
+ private static <T> Optional<T> oneOf(Optional<T>... optionals) {
+ for (Optional<T> o : optionals) {
+ if (o.isPresent()) {
+ return o;
+ }
}
- return o2;
+ return Optional.empty();
}
}
diff --git a/extensions/resteasy-classic/rest-client/runtime/src/test/java/io/quarkus/restclient/runtime/RestClientBaseTest.java b/extensions/resteasy-classic/rest-client/runtime/src/test/java/io/quarkus/restclient/runtime/RestClientBaseTest.java
index b8d330756d2..149560eb383 100644
--- a/extensions/resteasy-classic/rest-client/runtime/src/test/java/io/quarkus/restclient/runtime/RestClientBaseTest.java
+++ b/extensions/resteasy-classic/rest-client/runtime/src/test/java/io/quarkus/restclient/runtime/RestClientBaseTest.java
@@ -99,6 +99,23 @@ public void testQuarkusConfig() throws Exception {
Mockito.verify(restClientBuilderMock).property("resteasy.connectionPoolSize", 103);
}
+ @Test
+ public void testGlobalTimeouts() {
+ RestClientsConfig configRoot = new RestClientsConfig();
+ configRoot.connectTimeout = 5000L;
+ configRoot.readTimeout = 10000L;
+ RestClientBuilder restClientBuilderMock = Mockito.mock(RestClientBuilder.class);
+ RestClientBase restClientBase = new RestClientBase(TestClient.class,
+ "http://localhost:8080",
+ "test-client",
+ null,
+ configRoot);
+ restClientBase.configureTimeouts(restClientBuilderMock);
+
+ Mockito.verify(restClientBuilderMock).connectTimeout(5000, TimeUnit.MILLISECONDS);
+ Mockito.verify(restClientBuilderMock).readTimeout(10000, TimeUnit.MILLISECONDS);
+ }
+
/**
* This method creates a Quarkus style configuration object (which would normally be created based on the MP config
* properties, but it's easier to instantiate it directly here).
diff --git a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java
index 1f3fb2ee0c6..aa3e93ed981 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java
@@ -310,16 +310,16 @@ private Class<?> providerClassForName(String name) {
}
private void configureTimeouts(RestClientBuilder builder) {
- Optional<Long> connectTimeout = oneOf(clientConfigByClassName().connectTimeout,
- clientConfigByConfigKey().connectTimeout);
- if (connectTimeout.isPresent()) {
- builder.connectTimeout(connectTimeout.get(), TimeUnit.MILLISECONDS);
+ Long connectTimeout = oneOf(clientConfigByClassName().connectTimeout,
+ clientConfigByConfigKey().connectTimeout).orElse(this.configRoot.connectTimeout);
+ if (connectTimeout != null) {
+ builder.connectTimeout(connectTimeout, TimeUnit.MILLISECONDS);
}
- Optional<Long> readTimeout = oneOf(clientConfigByClassName().readTimeout,
- clientConfigByConfigKey().readTimeout);
- if (readTimeout.isPresent()) {
- builder.readTimeout(readTimeout.get(), TimeUnit.MILLISECONDS);
+ Long readTimeout = oneOf(clientConfigByClassName().readTimeout,
+ clientConfigByConfigKey().readTimeout).orElse(this.configRoot.readTimeout);
+ if (readTimeout != null) {
+ builder.readTimeout(readTimeout, TimeUnit.MILLISECONDS);
}
}
@@ -359,10 +359,13 @@ private RestClientConfig clientConfigByClassName() {
return this.configRoot.getClientConfig(jaxrsInterface);
}
- private static <T> Optional<T> oneOf(Optional<T> o1, Optional<T> o2) {
- if (o1.isPresent()) {
- return o1;
+ @SafeVarargs
+ private static <T> Optional<T> oneOf(Optional<T>... optionals) {
+ for (Optional<T> o : optionals) {
+ if (o.isPresent()) {
+ return o;
+ }
}
- return o2;
+ return Optional.empty();
}
}
diff --git a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/test/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilderTest.java b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/test/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilderTest.java
index a04647b57dc..c43bb7d913d 100644
--- a/extensions/resteasy-reactive/rest-client-reactive/runtime/src/test/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilderTest.java
+++ b/extensions/resteasy-reactive/rest-client-reactive/runtime/src/test/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilderTest.java
@@ -97,6 +97,22 @@ public void testQuarkusConfig() {
HttpPostRequestEncoder.EncoderMode.HTML5);
}
+ @Test
+ public void testGlobalTimeouts() {
+ RestClientsConfig configRoot = new RestClientsConfig();
+ configRoot.connectTimeout = 5000L;
+ configRoot.readTimeout = 10000L;
+ configRoot.multipartPostEncoderMode = Optional.empty();
+ RestClientBuilderImpl restClientBuilderMock = Mockito.mock(RestClientBuilderImpl.class);
+ new RestClientCDIDelegateBuilder<>(TestClient.class,
+ "http://localhost:8080",
+ "test-client",
+ configRoot).build(restClientBuilderMock);
+
+ Mockito.verify(restClientBuilderMock).connectTimeout(5000, TimeUnit.MILLISECONDS);
+ Mockito.verify(restClientBuilderMock).readTimeout(10000, TimeUnit.MILLISECONDS);
+ }
+
private static RestClientsConfig createSampleConfiguration() {
RestClientConfig clientConfig = new RestClientConfig();
clientConfig.url = Optional.of("http://localhost"); | ['extensions/resteasy-reactive/rest-client-reactive/runtime/src/test/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilderTest.java', 'extensions/resteasy-classic/rest-client/runtime/src/main/java/io/quarkus/restclient/runtime/RestClientBase.java', 'extensions/resteasy-classic/rest-client-config/runtime/src/main/java/io/quarkus/restclient/config/RestClientsConfig.java', 'extensions/resteasy-reactive/rest-client-reactive/runtime/src/main/java/io/quarkus/rest/client/reactive/runtime/RestClientCDIDelegateBuilder.java', 'extensions/resteasy-classic/rest-client/runtime/src/test/java/io/quarkus/restclient/runtime/RestClientBaseTest.java'] | {'.java': 5} | 5 | 5 | 0 | 0 | 5 | 19,414,754 | 3,760,797 | 494,558 | 4,781 | 3,639 | 711 | 68 | 3 | 1,903 | 231 | 420 | 61 | 3 | 2 | 1970-01-01T00:27:22 | 12,047 | Java | {'Java': 45174846, 'HTML': 1260641, 'Kotlin': 726044, 'JavaScript': 519044, 'Shell': 51146, 'Groovy': 25140, 'ANTLR': 23342, 'Batchfile': 13971, 'Mustache': 13199, 'Scala': 9778, 'FreeMarker': 8106, 'CSS': 5346, 'Dockerfile': 660, 'PLpgSQL': 109} | Apache License 2.0 |