You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by "Sascha Kehrli (Jira)" <ji...@apache.org> on 2024/01/18 22:25:00 UTC

[jira] [Created] (NUTCH-3027) Trivial resource leak patch in DomainSuffixes.java

Sascha Kehrli created NUTCH-3027:
------------------------------------

             Summary: Trivial resource leak patch in DomainSuffixes.java
                 Key: NUTCH-3027
                 URL: https://issues.apache.org/jira/browse/NUTCH-3027
             Project: Nutch
          Issue Type: Bug
          Components: util
    Affects Versions: 1.20
            Reporter: Sascha Kehrli


Found a trivial resource leak in .../util/DomainSuffixes.java, where an InputStream is not closed:
{code:java}
InputStream input = this.getClass().getClassLoader().getResourceAsStream(file);
try {
    new DomainSuffixesReader().read(this, input);
} catch (Exception ex) {
    LOG.warn(StringUtils.stringifyException(ex));
} {code}
 

instead of:
{code:java}
try (InputStream input = this.getClass().getClassLoader().getResourceAsStream(file)) {
    new DomainSuffixesReader().read(this, input);
} catch (Exception ex) {
    LOG.warn(StringUtils.stringifyException(ex));
} {code}
Where the InputStream is automatically closed.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)