-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
public final class RequestContextUtil {
-
private static final Logger LOG = org.slf4j.LoggerFactory.getLogger(RequestContextUtil.class);
private RequestContextUtil() {
- throw new UnsupportedOperationException();
+ // Hidden on purpose
}
-
- public static <T> ListenableFuture<RpcResult<T>> closeRequestContextWithRpcError(final RequestContext<T> requestContext,
- final String errorMessage) {
+ public static <T> ListenableFuture<RpcResult<T>> closeRequestContextWithRpcError(
+ final RequestContext<T> requestContext,
+ final String errorMessage) {
RpcResultBuilder<T> rpcResultBuilder = RpcResultBuilder.<T>failed().withRpcError(RpcResultBuilder
- .newError(RpcError.ErrorType.APPLICATION, "", errorMessage));
+ .newError(ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, errorMessage));
requestContext.setResult(rpcResultBuilder.build());
closeRequestContext(requestContext);
return requestContext.getFuture();
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
public static void closeRequestContext(final RequestContext<?> requestContext) {
try {
requestContext.close();