9
EaZyCode
182d

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.

Comments
  • 1
    I guess that even with the textbox working as intended you would not always get usable results by directly putting binary data in there.
    Maybe you could use base64 to encode it before printing it as text
  • 1
    @-Tor yes, but it is Java internal. That doesn't help me

    @SanitizedOutput the reason I did this Text box was to show there will be random characters after encoding
  • 3
    Time to try out JavaFX or Swing and create a bug report to give to your teacher as the excuse :)
  • 0
    While I hate Java in general. I do like javafx, with the Jfoenix library added
  • 1
    @KasperNS Why do you hate Java?
  • 0
    @Unoriginal it's kinda like the iPhone of programming languages. It's not inherently bad, in fact it's actually really good, and can do a lot of great things.

    There are just so many alternatives, with better support, more features, and easier to use. And you can't even argue about cross platform any more, since most backend technologies can be run on anything.

    But the main reason I don't like Java, is that it's going to be commercialized from next year. No more free development in Java. You need to have a license to deploy
  • 0
    @-Tor okay sorry, I had misunderstood it then. However my other points still stand I believe
  • 0
    @Proximyst I might be being stupid because I haven't had my coffee yet but isn't JTextField Swing?
Your Job Suck?
Get a Better Job
Add Comment