You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2024/04/25 13:00:00 UTC
[jira] [Updated] (CAMEL-20700) camel-core: ReflectionHelper.setField may fail for numeric type fields
[ https://issues.apache.org/jira/browse/CAMEL-20700?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Claus Ibsen updated CAMEL-20700:
--------------------------------
Fix Version/s: 4.6.0
> camel-core: ReflectionHelper.setField may fail for numeric type fields
> ----------------------------------------------------------------------
>
> Key: CAMEL-20700
> URL: https://issues.apache.org/jira/browse/CAMEL-20700
> Project: Camel
> Issue Type: Bug
> Components: camel-core
> Affects Versions: 4.3.0, 4.4.0, 4.5.0
> Reporter: James Netherton
> Priority: Minor
> Fix For: 4.6.0
>
>
> Originally reported here:
> [https://camel.zulipchat.com/#narrow/stream/257302-camel-quarkus/topic/PropertyInject.20failure.20in.20CxfConfigurer]
> If you use @PropertyInject like:
> {code:java}
> public class Foo {
> @PropertyInject(value = "1")
> private Integer bar;
> }
> {code}
> Then you get an exception like:
> {code:java}
> java.lang.UnsupportedOperationException: Cannot inject value of class: class java.lang.Integer into: private java.lang.Integer
> {code}
> The original exception is swallowed, but it's something like:
> {code:java}
> IllegalArgumentException: Can not set java.lang.Integer field to int(1)
> {code}
> You can't use Field.setInt etc where the field type is not a primitive. You have to use Field.set in that case.
> [https://docs.oracle.com/javase/tutorial/reflect/member/fieldTrouble.html]
> Maybe it's related to this change:
> [https://github.com/apache/camel/commit/df19aec009164ba821c60518651dfc5eda3aee7d]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)