Close stream properly.

This commit is contained in:
Brian Pellin committed 2013-01-25 00:08:16 -06:00
1 parent 23c829ec5b
commit b77d2b93eb
1 file changed
+2 -6
@@ -92,7 +92,7 @@ public class PwDbV4Output extends PwDbOutput {
OutputStream compressed;
try {
cos.write(header.streamStartBytes);
HashedBlockOutputStream hashed = new HashedBlockOutputStream(cos);
if ( mPM.compressionAlgorithm == PwCompressionAlgorithm.Gzip ) {
@@ -100,13 +100,9 @@ public class PwDbV4Output extends PwDbOutput {
} else {
compressed = hashed;
}
} catch (IOException e) {
throw new PwDbOutputException("Failed to set up output stream.");
}
try {
outputDatabase(compressed);
compressed.close();
} catch (IllegalArgumentException e) {
throw new PwDbOutputException(e);
} catch (IllegalStateException e) {