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

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

     [ https://issues.apache.org/jira/browse/NUTCH-3027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Markus Jelsma resolved NUTCH-3027.
----------------------------------
    Fix Version/s: 1.20
       Resolution: Fixed

> 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
>            Assignee: Markus Jelsma
>            Priority: Trivial
>             Fix For: 1.20
>
>   Original Estimate: 1m
>  Remaining Estimate: 1m
>
> 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)