Commit 53e6068
fix: guard against a null comment when updating it - EXO-88900
SonarCloud reported a possible NullPointerException (javabugs:S2259) on the
update endpoint: CommentStorageImpl.updateComment() returns the result of
StorageUtil.commentToDto(), which is null when the DAO update returns null,
and the endpoint dereferenced it right away. Since the refactoring, the
endpoint no longer loads the comment beforehand, which made that path
reachable.
The endpoint now answers a server error instead of failing with a NPE, and
the case is covered by a test.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 1f9b274 commit 53e6068
2 files changed
Lines changed: 9 additions & 0 deletions
File tree
- services/src
- main/java/org/exoplatform/task/rest
- test/java/org/exoplatform/task/rest
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1098 | 1098 | | |
1099 | 1099 | | |
1100 | 1100 | | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
1101 | 1105 | | |
1102 | 1106 | | |
1103 | 1107 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
904 | 904 | | |
905 | 905 | | |
906 | 906 | | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
907 | 912 | | |
908 | 913 | | |
909 | 914 | | |
| |||
0 commit comments