Fix checkstyle in RedirectIpNextHopEcHandler 38/80838/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2019 13:06:35 +0000 (14:06 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2019 14:44:04 +0000 (15:44 +0100)
Simple offences, like long lines and extra whitespace.

Change-Id: Ib2b5e4fefe4c82073441fdb446d2c67805a69124
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/extensions/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/extended/communities/RedirectIpNextHopEcHandler.java

index a35b000868f8f92ae43433a2bb4a1504cdaeefa2..982a6c95f974d0a7d016e1ba17ec286109fd3005 100644 (file)
@@ -5,13 +5,11 @@
  * 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.protocol.bgp.flowspec.extended.communities;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
 import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunityParser;
 import org.opendaylight.protocol.bgp.parser.spi.extended.community.ExtendedCommunitySerializer;
 import org.opendaylight.protocol.util.ByteBufWriteUtil;
@@ -34,22 +32,25 @@ public class RedirectIpNextHopEcHandler implements ExtendedCommunityParser, Exte
 
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.RedirectIpNhExtendedCommunity,
+        checkArgument(extendedCommunity instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+            .flowspec.rev180329.RedirectIpNhExtendedCommunity,
                 "The extended community %s is not RedirectIpNhExtendedCommunityCase type.", extendedCommunity);
-        final RedirectIpNhExtendedCommunity redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.RedirectIpNhExtendedCommunity) extendedCommunity).getRedirectIpNhExtendedCommunity();
+        final RedirectIpNhExtendedCommunity redirect = ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
+                .yang.bgp.flowspec.rev180329.RedirectIpNhExtendedCommunity) extendedCommunity)
+                .getRedirectIpNhExtendedCommunity();
         final IpAddress nextHopAddress = redirect.getNextHopAddress();
         if (nextHopAddress.getIpv4Address() != null) {
             ByteBufWriteUtil.writeIpv4Address(nextHopAddress.getIpv4Address(), byteAggregator);
         } else {
             ByteBufWriteUtil.writeIpv6Address(nextHopAddress.getIpv6Address(), byteAggregator);
         }
-        ByteBufWriteUtil.writeUnsignedShort((redirect.isCopy() == null || !redirect.isCopy()) ? 0 : 1, byteAggregator);
+        ByteBufWriteUtil.writeUnsignedShort(redirect.isCopy() == null || !redirect.isCopy() ? 0 : 1, byteAggregator);
     }
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
         final RedirectIpNhExtendedCommunityBuilder builder = new RedirectIpNhExtendedCommunityBuilder();
-        if (buffer.readableBytes() > Ipv6Util.IPV6_LENGTH ) {
+        if (buffer.readableBytes() > Ipv6Util.IPV6_LENGTH) {
             builder.setNextHopAddress(new IpAddress(Ipv6Util.addressForByteBuf(buffer)));
         } else {
             builder.setNextHopAddress(new IpAddress(Ipv4Util.addressForByteBuf(buffer)));
@@ -67,5 +68,4 @@ public class RedirectIpNextHopEcHandler implements ExtendedCommunityParser, Exte
     public int getSubType() {
         return SUBTYPE;
     }
-
 }