Skip to content

MINOR: Fix Javadocs for SourceTaskContext::transactionContext and SinkTaskContext::errantRecordReporter to use NoSuchMethodError instead of NoSuchMethodException#14036

Merged
gharris1727 merged 1 commit intoapache:trunkfrom
yashmayya:connect-no-such-method-error-exception
Jul 19, 2023

Conversation

@yashmayya
Copy link
Copy Markdown
Contributor

  • NoSuchMethodError is thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed.
  • NoSuchMethodException is thrown when trying to reflectively access a method that does not exist.
  • Both the SourceTaskContext::transactionContext and SinkTaskContext::errantRecordReporter methods use NoSuchMethodError in the example code block (which is the correct Throwable to use in this situation) but incorrectly specify NoSuchMethodException in their Javadocs.

* <pre>
* ErrantRecordReporter reporter;
* try {
* reporter = context.errantRecordReporter();
* } catch (NoSuchMethodError | NoClassDefFoundError e) {
* reporter = null;
* }
* </pre>

* <pre>
* TransactionContext transactionContext;
* try {
* transactionContext = context.transactionContext();
* } catch (NoSuchMethodError | NoClassDefFoundError e) {
* transactionContext = null;
* }
* </pre>

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@yashmayya
Copy link
Copy Markdown
Contributor Author

Hi @gharris1727, I noticed this small discrepancy after our related discussion here. Could you please take a look whenever you get a chance?

…kTaskContext::errantRecordReporter to use NoSuchMethodError instead of NoSuchMethodException
@yashmayya yashmayya force-pushed the connect-no-such-method-error-exception branch from d59d913 to 174dc93 Compare July 18, 2023 16:18
@C0urante C0urante added the docs label Jul 18, 2023
Copy link
Copy Markdown
Contributor

@gharris1727 gharris1727 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix! I like that the code sample is correct but the Javadoc is wrong :)
It also looks like there's no other similar mistakes.

LGTM!

@gharris1727 gharris1727 merged commit a68281b into apache:trunk Jul 19, 2023
@yashmayya
Copy link
Copy Markdown
Contributor Author

Thanks Greg!

jeqo pushed a commit to jeqo/kafka that referenced this pull request Jul 21, 2023
…stead of NoSuchMethodException (apache#14036)

Reviewed-by: Greg Harris <greg.harris@aiven.io>
Cerchie pushed a commit to Cerchie/kafka that referenced this pull request Jul 25, 2023
…stead of NoSuchMethodException (apache#14036)

Reviewed-by: Greg Harris <greg.harris@aiven.io>
jeqo pushed a commit to aiven/kafka that referenced this pull request Aug 15, 2023
…stead of NoSuchMethodException (apache#14036)

Reviewed-by: Greg Harris <greg.harris@aiven.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants