2 * Copyright (c) 2018 Inocybe Technologies and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.core.compat;
10 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
11 import org.opendaylight.yangtools.util.concurrent.ExceptionMapper;
14 * Adapter that maps the controller API-based ReadFailedException to the mdsal API-based ReadFailedException.
16 * @author Thomas Pantelis
18 public final class ReadFailedExceptionAdapter extends ExceptionMapper<ReadFailedException> {
19 public static final ReadFailedExceptionAdapter INSTANCE = new ReadFailedExceptionAdapter();
21 private ReadFailedExceptionAdapter() {
22 super("read", ReadFailedException.class);
26 protected ReadFailedException newWithCause(String message, Throwable cause) {
27 if (cause instanceof org.opendaylight.mdsal.common.api.ReadFailedException) {
28 return new ReadFailedException(cause.getMessage(), cause.getCause());
31 return new ReadFailedException(message, cause);