离奇的java.io.IOException的后续的解决方案
# 折腾 # · 2021-08-26
接上文:https://www.l5v.cn/archives/302/
时隔好几个月,原本以为项目出现的 java.io.IOException: Connection reset by peer的问题已经解决,然而当我看错误日志的时候......
一言难尽,直接来个暴力解决:自定义异常处理类,直接忽略IOException。
@Override
@ExceptionHandler(StackException.class)
public ModelAndView resolveException(HttpServletRequest httpServletRequest,HttpServletResponse httpServletResponse, Object o, Exception e) {
ModelAndView mv;
if (StringUtils.containsIgnoreCase(e.toString(), "Broken pipe") ||
StringUtils.containsIgnoreCase(e.toString(), "Connection reset by peer")) {
// socket closed
return null;
}
// 省略部分代码
}
这个解决方法实在是很暴力..
如无特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:一木林多 - https://www.l5v.cn/archives/303/
如若转载,请注明出处:一木林多 - https://www.l5v.cn/archives/303/
评论