On Mar 15, 2010, at 2:42 PM, Yury Luneff wrote:


Yury,

I think that something is catching the exceptions and not rendering
anything. Do you have any custom filters? My understanding is that
this anti-pattern will break exception reporting in a filter:

try {
  return handler.service(request, response);
} catch (Exception e) {
  log.debug("i just silently broke something", e)
  //@bug: here, exception caught!
}
i think i had exactly that (no servlet api knowledge, i'm stupid, i'm
ok with it):
public RequestFilter buildTimingFilter(final Logger logger) {
       return new RequestFilter() {
public boolean service(Request request, Response response, RequestHandler handler) throws IOException {
               long startTime = System.currentTimeMillis();
               boolean successful = true;

               try {
// The responsibility of a filter is to invoke the corresponding method // in the handler. When you chain multiple filters together, each filter // received a handler that is a bridge to the next filter.
                   successful = handler.service(request, response);
               } finally {
long elapsed = System.currentTimeMillis() - startTime;

                   if (!successful) {
logger.error(String.format("%s not found", request.getPath()));
                   } else {
                       logger.info(
                               String.format(
                                       "Request time: %d ms for %s",
                                       elapsed,
                                       request.getPath()));
                   }
                   return successful;
               }
           }
       };
   }

Ok... having a return or throw statement in a 'finally' clause is bad java. I'm glad you found the issue, though!

--
Robert Hailey


Reply via email to