Skip to content

Commit 3e4f6ab

Browse files
committed
Fixed Java 6/7 compatibility issue
1 parent e825e7b commit 3e4f6ab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/org/culturegraph/mf/stream/pipe/FileDigestCalculator.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,17 @@ public FileDigestCalculator(final String algorithm) {
6666
@Override
6767
public void process(final String file) {
6868
final String digest;
69-
try (final InputStream stream = new FileInputStream(file)) {
69+
InputStream stream = null;
70+
try {
71+
stream = new FileInputStream(file);
7072
digest = bytesToHex(getDigest(stream, messageDigest));
7173
} catch (IOException e) {
7274
throw new MetafactureException(e);
75+
} finally {
76+
if (stream != null) {
77+
try { stream.close(); }
78+
catch (final IOException e) { }
79+
}
7380
}
7481
getReceiver().process(new Triple(file, algorithm.name(), digest));
7582
}

0 commit comments

Comments
 (0)