Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

smallrye-config: Converter<Int> throws IllegalStateException #29918

Closed
mschorsch opened this issue Dec 16, 2022 · 9 comments · Fixed by #29998
Closed

smallrye-config: Converter<Int> throws IllegalStateException #29918

mschorsch opened this issue Dec 16, 2022 · 9 comments · Fixed by #29998
Assignees
Milestone

Comments

@mschorsch
Copy link
Contributor

mschorsch commented Dec 16, 2022

Describe the bug

Since Quarkus 2.15.0.Final a converter defined as follows leads to a IllegalStateException:

import org.eclipse.microprofile.config.spi.Converter

class MyConverter: Converter<Int> {

    override fun convert(value: String): Int {
       return 1
    }
}

This is because Int is interpreted as an int and not an java.lang.Integer. The exception is thrown in
method validateConverter (io/smallrye/config/smallrye-config-core/2.13.0/smallrye-config-core-2.13.0-sources.jar!/io/smallrye/config/ConfigMappingInterface.java:831).

[ERROR] 	[error]: Build step io.quarkus.arc.deployment.ConfigBuildStep#generateConfigClasses threw an exception: java.lang.IllegalArgumentException
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.validateConverter(ConfigMappingInterface.java:831)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.getPropertyDef(ConfigMappingInterface.java:721)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.getProperties(ConfigMappingInterface.java:699)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.createConfigurationInterface(ConfigMappingInterface.java:656)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.access$000(ConfigMappingInterface.java:28)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:33)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:31)
[ERROR] 	at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228)
[ERROR] 	at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210)
[ERROR] 	at java.base/java.lang.ClassValue.get(ClassValue.java:116)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.getConfigurationInterface(ConfigMappingInterface.java:80)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.getPropertyDef(ConfigMappingInterface.java:764)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.getProperties(ConfigMappingInterface.java:699)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.getProperties(ConfigMappingInterface.java:700)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.getProperties(ConfigMappingInterface.java:700)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.createConfigurationInterface(ConfigMappingInterface.java:656)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.access$000(ConfigMappingInterface.java:28)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:33)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface$1.computeValue(ConfigMappingInterface.java:31)
[ERROR] 	at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228)
[ERROR] 	at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210)
[ERROR] 	at java.base/java.lang.ClassValue.get(ClassValue.java:116)
[ERROR] 	at io.smallrye.config.ConfigMappingInterface.getConfigurationInterface(ConfigMappingInterface.java:80)
[ERROR] 	at io.smallrye.config.ConfigMappingLoader.getConfigMappingsMetadata(ConfigMappingLoader.java:28)
[ERROR] 	at io.quarkus.deployment.configuration.ConfigMappingUtils.processConfigClass(ConfigMappingUtils.java:86)
[ERROR] 	at io.quarkus.deployment.configuration.ConfigMappingUtils.generateConfigClasses(ConfigMappingUtils.java:59)
[ERROR] 	at io.quarkus.arc.deployment.ConfigBuildStep.generateConfigClasses(ConfigBuildStep.java:285)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR] 	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR] 	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java: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:833)
[ERROR] 	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

In addition: The exception should have more information about this failure.

How to Reproduce?

./mvnw clean install

reproducer.zip

Output of java -version

Java 17

Quarkus version or git rev

2.15.0.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Maven

@mschorsch mschorsch added the kind/bug Something isn't working label Dec 16, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Dec 16, 2022

/cc @Ladicek(smallrye), @evanchooly(kotlin), @geoand(kotlin), @jmartisk(smallrye), @phillip-kruger(smallrye), @radcortez(smallrye)

@mschorsch mschorsch changed the title smallrye-config: Convert<Int> throws IllegalStateException smallrye-config: Converter<Int> throws IllegalStateException Dec 16, 2022
@geoand
Copy link
Contributor

geoand commented Dec 16, 2022

I cannot reproduce this, so please attach a sample that exhibits the problem.

@geoand geoand added the triage/needs-reproducer We are waiting for a reproducer. label Dec 16, 2022
@mschorsch
Copy link
Contributor Author

@geoand I added a reproducer to the description.

@geoand
Copy link
Contributor

geoand commented Dec 19, 2022

@radcortez I opened smallrye/smallrye-config#863 to fix this

geoand added a commit to geoand/smallrye-config that referenced this issue Dec 19, 2022
@geoand geoand self-assigned this Dec 19, 2022
geoand added a commit to geoand/smallrye-config that referenced this issue Dec 19, 2022
geoand added a commit to geoand/smallrye-config that referenced this issue Dec 20, 2022
radcortez pushed a commit to smallrye/smallrye-config that referenced this issue Dec 20, 2022
@mschorsch
Copy link
Contributor Author

@geoand Will this be part of 2.15.1.Final?

@geoand
Copy link
Contributor

geoand commented Dec 20, 2022

Nope. Hopefully 2.15.2.Final

geoand added a commit to geoand/quarkus that referenced this issue Dec 21, 2022
geoand added a commit to geoand/quarkus that referenced this issue Dec 21, 2022
gsmet added a commit that referenced this issue Dec 21, 2022
Bump to smallrye-config 2.13.1
@quarkus-bot quarkus-bot bot added this to the 2.16 - main milestone Dec 21, 2022
@gsmet gsmet modified the milestones: 2.16 - main, 2.15.2.Final Jan 3, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 3, 2023
Fixes: quarkusio#29918
(cherry picked from commit ece369f)
@gsmet gsmet modified the milestones: 2.15.2.Final, 2.16 - main Jan 4, 2023
@mschorsch
Copy link
Contributor Author

@gsmet This issue prevents ist from upgrading to 2.15.. Can we backport this issue to 2.15.3.Final?

