[
https://issues.apache.org/jira/browse/CAMEL-15137?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17120006#comment-17120006
]
Omar Al-Safi edited comment on CAMEL-15137 at 5/29/20, 10:42 PM:
-----------------------------------------------------------------
Thanks [~davsclaus] for the explanation as I wasn't aware that actually is not
intended to handle time in fraction based. Hence I will need to then to some
proper modifications in debezium code generation. However, as you mentioned, it
could be less idea when it comes to small values, then wouldn't make sense to
have it more forgiving, for example for value less than 1m? If adding such
enhancements may add more complexity to the converter, I would definitely keep
it as it is.
was (Author: omarsmak):
Thanks [~davsclaus] for the explanation as I wasn't aware that actually doesn't
handle time in fraction based. Hence I will need to then to some proper
modifications in debezium code generation. However, as you mentioned, it could
be less idea when it comes to small values, then wouldn't make sense to have it
more forgiving, for example for value less than 1m? If adding such enhancements
may add more complexity to the converter, I would definitely keep it as it is.
> Duration converter does not parse the seconds fraction correctly
> ----------------------------------------------------------------
>
> Key: CAMEL-15137
> URL: https://issues.apache.org/jira/browse/CAMEL-15137
> Project: Camel
> Issue Type: Bug
> Components: came-core
> Reporter: Omar Al-Safi
> Priority: Major
> Fix For: 3.4.0
>
>
> In the
> [DurationConverter|https://github.com/apache/camel/blob/master/core/camel-base/src/main/java/org/apache/camel/converter/DurationConverter.java],
> there are some edge cases are not handled correctly when fractions being
> used, e.g: {{DurationConverter.toDuration("5s").toMillis()}} will give the
> correct value of {{5000}} meanwhile
> {{DurationConverter.toDuration("5.5s").toMillis()}} will give {{5005}} which
> is wrong. Here is list of some edge cases:
> * {{DurationConverter.toDuration("5.5s").toMillis()}} -> 5001
> * {{DurationConverter.toDuration("0.01s").toMillis()}} -> 1
> * {{DurationConverter.toDuration("0.1").toMillis()}} -> 1
> * {{DurationConverter.toDuration("0.5s").toMillis()}} -> 5
--
This message was sent by Atlassian Jira
(v8.3.4#803005)