ing-mattioni commented on code in PR #11245:
URL: https://github.com/apache/nifi/pull/11245#discussion_r3257738223
##########
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TailFile.java:
##########
@@ -427,9 +428,19 @@ private void initStates(final List<String> filesToTail,
final Map<String, String
for (Entry<String, String> entry : statesMap.entrySet()) {
final String key = entry.getKey();
final String value = entry.getValue();
- if (key.endsWith(TailFileState.StateKeys.FILENAME) &&
filesToTail.contains(value)) {
- int index = Integer.parseInt(key.split("\\.")[1]);
- states.put(value, new TailFileObject(index, statesMap,
preAllocatedBufferSize));
+ if (key.endsWith(TailFileState.StateKeys.FILENAME) &&
filesToTailSet.contains(value)) {
+ final int index;
+ try {
+ index = Integer.parseInt(key.split("\\.")[1]);
+ } catch (final RuntimeException e) {
+ getLogger().warn("Ignoring malformed TailFile
state key {}", key, e);
+ continue;
+ }
Review Comment:
Agreed. I removed this try/catch. TailFile controls the persisted state key
format, so adding defensive handling for malformed internal state is not needed
here.
--
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]