Bump MRI upstreams
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / util / RequestContextUtil.java
index ebd788404d7fe7efb524084d0357d003d3192791..05a36fc01b0ece95d86bfc98c2dcb999c115a887 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -9,29 +9,30 @@ package org.opendaylight.openflowplugin.impl.services.util;
 
 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();