mirror of
https://github.com/apache/nifi.git
synced 2025-03-06 01:19:49 +00:00
NIFI-6320. This closes #3494. Added a check whereby, if the user is using the "Use Segment Names" option in the ExtractHL7Attributes processor and the HL7 message being processed contains custom user segments (e.g., Z Segments), the code will downgrade to returning the Segment Label as it does when this option is not used. Without this a null pointer is thrown at line 288.
Signed-off-by: Joe Witt <joewitt@apache.org>
This commit is contained in:
parent
fa1ed16e2b
commit
15b0f1cfc2
@ -284,8 +284,12 @@ public class ExtractHL7Attributes extends AbstractProcessor {
|
||||
final Type field = segment.getField(i, 0);
|
||||
if (!isEmpty(field)) {
|
||||
final String fieldName;
|
||||
if (useNames) {
|
||||
fieldName = WordUtils.capitalize(segmentNames[i-1]).replaceAll("\\W+", "");
|
||||
//Some user defined segments (e.g. Z segments) will not have corresponding names returned
|
||||
//from segment.getNames() above. If we encounter one of these, do the next best thing
|
||||
//and return what we otherwise would if we were not in useNames mode.
|
||||
String segmentName = segmentNames[i-1];
|
||||
if (useNames && StringUtils.isNotBlank(segmentName)) {
|
||||
fieldName = WordUtils.capitalize(segmentName).replaceAll("\\W+", "");
|
||||
} else {
|
||||
fieldName = String.valueOf(i);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user