Skip to content

server: avoid NPE updating a network ACL rule with no protocol - #14046

Open
nagaboinaramgopal wants to merge 1 commit into
apache:4.20from
nagaboinaramgopal:fix/networkacl-fullupgrade-null-protocol
Open

server: avoid NPE updating a network ACL rule with no protocol#14046
nagaboinaramgopal wants to merge 1 commit into
apache:4.20from
nagaboinaramgopal:fix/networkacl-fullupgrade-null-protocol

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown

On a full (non-partial) network ACL item update, transferDataToNetworkAclRulePojo clears the protocol to null before updateIcmpCodeAndTypeFullUpgrade runs, and that method called networkACLItemVo.getProtocol().equalsIgnoreCase(...) on the null protocol, throwing NullPointerException. A full upgrade with no protocol is a valid input. Compare against the constant first so a null protocol falls through to clearing the icmp fields.

Tested: new unit test updateIcmpCodeAndTypeFullUpgradeHandlesNullProtocol (fails before, passes after); full NetworkACLServiceImplTest green

On a full (non-partial) network ACL item update, transferDataToNetworkAclRulePojo
clears the protocol to null before updateIcmpCodeAndTypeFullUpgrade runs, and
that method called networkACLItemVo.getProtocol().equalsIgnoreCase(...) on the
null protocol, throwing NullPointerException. A full upgrade with no protocol is
a valid input: the parameter is optional and the mode is meant to disregard the
current configuration. Compare against the constant first so a null protocol
falls through to clearing the icmp fields.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants