[英]Catch with multiple exceptions not catching exceptions in obfuscated build
I have used catch block with multiple exceptions , Which is working fine in unobfuscated build, But not catching exception in obfuscated build. 我使用了具有多个异常的catch块,这在未经模糊处理的构建中工作正常,但在模糊构建中没有捕获异常。
I am using proguard-maven-plugin 我正在使用proguard-maven-plugin
try {
...
} catch (ServletException | IOException e){
...
}
Is there any proguard rule i need to add for this? 我需要为此添加任何proguard规则吗?
Because its working fine When i write my code as 因为它的工作正常当我编写我的代码时
try {
...
} catch (ServletException e) {
...
} catch (IOException e) {
...
}
There can be a bug from Proguard. Proguard可能存在错误。 https://sourceforge.net/p/proguard/bugs/607/ Unfortunately no solution was provided.
https://sourceforge.net/p/proguard/bugs/607/很遗憾没有提供解决方案。 I suggest to avoid multi-catch until it's not fixed if possible.
我建议避免多次捕获,直到它被修复,如果可能的话。
Multi catch exception can be used when there are chances of raising exceptions without any relation(parent-child), something like IOException
and ArithmeticException
and NullPointerException
. 当有可能在没有任何关系(父子)的情况下引发异常时,可以使用多捕获异常,例如
IOException
和ArithmeticException
以及NullPointerException
。 But you can't use multi catch block with the exception like IOException
and FileNotFoundException
because IOException
is the parent of FileNotFoundException
. 但是您不能使用多捕获块,例如
IOException
和FileNotFoundException
因为IOException
是FileNotFoundException
的父级。
Multi catch block is given in java7 just for programmer's convenience. java7中给出了多捕获块,只是为了方便程序员。 It doesn't affect the execution time.
它不会影响执行时间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.