[xwiki/xwiki-platform] cf0aaa: [Misc] Fix an unsafe type cast in DocumentReferenc...
Branch: refs/heads/master Home: https://github.com/xwiki/xwiki-platform Commit: cf0aaa07abf9f86c261d5facd72863e8ee589240 https://github.com/xwiki/xwiki-platform/commit/cf0aaa07abf9f86c261d5facd7286... Author: Vincent Massol <[email protected]> Date: 2026-06-08 (Mon, 08 Jun 2026) Changed paths: M xwiki-platform-core/xwiki-platform-model/xwiki-platform-model-api/src/main/java/org/xwiki/model/reference/DocumentReference.java Log Message: ----------- [Misc] Fix an unsafe type cast in DocumentReference#getSpaceReferences reported by SonarQube * SonarQube rule javabugs:S6320 flagged the cast of an EntityReference to SpaceReference while walking the parent chain. The chain elements are typed EntityReference and are not guaranteed to be SpaceReference instances (e.g. when the DocumentReference is built from a generic EntityReference), so the cast could throw a ClassCastException. * Build the SpaceReference from the EntityReference instead, which is safe in all cases and preserves equality (so the returned list is unchanged for the existing scenarios). Co-authored-by: Claude <[email protected]> To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-platform/settings/notifications
participants (1)
-
XWiki Notifications