Commit 6cf8b0d
[Misc] Explain why these code blocks are empty and fix comment syntax (SonarQube) (#6221)
* [Misc] Explain why these code blocks are empty and fix comment syntax (SonarQube)
* java:S108: document the 80 empty blocks reported in 19 files with a
comment saying why they are empty, and remove two blocks that are empty
and useless (an empty finally and an empty else in XWiki).
* java:S9355: turn the block comments that carry Javadoc tags into real
Javadoc comments (MailStatus fields and XWiki#getUserTimeZone).
Co-Authored-By: Vincent Massol <vincent@massol.net>
* [Misc] Turn the empty-block comments into TODOs (SonarQube)
* Following review: a catch that neither rethrows nor logs is a bug to fix
later, so each comment now starts with a "// TODO:" asking either to log a
warning, or (where an exception is the expected outcome) to change the
logic so the case isn't signalled by an exception.
* The two blocks that are not exception handling (dropping XML control
characters, an empty switch default) keep their plain comment.
Co-Authored-By: Vincent Massol <vincent@massol.net>
* [Misc] Replace the try/catch of MonitorTimer#toString() with a null check
* Following review: the catch was only there to swallow the NPE thrown when
the duration of a timer that has not ended yet is printed, so a null check
on the two dates says it directly and removes the empty block.
* Behaviour is unchanged: the "Duration: " label was already appended before
the throwing expression, so a running timer printed the label with no value
before and still does.
Co-Authored-By: Vincent Massol <vincent@massol.net>
* [Misc] Drop the TODOs where catching the exception is the valid design
* Following review: XWikiRightNotFoundException is a domain signal meaning
"no right defined at this level", so catching it to continue with the next
check is valid and the 12 TODOs asking to change that logic are removed;
the comment saying what the catch means stays.
* FeedPlugin's TODO is reworded: falling back when the Map constructor is
missing is fine, but catching Throwable there also hides a failure of the
constructor that was found, so the ask is to log a warning.
Co-Authored-By: Vincent Massol <vincent@massol.net>
---------
Co-authored-by: Vincent Massol <vincent@massol.net>1 parent 6f166ae commit 6cf8b0d
20 files changed
Lines changed: 161 additions & 17 deletions
File tree
- xwiki-platform-core
- xwiki-platform-feed/xwiki-platform-feed-api/src/main/java/com/xpn/xwiki/plugin/feed
- xwiki-platform-mail/xwiki-platform-mail-send/xwiki-platform-mail-send-api/src/main/java/org/xwiki/mail
- xwiki-platform-notifications/xwiki-platform-notifications-filters/xwiki-platform-notifications-filters-default/src/main/java/org/xwiki/notifications/filters/internal/livedata/custom
- xwiki-platform-oldcore/src/main/java/com/xpn/xwiki
- api
- doc
- internal/render/groovy
- monitor/api
- plugin
- packaging
- store
- user/impl/xwiki
- web
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
| 193 | + | |
192 | 194 | | |
193 | 195 | | |
194 | 196 | | |
| |||
219 | 221 | | |
220 | 222 | | |
221 | 223 | | |
| 224 | + | |
| 225 | + | |
222 | 226 | | |
223 | 227 | | |
224 | 228 | | |
| |||
855 | 859 | | |
856 | 860 | | |
857 | 861 | | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
858 | 865 | | |
859 | 866 | | |
860 | 867 | | |
| |||
Lines changed: 8 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
| 54 | + | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
| 79 | + | |
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
Lines changed: 34 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1228 | 1228 | | |
1229 | 1229 | | |
1230 | 1230 | | |
1231 | | - | |
1232 | 1231 | | |
1233 | 1232 | | |
1234 | 1233 | | |
| |||
1745 | 1744 | | |
1746 | 1745 | | |
1747 | 1746 | | |
| 1747 | + | |
| 1748 | + | |
1748 | 1749 | | |
1749 | 1750 | | |
1750 | 1751 | | |
| |||
1758 | 1759 | | |
1759 | 1760 | | |
1760 | 1761 | | |
| 1762 | + | |
| 1763 | + | |
1761 | 1764 | | |
1762 | 1765 | | |
1763 | 1766 | | |
| |||
1815 | 1818 | | |
1816 | 1819 | | |
1817 | 1820 | | |
1818 | | - | |
1819 | 1821 | | |
1820 | 1822 | | |
1821 | 1823 | | |
| |||
3193 | 3195 | | |
3194 | 3196 | | |
3195 | 3197 | | |
| 3198 | + | |
| 3199 | + | |
3196 | 3200 | | |
3197 | 3201 | | |
3198 | 3202 | | |
| |||
3206 | 3210 | | |
3207 | 3211 | | |
3208 | 3212 | | |
| 3213 | + | |
| 3214 | + | |
3209 | 3215 | | |
3210 | 3216 | | |
3211 | 3217 | | |
| |||
3398 | 3404 | | |
3399 | 3405 | | |
3400 | 3406 | | |
| 3407 | + | |
| 3408 | + | |
3401 | 3409 | | |
3402 | 3410 | | |
3403 | 3411 | | |
| |||
3409 | 3417 | | |
3410 | 3418 | | |
3411 | 3419 | | |
| 3420 | + | |
| 3421 | + | |
3412 | 3422 | | |
3413 | 3423 | | |
3414 | 3424 | | |
| |||
3427 | 3437 | | |
3428 | 3438 | | |
3429 | 3439 | | |
| 3440 | + | |
| 3441 | + | |
3430 | 3442 | | |
3431 | 3443 | | |
3432 | 3444 | | |
| |||
3495 | 3507 | | |
3496 | 3508 | | |
3497 | 3509 | | |
| 3510 | + | |
| 3511 | + | |
3498 | 3512 | | |
3499 | 3513 | | |
3500 | 3514 | | |
| |||
3510 | 3524 | | |
3511 | 3525 | | |
3512 | 3526 | | |
| 3527 | + | |
| 3528 | + | |
3513 | 3529 | | |
3514 | 3530 | | |
3515 | 3531 | | |
| |||
3528 | 3544 | | |
3529 | 3545 | | |
3530 | 3546 | | |
| 3547 | + | |
| 3548 | + | |
3531 | 3549 | | |
3532 | 3550 | | |
3533 | 3551 | | |
| |||
3656 | 3674 | | |
3657 | 3675 | | |
3658 | 3676 | | |
| 3677 | + | |
| 3678 | + | |
3659 | 3679 | | |
3660 | 3680 | | |
3661 | 3681 | | |
| 3682 | + | |
| 3683 | + | |
3662 | 3684 | | |
3663 | 3685 | | |
3664 | 3686 | | |
| |||
4501 | 4523 | | |
4502 | 4524 | | |
4503 | 4525 | | |
| 4526 | + | |
| 4527 | + | |
4504 | 4528 | | |
4505 | 4529 | | |
4506 | 4530 | | |
| |||
4550 | 4574 | | |
4551 | 4575 | | |
4552 | 4576 | | |
| 4577 | + | |
| 4578 | + | |
4553 | 4579 | | |
4554 | 4580 | | |
4555 | 4581 | | |
| |||
6263 | 6289 | | |
6264 | 6290 | | |
6265 | 6291 | | |
| 6292 | + | |
| 6293 | + | |
6266 | 6294 | | |
6267 | 6295 | | |
6268 | 6296 | | |
| |||
6542 | 6570 | | |
6543 | 6571 | | |
6544 | 6572 | | |
| 6573 | + | |
| 6574 | + | |
6545 | 6575 | | |
6546 | 6576 | | |
6547 | 6577 | | |
| |||
7160 | 7190 | | |
7161 | 7191 | | |
7162 | 7192 | | |
| 7193 | + | |
| 7194 | + | |
7163 | 7195 | | |
7164 | 7196 | | |
7165 | 7197 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1340 | 1340 | | |
1341 | 1341 | | |
1342 | 1342 | | |
| 1343 | + | |
| 1344 | + | |
1343 | 1345 | | |
1344 | 1346 | | |
1345 | 1347 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1003 | 1003 | | |
1004 | 1004 | | |
1005 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
1006 | 1008 | | |
1007 | 1009 | | |
1008 | 1010 | | |
| |||
2329 | 2331 | | |
2330 | 2332 | | |
2331 | 2333 | | |
2332 | | - | |
2333 | | - | |
2334 | | - | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
2335 | 2338 | | |
2336 | 2339 | | |
2337 | 2340 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3706 | 3706 | | |
3707 | 3707 | | |
3708 | 3708 | | |
| 3709 | + | |
| 3710 | + | |
3709 | 3711 | | |
3710 | 3712 | | |
3711 | 3713 | | |
| |||
5426 | 5428 | | |
5427 | 5429 | | |
5428 | 5430 | | |
| 5431 | + | |
5429 | 5432 | | |
5430 | 5433 | | |
5431 | 5434 | | |
| |||
7404 | 7407 | | |
7405 | 7408 | | |
7406 | 7409 | | |
7407 | | - | |
| 7410 | + | |
| 7411 | + | |
7408 | 7412 | | |
7409 | 7413 | | |
7410 | 7414 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
72 | 74 | | |
73 | 75 | | |
74 | 76 | | |
| |||
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| 98 | + | |
| 99 | + | |
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| |||
0 commit comments