How to catch and Ignore org.apache.catalina.connector.ClientAbortException

后端 未结 3 703
猫巷女王i
猫巷女王i 2020-12-30 02:18

I want to catch and ignore the following tomcat ClientAbortException. As it is unnecessary to pay any attention on this for my program.

Any idea how and

3条回答
  •  青春惊慌失措
    2020-12-30 02:53

    since you probably don't want a dependency to Catalina, you can ignore the Exception like this (I'm assuming the ClientAbortException is the cause):

    String simpleName = e.getCause().getClass().getSimpleName();
    if (simpleName.equals("ClientAbortException")) {
        // ignore
    } else {
        // do whatever you do
    }
    

提交回复
热议问题