Question:
Is it gay for a library to throw a null-pointer exception?
anonymous
2012-08-04 09:59:08 UTC
We have a Java library to access some secure content. If you pass a key name that does not exist in the keystore it throws a null-pointer exception. I think this is really lame, it should verify inputs rather than fall over internally.

Do you think that this reflects badly on the probable quality and security of the library?
Three answers:
husoski
2012-08-04 10:36:49 UTC
You mean the java.lang.NullPointerException?



Yes, it's "frivolous" (uh, "lazy" actually) to throw that exception for anything except when a null was given instead of a required object. Also, just for good design, on a method that expects to check supplied credentials, the exception thrown should be a *checked* exception, derived from Exception, not RuntimeException. A caller that doesn't catch the exception or knowingly pass it to the caller is not using the method properly.



As for "gay", I'm still preoccupied with how the mass media have distorted the meaning of "hacker", and how the rap-infused younger generation has turned the F-bomb into a random meaningless symbol. (...did I hear "Freaking right!" from the back row?)



anonymous
2012-08-04 17:01:45 UTC
I don't think library packages have sexual orientations.
anonymous
2012-08-04 17:05:45 UTC
Sooo gay. Total freakin homo crap


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...