users@jax-rs-spec.java.net

[jax-rs-spec users] [jsr339-experts] ReaderInterceptor example question

From: Jan Algermissen <jan.algermissen_at_nordsc.com>
Date: Sun, 21 Oct 2012 14:06:54 +0200

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