Skip to content

Commit

Permalink
Do not iterate notification updates
Browse files Browse the repository at this point in the history
This return statement returned the first notification update it found,
making the for loop unnecessary. Just remove the iteration and return
first from the list.

JIRA: LIGHTY-235
Signed-off-by: tobias.pobocik <[email protected]>
  • Loading branch information
Tobianas committed Sep 22, 2023
1 parent 7d44019 commit 962fc7c
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ public GetResponseToNormalizedNodeCodec(final SchemaContextProvider schemaContex
public Optional<NormalizedNode> apply(Gnmi.GetResponse response, YangInstanceIdentifier identifier)
throws GnmiCodecException {
for (Gnmi.Notification notification : response.getNotificationList()) {
for (Gnmi.Update update : notification.getUpdateList()) {
if (!notification.getUpdateList().isEmpty()) {
// Json to NormalizedNode
final NormalizedNode codecResult = updateToNormalizedNode(update, identifier);
final var update = notification.getUpdateList().get(0);
final var codecResult = updateToNormalizedNode(update, identifier);
/*
If the serialized normalized node is of type AugmentationNode we need to return the child
because the AugmentationNode has no QName so later post processing (for example restconf)
Expand Down

0 comments on commit 962fc7c

Please sign in to comment.