Catch with a few exceptions without catching exceptions in obfuscation

I used a catch block with a few exceptions, which works fine in an unobfuscated build, but not a catching exception in an obfuscated build.

I am using proguard-maven-plugin

try { ... } catch (ServletException | IOException e){ ... } 

Is there any proguard rule that needs to be added for this?

Because it works fine when I write my code like

 try { ... } catch (ServletException e) { ... } catch (IOException e) { ... } 
+5
source share
2 answers

There may be a bug in Proguard. https://sourceforge.net/p/proguard/bugs/607/ Unfortunately, no solution was provided. I suggest avoiding multiple catch until it is fixed, if possible.

+2
source

A multi-word exception can be used when there is a possibility of exceptions without any parent-child relationship, for example, IOException and ArithmeticException and NullPointerException . But you cannot use a multi catch block with exceptions like IOException and FileNotFoundException because IOException is the parent of FileNotFoundException .

The multi catch block is provided in java7 just for the convenience of the programmer. This does not affect runtime.

0
source

Source: https://habr.com/ru/post/1273346/


All Articles