Explanations of common Java exceptions

java.lang
ArithmeticException You are trying to use your computer to solve a mathematical problem that you cannot solve yourself. Read up on your arithmetics and try again.
ArrayIndexOutOfBoundsException See IndexOutOfBoundsException. The difference is that this exception refers to more than one finger.
ArrayStoreException You have used all your arrays and need to buy more from the array store.
ClassCastException You need to stay in the class or caste you were born into. Java will not accept dailits acting as kshatriyas or noblemen pretending to be working class. Note the spelling mistake (of caste) that was introduced in Java 1.0 and has not been corrected for backwards compatability reasons.
ClassNotFoundException You seem to have invented your own class. There are also caste systems that are not yet implemented in Java, most notibly the balinese caste system. For example, if you are a wesia, use the indian counterpart vaishya.
CloneNotSupportedException You are a clone. Find the original you, tell him what you want to do and then kill yourself.
IllegalAccessException You are a burgler that are running a Java program during a burglery. Please finish stealing the computer, leave the premises and try again.
IllegalArgumentException You have tried to protest against a previous exception.
IllegalMonitorStateException Please turn your computer screen back on.
IllegalStateException You come from a state that is not yet recognized by the UN, possibly Kurdistan or Palestine. Get a real citizenship, recompile your java code and try again.
IllegalThreadStateException One of the screws in your computer is threaded the wrong way. Please contact your hardware vendor.
IndexOutOfBoundsException You have put your index finger in an unacceptable place. Reposition it and try again.
InstantiationException Not everything can happen instantly. Please be more patient.
InterruptedException Tell your colleagues, room-mates etc. to leave you alone while you are working.
NegativeArraySizeException You have created an array with negative size. This can cause information to be lost and in the long run the Universe will be destroyed. Be happy that Java noticed what you were doing and DON'T DO IT AGAIN.
NoSuchFieldException You are trying to have a picknick on a field that does not exist. You can also get this exception if you try to visit an airfield that in fact does exist, but has been classified as top-secret. I'd give you examples, but then I'd have to kill you.
NoSuchMethodException Don't use that method! Please, do things like we have always done.
NullPointerException You do not own a dog. Get one, for example a brittany spaniel, and try again.
NumberFormatException You are using outdated units of measurement, for example inches or pints. Convert to SI. There is a known bug that causes this exception to be thrown if you are very short or tall.
RuntimeException You cannot run fast enough, possibly due to obesity. Turn off your computer and go out and get som exercise.
SecurityException You have been deemed a threat to nationaly security. Please sit still and wait for the authorities to come and get you.
StringIndexOutOfBoundsException Your panties have shiften out of place. Adjust them and try again. You can also get this exception if you are not wearing any panties at all.
UnsupportedOperationException You are trying to have an operation that for som reason, ethical or otherwise, is not supported by Java. Examples of this include unneeded amputations, for example circumcisions. Please stop abusing your body and do not remove pieces of you child, damn it!
 

