NIFI-9910: This closes #5956. Call toString() on the provided key in CSVRecordLookupService instead of attempting to cast to a String

Signed-off-by: Joe Witt <joewitt@apache.org>
This commit is contained in:
Mark Payne 2022-04-11 14:15:13 -04:00 committed by Joe Witt
parent 900a34971c
commit b67b2bc356
No known key found for this signature in database
GPG Key ID: 9093BF854F811A1A
1 changed files with 8 additions and 3 deletions

View File

@ -139,8 +139,13 @@ public class CSVRecordLookupService extends AbstractCSVLookupService implements
return Optional.empty();
}
final String key = (String) coordinates.get(KEY);
if (StringUtils.isBlank(key)) {
final Object key = coordinates.get(KEY);
if (key == null) {
return Optional.empty();
}
final String keyString = key.toString();
if (StringUtils.isBlank(keyString)) {
return Optional.empty();
}
@ -152,7 +157,7 @@ public class CSVRecordLookupService extends AbstractCSVLookupService implements
throw new LookupFailureException(e.getMessage(), e);
}
return Optional.ofNullable(cache.get(key));
return Optional.ofNullable(cache.get(keyString));
}
@Override