So I'm the guy who swung down on this particular question. No, it's probably not a run-of-the-mill NPE question, but I'm somewhat happy that at some attention had been brought to it.
The question is missing some key components.
The bug does not follow from what was provided. You cannot return null
from a new instance invocation. Where the problem was highlighted doesn't make practical sense in terms of an NPE; it has to be coming from somewhere else.
If the problem has to do with threading, then that should be mentioned explicitly rather than implicitly.
On the merit of there being the NPE in the first place I elected to close it, but if the following can be addressed, I wouldn't mind having it reopened at all.
Information about how the method is called is missing. We know that the method is invoked in init
, but we don't see where that invocation is. Perhaps we don't need to see it, but if it has to do with threading as you suspect, the more information we have, the better.
There is the tearDown
method which does operations on a contentPane
field, but that field is not initialized from the code provided. If that tearDown
method is used anywhere, then that too could generate an NPE (although it's not present in the stack).
It's difficult at first glance to repeat the same problem on another machine. That is to say, it's difficult for someone like myself with an IDE to copy that code and debug it, just to see what's going on.
To be blunt, the question needs more information about what's going on with it. I'm not going to clutch at straws trying to figure this out; that's what they are meant to do in the process of debugging.
Again, I state that I'd be fine to reopen the question personally if more information as to what's really going on here is provided.