java.util
ConcurrentModificationException Someone else has modified your Java code. You should probably change your password.
EmptyStackException In order for Java to work, you must have a stack of Java books on your desk. Actually, one is enough if it is really thick.
MissingResourceException You are too poor to be using Java. Switch to a cheaper language (such as Whitespace, Shakespeare, Cow, Spaghetti or C#).
NoSuchElementException There are only four elements (earth, water, air, fire). The Fifth Element is just a movie.
TooManyListenersException You are bugged by too many secret organizations. Expect a SecurityException soon.
 

java.awt
AWTException You are using AWT, which means your GUI will be ugly. This exception is only a warning and can be ignored.
FontFormatException Your layout is ugly, or you have selected a bad font, or too many fonts. Please consult a professional designer.
HeadlessException Java thinks you are too stupid to be a programmer.
IllegalComponentStateException One of your hardware components (e.g. harddrive, CPU, RAM) is broken. Please contact your hardware vendor.
 

java.awt.color
CMMException Your CMM is broken. What ever the hell that is. I usually burn my house down and move to a new city to start over.
ProfileDataException Your personal profile contains suspicious information. If you are not a communist, terrorist, atheist etc., please contact the CIA to correct the mistake.
 

java.awt.datatransfer
MimeTypeParseException You are a bad mime. Noone can understand what you are trying to express. Try something simpler, like walking-against-the-wind och being-trapped-in-an-invisible-box.
UnsupportedFlavorException You are trying to use a flavor that is unknown to Java. Most people seem to get by using only vanilla and cherry.
 

java.beans
IntrospectionException You are too introverted. Be more extroverted. Stop being such a nerd and go out and meet some people!
PropertyVetoException One of your properties has been vetoed. The message should inform you of who did it and why. If it does not, you probably shouldn't ask.
 

java.io
CharConversionException You have been trying to incinerate something noncombustible. It is also possible that you have tried turning yourself into a fish, but that's rare.
EOFException You get this exception because you don't know what EOF stands for. Well, I'm not going to tell you, Mr Ignoramus.
FileNotFoundException A carpenter should always know where his tools are.
InterruptedIOException You have been using IO despite of an earlier IOException and your activities have been interrupted.
InvalidClassException See ClassNotFoundException.
InvalidObjectException Objection overruled, as they say in court.
IOException IO stands for input/output and has to do with sending and recieving data. IO is a security problem and should not be used.
NotActiveException This can mean two things. Either something is inactive and needs to be active, or something is active and needs to be inactive. Activate and inactivate things randomly until things work.
NotSerializableException You are trying to make a TV series based on a movie.
ObjectStreamException You have issued a stream of objections. Please limit yourself to one at a time and wait for the judge to make a ruling before issuing a new one. See InvalidObjectException.
OptionalDataException You seem to think that some optional data is required. Don't make things harder than they are.
StreamCorruptedException Your data stream is corrupted, which means that it has been stealing packages and selling them on the black market.
SyncFailedException You have tried to synchronize your failures with someone else and you have turned out to be a bigger failure that that person. Try to find someone on your own level.
UnsupportedEncodingException If you want to send something coded over the network, you have to file your encryption key with the NSA. If you don't, you will be regarded as a terrorist and dealt with in the appropriate way. If you get this exception, you should run away very fast indeed.
UTFDataFormatException UTF stands for Universal Transmission Format and is a way of transmitting data that works regardless of which format you use. You have tried to transmit data over UTF using the wrong format.
WriteAbortedException You need to write the word "aborted" somewhere in your program. It usually doesn't matter where, you just have to do it.
 

java.net
BindException Java programming and bondage don't mix.
ConnectException You are trying to connect something to something it cannot be connected to. Try to connect it to something else. Perhaps it is possible to connect your things to eachother via a special connection object that connects to both ends of your desired connection.
MalformedURLException You are making an urn and either it has the wrong shape (e.g. an "L" shape) or you have misspelled the word "urn" (e.g. "url").
NoRouteToHostException There is no route to the host. Contact the Road Administration.
PortUnreachableException Ports and harbors must be placed right next to a water body. If placed inland, they will be unreachable.
ProtocolException This is the result of a serious breach of etiquette (such as pukíng on your host). The solution is simple: Don't do that!
SocketException You have connected your computer to a power outlet of the wrong kind. Most of the times you have to find another outlet, but some computers have a switch on the back where you can set the power outlet type.
SocketTimeoutException You have connected your computer a power outlet with a timer and the time has run out. Such outlets should only be used for flat-irons and similar things.
UnknownHostException Didn't your parents teach you to not talk to strangers?
UnknownServiceException You are trying to access an unknown service. The most known unknown service is perhaps Secret Service.
URISyntaxException The sentence "You are I" is not syntactically correct. Change it to "You are me". What ever the hell that means.
 

java.rmi
AccessException You are using Microsoft Access. Please don't.
AlreadyBoundException Despite what is stated in the description of java.net.BindException, RMI does support bondage. However, you cannot tie up someone that is already bound.
ConnectException You are trying to connect something to something it cannot be connected to. Try to connect it to something else. Perhaps it is possible to connect your things to eachother via a special connection object that connects to both ends of your desired connection.
ConnectIOException You are trying to connect something that has to do with IO to something it cannot be connected to. Try to connect it to something else. Perhaps it is possible to connect your things to eachother via a special connection object that connects to both ends of your desired connection.
MarshalException Something is wrong with your marshal. What you should do depends on what kind of marshal we are talking about. It can be a field marshal, police, firefighter or just your ordinary basic marshal. Note that this exception has nothing to do with the Republic of the Marshall Islands, a.k.a. RMI.
NoSuchObjectException You are trying to use an object that does not exist. Create it or don't use it, Einstein!
NotBoundException If you are using bondage, please make sure that at least one person is tied up.
RemoteException This is a special exception that is thrown remotely. If someone else's application has become so instable that it can't even produce an exception, then you may get the exception instead. Please find the source and inform that programmer of the error.
RMISecurityException The Republic of the Marshall Islands has become instable. If you live there, you should probably leave and don't come back until your security can be guaranteed. If you live elsewhere, you can ignore this exception.
ServerException Second serve. (Or double fault if applicable.)
ServerRuntimeException Tennis matches are long enough as it is. You will get this exception if you take too long to serve.
StubNotFoundException When you go to the movies, you should always keep your stub. If you don't, and also leave the theater, you will not be let back in and you may have to buy a new ticket. So, KEEP YOUR STUB!
UnexpectedException This exception should come as a total surprise to you. If it did, everything is as it should be.
UnknownHostException Didn't your parents teach you to not talk to strangers?
UnmarshalException You have not fullfilled your duties as an officer of the law (or whatever marshal you used to work as). Note that the correct term is "used to". You have been fired (which is really ironic if you were a firefighter).
 

java.security
AccessControlException You have lost control of Microsoft Access. If you cannot regain control or stop the program in some other way, you should cut the power to your computer as fast as possible.
DigestException You should be careful with what you eat. Indigestion can be a serious problem.
GeneralSecurityException Something somewhere appears to be unsafe. If you have the power to do so, you should invade a random country (preferably in the middle east). If you do not have such power, you should at least get a gun.
InvalidAlgorithmParameterException You have explained your algorithm to a disabled person in a way that is not suited to that person's level of understanding. Keep it simple!
InvalidKeyException There are two rather different reasons for this exception: 1. You are using the wrong key. My advice is to paint small dots in different colors on your keys to help you remember which one is for which lock. 2. You are not allowed to lock up disabled people without giving them a key. If they are smart enough to figure out how to use it, they have a right to move freely.
InvalidParameterException You have used a disparaging term to describe a disabled person.
KeyException Do not try to unlock locks without a key.
KeyManagementException You have lost your key. Most likely you left it at the office (if you're trying to enter your home) or at home (if you're trying to enter the office).
KeyStoreException The explanation for the previous KeyManagementException is that there is a hole in your pocket.
NoSuchAlgorithmException You are trying to solve a problem in a previously unknown way. Stop being so damn creative and rewrite your program using old algorithms. You can also patent your idea and wait for it to be incorporated into a future Java release.
NoSuchProviderException If you are a single mom, you cannot be a housewife. First, you need to get a provider for your family.
PrivilegedActionException You have tried to take an action that you do not have the privilege to take. For example, getting away with murder is something that only famous people can do, child molestation is only for catholic priests and high ranking jehova's witnesses, and only people with managerial positions in private corporations are allowed to steal money.
ProviderException You are a woman and are trying to be the provider of a family. Obviously, your husband cannot be a housewife, so you need to let him do the providing. Thinking that Java is old-fashioned will not change reality. This is how things work. Deal with it.
SignatureException Either you have forged someone else's signature, or your signature unacceptable. A signature cannot be too ugly, too readable or too large.
UnrecoverableKeyException Damn. You dropped your key down a drain. The only comfort I can offer is that the key should be unrecoverable for other people as well, so it may not be necessary to change your locks.
 

java.text
ParseException You are not making any sense. Calm down and try again.
 

Copyright © 2005 Björn Andersson