I am using Eclipse Luna (tested also in Kepler so not version specific). Run on JDK 1.8_40. I would like to find places with "eaten" exceptions - e.g. inproperly handled with try/catch block.
Example code below. When I am setting Exception breakpoint as on picture e.printStackTrace() does not stop with exception.
How to make this work or any workaround / alternative ? It is handy to find out what your code is catching, and not see all the libraries code exception handling.
NOTE: Of course if we remove scope it will improperly stop in BigDecimal. where exception is raised, and also on any other exception during main() execution - in this case some ClassNotFoundException s
Common sense says it is a caught location, scope matches and Exception type also (subtype).
the API description says that it should work correctly (for each throw find a related catch): http://docs.oracle.com/javase/8/docs/jdk/api/jpda/jdi/com/sun/jdi/event/ExceptionEvent.html#catchLocation--
I can see this may be something related to Java Debugging interface itself as per long long time ago since java 1.4 - but not sure how many events are eaten when:
https://bugs.openjdk.java.net/browse/JDK-4515254
package test.me;
import java.math.BigDecimal;
public class EatExceptionBreakpoint {
public static void main(String[] args) {
try {
new BigDecimal("10 "); // how to make Exception Breakpoint to stop ?
} catch (Exception e) {
e.printStackTrace();
}
new BigDecimal("20 ");
}
}