Skip to content

Commit

Permalink
handle possibly null (invalid) records
Browse files Browse the repository at this point in the history
  • Loading branch information
gdusbabek committed Dec 20, 2010
1 parent 2ad5070 commit db97d53
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/com/rackspace/flewton/CollectorHandler.java
Expand Up @@ -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.

Copy link
@eevans

eevans Dec 20, 2010

Collaborator

Nit: would it be any cheaper to return here than to evaluate record for null later?

This comment has been minimized.

Copy link
@gdusbabek

gdusbabek Dec 22, 2010

Author Collaborator

I'm not sure if it would be faster, but it's a harmless change.

logger.warn(String.format("Netflow v%d is not supported", version));
if (logger.isDebugEnabled())
logPacket(e.getRemoteAddress(), buff.duplicate());
Expand All @@ -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
Expand Down

0 comments on commit db97d53

Please sign in to comment.