Uncaught exceptions

Hi,

I'm loving IDEA right now, but one big issue my team and I have with it right now is that it doesn't appear to warn about possible exceptions. I know eclipse does this and I find it pretty hard to believe that IDEA does not do this. Have I just missed a setting somewhere? For example, the following code will generate a warning on make in Eclipse, but not IDEA:

public void doSomething(String myString) {
Long long = Long.parseLong(myString);
}

Long.parseLong could throw a NumberFormatException, but IDEA does not warn about it. Similarly, the following code will generate a warning in Eclipse, but not IDEA:

public void doSomething(String myString) {
String lowerString = myString.toLowerCase();
}

In that code, there is a possible NullPointerException when calling toLowerCase on myString.

Am I missing something or is there really no setting in IDEA to catch these things?

Thanks.

Brendon

2 comments
Comment actions Permalink

I'm wondering what plugins you have installed (FindBugs, PMD maybe?), cause AFAIK, Eclipse doesn't (and IMO, shouldn't!) warn about those things. I've never see Eclipse warn about it, and not catching an RuntimeException is a quite valid usecase (that's why it's a runtime exception, right?).

I can hardly believe that Eclipse knows where in the code this method is called, and if the exception is handled or not. Therefor, if it doesn't know about it, it shouldn't warn, because it would generate a lot of noice.

0
Comment actions Permalink

I don't think IntelliJ warns about about unchecked exceptions. I don't think that would be desirable anyway.

Why do you want to be warned about unchecked exceptions?

0

Please sign in to leave a comment.