Minor refactoring due to change in the library model
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / translator / ErrorTranslator.java
index 3ff9d9d1d0af0eb6059a62470e836e32964caa4d..8a26264fbe2e9bbd04a01feb6f5cc51a67ea5b03 100644 (file)
@@ -1,13 +1,21 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.openflowplugin.openflow.md.core.translator;
 
 import java.math.BigInteger;
+import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
 
-import org.opendaylight.openflowplugin.openflow.md.core.ByteUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.IMDMessageTranslator;
 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.errors.rev131116.ErrorType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeErrorNotification;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeErrorNotificationBuilder;
@@ -27,8 +35,8 @@ public class ErrorTranslator implements IMDMessageTranslator<OfHeader, List<Data
         if (msg instanceof ErrorMessage) {
             ErrorMessage message = (ErrorMessage) msg;
             List<DataObject> list = new CopyOnWriteArrayList<DataObject>();
-            LOG.error(" Error Message received: type={}[{}], code={}[{}], data={}[{}] ", message.getType(),
-                    message.getTypeString(), message.getCode(), message.getCodeString(), new String(message.getData()),
+            LOG.debug(" Error Message received: type={}[{}], code={}[{}], data=[{}] ", message.getType(),
+                    message.getTypeString(), message.getCode(), message.getCodeString(),
                     ByteUtil.bytesToHexstring(message.getData(), " "));
 
             // create a Node Error Notification event builder
@@ -54,7 +62,7 @@ public class ErrorTranslator implements IMDMessageTranslator<OfHeader, List<Data
             return list;
         } else {
             LOG.error("Message is not of Error Message ");
-            return null;
+            return Collections.emptyList();
         }
     }