[jira] [Commented] (NIFI-5775) DataTypeUtils "toString" incorrectly treats value as a "byte" when passing an array leading to ClassCastException
[ https://issues.apache.org/jira/browse/NIFI-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)
[jira] [Commented] (NIFI-5775) DataTypeUtils "toString" incorrectly treats value as a "byte" when passing an array leading to ClassCastException
[ https://issues.apache.org/jira/browse/NIFI-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17036090#comment-17036090 ] karthik kadajji commented on NIFI-5775: --- 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)
[jira] [Commented] (NIFI-5775) DataTypeUtils "toString" incorrectly treats value as a "byte" when passing an array leading to ClassCastException
[ https://issues.apache.org/jira/browse/NIFI-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16679155#comment-16679155 ] Joseph Percivall commented on NIFI-5775: [~sivaprasanna] this can be replicated in the unit tests by adding the String data type to the linked unit test. To be more exact on when it'll occur, if you have a field with the ability to be multiple types (e.g. array + string + null) and have string as first in the schema type list, this will occur. > 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 >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 (v7.6.3#76005)
[jira] [Commented] (NIFI-5775) DataTypeUtils "toString" incorrectly treats value as a "byte" when passing an array leading to ClassCastException
[ https://issues.apache.org/jira/browse/NIFI-5775?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16678002#comment-16678002 ] Sivaprasanna Sethuraman commented on NIFI-5775: --- When do you see this error? Any example flow would help. > 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 >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 (v7.6.3#76005)