Ensure workbooks are closed after reading/writing

This commit is contained in:
Owen Stephens 2019-04-09 15:02:10 +01:00
parent 461b352035
commit e2aa929908
3 changed files with 4 additions and 3 deletions

View File

@ -141,8 +141,8 @@ public class XlsExporter implements StreamExporter {
project, engine, params, serializer);
wb.write(outputStream);
wb.close();
outputStream.flush();
wb.close();
}
}

View File

@ -117,6 +117,7 @@ public class ExcelImporter extends TabularImportingParserBase {
}
JSONUtilities.append(sheetRecords, sheetRecord);
}
wb.close();
} finally {
is.close();
}
@ -146,7 +147,6 @@ public class ExcelImporter extends TabularImportingParserBase {
Workbook wb = null;
if (!inputStream.markSupported()) {
inputStream = new BufferedInputStream(inputStream);
;
}
try {
@ -238,7 +238,7 @@ public class ExcelImporter extends TabularImportingParserBase {
exceptions
);
}
super.parseOneFile(project, metadata, job, fileSource, inputStream, limit, options, exceptions);
}

View File

@ -222,6 +222,7 @@ public class ExcelImporterTests extends ImporterTest {
wb.write(outputStream);
outputStream.flush();
outputStream.close();
wb.close();
} catch (IOException e) {
return null;
}