[xwiki/xwiki-commons] 06cafc: [Misc] Keep the eager String for log arguments tha...
Branch: refs/heads/misc-log-argument-strings Home: https://github.com/xwiki/xwiki-commons Commit: 06cafcf60b4f664ead6457db9b0e746d17437b66 https://github.com/xwiki/xwiki-commons/commit/06cafcf60b4f664ead6457db9b0e74... Author: Vincent Massol <[email protected]> Date: 2026-08-03 (Mon, 03 Aug 2026) Changed paths: M xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/main/java/org/xwiki/component/annotation/ComponentAnnotationLoader.java M xwiki-commons-core/xwiki-commons-job/xwiki-commons-job-api/src/main/java/org/xwiki/job/internal/DefaultJobProgress.java Log Message: ----------- [Misc] Keep the eager String for log arguments that must not be serialized Reverts 3 of the 4 explicit toString() removals from #1871, following Thomas' review. Log arguments are kept as objects in the captured LogEvent and XStream-serialized into the job log (SafeMessageConverter), so dropping the toString() changes what lands in the job log file: an arbitrary object has its whole graph written, and it is read back as null once its class can no longer be resolved (SafeArrayConverter turns read failures into null). * DefaultJobProgress x2: the source is an arbitrary Object and this code runs inside a job by definition, so its log always reaches the persisted job log. String.valueOf() rather than toString() so that a null source still renders. This re-opens the java:S2629 issues that the removal had closed, hence the @SuppressWarnings. * ComponentAnnotationLoader: getName(), which reads better in the message than "class org.foo.Bar" and hits the rule's no-arg getter exemption, so no suppression is needed there. * RepositoryUtils is left as merged: ExtensionRepositoryDescriptor is a commons type that is always resolvable, and its toString() already prints every field, so there is no size win and the typed form is the more useful one. Each site carries a comment explaining why the String is built eagerly, so that the next logging pass does not remove it again. Co-authored-by: Claude Opus 5 (1M context) <[email protected]> To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-commons/settings/notifications
participants (1)
-
XWiki Notifications