Reputation: 105238
I'm monitoring some server logs and there are quite a few NullPointerExceptions
. The logs contain the stacktrace and the cause from getCause.
The problem is that these NPEs do not contain a cause. In the JavaDocs it says that the cause is null when it's inexistent or unknown (not very helpful).
So my question is, has somebody run into these "causeless" NPEs? If so, which was the problem in that situation? I'm kinda lost here so any insight will be appreciated.
Upvotes: 2
Views: 944
Reputation: 91911
The cause of a NullPointerException is generally very clear from the stacktrace. You look at the line where it happened and observe what can be null there. There is no further cause (cause here being a different exception that was wrapped by the NullPointerException).
If the NullPointerException has no stacktrace, that can happen and is a harder problem to diagnose, but if I understand your question that is not the case here.
Upvotes: 3
Reputation: 13841
NPEs never have causes because their generated by the JVM when you try to access a null object reference. The stacktrace should have information about the line where it happened.
Upvotes: 4