X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pcep%2Fbase-parser%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fpcep%2Fparser%2Fsubobject%2FRROLabelSubobjectParser.java;fp=pcep%2Fbase-parser%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fpcep%2Fparser%2Fsubobject%2FRROLabelSubobjectParser.java;h=00150ed2fa48ea556732a9de4e2e74133708f810;hb=573e76691c197a1756e48d54d24f1f9ee76df472;hp=cd30750d9a622065741c6062bb1be9f5e0d6a3e5;hpb=f56de4cc1d9e374e2e353f335ecc5d244060275b;p=bgpcep.git diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROLabelSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROLabelSubobjectParser.java index cd30750d9a..00150ed2fa 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROLabelSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROLabelSubobjectParser.java @@ -7,13 +7,13 @@ */ package org.opendaylight.protocol.pcep.parser.subobject; +import static com.google.common.base.Preconditions.checkArgument; import static java.util.Objects.requireNonNull; -import com.google.common.base.Preconditions; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; +import org.opendaylight.protocol.pcep.PCEPDeserializerException; import org.opendaylight.protocol.pcep.spi.LabelRegistry; -import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException; import org.opendaylight.protocol.pcep.spi.RROSubobjectParser; import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil; @@ -47,13 +47,12 @@ public class RROLabelSubobjectParser implements RROSubobjectParser, RROSubobject private final LabelRegistry registry; public RROLabelSubobjectParser(final LabelRegistry labelReg) { - this.registry = requireNonNull(labelReg); + registry = requireNonNull(labelReg); } @Override public Subobject parseSubobject(final ByteBuf buffer) throws PCEPDeserializerException { - Preconditions.checkArgument(buffer != null && buffer.isReadable(), - "Array of bytes is mandatory. Can't be null or empty."); + checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty."); if (buffer.readableBytes() < HEADER_LENGTH) { throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; Expected: >" + HEADER_LENGTH + "."); @@ -62,7 +61,7 @@ public class RROLabelSubobjectParser implements RROSubobjectParser, RROSubobject final short cType = buffer.readUnsignedByte(); - final LabelType labelType = this.registry.parseLabel(cType, buffer.slice()); + final LabelType labelType = registry.parseLabel(cType, buffer.slice()); if (labelType == null) { LOG.warn("Ignoring RRO label subobject with unknown C-TYPE: {}", cType); return null; @@ -82,7 +81,7 @@ public class RROLabelSubobjectParser implements RROSubobjectParser, RROSubobject requireNonNull(subobject.getSubobjectType(), "Subobject type cannot be empty."); final Label label = ((LabelCase) subobject.getSubobjectType()).getLabel(); final ByteBuf body = Unpooled.buffer(); - this.registry.serializeLabel(label.getUniDirectional(), label.getGlobal(), label.getLabelType(), body); + registry.serializeLabel(label.getUniDirectional(), label.getGlobal(), label.getLabelType(), body); RROSubobjectUtil.formatSubobject(TYPE, body, buffer); } }