Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle possibly null (invalid) records
- Loading branch information
Showing
1 changed file
with
4 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ record = new Recordv5(buff); | |
break; | ||
default: | ||
if (logUnhandledVersions) { | ||
// this means the record stays null. we need to check for that when handling. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
gdusbabek
Author
Collaborator
|
||
logger.warn(String.format("Netflow v%d is not supported", version)); | ||
if (logger.isDebugEnabled()) | ||
logPacket(e.getRemoteAddress(), buff.duplicate()); | ||
|
@@ -82,8 +83,9 @@ record = new Recordv5(buff); | |
} | ||
|
||
// Send record to backends | ||
for (AbstractBackend backend : backEnds) | ||
backend.write(record); | ||
if (record != null) | ||
for (AbstractBackend backend : backEnds) | ||
backend.write(record); | ||
} | ||
|
||
// dumps the contents of a buffer | ||
|
Nit: would it be any cheaper to return here than to evaluate
record
for null later?