Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Get a devDuck
Rubber duck debugging has never been so cute! Get your favorite coding language devDuckBuy Now
Search - "java npe"
It would be much easier when a NullPointerException would log also what is null. Instead of just the line.... with multiple possibilities........5
OKAY WHAT THE FUCK JAVA.
At school we were assigned the task to do Huffman's algorithm. Since I am way ahead of all the others, I made a GUI for that. (Btw, we use BlueJ for Java, it's just painful)
Now... I made a JTextField to put the output, which would be any character from 0x0 to 0xFFFF, into it.
Apparently, there is a bug in the setText method, which throws random NullPointerExceptions right into your face if you give it those Unicode characters.
So I looked it up:
It was a Bug, in JDK 1.6.something, where putting a 0xFFFF together with a 0x10000 would cause this. Now you may think, do we still have 1.6? No, we have 1.8 v171, WHY THE FUCK DOES THIS SHIT GIVE ME A NPE?! THE WORST PART IS I CAN'T DO ANYTHING ABOUT IT!
AND IT HAS THE WORST UNDEFINED BEHAVIOR:
1. NPE, nothing else happens
2. The Text box just gets invisible, but the border stays visible + NPE
3. The box completely disappears + NPE
Try-catching it doesn't do anything, everytime I fill the box with text, one of those options happens, and the box was never to be seen again! NOT EVEN CREATING A NEW TEXT BOX AND ADDING IT TO MY WINDOW WORKS.8
There was MCQ test based on Java we were required to give by our degree college, partnered with this firm.
The image is not even the tip of the iceberg.
3 of the four options in every question were same.
Select A and later come back to the question, you'll find option C as selected.
Never was I ever this frustrated, not even all the times I've encountered a NPE.
Shitty shitty shitty as fuck.
This guy keeps insisting there’s a bug in my code, on a specific line. The stack trace shows that a NPE is thrown in his code, before that line is reached, but he won’t be persuaded by this argument and won’t send me the class.
Somehow he’s certain that Java would throw a NPE on trying to iterate through an empty list, as if his code was even returning an empty list. Can you imagine the chaos.1
Hit into NullPointerException on production then I saw this in the source code,
Sweet Zombie NullFuckingPointerException...
New Rule: When creating an API (I'm looking at you, Java), designers must include a boolean flag in the parameter list of any method which throws a NullPointerException.
If TRUE, this means that a NULL result is non-trivial and the method should therefore THROW an NPE.
If set to FALSE, this means that NULL is completely f*cking trivial so whenever there's a NULL result, just instantiate a new instance of the return type and return that, 'cause that's what was gonna happen in the catch block of the NPE anyways.2
When I don't code with IDE support, I will be like is it NullpointerException or NullPointerException