Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / AbstractMultipartRequestCallback.java
index d138b2ec79aa9ef9ace9696dd3a536c59197c6ad..f46310ea328c3c675cbc87fc368a1f5c7d507e00 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
@@ -8,13 +8,12 @@
 package org.opendaylight.openflowplugin.impl.services;
 
 import java.util.List;
-import java.util.Objects;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
 import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -35,19 +34,19 @@ public abstract class AbstractMultipartRequestCallback<T extends OfHeader> exten
     @Override
     @SuppressWarnings("unchecked")
     public void onSuccess(final OfHeader result) {
-        if (Objects.isNull(result)) {
+        if (result == null) {
             LOG.info("Response received was null.");
             collector.endCollecting(getEventIdentifier());
             return;
         }
 
         if (!isMultipart(result)) {
-            LOG.info("Unexpected response type received {}.", result.getClass());
+            LOG.info("Unexpected response type received: {}.", result.getClass());
 
             setResult(RpcResultBuilder
                     .<List<T>>failed()
-                    .withError(RpcError.ErrorType.APPLICATION,
-                            String.format("Unexpected response type received %s.", result.getClass()))
+                    .withError(ErrorType.APPLICATION,
+                            String.format("Unexpected response type received: %s.", result.getClass()))
                     .build());
         } else {
             final T resultCast = (T) result;
@@ -56,17 +55,17 @@ public abstract class AbstractMultipartRequestCallback<T extends OfHeader> exten
     }
 
     /**
-     * Check if result is multipart
+     * Check if result is multipart.
      * @param result result
      * @return true if result is multipart
      */
-    protected abstract boolean isMultipart(final OfHeader result);
+    protected abstract boolean isMultipart(OfHeader result);
 
     /**
-     * Check if result requests more multiparts
+     * Check if result requests more multiparts.
      * @param result result
      * @return true if result requests more multiparts
      */
-    protected abstract boolean isReqMore(final T result);
+    protected abstract boolean isReqMore(T result);
 
 }