You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by jo...@apache.org on 2022/04/11 22:17:59 UTC
[nifi] branch main updated: NIFI-9910: This closes #5956. Call toString() on the provided key in CSVRecordLookupService instead of attempting to cast to a String
This is an automated email from the ASF dual-hosted git repository.
joewitt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi.git
The following commit(s) were added to refs/heads/main by this push:
new b67b2bc356 NIFI-9910: This closes #5956. Call toString() on the provided key in CSVRecordLookupService instead of attempting to cast to a String
b67b2bc356 is described below
commit b67b2bc3565ac7f2463ca19a1b1245ebc46bb74e
Author: Mark Payne <ma...@hotmail.com>
AuthorDate: Mon Apr 11 14:15:13 2022 -0400
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 <jo...@apache.org>
---
.../java/org/apache/nifi/lookup/CSVRecordLookupService.java | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/CSVRecordLookupService.java b/nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/CSVRecordLookupService.java
index d640fe96ba..bfbefee237 100644
--- a/nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/CSVRecordLookupService.java
+++ b/nifi-nar-bundles/nifi-standard-services/nifi-lookup-services-bundle/nifi-lookup-services/src/main/java/org/apache/nifi/lookup/CSVRecordLookupService.java
@@ -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