java - What happens if one filter throws Exceptions in servlet? -


i want add filter existing project, , don't expect filter affect original process in abnormal case. in cases, original filter should executed.

so, want know, how should process when catch exception:

  1. throw exception
  2. catch exception , call chain.dofilter();
  3. do nothing, following code:

    if (filter != null) {      filter.dofilter(req,resp,chain);     // should catch exception here? } else {      chain.dofilter(req,resp); } 

thanks all.

nest try-catch block inside if(filter!=null) instance:

if(filter != null){      try{} catch (exception e){         //do     } } 

also can use finally after catch clean or code want run no whether exception caught or not.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -