From 1326e9fa5cffe326b82aeee9d82d008526aff947 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Mon, 5 Sep 2016 12:10:26 +0200 Subject: Cleanup TODOs and FIXMEs - Fix minor ones - Report bigger and include issue number in comment - Pull common dependencies into dependency management of common/parents Change-Id: I06a6ac37c52b603fd73ed42023d6b2e7fa18010f Signed-off-by: Maros Marsalek --- .../v3po/interfaces/acl/IetfAClWriter.java | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java index a25ddac6c..9c1098286 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/acl/IetfAClWriter.java @@ -132,9 +132,6 @@ public final class IetfAClWriter { // filter ACE entries and group by AceType final Map> acesByType = acls.stream() .flatMap(acl -> aclToAceStream(acl, writeContext)) - // TODO we should not tolerate nulls, but throw some meaningful exceptions instead - .filter(ace -> ace != null && ace.getMatches() != null && ace.getMatches().getAceType() != null && - ace.getActions() != null && ace.getActions().getPacketHandling() != null) .collect(Collectors.groupingBy(AclType::fromAce)); final InputAclSetInterface request = new InputAclSetInterface(); @@ -170,16 +167,21 @@ public final class IetfAClWriter { @Nonnull private static AclType fromAce(final Ace ace) { AclType result = null; - final AceType aceType = ace.getMatches().getAceType(); - if (aceType instanceof AceEth) { - result = ETH; - } else if (aceType instanceof AceIp) { - final AceIpVersion aceIpVersion = ((AceIp) aceType).getAceIpVersion(); - if (aceIpVersion instanceof AceIpv4) { - result = IP4; - } else { - result = IP6; + final AceType aceType; + try { + aceType = ace.getMatches().getAceType(); + if (aceType instanceof AceEth) { + result = ETH; + } else if (aceType instanceof AceIp) { + final AceIpVersion aceIpVersion = ((AceIp) aceType).getAceIpVersion(); + if (aceIpVersion instanceof AceIpv4) { + result = IP4; + } else { + result = IP6; + } } + } catch (NullPointerException e) { + throw new IllegalArgumentException("Incomplete ACE: " + ace, e); } if (result == null) { throw new IllegalArgumentException(String.format("Not supported ace type %s", aceType)); -- cgit 1.2.3-korg