Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PluginConsumer: fix a number of bugs #422

Merged
merged 1 commit into from
Sep 10, 2017
Merged

PluginConsumer: fix a number of bugs #422

merged 1 commit into from
Sep 10, 2017

Conversation

dhalperi
Copy link
Member

@dhalperi dhalperi commented Sep 8, 2017

  1. Inability to handle serialized objects bigger than 2GB
  2. Leaked streams

The fix for 1 involves not reading the data into an array before
passing it to the deserializer.

The fix for 2 involves making sure we close streams, even in exception cases.
Guava's Closer makes this easier, although it still throws IOException which
makes integration with Batfish's exception policies more challenging.

1. Inability to handle serialized objects bigger than 2GB
2. Leaked streams

The fix for 1 involves not reading the data into an array before
passing it to the deserializer.

The fix for 2 involves making sure we close streams, even in exception cases.
Guava's Closer makes this easier, although it still throws IOException which
makes integration with Batfish's exception policies more challenging.
}

protected byte[] fromGzipFile(Path inputFile) {
try {
FileInputStream fis = new FileInputStream(inputFile.toFile());
GZIPInputStream gis = new GZIPInputStream(fis);
byte[] data = IOUtils.toByteArray(gis);
Copy link
Member Author

Choose a reason for hiding this comment

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

This file stream was leaked -- IOUtils.toByteArray does not close the input stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants