[xwiki/xwiki-platform] 7c8869: [Misc] Add null guards in XWiki#checkDeletingDocum...
Branch: refs/heads/master Home: https://github.com/xwiki/xwiki-platform Commit: 7c88692b8e2f508ebfdc2d8ff0304d7c4687ce15 https://github.com/xwiki/xwiki-platform/commit/7c88692b8e2f508ebfdc2d8ff0304... Author: Vincent Massol <[email protected]> Date: 2026-09-15 (Tue, 15 Sep 2026) Changed paths: M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java M xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/XWikiMockitoTest.java Log Message: ----------- [Misc] Add null guards in XWiki#checkDeletingDocument and XWiki#getDocumentReference (#6382) * [Misc] Add a null guard in XWiki#checkDeletingDocument * Throw an XWikiException with an explicit message instead of a raw NPE when the passed document is null, fixing the javabugs:S2259 SonarCloud issue reported on that method * Add a unit test covering the null document case Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> * [Misc] Add a null guard in XWiki#getDocumentReference for the XML-RPC mode * In XML-RPC mode the current document was dereferenced twice with no null check, while XWikiContext#getDoc() is documented as nullable and the main caller (prepareDocuments) calls this very method to find out which document is requested, i.e. before any document is in the context. Fall back on the wiki's home page in that case, as the portlet mode already does. This fixes the javabugs:S2259 SonarCloud issue reported on that method * Extract the XML-RPC branch into a private method so that the added condition doesn't push getDocumentReference() over the allowed cognitive complexity * Add unit tests for both XML-RPC cases Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> --------- 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