Vous êtes sur la page 1sur 5

Explanations to common Java exceptionsExplanations of common Java exceptions

java.lang
ArithmeticExceptionYou are trying to use your computer to solve a
mathematical problem that you cannot solve yourself. Read up on your
arithmetics and try again.
ArrayIndexOutOfBoundsExceptionSee IndexOutOfBoundsException. The
difference is that this exception refers to more than one finger.
ArrayStoreExceptionYou have used all your arrays and need to buy more from
the array store.
ClassCastExceptionYou 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.
ClassNotFoundExceptionYou 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.
CloneNotSupportedExceptionYou are a clone. Find the original you, tell him
what you want to do and then kill yourself.
IllegalAccessExceptionYou are a burgler that are running a Java program
during a burglery. Please finish stealing the computer, leave the premises
and try again.
IllegalArgumentExceptionYou have tried to protest against a previous
exception.
IllegalMonitorStateExceptionPlease turn your computer screen back on.
IllegalStateExceptionYou 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.
IllegalThreadStateExceptionOne of the screws in your computer is threaded
the wrong way. Please contact your hardware vendor.
IndexOutOfBoundsExceptionYou have put your index finger in an unacceptable
place. Reposition it and try again.
InstantiationExceptionNot everything can happen instantly. Please be more
patient.
InterruptedExceptionTell your colleagues, room-mates etc. to leave you
alone while you are working.
NegativeArraySizeExceptionYou 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.
NoSuchFieldExceptionYou 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.
NoSuchMethodExceptionDon't use that method! Please, do things like we have
always done.
NullPointerExceptionYou do not own a dog. Get one, for example a brittany
spaniel, and try again.
NumberFormatExceptionYou 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.
RuntimeExceptionYou cannot run fast enough, possibly due to obesity. Turn
off your computer and go out and get som exercise.
SecurityExceptionYou have been deemed a threat to nationaly security.
Please sit still and wait for the authorities to come and get you.
StringIndexOutOfBoundsExceptionYour 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.
UnsupportedOperationExceptionYou 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
ConcurrentModificationExceptionSomeone else has modified your Java code.
You should probably change your password.
EmptyStackExceptionIn 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.
MissingResourceExceptionYou are too poor to be using Java. Switch to a
cheaper language (such as Whitespace, Shakespeare, Cow, Spaghetti or C#).
NoSuchElementExceptionThere are only four elements (earth, water, air,
fire). The Fifth Element is just a movie.
TooManyListenersExceptionYou are bugged by too many secret organizations.
Expect a SecurityException soon.
java.awt
AWTExceptionYou are using AWT, which means your GUI will be ugly. This
exception is only a warning and can be ignored.
FontFormatExceptionYour layout is ugly, or you have selected a bad font,
or too many fonts. Please consult a professional designer.
HeadlessExceptionJava thinks you are too stupid to be a programmer.
IllegalComponentStateExceptionOne of your hardware components (e.g.
harddrive, CPU, RAM) is broken. Please contact your hardware vendor.
java.awt.color
CMMExceptionYour CMM is broken. What ever the hell that is. I usually burn
my house down and move to a new city to start over.
ProfileDataExceptionYour 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
MimeTypeParseExceptionYou 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.
UnsupportedFlavorExceptionYou are trying to use a flavor that is unknown
to Java. Most people seem to get by using only vanilla and cherry.
java.beans
IntrospectionExceptionYou are too introverted. Be more extroverted. Stop
being such a nerd and go out and meet some people!
PropertyVetoExceptionOne 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
CharConversionExceptionYou have been trying to incinerate something
noncombustible. It is also possible that you have tried turning yourself
into a fish, but that's rare.
EOFExceptionYou get this exception because you don't know what EOF stands
for. Well, I'm not going to tell you, Mr Ignoramus.
FileNotFoundExceptionA carpenter should always know where his tools are.
InterruptedIOExceptionYou have been using IO despite of an earlier
IOException and your activities have been interrupted.
InvalidClassExceptionSee ClassNotFoundException.
InvalidObjectExceptionObjection overruled, as they say in court.
IOExceptionIO stands for input/output and has to do with sending and
recieving data. IO is a security problem and should not be used.
NotActiveExceptionThis 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.
NotSerializableExceptionYou are trying to make a TV series based on a
movie.
ObjectStreamExceptionYou 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.
OptionalDataExceptionYou seem to think that some optional data is
required. Don't make things harder than they are.
StreamCorruptedExceptionYour data stream is corrupted, which means that it
has been stealing packages and selling them on the black market.
SyncFailedExceptionYou 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.
UnsupportedEncodingExceptionIf 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.
UTFDataFormatExceptionUTF 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.
WriteAbortedExceptionYou need to write the word "aborted" somewhere in
your program. It usually doesn't matter where, you just have to do it.
java.net
BindExceptionJava programming and bondage don't mix.
ConnectExceptionYou 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.
MalformedURLExceptionYou 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").
NoRouteToHostExceptionThere is no route to the host. Contact the Road
Administration.
PortUnreachableExceptionPorts and harbors must be placed right next to a
water body. If placed inland, they will be unreachable.
ProtocolExceptionThis is the result of a serious breach of etiquette (such
as pukíng on your host). The solution is simple: Don't do that!
SocketExceptionYou 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.
SocketTimeoutExceptionYou 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.
UnknownHostExceptionDidn't your parents teach you to not talk to
strangers?
UnknownServiceExceptionYou are trying to access an unknown service. The
most known unknown service is perhaps Secret Service.
URISyntaxExceptionThe sentence "You are I" is not syntactically correct.
Change it to "You are me". What ever the hell that means.
java.rmi
AccessExceptionYou are using Microsoft Access. Please don't.
AlreadyBoundExceptionDespite what is stated in the description of
java.net.BindException, RMI does support bondage. However, you cannot tie
up someone that is already bound.
ConnectExceptionYou 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.
ConnectIOExceptionYou 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.
MarshalExceptionSomething 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.
NoSuchObjectExceptionYou are trying to use an object that does not exist.
Create it or don't use it, Einstein!
NotBoundExceptionIf you are using bondage, please make sure that at least
one person is tied up.
RemoteExceptionThis 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.
RMISecurityExceptionThe 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.
ServerExceptionSecond serve. (Or double fault if applicable.)
ServerRuntimeExceptionTennis matches are long enough as it is. You will
get this exception if you take too long to serve.
StubNotFoundExceptionWhen 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!
UnexpectedExceptionThis exception should come as a total surprise to you.
If it did, everything is as it should be.
UnknownHostExceptionDidn't your parents teach you to not talk to
strangers?
UnmarshalExceptionYou 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
AccessControlExceptionYou 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.
DigestExceptionYou should be careful with what you eat. Indigestion can be
a serious problem.
GeneralSecurityExceptionSomething 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.
InvalidAlgorithmParameterExceptionYou 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!
InvalidKeyExceptionThere 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.
InvalidParameterExceptionYou have used a disparaging term to describe a
disabled person.
KeyExceptionDo not try to unlock locks without a key.
KeyManagementExceptionYou 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).
KeyStoreExceptionThe explanation for the previous KeyManagementException
is that there is a hole in your pocket.
NoSuchAlgorithmExceptionYou 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.
NoSuchProviderExceptionIf you are a single mom, you cannot be a housewife.
First, you need to get a provider for your family.
PrivilegedActionExceptionYou 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.
ProviderExceptionYou 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.
SignatureExceptionEither you have forged someone else's signature, or your
signature unacceptable. A signature cannot be too ugly, too readable or
too large.
UnrecoverableKeyExceptionDamn. 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
ParseExceptionYou are not making any sense. Calm down and try again.
Copyright © 2005 Björn Andersson