HBASE-10593 FileInputStream in JenkinsHash#main() is never closed

This commit is contained in:
Ted Yu 2014-06-08 22:08:19 +00:00
parent 961919d443
commit b436d20d5c
1 changed files with 6 additions and 2 deletions

View File

@ -253,8 +253,12 @@ public class JenkinsHash extends Hash {
byte[] bytes = new byte[512]; byte[] bytes = new byte[512];
int value = 0; int value = 0;
JenkinsHash hash = new JenkinsHash(); JenkinsHash hash = new JenkinsHash();
for (int length = in.read(bytes); length > 0; length = in.read(bytes)) { try {
value = hash.hash(bytes, length, value); for (int length = in.read(bytes); length > 0; length = in.read(bytes)) {
value = hash.hash(bytes, length, value);
}
} finally {
in.close();
} }
System.out.println(Math.abs(value)); System.out.println(Math.abs(value));
} }