Junos: parse and warn on empty interface description#8972
Merged
dhalperi merged 2 commits intobatfish:masterfrom Mar 18, 2024
Merged
Junos: parse and warn on empty interface description#8972dhalperi merged 2 commits intobatfish:masterfrom
dhalperi merged 2 commits intobatfish:masterfrom
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #8972 +/- ##
=======================================
Coverage 72.51% 72.51%
=======================================
Files 3323 3323
Lines 169630 169630
Branches 19914 19914
=======================================
+ Hits 123004 123010 +6
+ Misses 37462 37455 -7
- Partials 9164 9165 +1 |
dhalperi
reviewed
Mar 15, 2024
Member
dhalperi
left a comment
There was a problem hiding this comment.
Reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @zergling-aws)
projects/batfish/src/main/java/org/batfish/grammar/flatjuniper/ConfigurationBuilder.java line 4929 at r1 (raw file):
} catch (NullPointerException e) { warn(ctx, "Batfish does not support an empty description"); }
The better way to do this would be to check for null.
if (ctx.description() == null) {
warn...
} else {
setDesc...
}
But I wonder -- why accept description missing vs just not parse it?
Code quote:
try {
String text = toString(ctx.description());
_currentInterfaceOrRange.setDescription(text);
} catch (NullPointerException e) {
warn(ctx, "Batfish does not support an empty description");
}
dhalperi
reviewed
Mar 18, 2024
Member
dhalperi
left a comment
There was a problem hiding this comment.
Reviewed 4 of 4 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @zergling-aws)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The prevents crashing when interface description is empty. Junos will ignore an interface statement with an empty description (ie the statement has no effect).