allthingssecurity commented on PR #29526: URL: https://github.com/apache/camel/pull/29526#issuecomment-6762578883
Thanks for the review. Follow-up commit 8a69b1dc2b7e. - **The forms the scan misses.** I checked widening the `sleep` rule to any receiver except `TimeSource`. It would give false reports in the listed classes: `TimeSource.sleep` calls `provider.sleep(millis)`, and `RedeliveryErrorHandler` calls `currentRedeliveryPolicy.sleep(redeliveryDelay)`, which goes through `TimeSource`. So I kept that rule as it is. The Javadoc now says the scan catches the usual forms only, lists them, and says why a `sleep` on a variable or a field (`unit.sleep(x)`) is not caught. The other forms you listed had no false reports in the listed classes, so they are now rules: `import static java.lang.System.*` and `java.lang.Thread.*`, `LocalDateTime.now()` and the other `java.time` `now()` (also as `::now`), `new Date()` (also `Date::new`), `Clock.systemUTC()` and the other system clocks, and `TimeUnit.SECONDS::sleep`. The scanner self-test covers each one, and also `unit.sleep(1)` and `policy.sleep(2)` on variables, which are not reported. - **A test in each of the four modules.** I left this as a follow-up. camel-base-engine has no test sources and no JUnit dependency. The modules below camel-core share no test jar, so each module would also need its own copy of the scanner. It can be a follow-up JIRA if you want it. - **`coreDir()`.** It now walks up from where the test class is loaded (`camel-core/target/test-classes`) to the directory that holds `camel-util` and `camel-core`. It no longer reads `basedir` or uses `"."`, so the test also runs from an IDE with another working directory. Tests: `TimeSourceDirectClockCallsTest` 3, `TimeSourceLogTest` 3 and `TimeSourceTest` 8 pass, and none of the new rules matches anything in the listed classes. I updated the PR description to match. _Claude Code on behalf of allthingssecurity_ -- 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]
