sb3vecore commented on code in PR #23922:
URL: https://github.com/apache/camel/pull/23922#discussion_r3397316099
##########
components/camel-bindy/src/main/java/org/apache/camel/dataformat/bindy/BindyKeyValuePairFactory.java:
##########
@@ -573,18 +581,26 @@ public String unbind(CamelContext camelContext,
Map<String, Object> model) throw
return builder.toString();
}
- private Object formatField(Format<?> format, String value, int tag, int
line) throws Exception {
+ private Object formatField(
+ Format<?> format, String value, int tag, int line, boolean
fieldOpinion, Class<?> fieldType, String defaultValue)
+ throws Exception {
Object obj = null;
if (value != null) {
// Format field value
try {
- obj = format.parse(value);
+ obj = parseField(format, value, fieldOpinion, fieldType,
defaultValue);
} catch (Exception e) {
- throw new IllegalArgumentException(
- "Parsing error detected for field defined at the tag:
" + tag + ", line: " + line, e);
+ if (!fieldOpinion) {
+ throw new IllegalArgumentException(
+ "Parsing error detected for field defined at the
tag: " + tag + ", line: " + line, e);
+ }
+ if (!defaultValue.isEmpty()) {
+ return format.parse(defaultValue);
+ }
Review Comment:
Have addressed this in the most recent commit!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]