Remove RestconfDocumentedException.decodeAndThrow() 35/108535/3
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 20 Oct 2023 12:16:05 +0000 (14:16 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 20 Oct 2023 14:47:49 +0000 (16:47 +0200)
This method is not used anywhere, remove it as it binds strongly to
ErrorTags, which are a JAX-RS mapping thing (mostly).

JIRA: NETCONF-1188
Change-Id: I08f0faa8858f4835f843b3b5b4f80de1bb10fa3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/errors/RestconfDocumentedException.java

index c04d9d98e8b5ef4a3df9c7d53351622f1c98ff21..cc5f15b2bb4892cd5738cda8599b7ac9c0c687f9 100644 (file)
@@ -14,10 +14,8 @@ import java.util.Collection;
 import java.util.List;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.restconf.common.ErrorTags;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
-import org.opendaylight.yangtools.yang.common.OperationFailedException;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangNetconfError;
@@ -166,17 +164,6 @@ public class RestconfDocumentedException extends RuntimeException {
         modelContext = null;
     }
 
-    public static RestconfDocumentedException decodeAndThrow(final String message,
-            final OperationFailedException cause) {
-        for (final RpcError error : cause.getErrorList()) {
-            if (error.getErrorType() == ErrorType.TRANSPORT && error.getTag().equals(ErrorTag.RESOURCE_DENIED)) {
-                throw new RestconfDocumentedException(error.getMessage(), ErrorType.TRANSPORT,
-                    ErrorTags.RESOURCE_DENIED_TRANSPORT, cause);
-            }
-        }
-        throw new RestconfDocumentedException(message, cause, cause.getErrorList());
-    }
-
     /**
      * Throw an instance of this exception if an expression evaluates to true. If the expression evaluates to false,
      * this method does nothing.