@gsmet
Copy link
Member

gsmet commented Jan 5, 2023

Yes, @radcortez pointed me to another PR we need to backport together with the one fixing this issue. If no other problem arises, it will be in 2.15.3.Final.

@gsmet gsmet modified the milestones: 2.16 - main, 2.15.3.Final Jan 5, 2023
gsmet pushed a commit to gsmet/quarkus that referenced this issue Jan 5, 2023
Fixes: quarkusio#29918
(cherry picked from commit ece369f)
@mschorsch
Copy link
Contributor Author

Thanks @gsmet

benkard added a commit to benkard/mulkcms2 that referenced this issue Jan 14, 2023
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [io.quarkus:quarkus-maven-plugin](https://github.com/quarkusio/quarkus) | build | patch | `2.15.2.Final` -> `2.15.3.Final` |
| [io.quarkus:quarkus-universe-bom](https://github.com/quarkusio/quarkus-platform) | import | patch | `2.15.2.Final` -> `2.15.3.Final` |

---

### Release Notes

<details>
<summary>quarkusio/quarkus</summary>

### [`v2.15.3.Final`](https://github.com/quarkusio/quarkus/releases/tag/2.15.3.Final)

[Compare Source](quarkusio/quarkus@2.15.2.Final...2.15.3.Final)

##### Complete changelog

-   [#&#8203;30255](quarkusio/quarkus#30255) - Introduce a JSON Stream parser for the reactive rest client
-   [#&#8203;30242](quarkusio/quarkus#30242) - Throw an IllegalStateException with basic info about the provider that failed to provide a resource
-   [#&#8203;30227](quarkusio/quarkus#30227) - SmallRye GraphQL 1.9.1/2.0.1 + config property to control Federation
-   [#&#8203;30218](quarkusio/quarkus#30218) - OIDC documentation fixes
-   [#&#8203;30200](quarkusio/quarkus#30200) - Ensure that Kotlin implementation of QuarkusApplication works properly
-   [#&#8203;30195](quarkusio/quarkus#30195) - Log graphql.execution.AbortExecutionException when it occurs
-   [#&#8203;30190](quarkusio/quarkus#30190) - 2.15.2.Final breaks command mode with main class extends from QuarkusApplication in kotlin
-   [#&#8203;30187](quarkusio/quarkus#30187) - Bump xstream from 1.4.19 to 1.4.20
-   [#&#8203;30183](quarkusio/quarkus#30183) - Fixing typos in security overview doc
-   [#&#8203;30177](quarkusio/quarkus#30177) - Properly handle SSE comments in RESTEasy Reactive client and server code
-   [#&#8203;30172](quarkusio/quarkus#30172) - Codestarts - Fix flattening of log levels
-   [#&#8203;30169](quarkusio/quarkus#30169) - NullPointerException when sending SSE with comment only
-   [#&#8203;30161](quarkusio/quarkus#30161) - Align behavior for getDeferredIdentity and getIdentity in TestIdentityAssociation
-   [#&#8203;30160](quarkusio/quarkus#30160) - Different behavior in TestIdentityAssociation for getDeferredIdentity and getIdentity
-   [#&#8203;30157](quarkusio/quarkus#30157) - Gradle quarkusDev: don't use test classes dir for app classes
-   [#&#8203;30155](quarkusio/quarkus#30155) - Show how to verify smallrye-jwt issuer in a shared network
-   [#&#8203;30154](quarkusio/quarkus#30154) - Remove remaining references to javax classes
-   [#&#8203;30152](quarkusio/quarkus#30152) - Improve error handling of AbortExecutionException in smallrye-graphql extension
-   [#&#8203;30146](quarkusio/quarkus#30146) - Properly segregate Json MessageBodyReader/Writer classes for server and client
-   [#&#8203;30145](quarkusio/quarkus#30145) - GraphQL federation directives, which allow multiple values, do not match Apollo contract
-   [#&#8203;30142](quarkusio/quarkus#30142) - When disabling name and version for label selectod in k8s, don't remove from labels
-   [#&#8203;30138](quarkusio/quarkus#30138) - Keycloak Dev Services
-   [#&#8203;30132](quarkusio/quarkus#30132) - Register REST Client body parameters for reflection
-   [#&#8203;30119](quarkusio/quarkus#30119) - Enable/disable GraphQL Federation automatically (+ add a config property for it)
-   [#&#8203;30100](quarkusio/quarkus#30100) - Setting `add-version-to-label-selectors: false` removes the app.kubernetes.io/version label
-   [#&#8203;30078](quarkusio/quarkus#30078) - Quarkus Kotlin Native Reactive REST Client not working properly
-   [#&#8203;30061](quarkusio/quarkus#30061) - Adding Kotlin Tests Breaks Kotlin/Java project
-   [#&#8203;30044](quarkusio/quarkus#30044) - Resteasy Reactive Rest Client fails to re-construct large chunks of streamed json (stream+json) and fails deserialization
-   [#&#8203;29998](quarkusio/quarkus#29998) - Bump to smallrye-config 2.13.1
-   [#&#8203;29918](quarkusio/quarkus#29918) - smallrye-config: Converter<Int> throws IllegalStateException
-   [#&#8203;29609](quarkusio/quarkus#29609) - Remove Reflection replacements, now supported by GraalVM

</details>

<details>
<summary>quarkusio/quarkus-platform</summary>

### [`v2.15.3.Final`](quarkusio/quarkus-platform@2.15.2.Final...2.15.3.Final)

[Compare Source](quarkusio/quarkus-platform@2.15.2.Final...2.15.3.Final)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
ebullient pushed a commit to maxandersen/quarkus that referenced this issue Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants