[ 
https://issues.apache.org/jira/browse/CAMEL-14631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17541328#comment-17541328
 ] 

Ralf Claussnitzer commented on CAMEL-14631:
-------------------------------------------

So that's indeed a regression. I've updated the ticket accordingly.

I looked  up the current tag on GitHub. The problem seems to remain: 
https://github.com/apache/camel/blob/camel-3.17.0/core/camel-base/src/main/java/org/apache/camel/impl/converter/EnumTypeConverter.java

Also there seems to be no explicit EnumTypeConverter test.

> Support custom type converters for Enums
> ----------------------------------------
>
>                 Key: CAMEL-14631
>                 URL: https://issues.apache.org/jira/browse/CAMEL-14631
>             Project: Camel
>          Issue Type: Bug
>          Components: came-core
>    Affects Versions: 2.20.4, 3.17.0
>            Reporter: Ralf Claussnitzer
>            Priority: Minor
>
> It should be possible to provide a custom TypeConverter for converting 
> strings into an Enum instances.
> The conversion of `String` to `Enum` is hard coded to fail with an Exception 
> if `EnumTypeConverter` cannot instantiate an `Enum` constant by name. 
> However, Java allows to override the string representation for enums. 
> Converting such strings back to enums is only possible through a special 
> converting function.
> Currently `org.apache.camel.impl.converter.EnumTypeConverter` tries to find 
> the Enum instance by name. If that fails it falls backĀ  to calling the 
> built-in valueOf(String) method which will end the program with a 
> RuntimeException. The type conversion process stops there instead of further 
> looking for custom type converters. The line with `return null;` in 
> `EnumTypeConverter` is never reached. Would `EnumTypeConverter` indeed return 
> null, the process would continue and a custom converter would finally be 
> called.
>  * 
> https://mail-archives.apache.org/mod_mbox/camel-dev/202002.mbox/%3Cc87cef78-9709-5b92-efee-9bf0e2c2370d%40slub-dresden.de%3E



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to