Besides, the valueOf()
method of Java's Enum
class API, does anyone know, if any other Java API class throws that same exception, i.e., NullPointerException("Name is null");
?
Asked
Active
Viewed 6,785 times
3

Michał Schielmann
- 1,372
- 8
- 17

Dr Jorge
- 353
- 9
- 15
-
3I don't uderstand the downvotes. I thing the OP wants to know if there are any other methods that throw NPE with specified message("Name is null"). The message is not constant for all NPE occurances. – Michał Schielmann Sep 04 '14 at 14:24
-
possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) – Rick S Sep 04 '14 at 14:29
-
3@RickS how is it duplicate? There is no answer which method throws NPE with that message. Default NPE message is `null`. For enums it is `Name is null` if you do `valueOf(null)`; – Michał Schielmann Sep 04 '14 at 14:33
-
1@MichałSchielmann Instead of commenting and downvoting everyone, why don't you answer the question. You seem to be the NullPointer police here. – Rick S Sep 04 '14 at 14:45
-
1This question appears to be off-topic because it is about a list of things. – Henry Keiter Sep 04 '14 at 14:46
-
1@RickS why the emotions? I just think the question is valid (not duplicate for sure). It's strage, not clear. Why someone would need that - I have no idea. But that's not the reason for downvoting/flagging as duplicate. I would rather go for off-topic as Henry suggested. If I knew the answer I would have answered it. And what is wrong with downvoting wrong answers? Thats what the votes are for. – Michał Schielmann Sep 04 '14 at 14:49
1 Answers
6
There are no others:
$ pwd
/c/apps/java/jdk1.8.0/src
$ grep -r "\"Name is null"\" *
java/lang/Enum.java: throw new NullPointerException("Name is null");
There are, of course, many other Java APIs (not the Oracle Java SDK) that could throw exactly the same exception...

DavidPostill
- 7,734
- 9
- 41
- 60