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:
- throw exception
- catch exception , call
chain.dofilter();
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
Post a Comment