[
https://issues.apache.org/jira/browse/NIFI-3919?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16013821#comment-16013821
]
ASF GitHub Bot commented on NIFI-3919:
--------------------------------------
Github user ijokarumawak commented on the issue:
https://github.com/apache/nifi/pull/1816
This PR includes 3 commits, but only the [last
commit](https://github.com/apache/nifi/pull/1816/commits/48ac74c1ef86f7b654e0d3b312f231d5f2ed5115)
is needed to be merged from this PR. Other two have specific PRs(NIFI-3920:
#1813 and NIFI-3918: #1815 ) for those and can be merged independently.
However, this PR depends on those two for testing.
A NiFi template file for testing this fix is available here in
[Gist](https://gist.github.com/ijokarumawak/fc7eb3d1373733ca1057d9c84c61f20e).
Thanks for reviewing!
> AvroTypeUtil throws Exception before trying every possible type
> ---------------------------------------------------------------
>
> Key: NIFI-3919
> URL: https://issues.apache.org/jira/browse/NIFI-3919
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.2.0
> Reporter: Koji Kawamura
> Assignee: Koji Kawamura
>
> With a field schema having mixed types, for example, "[null, int, string]",
> AvroTypeUtil tries to coerce type conversion so that the input raw object can
> fit with one of possible data type defined in the union.
> If an input string "bar" is passed, we expect it's mapped as "string" data
> type. However, the "bar" is parsed as integer first, and a
> NumberFormatException is thrown but not caught, before converting it to
> "string".
> We surround type conversion with try/catch when AvroTypeUtil tries to find a
> right type within an union field so that it can check every possible type.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)