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

ConfigProperties - Cannot convert "axe,sword,wand" to type java.util.List #4691

Closed
danielkec opened this issue Aug 9, 2022 · 1 comment
Closed
Assignees
Labels
bug Something isn't working config MP P2

Comments

@danielkec
Copy link
Contributor

Environment Details

  • Helidon Version: 3.0.0
  • Helidon MP
  • JDK version: 17.0.2+8-86
  • OS: Ubuntu

Problem Description

MP Configuration @ConfigProperties doesn't properly convert to List, array works as expected.

Steps to reproduce

@ApplicationScoped
@ConfigProperties(prefix="sorcerer")
public class SorcererProperties {
    public @ConfigProperty(name="orcSlayingPotions") int potions;
    public boolean cloak;
    public List<String> weapons;
}
java.lang.IllegalArgumentException: Failed to convert property "sorcerer.weapons" from its value "axe,sword,wand" to java.util.List
        at io.helidon.config.mp.MpConfigImpl.convert(MpConfigImpl.java:312)
        at io.helidon.config.mp.MpConfigImpl.lambda$optionalValue$7(MpConfigImpl.java:193)
        at java.base/java.util.Optional.map(Optional.java:260)
        at io.helidon.config.mp.MpConfigImpl.optionalValue(MpConfigImpl.java:193)
        at io.helidon.config.mp.MpConfigImpl.getOptionalValue(MpConfigImpl.java:131)
        at io.helidon.config.mp.MpConfigProviderResolver$ConfigDelegate.getOptionalValue(MpConfigProviderResolver.java:356)
        at io.helidon.microprofile.config.FieldSetter.set(FieldSetter.java:61)
        at io.helidon.microprofile.config.ConfigBeanDescriptor.produce(ConfigBeanDescriptor.java:144)
        at io.helidon.microprofile.config.ConfigBeanDescriptor.produce(ConfigBeanDescriptor.java:132)
        at io.helidon.microprofile.config.ConfigCdiExtension.lambda$registerConfigProducer$5(ConfigCdiExtension.java:211)
        at org.jboss.weld.bootstrap.events.configurator.BeanConfiguratorImpl$CreateCallback.create(BeanConfiguratorImpl.java:368)
        at org.jboss.weld.bootstrap.events.configurator.BeanConfiguratorImpl$CreateCallback.access$700(BeanConfiguratorImpl.java:338)
        at org.jboss.weld.bootstrap.events.configurator.BeanConfiguratorImpl$ImmutableBean.create(BeanConfiguratorImpl.java:503)
        at org.jboss.weld.contexts.unbound.DependentContextImpl.get(DependentContextImpl.java:64)
        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:694)
        at org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:794)
        at org.jboss.weld.injection.ParameterInjectionPointImpl.getValueToInject(ParameterInjectionPointImpl.java:76)
        at org.jboss.weld.injection.ConstructorInjectionPoint.getParameterValues(ConstructorInjectionPoint.java:150)
        at org.jboss.weld.injection.ConstructorInjectionPoint.newInstance(ConstructorInjectionPoint.java:75)
        at org.jboss.weld.injection.producer.AbstractInstantiator.newInstance(AbstractInstantiator.java:28)
        at org.jboss.weld.injection.producer.BasicInjectionTarget.produce(BasicInjectionTarget.java:112)
        at org.jboss.weld.injection.producer.BeanInjectionTarget.produce(BeanInjectionTarget.java:186)
        at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:160)
        at org.jboss.weld.contexts.AbstractContext.get(AbstractContext.java:96)
        at org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:100)
        at org.jboss.weld.bean.ContextualInstanceStrategy$ApplicationScopedContextualInstanceStrategy.get(ContextualInstanceStrategy.java:140)
        at org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
        at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:102)
        at org.jboss.weld.bean.proxy.ProxyMethodHandler.getInstance(ProxyMethodHandler.java:131)
        at com.manning.helidoninaction.ch03config.SorcererBean$Proxy$_$$_WeldClientProxy.toJson(Unknown Source)
        at com.manning.helidoninaction.ch03config.SorcererResource.getJsonOrc(SorcererResource.java:36)
        at com.manning.helidoninaction.ch03config.SorcererResource$Proxy$_$$_WeldClientProxy.getJsonOrc(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.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:134)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:177)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:219)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:81)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:475)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:397)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:255)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:234)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:684)
        at io.helidon.webserver.jersey.JerseySupport$JerseyHandler.lambda$doAccept$4(JerseySupport.java:326)
        at io.helidon.common.context.Contexts.runInContext(Contexts.java:117)
        at io.helidon.common.context.ContextAwareExecutorImpl.lambda$wrap$7(ContextAwareExecutorImpl.java:154)
        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.IllegalArgumentException: Cannot convert "axe,sword,wand" to type java.util.List
        at io.helidon.config.mp.MpConfigImpl$FailingConverter.convert(MpConfigImpl.java:546)
        at io.helidon.config.mp.MpConfigImpl.convert(MpConfigImpl.java:305)
        ... 60 more

@m0mus m0mus added bug Something isn't working config MP labels Aug 11, 2022
@m0mus m0mus added the P2 label Aug 11, 2022
@m0mus m0mus assigned trentjeff and unassigned danielkec Sep 22, 2022
trentjeff added a commit to trentjeff/helidon that referenced this issue Oct 3, 2022
trentjeff added a commit that referenced this issue Oct 3, 2022
@trentjeff
Copy link
Member

fixed and merged

@m0mus m0mus added this to Backlog Aug 12, 2024
@m0mus m0mus moved this to Closed in Backlog Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working config MP P2
Projects
Archived in project
Development

No branches or pull requests

3 participants