Hi Jan,
Interesting topic. Frankly I'm not sure if the finally clause is a must have in general. Event though in this case it might, but still not sure... I'd like to hear comments from others in this group.
Marek
On Oct 21, 2012, at 2:06 PM, Jan Algermissen <jan.algermissen_at_nordsc.com> wrote:
> Hi
>
> in the spec it says in the reader interceptor example
>
>
> @Override
> Object aroundReadFrom(ReaderInterceptorContext ctx) ... {
>
> InputStream old = ctx.getInputStream();
> ctx.setInputStream(new GZIPInputStream(old));
> try {
>
> return ctx.proceed();
> } finally {
>
> ctx.setInputStream(old);
> }
>
> }
>
>
> Which means that the old input stream will *always* be restore, not just in the exceptional case.
>
> I wonder: am I just making some stupid mistake or is that a bug in the text or is that a pattern that has to be applied to every reader interceptor anyone is going to write?
>
>
> Jan