Remove EncodeConstants.SIZE_OF_{BYTE,SHORT,INT,LONG}_IN_BYTES
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / factories / ErrorMessageFactory.java
index 0024ed34e41b04cf5864dcd05e07cd5fc2cebed3..1196e416a386981d69871ea73922485e164e9eb2 100644 (file)
@@ -5,7 +5,6 @@
  * 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.openflowjava.protocol.impl.deserialization.factories;
 
 import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
@@ -55,16 +54,16 @@ public class ErrorMessageFactory implements OFDeserializer<ErrorMessage>,
         Objects.requireNonNull(registry);
 
         int startIndex = rawMessage.readerIndex();
-        ErrorMessageBuilder builder = new ErrorMessageBuilder();
-        builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
-        builder.setXid(readUint32(rawMessage));
+        ErrorMessageBuilder builder = new ErrorMessageBuilder()
+                .setVersion(EncodeConstants.OF_VERSION_1_3)
+                .setXid(readUint32(rawMessage));
         int type = rawMessage.readUnsignedShort();
         ErrorType errorType = ErrorType.forValue(type);
         if (ErrorType.EXPERIMENTER.equals(errorType)) {
             OFDeserializer<ErrorMessage> deserializer = registry.getDeserializer(
                     ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(
                             EncodeConstants.OF13_VERSION_ID, rawMessage.getUnsignedInt(
-                                    rawMessage.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES)));
+                                    rawMessage.readerIndex() + Short.BYTES)));
             rawMessage.readerIndex(startIndex);
             return deserializer.deserialize(rawMessage);
         }