[ https://issues.apache.org/jira/browse/NIFI-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17036090#comment-17036090 ]
karthik kadajji edited comment on NIFI-5775 at 2/13/20 10:58 AM: ----------------------------------------------------------------- Hi [~jpercivall] , I was trying to reproduce the same error in testChoiceArray() class. Could you please tell me, if for example the schema was of the form [STRING, CHOICE[ARRAY[STRING]]] which according to the testclass should have produced [{"name":"John Doe","path":["10.2.1.3"]}]. are you getting the issue while doing this? was (Author: karthikkadajji): Hi Joe, I was trying to reproduce the same error in testChoiceArray() class. Could you please tell me, if for example the schema was of the form [STRING, CHOICE[ARRAY[STRING]]] which according to the testclass should have produced [\{"name":"John Doe","path":["10.2.1.3"]}]. are you getting the issue while doing this? > 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 > 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)