Is a finally block without a catch block a java anti-pattern?

前端 未结 12 664
鱼传尺愫
鱼传尺愫 2020-12-05 12:35

I just had a pretty painful troubleshooting experience in troubleshooting some code that looked like this:

try {
   doSomeStuff()
   doMore()
} finally {
            


        
12条回答
  •  情深已故
    2020-12-05 13:35

    I think the real "anti-pattern" here is doing something in a finally block that can throw, not not having a catch.

提交回复
热议问题