Claus Ibsen created CAMEL-25009:
-----------------------------------

             Summary: camel-core - Bean binding: @PropertyInject hides an 
invalid value, and overloaded constructors are not found
                 Key: CAMEL-25009
                 URL: https://issues.apache.org/jira/browse/CAMEL-25009
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Claus Ibsen


A review of bean binding and dependency injection (CamelPostProcessorHelper, 
PropertyBindingSupport) found the bugs below. Each one was reproduced against 
4.23.0-SNAPSHOT.

# *@PropertyInject uses the default value when the property value is invalid.* 
When the property existed but its value could not be converted to the type of 
the field or parameter (such as port=80a for an int), the defaultValue was 
silently used instead, so the mistake in the configuration went unnoticed. The 
defaultValue is now only used when the property cannot be resolved (such as not 
existing), and an invalid value fails.
# *A constructor or factory method overloaded for the given parameters is not 
found.* When more than one constructor or factory method matched the 
parameters, such as #class:java.math.BigDecimal(5) (constructors with int, long 
and BigInteger), or a factory method overloaded with int and long, none was 
chosen and the bean could not be created. The most specific is now chosen, as 
Java would: a whole number is an int (and then a long), and a bean is of its 
own type rather than a super type. When there is still no single most specific, 
the previous behavior applies.

_Claude Code on behalf of Claus Ibsen_




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to