CLI upload-examples failed to delete file under windows

This commit is contained in:
James Agnew 2016-12-05 14:51:59 -05:00
parent ffefb79bf1
commit cfb2c51eab
2 changed files with 43 additions and 36 deletions

View File

@ -287,7 +287,6 @@ public class ExampleDataUploader extends BaseCommand {
} }
} }
if (subResourceList.size() < 10 && resources.size() > 0) { if (subResourceList.size() < 10 && resources.size() > 0) {
subResourceList.add(resources.remove(0)); subResourceList.add(resources.remove(0));
continue; continue;
@ -357,8 +356,8 @@ public class ExampleDataUploader extends BaseCommand {
Entry next = iterator.next(); Entry next = iterator.next();
// DataElement have giant IDs that seem invalid, need to investigate this.. // DataElement have giant IDs that seem invalid, need to investigate this..
if ("Subscription".equals(next.getResource().getResourceName()) || "DataElement".equals(next.getResource().getResourceName()) || "OperationOutcome".equals(next.getResource().getResourceName()) if ("Subscription".equals(next.getResource().getResourceName()) || "DataElement".equals(next.getResource().getResourceName())
|| "OperationDefinition".equals(next.getResource().getResourceName())) { || "OperationOutcome".equals(next.getResource().getResourceName()) || "OperationDefinition".equals(next.getResource().getResourceName())) {
ourLog.info("Skipping " + next.getResource().getResourceName() + " example"); ourLog.info("Skipping " + next.getResource().getResourceName() + " example");
iterator.remove(); iterator.remove();
} else { } else {
@ -437,8 +436,8 @@ public class ExampleDataUploader extends BaseCommand {
BundleEntryComponent next = iterator.next(); BundleEntryComponent next = iterator.next();
// DataElement have giant IDs that seem invalid, need to investigate this.. // DataElement have giant IDs that seem invalid, need to investigate this..
if ("Subscription".equals(next.getResource().getResourceType()) || "DataElement".equals(next.getResource().getResourceType()) || "OperationOutcome".equals(next.getResource().getResourceType()) if ("Subscription".equals(next.getResource().getResourceType()) || "DataElement".equals(next.getResource().getResourceType())
|| "OperationDefinition".equals(next.getResource().getResourceType())) { || "OperationOutcome".equals(next.getResource().getResourceType()) || "OperationDefinition".equals(next.getResource().getResourceType())) {
ourLog.info("Skipping " + next.getResource().getResourceType() + " example"); ourLog.info("Skipping " + next.getResource().getResourceType() + " example");
iterator.remove(); iterator.remove();
} else { } else {
@ -659,6 +658,7 @@ public class ExampleDataUploader extends BaseCommand {
private void downloadFileFromInternet(CloseableHttpResponse result, File localFile) throws IOException { private void downloadFileFromInternet(CloseableHttpResponse result, File localFile) throws IOException {
FileOutputStream buffer = FileUtils.openOutputStream(localFile); FileOutputStream buffer = FileUtils.openOutputStream(localFile);
try {
long maxLength = result.getEntity().getContentLength(); long maxLength = result.getEntity().getContentLength();
long nextLog = -1; long nextLog = -1;
@ -690,6 +690,9 @@ public class ExampleDataUploader extends BaseCommand {
System.err.println(); System.err.println();
System.err.flush(); System.err.flush();
} finally {
IOUtils.closeQuietly(buffer);
}
} }
} }

View File

@ -66,6 +66,10 @@
external references (and therefore can't be loaded external references (and therefore can't be loaded
by the server). Thanks to Hannes Ulrich for reporting! by the server). Thanks to Hannes Ulrich for reporting!
</action> </action>
<action type="fix">
HAPI FHIR CLI failed to delete a file when uploading
example resources while running under Windows.
</action>
</release> </release>
<release version="2.1" date="2016-11-11"> <release version="2.1" date="2016-11-11">
<action type="add"> <action type="add">