Remove RestCodec's identityref handling 54/100554/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 12 Apr 2022 15:47:46 +0000 (17:47 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 12 Apr 2022 16:08:46 +0000 (18:08 +0200)
The sole caller is intercepting IdentityrefTypeDefinition before
invoking this method, so this code is dead. Remove it.

JIRA: NETCONF-871
Change-Id: I1f2a9b2f343c7b802e8c61c755a9f2a4c5b56394
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/codecs/RestCodec.java

index dbfeb72e089d9f9e335ce5314fb9266462c1cefd..88031f577806e0b00c78c77b5dbf17cca6c7993d 100644 (file)
@@ -11,7 +11,6 @@ import org.opendaylight.restconf.common.util.RestUtil;
 import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -29,16 +28,7 @@ public final class RestCodec {
         final TypeDefinition<?> type = RestUtil.resolveBaseTypeFrom(typeDefinition);
 
         try {
-            if (type instanceof IdentityrefTypeDefinition) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug(
-                        "Value is not instance of IdentityrefTypeDefinition but is {}. "
-                                + "Therefore NULL is used as translation of - {}",
-                        input == null ? "null" : input.getClass(), String.valueOf(input));
-                }
-                // FIXME: this should be a hard error
-                return null;
-            } else if (type instanceof InstanceIdentifierTypeDefinition) {
+            if (type instanceof InstanceIdentifierTypeDefinition) {
                 // FIXME: what is it that we are trying to decode here and why?
                 return new StringModuleInstanceIdentifierCodec(schemaContext).deserialize(input);
             } else {