HDFS-13246. FileInputStream redundant closes in readReplicasFromCache. Contributed by liaoyuxiangqin.

This commit is contained in:
Xiao Chen 2018-03-14 21:59:26 -07:00
parent 3a0f4bc0d5
commit 5ff22d4c3a
1 changed files with 3 additions and 3 deletions

View File

@ -812,7 +812,6 @@ class BlockPoolSlice {
break;
}
}
inputStream.close();
// Now it is safe to add the replica into volumeMap
// In case of any exception during parsing this cache file, fall back
// to scan all the files on disk.
@ -835,12 +834,13 @@ class BlockPoolSlice {
return false;
}
finally {
// close the inputStream
IOUtils.closeStream(inputStream);
if (!fileIoProvider.delete(volume, replicaFile)) {
LOG.info("Failed to delete replica cache file: " +
replicaFile.getPath());
}
// close the inputStream
IOUtils.closeStream(inputStream);
}
}