adoroszlai commented on code in PR #3699:
URL: https://github.com/apache/ozone/pull/3699#discussion_r950566220
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/CodecRegistry.java:
##########
@@ -105,15 +109,17 @@ private <T> Codec getCodec(T object) throws IOException {
*/
private <T> Codec getCodec(Class<T> format) throws IOException {
Codec<T> codec;
- if (valueCodecs.containsKey(format)) {
- codec = (Codec<T>) valueCodecs.get(format);
- } else if (valueCodecs.containsKey(format.getSuperclass())) {
- codec = (Codec<T>) valueCodecs.get(format.getSuperclass());
- } else {
- throw new IllegalStateException(
- "Codec is not registered for type: " + format);
Review Comment:
> This adds codec support for interfaces implemented and not related to the
Jira.
It is related. Generated c;ass for specific proto message extends
`GeneratedMessage`, which implements `Message`.
So generated class doesn't directly implement `Message`. Thus we need to
lookup by interface implemented by parent/ancestor.
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/CodecRegistry.java:
##########
@@ -105,15 +109,17 @@ private <T> Codec getCodec(T object) throws IOException {
*/
private <T> Codec getCodec(Class<T> format) throws IOException {
Codec<T> codec;
- if (valueCodecs.containsKey(format)) {
- codec = (Codec<T>) valueCodecs.get(format);
- } else if (valueCodecs.containsKey(format.getSuperclass())) {
- codec = (Codec<T>) valueCodecs.get(format.getSuperclass());
- } else {
- throw new IllegalStateException(
- "Codec is not registered for type: " + format);
Review Comment:
> This adds codec support for interfaces implemented and not related to the
Jira.
It is related. Generated class for specific proto message extends
`GeneratedMessage`, which implements `Message`.
So generated class doesn't directly implement `Message`. Thus we need to
lookup by interface implemented by parent/ancestor.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]