gnodet-bot commented on code in PR #28087:
URL: https://github.com/apache/camel/pull/28087#discussion_r4311900148
##########
components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java:
##########
@@ -58,6 +58,8 @@ public abstract class GenericFileConsumer<T> extends
ScheduledBatchPollingConsum
protected GenericFileOperations<T> operations;
protected GenericFileProcessStrategy<T> processStrategy;
protected volatile ShutdownRunningTask shutdownRunningTask;
+ // the fileName of the message that poll or pollEnrich polls for, during
that poll (CAMEL-25792)
+ private volatile DynamicFileName dynamicFileName;
Review Comment:
💬 **Documentation nit:** The comment above this field should document the
concurrent-access contract to prevent future maintainers from removing the
fallback path in `isMatched()`, which would silently break correctness under
parallel `pollEnrich`.
```suggestion
// The fileName of the message that poll or pollEnrich polls for, during
that poll (CAMEL-25792).
// Under concurrent access (e.g. parallel pollEnrich sharing this
consumer via SinglePool), the
// cached value may belong to a different exchange — isMatched() falls
back to
// evaluateDynamicFileName(dynamic) in that case, so correctness is
preserved but caching is best-effort.
private volatile DynamicFileName dynamicFileName;
```
##########
components/camel-file/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java:
##########
@@ -61,6 +61,8 @@ public abstract class GenericFileEndpoint<T> extends
ScheduledPollEndpoint imple
protected static final int DEFAULT_IN_PROGRESS_CACHE_SIZE = 50000;
private static final Logger LOG =
LoggerFactory.getLogger(GenericFileEndpoint.class);
+ /** The file functions of the File Language, which read the file found:
${file:name}, ${date:file:yyyyMMdd}. */
+ private static final Pattern FILE_FUNCTION =
Pattern.compile("\\$(simple)?\\{(date(-with-timezone)?:)?file:");
Review Comment:
💬 **Documentation nit:** The Javadoc for `FILE_FUNCTION` only lists two
examples. Documenting all four matched forms (including `$simple{...}` variants
and `${date-with-timezone:file:...}`) prevents ambiguity for future maintainers
changing the regex.
```suggestion
/**
* The file functions of the File Language, which read the file found:
* ${file:name}, ${date:file:yyyyMMdd}, $simple{file:name},
${date-with-timezone:file:yyyyMMdd z}.
*/
private static final Pattern FILE_FUNCTION =
Pattern.compile("\$(simple)?\{(date(-with-timezone)?:)?file:");
```
--
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]