mrszj / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Swallowing exceptions prevents effective debugging of the GuiceFilter #688

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In GuiceFilter you just try/finally possible exceptions in at least two 
locations in the code, see

http://code.google.com/p/google-guice/source/browse/extensions/servlet/src/com/g
oogle/inject/servlet/GuiceFilter.java#124

http://code.google.com/p/google-guice/source/browse/extensions/servlet/src/com/g
oogle/inject/servlet/GuiceFilter.java#199

Please at least log and rethrow the exceptions in a catch using 

  catch(Throwable e) {
    logger.warn("...", e);
    throw e;
  }

so that one might know why the filter failed.

TIA

Original issue reported on code.google.com by carstenk...@yahoo.de on 27 Feb 2012 at 10:50

GoogleCodeExporter commented 9 years ago
try {
 ..
} finally {
 ..
}

doesn't swallow exceptions.  It makes sure that certain things happen even if 
an exception is thrown.  When the finally block finishes, the stack continues & 
the exception continues propagating.

Original comment by sberlin on 27 Feb 2012 at 11:22

GoogleCodeExporter commented 9 years ago
Oh, dear, I should not try read code that late in the day...
Thanks for pointing this out.

Original comment by carstenk...@yahoo.de on 1 Mar 2012 at 9:40