Skip to main content
8 events
when toggle format what by license comment
May 5, 2015 at 15:54 vote accept Tavo
May 5, 2015 at 15:51 comment added ryanyuyu @Tavo Like I said, both answer have two separate approaches to solving a problem. Both can be independently useful (or not). Fixing this specific NPE is useful, and so is rewriting code to completely avoid a bad situation that lead to this NPE. If the user still runs into a NPE in a different context, a new question is fine. If it's the same context, the user has your answer as guidance.
May 5, 2015 at 15:48 comment added Tavo Sorry, I might not have been clear in my comment. I was talking specifically about the NPE in his case, not NPEs in general, not exceptions in general either.
May 5, 2015 at 15:40 comment added ryanyuyu @Tavo so you're saying that the original question is more like what is an exception and how do I fix it? That is a really broad question that entire books are devoted to. Keep in mind that your response to fix this immediate (NPE) problem is still useful. But the alternate approach has the potential to be also useful.
May 5, 2015 at 15:37 comment added Tavo But then the user will have more knowledge of why it happens and might be able to resolve it on his own.
May 5, 2015 at 15:36 comment added ryanyuyu @Tavo following the best practices, the user will encounter the Exception, in a completely new context. This (assuming it's not closed) will warrant a completely separate answer from the original question.
May 5, 2015 at 15:31 comment added Tavo As much as I agree with your comment, my dilemma comes from the fact that yes, the user will use a new approach that will get rid of the exception. But when faced with a NullPointerException again, he will have to ask (almost) the same question.
May 5, 2015 at 15:12 history answered ryanyuyu CC BY-SA 3.0