Daniil wrote:
Rafael Steil wrote:try-cath is not a solution ;)
That's what exceptions are for - get rid of the hundreds of error-checking
NullPointerException is a bug in your code and must be handled in the correct way. When an exception occur, the VM must get the entine call stack, generate messages, stop processing and so on. This is very costing, and worst, using empty try-catch blocks, you will never know that the bug is occuring ( logging may be an option, but when will look at the web server log? ;) ).
Daniil wrote:
if()'s. OK, so
if (s != "") {
start = Integer.parseInt(s);
}
And what if s == "laskdjfhkasdjfh"?
I suppose passing empty start is a bug in JForum anyway.
ops. s != "" is bogus uaheuaheuahe.. sorry.. It must be !s.equals("") ..
And yes, start must not be empty, but we should make the validation ( and not expect for the exception ).
Anyway, where this bug was thrown?
Rafael
[originally posted on jforum.net by Rafael Steil]