1

I'm talking about this question: Java FX Null Pointer Exception when using Media Player at javafx.scene.media.MediaPlayer.init

Yes there were a couple of red flags:

  • It was a NullPointerException
  • The user was a new user

However, if you read the question carefully:

  • It wasn't an obvious dumb mistake
  • It was clearly more complicated than the average 1 rep user NullPointerException question
  • The user had written the question well and had tried obvious things

I don't think it should have been closed, I think it should be reopened.

I'm fairly certain the users problem was a a more complicated multithreading issue than a standard NPE problem, and should be reopened.

UPDATE:

The problem was caused the asker using the JavaFX API incorrectly, not by "typical standard beginner NPE mistakes". Fortunately, it was reopened and the asker was able to get some good help.

4
  • Is the answer different to what it gets in the duplicated? Is the question different? To what extent? If you had to describe the problem in a sentence what would it be?
    – Braiam
    Commented Apr 27, 2015 at 0:32
  • @Braiam The duplicated post is a canonical one for people who do dumb mistakes on calling methods on null values that don't know much about programming. It doesn't talk much about how NPEs can occur in non-threadsafe code, which was almost certainly the problem in this case.
    – durron597
    Commented Apr 27, 2015 at 0:36
  • Yes, it is a ratty problem in GSTMediaPlayer, well beyond his control. It should be reopened. Commented Apr 27, 2015 at 0:40
  • @durron597 I've changed title so it is a bit more broad (as C# have exactly the same issue with "I have NRE, here is wall of code, fix it for me since I don't bother to read existing answers/provide useful details"). Feel free to revert if you think it is too radical of change. Commented Apr 27, 2015 at 1:46

1 Answer 1

2

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.

7
  • Or, you know, you could vote as "needs more information", no?
    – Braiam
    Commented Apr 27, 2015 at 0:33
  • If you want to close it as off-topic (seeking debugging help should have minimum steps to reproduce the problem) that's fine, but there's a reason that particular close reason requires 5 votes and dupe superpowers only require one.
    – durron597
    Commented Apr 27, 2015 at 0:33
  • Personally I do feel like it's a duplicate. Something's coming up null somewhere; checking JavaFX's Media class and JavaFX's MediaPlayer class leads me to believe that one of those two constructors is throwing the NPE.
    – Makoto
    Commented Apr 27, 2015 at 0:35
  • That question talks little about how to find and debug NPEs that are caused by non-threadsafe code. It's really for beginners.
    – durron597
    Commented Apr 27, 2015 at 0:37
  • I reopened it, on the basis that the answers to the "duplicate" do not answer the question that was posted. The question could probably be improved (e.g. making it into a genuine MCVE), but comments soliciting more information seem more appropriate than just closing it.
    – James_D
    Commented Apr 27, 2015 at 0:41
  • I'm fine with this. Hopefully a better solution can come of this other than, "it's an NPE - something is null".
    – Makoto
    Commented Apr 27, 2015 at 0:47
  • FWIW NPE from new is my favorite pattern in discovering data races
    – gnat
    Commented Apr 27, 2015 at 21:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .