Commit 84f810e
authored
MINOR: Resolve hidden NPE in RequestQuotaTest (#21587)
`RequestQuotaTest` was silently experiencing NPE when testing
`SHARE_ACKNOWLEDGE`. This is because the default for the group ID in
this request is null, even though this is never actually used in
practice by a real client. The construction of
`ShareAcknowledgeRequestData` in this test did not initialize a specific
value for group ID, and this means it was left as null. The result was
an NPE handling the request in the broker, which was not the intended
action of the test.
The PR explicitly handles null for group ID and member ID in
`SHARE_FETCH` and `SHARE_ACKNOWLEDGE` requests so that we are not
relying on the overall exception handling for this situation. In
practice, this would not be necessary for a real client, but the
defensive code makes sense for this test (or a poorly written client).
It also initialises the request in the test case with a non-null group
ID and member ID for `SHARE_ACKNOWLEDGE` which aligns with what already
exists for `SHARE_FETCH`.
Reviewers: Apoorv Mittal <apoorvmittal10@gmail.com>, Chia-Ping Tsai
<chia7712@gmail.com>1 parent c4631a2 commit 84f810e
2 files changed
Lines changed: 20 additions & 2 deletions
File tree
- core/src
- main/scala/kafka/server
- test/scala/unit/kafka/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3172 | 3172 | | |
3173 | 3173 | | |
3174 | 3174 | | |
| 3175 | + | |
| 3176 | + | |
| 3177 | + | |
| 3178 | + | |
| 3179 | + | |
| 3180 | + | |
3175 | 3181 | | |
3176 | 3182 | | |
3177 | 3183 | | |
| |||
3539 | 3545 | | |
3540 | 3546 | | |
3541 | 3547 | | |
| 3548 | + | |
| 3549 | + | |
| 3550 | + | |
| 3551 | + | |
| 3552 | + | |
| 3553 | + | |
3542 | 3554 | | |
3543 | 3555 | | |
3544 | 3556 | | |
| |||
4222 | 4234 | | |
4223 | 4235 | | |
4224 | 4236 | | |
4225 | | - | |
| 4237 | + | |
4226 | 4238 | | |
4227 | 4239 | | |
4228 | 4240 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
| 332 | + | |
332 | 333 | | |
333 | 334 | | |
334 | 335 | | |
| |||
493 | 494 | | |
494 | 495 | | |
495 | 496 | | |
| 497 | + | |
496 | 498 | | |
497 | 499 | | |
498 | 500 | | |
| |||
503 | 505 | | |
504 | 506 | | |
505 | 507 | | |
| 508 | + | |
506 | 509 | | |
507 | 510 | | |
508 | 511 | | |
| |||
719 | 722 | | |
720 | 723 | | |
721 | 724 | | |
722 | | - | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
723 | 729 | | |
724 | 730 | | |
725 | 731 | | |
| |||
0 commit comments