Zip Exception not getting caught correctly

21 Views Asked by At

Here in this piece of code I am trying to catch zipping exception.

try {
    // Your code that may throw exceptions
} catch (ZipException e) {
    // Handle ZipException
} catch (IOException e) {
    // Handle IOException
} catch (Exception e) {
    // Handle other exceptions
}

I have categorised my exception in above format. Now I am getting "Invalid zip file format" which should ideally be caught in ZipException or IOException but it is getting caught in generic Exception.

Can someone help me out?

0

There are 0 best solutions below