I have a method that can throw two different exceptions, CommuncationException and SystemException. In both cases I do the same three-line code block.
try {
 ...
}
catch (CommunicationException ce) {
   ...
}
catch {SystemExcetion se) {
   ... 
}
Is there any possibility to do it like that?
try {
   ...
}
catch (CommunicationException ce, SystemException se) {
   ...
}
Then I would not have to write this much code. I know I could extract the exception handling to a private method, but since the code is only 3 lines long, the method definition would take more code than the body itself.
 
     
     
     
     
     
     
     
     
     
     
    