schema-registry icon indicating copy to clipboard operation
schema-registry copied to clipboard

Document configure only should be called once

Open slominskir opened this issue 3 years ago • 3 comments

Fixes https://github.com/confluentinc/schema-registry/issues/1903

slominskir avatar Jun 09 '21 17:06 slominskir

I don't think a Javadoc comment will save anyone from accidentally calling the configure method more than once.

If the purpose is to prevent that from happening, why not throw IllegalStateException, for example?

OneCricketeer avatar Jun 16 '21 14:06 OneCricketeer

Documenting the expected behavior is better than nothing. An Exception is more direct, but also more invasive and risky to implement - that configure method is inherited and overridden all the way up to AbstractKafkaAvroDeserializer and AbstractKafkaAvroSerializer. Where would this Exception be thrown from and how is the called state maintained? I figured just documenting the current behavior was good enough, but throwing an Exception sounds good if someone else wants to spend the time to write it and test it.

slominskir avatar Jun 16 '21 20:06 slominskir

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

cla-assistant[bot] avatar Sep 25 '23 16:09 cla-assistant[bot]