You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/10/16 19:46:53 UTC
[GitHub] [lucene-solr] muse-dev[bot] commented on a change in pull request #1997: SOLR-14940: Add ability to remove SolrCore.closeHooks. Keep reference…
muse-dev[bot] commented on a change in pull request #1997:
URL: https://github.com/apache/lucene-solr/pull/1997#discussion_r506688097
##########
File path: solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
##########
@@ -415,19 +415,15 @@ private void fetchIndex(SolrParams solrParams, SolrQueryResponse rsp) throws Int
}
static Long getCheckSum(Checksum checksum, File f) {
- FileInputStream fis = null;
checksum.reset();
byte[] buffer = new byte[1024 * 1024];
int bytesRead;
- try {
- fis = new FileInputStream(f);
+ try (final FileInputStream fis = new FileInputStream(f)) {
while ((bytesRead = fis.read(buffer)) >= 0)
checksum.update(buffer, 0, bytesRead);
return checksum.getValue();
} catch (Exception e) {
Review comment:
*RESOURCE_LEAK:* resource of type `java.io.FileInputStream` acquired by call to `FileInputStream(...)` at line 421 is not released after line 425.
**Note**: potential exception at line 422
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org