Skip to content

Commit

Permalink
Move Map creation out of try block
Browse files Browse the repository at this point in the history
  • Loading branch information
acoburn committed Nov 17, 2018
1 parent 356585c commit 8f649b4
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -273,11 +273,11 @@ protected void checkForBadDigest(final Digest digest) {
}

protected CompletableFuture<Void> persistContent(final IRI contentLocation, final BinaryMetadata metadata) {
final Map<String, String> md = new HashMap<>();
metadata.getSize().ifPresent(size -> md.put(CONTENT_LENGTH, size.toString()));
metadata.getMimeType().ifPresent(mimeType -> md.put(CONTENT_TYPE, mimeType));
try {
final InputStream input = new FileInputStream(entity);
final Map<String, String> md = new HashMap<>();
metadata.getSize().ifPresent(size -> md.put(CONTENT_LENGTH, size.toString()));
metadata.getMimeType().ifPresent(mimeType -> md.put(CONTENT_TYPE, mimeType));
return getServices().getBinaryService().setContent(contentLocation, input, md)
.whenComplete(HttpUtils.closeInputStreamAsync(input));
} catch (final IOException ex) {
Expand Down

0 comments on commit 8f649b4

Please sign in to comment.