James Netherton created CAMEL-20700:
---------------------------------------

             Summary: 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.5.0, 4.4.0, 4.3.0
            Reporter: James Netherton


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)

Reply via email to