[ 
https://issues.apache.org/jira/browse/NIFI-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17037919#comment-17037919
 ] 

Joe Percivall commented on NIFI-5775:
-------------------------------------

Hey Karthik,

Not exactly, the schema that would cause issues would be  [CHOICE[STRING, 
ARRAY[STRING]]. This would result in a valid test case that is either: 
[{"path": "10.2.1.3"}] or [{"path": ["10.2.1.3"]}]. I'm having trouble with my 
build environment attempting to test master (Intellij says: "Error:java: 
invalid source release: 11") so I can't test it at the moment but the code does 
look like it has changed since this was first created if the test case works if 
you change it as listed in the description then I'd consider this OBE.


> DataTypeUtils "toString" incorrectly treats value as a "byte" when passing an 
> array leading to ClassCastException
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: NIFI-5775
>                 URL: https://issues.apache.org/jira/browse/NIFI-5775
>             Project: Apache NiFi
>          Issue Type: Bug
>    Affects Versions: 1.8.0
>            Reporter: Joe Percivall
>            Assignee: karthik kadajji
>            Priority: Major
>
> To reproduce, change this line[1] to either put "String" as the first choice 
> of record type or just set the key to use string. 
> The resulting error:
> {noformat}
> java.lang.ClassCastException: java.lang.String cannot be cast to 
> java.lang.Byte
>       at 
> org.apache.nifi.serialization.record.util.DataTypeUtils.toString(DataTypeUtils.java:530)
>       at 
> org.apache.nifi.serialization.record.util.DataTypeUtils.convertType(DataTypeUtils.java:147)
>       at 
> org.apache.nifi.serialization.record.util.DataTypeUtils.convertType(DataTypeUtils.java:115)
>       at 
> org.apache.nifi.json.WriteJsonResult.writeValue(WriteJsonResult.java:284)
>       at 
> org.apache.nifi.json.WriteJsonResult.writeRecord(WriteJsonResult.java:187)
>       at 
> org.apache.nifi.json.WriteJsonResult.writeRecord(WriteJsonResult.java:136)
>       at 
> org.apache.nifi.json.TestWriteJsonResult.testChoiceArray(TestWriteJsonResult.java:494)
> {noformat}
> [1] 
> https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/json/TestWriteJsonResult.java#L479



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to