You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by Jukka Zitting <ju...@gmail.com> on 2011/09/01 13:26:22 UTC

Resource management patterns (Was: Tika leaves files open)

Hi,

[update subject, move to dev@]

On Thu, Sep 1, 2011 at 12:41 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
> With our internal Lucene IOUtils it's even simplier, see javadocs :-)

Yep, Lucene's version is certainly better.

> It's just a few lines more code.

It's still at least 7 lines of wrapper code compared to my 3 extra
lines over the ARM pattern in Java 7. And you need an extra variable
for each type of exceptions (what about Throwables?) that may be
thrown by the code in question. In Tika that would typically be at
least three variables, one each for IO-, SAX- and TikaExceptions.

I think that's too high a price to pay for the IMHO rather marginal
benefits. Let's wait for the upgrade to Java 7 and do it properly
then.

BR,

Jukka Zitting

Re: Resource management patterns (Was: Tika leaves files open)

Posted by Michael McCandless <lu...@mikemccandless.com>.
On Thu, Sep 1, 2011 at 7:26 AM, Jukka Zitting <ju...@gmail.com> wrote:
> Hi,
>
> [update subject, move to dev@]
>
> On Thu, Sep 1, 2011 at 12:41 PM, Uwe Schindler <uw...@thetaphi.de> wrote:
>> With our internal Lucene IOUtils it's even simplier, see javadocs :-)
>
> Yep, Lucene's version is certainly better.
>
>> It's just a few lines more code.
>
> It's still at least 7 lines of wrapper code compared to my 3 extra
> lines over the ARM pattern in Java 7. And you need an extra variable
> for each type of exceptions (what about Throwables?) that may be
> thrown by the code in question. In Tika that would typically be at
> least three variables, one each for IO-, SAX- and TikaExceptions.
>
> I think that's too high a price to pay for the IMHO rather marginal
> benefits. Let's wait for the upgrade to Java 7 and do it properly
> then.

OK let's wait for Java 7...

Mike McCandless

http://blog.mikemccandless.com