allthingssecurity opened a new pull request, #29673:
URL: https://github.com/apache/camel/pull/29673

   # Description
   
   [CAMEL-26867](https://issues.apache.org/jira/browse/CAMEL-26867)
   
   Follow-up of #29526 (CAMEL-26752), with the optional ideas of its review:
   
   - **Log noise.** `TimeSource.install` logged each install of a provider 
other than the default, and each time the default was put back, at INFO. 
camel-test-dst installs its provider for each seed, so a test of 1000 seeds 
wrote about 2000 INFO lines. Now the first install of each provider class is 
logged at INFO and the next ones at DEBUG; putting the default back after a 
provider class likewise (INFO the first time, then DEBUG). Installing a 
provider over another one that is not the default now also says which one it 
replaced: `Installed TimeSource provider: B (replacing: A)`. What was logged at 
INFO is kept as class names (no class of a test harness is held) in a set 
guarded by the lock the install already takes; it grows by at most two entries 
per provider class (its install, and putting the default back after it).
   - **Every core module.** 
`TimeSourceDirectClockCallsTest.everyClassOfTheCoreModulesThatUsesTimeSourceIsInTheList`
 walked four hard-coded modules (`MODULES`). It now walks the `src/main/java` 
of every core module, so a class of another module (such as camel-core-engine 
or camel-management) that starts to use `TimeSource` must be added to the list, 
and is then checked for direct clock calls. Today it finds the same 23 classes.
   - **More clock calls.** The scan also finds `Calendar.getInstance(...)` and 
`GregorianCalendar.getInstance(...)` (also as method references), `new 
GregorianCalendar()` (also fully qualified, and `GregorianCalendar::new`) and 
the `now()` of `Year`, `YearMonth` and `MonthDay`. The Javadoc says what it 
still does not find: a `GregorianCalendar` created with a time zone or a locale 
(a constructor with a date reads no clock, so only the no-argument one is 
matched). None of the listed classes makes such a call.
   - **test-dst.adoc** (and its catalog copy) names the calls the test finds, 
and that it also fails for a class of a core module that uses `TimeSource` and 
is not in its list.
   
   No upgrade guide entry: only the level of log lines of a test harness 
changes.
   
   Tests:
   - `TimeSourceLogTest` (camel-util): captures DEBUG too, and each test uses 
provider classes of its own, as what was logged at INFO is kept for the JVM. 
New: `theNextInstallsOfTheSameProviderClassAreLoggedAtDebug` (three 
install/reset rounds: the first install and reset at INFO, the next two rounds 
at DEBUG) and `replacingAProviderOtherThanTheDefaultSaysWhatItReplaced`; the 
three earlier cases keep their expectations.
   - `TimeSourceDirectClockCallsTest` (camel-core): the self-test of the scan 
gets the new calls (a `GregorianCalendar` with a date is not reported); a 
failure of the scanner names the file it scanned.
   
   With the `TimeSource` of main, the two new log tests fail; with the change 
the `TimeSource*Test` classes pass (camel-util 5 + 8, camel-core 3).
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-26867](https://issues.apache.org/jira/browse/CAMEL-26867).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built the core modules with the formatter and import-sort plugins and 
ran the tests named above; the catalog copy of test-dst.adoc matches it. I did 
not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to