I have the following code snippet
try{
}
catch (Exception e) {
log.error(e, e);
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException(e);
}
}
findbugs stataic analysis tool throws this warning on it
instanceof always returns true for all nonnull values ββin methodX, since all RuntimeException are instances of RuntimeException
what I don't understand is that its Exception is caught, not a RuntimeException, so why is this a warning?
source
share