[xwiki/xwiki-platform] cfa444: [Misc] Keep the eager String for log arguments tha...
Branch: refs/heads/misc-log-argument-strings Home: https://github.com/xwiki/xwiki-platform Commit: cfa4443a39e5a9a29bc5072b8abe53dfcc06e909 https://github.com/xwiki/xwiki-platform/commit/cfa4443a39e5a9a29bc5072b8abe5... Author: Vincent Massol <[email protected]> Date: 2026-08-03 (Mon, 03 Aug 2026) Changed paths: M xwiki-platform-core/xwiki-platform-attachment/xwiki-platform-attachment-api/src/main/java/org/xwiki/attachment/internal/listener/MovedAttachmentListener.java M xwiki-platform-core/xwiki-platform-component/xwiki-platform-component-wiki/src/main/java/org/xwiki/component/wiki/internal/DefaultWikiComponentInvocationHandler.java M xwiki-platform-core/xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-storage/src/main/java/org/xwiki/mail/internal/DatabaseMailStatusStore.java M xwiki-platform-core/xwiki-platform-mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPlugin.java M xwiki-platform-core/xwiki-platform-mailsender/src/main/java/com/xpn/xwiki/plugin/mailsender/MailSenderPluginApi.java M xwiki-platform-core/xwiki-platform-observation/xwiki-platform-observation-remote/src/main/java/org/xwiki/observation/remote/internal/jgroups/JGroupsNetworkAdapter.java M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/XWikiHibernateBaseStore.java M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/store/migration/hibernate/R40000XWIKI6990DataMigration.java M xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/src/main/java/org/xwiki/search/solr/internal/SolrIndexAvailableLocalesListener.java M xwiki-platform-core/xwiki-platform-search/xwiki-platform-search-solr/xwiki-platform-search-solr-api/src/main/java/org/xwiki/search/solr/internal/SolrIndexEventListener.java M xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-workspaces-migrator/src/main/java/org/xwiki/wiki/workspacesmigrator/internal/WorkspacesMigration.java M xwiki-platform-core/xwiki-platform-wiki/xwiki-platform-wiki-workspaces-migrator/src/test/java/org/xwiki/wiki/workspacesmigrator/internal/WorkspaceMigrationTest.java Log Message: ----------- [Misc] Keep the eager String for log arguments that must not be serialized Same fix as xwiki-commons#1872, for the sites the logging best practices pass (#6055 ... #6079) changed here. Log arguments are kept as objects in the captured LogEvent and XStream-serialized into the job log (SafeMessageConverter in xwiki-commons), so dropping an explicit toString() changes what lands in the job log file: the whole object graph is written out, and it is read back as null once its class can no longer be resolved. * XWikiHibernateBaseStore: a live Hibernate Session, which implements Serializable, so it would be walked field by field. * MailSenderPluginApi: a MailConfiguration, whose toString() masks the SMTP password that the object itself carries in clear text. * MailSenderPlugin x3 and MailSenderPluginApi: a Mail, which holds the body and the attachments, none of which its toString() prints. * MovedAttachmentListener: a MoveAttachmentRequest. A Request is Serializable, so the move job would end up with a copy of its own request in its own log. * SolrIndexEventListener and SolrIndexAvailableLocalesListener: an arbitrary source object, as in DefaultJobProgress. * JGroupsNetworkAdapter x2: a RemoteEventData, Serializable by design since it is the replicated payload. * DatabaseMailStatusStore, WorkspacesMigration: a StringBuilder, which would be written out as its internal char array. * R40000XWIKI6990DataMigration: a StringBuilder holding the whole Liquibase XML of the migration. The String it is converted to is now reused for the return value instead of being built twice. * DefaultWikiComponentInvocationHandler: getTypeName() on the role Type, which is backed by a Class that cannot always be resolved. The document reference stays an object, since the log displayers render it as a link. Left alone on purpose: EntityReference arguments (the case the displayers are for), enums, a File, and a QueryFilter, which is a component and is therefore already stringified by the converter. Each site carries a comment explaining why the String is built eagerly, so that the next logging pass does not remove it again. java:S2629 only looks at String-typed arguments, exempts no-arg getters and skips catch blocks, so only four of these sites need a suppression. 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-platform/settings/notifications
participants (1)
-
XWiki Notifications