Close OutputStream during filesystem putBlob

This commit is contained in:
Andrew Gaul 2011-11-09 10:20:51 -08:00
parent e9cff5e17c
commit 322d37897e
1 changed files with 4 additions and 2 deletions

View File

@ -208,8 +208,10 @@ public class FilesystemStorageStrategyImpl implements FilesystemStorageStrategy
Files.createParentDirs(outputFile); Files.createParentDirs(outputFile);
if (payload.getRawContent() instanceof File) if (payload.getRawContent() instanceof File)
Files.copy(File.class.cast(payload.getRawContent()), outputFile); Files.copy(File.class.cast(payload.getRawContent()), outputFile);
else else {
payload.writeTo(new FileOutputStream(outputFile)); output = new FileOutputStream(outputFile);
payload.writeTo(output);
}
} catch (IOException ex) { } catch (IOException ex) {
if (outputFile != null) { if (outputFile != null) {
outputFile.delete(); outputFile.delete();