pvillard31 commented on code in PR #10914: URL: https://github.com/apache/nifi/pull/10914#discussion_r2823473609
########## nifi-extension-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/xml/XMLRecordReader.java: ########## Review Comment: `parseUnknownField` (which calls `parseAttributesForUnknownField`) is invoked from multiple code paths: - `parseFieldForType` — when a schema field has data type CHOICE. Since the reader doesn't know which concrete type to pick, it falls back to parsing the element as an unknown field. - `parseRecord` — when `dropUnknown=false`. Specifically when `coerceTypes=true` but the field is not present in the schema, so there is no type to coerce to and it is parsed as unknown. And when `coerceTypes=false`, so every sub-element is parsed as unknown regardless of schema presence. - `parseRecord` — when `dropUnknown=true`, `coerceTypes=true`, and a field is present in the schema with an ARRAY or RECORD type whose nested children are recursively parsed as unknown. - Recursively within `parseUnknownField` itself for nested sub-elements. In practical terms, the most common scenario hitting this bug is when using `coerceTypes=false` (which is the default for the "no coercion" mode), because in that case every sub-element goes through `parseUnknownField`, and any namespaced attributes on those sub-elements would get the wrong field name from `toString()` instead of `getLocalPart()` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
