You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Abhiram98 (via GitHub)" <gi...@apache.org> on 2025/06/11 02:39:37 UTC

[PR] MINOR: rename exception `e` to `swallow` where appropriate [kafka]

Abhiram98 opened a new pull request, #19948:
URL: https://github.com/apache/kafka/pull/19948

   I noticed that in commit [a662bc56](https://github.com/apache/kafka/commit/a662bc56345d1d46d5f3340ea522d8158d09ca49), renamed ignored exceptions `e` to `swallow. 
   
   Here's a small patch to make that change consistent in other files: AsyncKafkaConsumer.java, KafkaConsumerTest.java, AsyncKafkaConsumerTest.java


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: rename exception `e` to `swallow` where appropriate [kafka]

Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #19948:
URL: https://github.com/apache/kafka/pull/19948#discussion_r2150617216


##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -1977,7 +1977,7 @@ public void testOperationsBySubscribingConsumerWithDefaultGroupId(GroupProtocol
         try {
             newConsumer(groupProtocol, null, Optional.of(Boolean.TRUE));
             fail("Expected an InvalidConfigurationException");
-        } catch (InvalidConfigurationException e) {
+        } catch (InvalidConfigurationException swallow) {

Review Comment:
   This is a bad pattern: `assertThrow` should be used instead. Same for the other tests that were updated in this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: rename exception `e` to `swallow` where appropriate [kafka]

Posted by "chia7712 (via GitHub)" <gi...@apache.org>.
chia7712 merged PR #19948:
URL: https://github.com/apache/kafka/pull/19948


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: rename exception `e` to `swallow` where appropriate [kafka]

Posted by "kirktrue (via GitHub)" <gi...@apache.org>.
kirktrue commented on code in PR #19948:
URL: https://github.com/apache/kafka/pull/19948#discussion_r2141239509


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumerTest.java:
##########
@@ -182,7 +182,7 @@ public void resetAll() {
         if (consumer != null) {
             try {
                 consumer.close(CloseOptions.timeout(Duration.ZERO));
-            } catch (Exception e) {
+            } catch (Exception swallow) {
                 // best effort to clean up after each test, but may throw (ex. if callbacks where

Review Comment:
   Not introduced in this, just a suggestion since I noticed the typo.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: rename exception `e` to `swallow` where appropriate [kafka]

Posted by "ijuma (via GitHub)" <gi...@apache.org>.
ijuma commented on code in PR #19948:
URL: https://github.com/apache/kafka/pull/19948#discussion_r2150617216


##########
clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java:
##########
@@ -1977,7 +1977,7 @@ public void testOperationsBySubscribingConsumerWithDefaultGroupId(GroupProtocol
         try {
             newConsumer(groupProtocol, null, Optional.of(Boolean.TRUE));
             fail("Expected an InvalidConfigurationException");
-        } catch (InvalidConfigurationException e) {
+        } catch (InvalidConfigurationException swallow) {

Review Comment:
   This is a bad pattern: `assertThrow` should be used instead.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: rename exception `e` to `swallow` where appropriate [kafka]

Posted by "Abhiram98 (via GitHub)" <gi...@apache.org>.
Abhiram98 commented on code in PR #19948:
URL: https://github.com/apache/kafka/pull/19948#discussion_r2141506104


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumerTest.java:
##########
@@ -182,7 +182,7 @@ public void resetAll() {
         if (consumer != null) {
             try {
                 consumer.close(CloseOptions.timeout(Duration.ZERO));
-            } catch (Exception e) {
+            } catch (Exception swallow) {
                 // best effort to clean up after each test, but may throw (ex. if callbacks where

Review Comment:
   Thanks! I missed it



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: rename exception `e` to `swallow` where appropriate [kafka]

Posted by "kirktrue (via GitHub)" <gi...@apache.org>.
kirktrue commented on code in PR #19948:
URL: https://github.com/apache/kafka/pull/19948#discussion_r2141239123


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/AsyncKafkaConsumerTest.java:
##########
@@ -182,7 +182,7 @@ public void resetAll() {
         if (consumer != null) {
             try {
                 consumer.close(CloseOptions.timeout(Duration.ZERO));
-            } catch (Exception e) {
+            } catch (Exception swallow) {
                 // best effort to clean up after each test, but may throw (ex. if callbacks where

Review Comment:
   ```suggestion
                   // best effort to clean up after each test, but may throw (ex. if callbacks were
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] MINOR: rename exception `e` to `swallow` where appropriate [kafka]

Posted by "Abhiram98 (via GitHub)" <gi...@apache.org>.
Abhiram98 commented on PR #19948:
URL: https://github.com/apache/kafka/pull/19948#issuecomment-2961062325

   I'd like to request a review from @mjsax - since you worked on [this](https://github.com/apache/kafka/pull/19669) PR to clean up tests, and made those renames 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org