Joseph Percivall created NIFI-5775:
--------------------------------------

             Summary: 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: Joseph Percivall


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
(v7.6.3#76005)

Reply via email to