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

Yaniv Kunda updated TIKA-1719:
------------------------------
    Attachment: TIKA-1719.patch

> Utilize try-with-resources where it is trivial
> ----------------------------------------------
>
>                 Key: TIKA-1719
>                 URL: https://issues.apache.org/jira/browse/TIKA-1719
>             Project: Tika
>          Issue Type: Improvement
>          Components: cli, core, example, gui, packaging, parser, server
>            Reporter: Yaniv Kunda
>            Priority: Minor
>              Labels: easyfix
>             Fix For: 1.11
>
>         Attachments: TIKA-1719.patch
>
>
> The following type of resource usages:
> {code}
>     AutoCloseable resource = ...;
>     try {
>         // do something with resource
>     } finally {
>         resource.close();
>     }
> {code}
> {code}
>     AutoCloseable resource = null;
>     try {
>         resource = ...;
>         // do something with resource
>     } finally {
>         if (resource != null) {
>             resource.close();
>         }
>     }
> {code}
> and similar constructs can be trivially replaced with Java 7's 
> try-with-resource statement:
> {code}
>     try (AutoCloseable resource = ...) {
>         // do something with resource
>     }
> {code}
> This brings more concise code with less chance of causing resource leaks.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to