Skip to content

SmallRye Config error message suggests strange enum values when a bad value is passed #36847

@ppalaga

Description

@ppalaga

Describe the bug

Originally reported as quarkiverse/quarkus-cxf#1048 by @famod:

I'm getting the following config error when setting a nonexistent factory (by mistake), e.g. -Dquarkus.cxf.http-conduit-factory=foo:

java.lang.RuntimeException: io.smallrye.config.ConfigValidationException: Configuration validation failed:
  java.lang.IllegalArgumentException: SRCFG00039: The config property quarkus.cxf.http-conduit-factory with the config value "foo" threw an Exception whilst being converted SRCFG00049: Cannot convert foo > to enum class io.quarkiverse.cxf.CxfClientConfig$HTTPConduitImpl, allowed values: cxfd-efault,http-client-httpc-onduit-factory,urlc-onnection-httpc-onduit-factory,quarkus-cxfd-efault
...

The "allowed values" look very odd:

cxfd-efault,http-client-httpc-onduit-factory,urlc-onnection-httpc-onduit-factory,quarkus-cxfd-efault

Expected behavior

The expected values are the real values of the enum: QuarkusCXFDefault, CXFDefault, HttpClientHTTPConduitFactory, URLConnectionHTTPConduitFactory

We even set @ConfigDocEnumValue("QuarkusCXFDefault") etc. on the enum:

https://github.com/quarkiverse/quarkus-cxf/blob/16f20f492ee68b6710c170b8b83df492fcc5c3b2/extensions/core/runtime/src/main/java/io/quarkiverse/cxf/CxfClientConfig.java#L327-L335

This names should be honored also in the error message.

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions