[xwiki/xwiki-platform] e36e2b: [Misc] Fix the SonarQube java:S2097 issues by type...
Branch: refs/heads/claude/clever-feynman-09kzzr-judgement Home: https://github.com/xwiki/xwiki-platform Commit: e36e2b47f5b2846f4397bfe4bcc1583afb860123 https://github.com/xwiki/xwiki-platform/commit/e36e2b47f5b2846f4397bfe4bcc15... Author: Vincent Massol <[email protected]> Date: 2026-09-10 (Thu, 10 Sep 2026) Changed paths: M xwiki-platform-core/xwiki-platform-bridge/src/main/java/org/xwiki/bridge/event/AbstractActionExecutionEvent.java M xwiki-platform-core/xwiki-platform-notifications/xwiki-platform-notifications-preferences/xwiki-platform-notifications-preferences-api/src/main/java/org/xwiki/notifications/preferences/internal/AbstractNotificationPreference.java M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/objects/NumberProperty.java M xwiki-platform-core/xwiki-platform-resource/xwiki-platform-resource-api/src/main/java/org/xwiki/resource/events/AbstractResourceReferenceHandlerEvent.java Log Message: ----------- [Misc] Fix the SonarQube java:S2097 issues by type-testing in equals() * Three equals() implementations cast their argument without a type test, so equals() on an unrelated object throws ClassCastException (and, for XWikiDocument, equals(null) throws NullPointerException) where the Object#equals contract requires false. * The two event classes are false positives - getClass().isAssignableFrom() is the type test - and are resolved with @SuppressWarnings plus the reason, per the XWiki convention. Co-Authored-By: Vincent Massol <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ChPn88cFpNHMHk8Y2i1XB2 Commit: 78f9e2791413505da7145775f923ee2adf35f85f https://github.com/xwiki/xwiki-platform/commit/78f9e2791413505da7145775f923e... Author: Vincent Massol <[email protected]> Date: 2026-09-10 (Thu, 10 Sep 2026) Changed paths: M xwiki-platform-core/xwiki-platform-annotation/xwiki-platform-annotation-maintainer/src/main/java/org/xwiki/annotation/maintainer/internal/CharacterDiffService.java Log Message: ----------- [Misc] Fix the SonarQube java:S4973 issues of CharacterDiffService * Difference's start/end offsets were compared to Difference.NONE with == and !=, i.e. by reference on boxed integers; it only works today because NONE falls inside the Integer cache. Co-Authored-By: Vincent Massol <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ChPn88cFpNHMHk8Y2i1XB2 Commit: 69e04c4326dc592fa19d85cacaac00293f4f3452 https://github.com/xwiki/xwiki-platform/commit/69e04c4326dc592fa19d85cacaac0... Author: Vincent Massol <[email protected]> Date: 2026-09-10 (Thu, 10 Sep 2026) Changed paths: M xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-handlers/xwiki-platform-extension-handler-xar/src/main/java/org/xwiki/extension/xar/internal/handler/packager/PackageConfiguration.java M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/doc/XWikiAttachmentArchive.java Log Message: ----------- [Misc] Fix the SonarQube java:S2225 issues by not returning null from clone() * Both classes implement Cloneable, so the CloneNotSupportedException branch that returned null is unreachable; it is now an IllegalStateException carrying the cause. Co-Authored-By: Vincent Massol <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ChPn88cFpNHMHk8Y2i1XB2 Commit: 1d35b18d6e0f082bbd9f6d89bbcccbe80591c233 https://github.com/xwiki/xwiki-platform/commit/1d35b18d6e0f082bbd9f6d89bbccc... Author: Vincent Massol <[email protected]> Date: 2026-09-10 (Thu, 10 Sep 2026) Changed paths: M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/internal/model/reference/CompactStringEntityReferenceSerializer.java Log Message: ----------- [Misc] Fix the SonarQube java:S1221 issue by renaming equal() to isEqual() * The method is one character away from equals() without overriding it. It is protected in an internal package and its only caller is in the same class. Co-Authored-By: Vincent Massol <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ChPn88cFpNHMHk8Y2i1XB2 Commit: 1a48ca59fd0c5b2bfa38dc5b67db042a1fc673f2 https://github.com/xwiki/xwiki-platform/commit/1a48ca59fd0c5b2bfa38dc5b67db0... Author: Vincent Massol <[email protected]> Date: 2026-09-10 (Thu, 10 Sep 2026) Changed paths: M xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/main/java/org/xwiki/rest/internal/RangeIterable.java M xwiki-platform-core/xwiki-platform-rest/xwiki-platform-rest-server/src/test/java/org/xwiki/rest/internal/RangeIterableTest.java Log Message: ----------- [Misc] Fix the SonarQube java:S2272 issue of RangeIterable * next() now throws NoSuchElementException past the end of the iteration, as Iterator#next() requires, instead of letting list.get() throw IndexOutOfBoundsException. * RangeIterableTest pinned the old exception type; it now asserts the contractual one. Co-Authored-By: Vincent Massol <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ChPn88cFpNHMHk8Y2i1XB2 Commit: fc3294249b12ab0fc962e8d17b018f04b77ec455 https://github.com/xwiki/xwiki-platform/commit/fc3294249b12ab0fc962e8d17b018... Author: Vincent Massol <[email protected]> Date: 2026-09-10 (Thu, 10 Sep 2026) Changed paths: M xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/web/Utils.java Log Message: ----------- [Misc] Fix the SonarQube java:S2674 issue of Utils#getContent * A single InputStream#read() call was assumed to fill the whole buffer, so a short read silently produced a partially-filled byte array. IOUtils#readFully loops and reports the shortfall as an IOException, which the existing handler already turns into an XWikiException. Co-Authored-By: Vincent Massol <[email protected]> Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ChPn88cFpNHMHk8Y2i1XB2 Compare: https://github.com/xwiki/xwiki-platform/compare/e36e2b47f5b2%5E...fc3294249b... To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-platform/settings/notifications
participants (1)
-
XWiki Notifications