From 8da2e232a1842b35969d9975b60e57ce4a25a386 Mon Sep 17 00:00:00 2001 From: Jim Balhoff Date: Fri, 16 Apr 2021 15:07:22 -0400 Subject: [PATCH] Close output streams when dumping files. --- .../geneontology/minerva/BlazegraphMolecularModelManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/minerva-core/src/main/java/org/geneontology/minerva/BlazegraphMolecularModelManager.java b/minerva-core/src/main/java/org/geneontology/minerva/BlazegraphMolecularModelManager.java index c820ab8d..0ae21aa4 100644 --- a/minerva-core/src/main/java/org/geneontology/minerva/BlazegraphMolecularModelManager.java +++ b/minerva-core/src/main/java/org/geneontology/minerva/BlazegraphMolecularModelManager.java @@ -833,8 +833,8 @@ public void dumpStoredModel(IRI modelId, File folder) throws IOException { tempFile = File.createTempFile(prefix, ".ttl"); try { BigdataSailRepositoryConnection connection = repo.getReadOnlyConnection(); + OutputStream out = new FileOutputStream(tempFile); try { - OutputStream out = new FileOutputStream(tempFile); // Workaround for order dependence of RDF reading by OWL API // Need to output ontology triple first until this bug is fixed: // https://github.com/owlcs/owlapi/issues/574 @@ -847,6 +847,7 @@ public void dumpStoredModel(IRI modelId, File folder) throws IOException { // copy temp file to the finalFile FileUtils.copyFile(tempFile, targetFile); } finally { + out.close(); connection.close(); } } catch (RepositoryException e) {