package org.kungfoocoder.sonarqube.bugs;
public class FalsePositiveNestedTry {
interface CallBack {
void callback() throws Exception;
}
void useCallback(CallBack callback) throws Exception {
callback.callback();
}
void test () {
try {
useCallback(new CallBack() {
@Override
public void callback() throws Exception {
try { // ← False Positive squid:S1141 (Try-catch blocks should not be nested)
Thread.sleep(1000);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
}
}
});
} catch (Exception e) {
System.out.println("This must be here for a reason, right? msg: " + e.getMessage());
}
}
}
--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/6be47c41-33a9-43e5-b099-bb97cd147b80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.