explanations to common java exceptions

Upload: v-srinivasa-rao

Post on 07-Apr-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Explanations to Common Java Exceptions

    1/5

    Explanations to common Java exceptionsExplanations of common Java exceptionsjava.langArithmeticExceptionYou are trying to use your computer to solve amathematical problem that you cannot solve yourself. Read up on yourarithmetics and try again.ArrayIndexOutOfBoundsExceptionSee IndexOutOfBoundsException. Thedifference 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 borninto. Java will not accept dailits acting as kshatriyas or noblemenpretending to be working class. Note the spelling mistake (of caste) thatwas introduced in Java 1.0 and has not been corrected for backwardscompatability reasons.ClassNotFoundExceptionYou seem to have invented your own class. There arealso caste systems that are not yet implemented in Java, most notibly thebalinese caste system. For example, if you are a wesia, use the indiancounterpart vaishya.

    CloneNotSupportedExceptionYou are a clone. Find the original you, tell himwhat you want to do and then kill yourself.IllegalAccessExceptionYou are a burgler that are running a Java programduring a burglery. Please finish stealing the computer, leave the premises

    and try again.IllegalArgumentExceptionYou have tried to protest against a previousexception.IllegalMonitorStateExceptionPlease turn your computer screen back on.IllegalStateExceptionYou come from a state that is not yet recognized bythe UN, possibly Kurdistan or Palestine. Get a real citizenship, recompile

    your java code and try again.IllegalThreadStateExceptionOne of the screws in your computer is threadedthe 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 morepatient.InterruptedExceptionTell your colleagues, room-mates etc. to leave youalone 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 andDON'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 giveyou 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 brittanyspaniel, and try again.

    NumberFormatExceptionYou are using outdated units of measurement, forexample inches or pints. Convert to SI. There is a known bug that causesthis exception to be thrown if you are very short or tall.

  • 8/6/2019 Explanations to Common Java Exceptions

    2/5

    RuntimeExceptionYou cannot run fast enough, possibly due to obesity. Turnoff 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 notwearing any panties at all.

    UnsupportedOperationExceptionYou are trying to have an operation that forsom reason, ethical or otherwise, is not supported by Java. Examples ofthis include unneeded amputations, for example circumcisions. Please stopabusing your body and do not remove pieces of you child, damn it!

    java.utilConcurrentModificationExceptionSomeone else has modified your Java code.You should probably change your password.EmptyStackExceptionIn order for Java to work, you must have a stack ofJava books on your desk. Actually, one is enough if it is really thick.MissingResourceExceptionYou are too poor to be using Java. Switch to acheaper 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.awtAWTExceptionYou are using AWT, which means your GUI will be ugly. Thisexception 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.colorCMMExceptionYour 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 theCIA to correct the mistake.

    java.awt.datatransferMimeTypeParseExceptionYou are a bad mime. Noone can understand what youare trying to express. Try something simpler, likewalking-against-the-wind och being-trapped-in-an-invisible-box.UnsupportedFlavorExceptionYou are trying to use a flavor that is unknownto Java. Most people seem to get by using only vanilla and cherry.

    java.beansIntrospectionExceptionYou are too introverted. Be more extroverted. Stopbeing such a nerd and go out and meet some people!PropertyVetoExceptionOne of your properties has been vetoed. The messageshould inform you of who did it and why. If it does not, you probablyshouldn't ask.

    java.io

    CharConversionExceptionYou have been trying to incinerate somethingnoncombustible. It is also possible that you have tried turning yourselfinto a fish, but that's rare.

  • 8/6/2019 Explanations to Common Java Exceptions

    3/5

    EOFExceptionYou get this exception because you don't know what EOF standsfor. 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 earlierIOException 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 andrecieving data. IO is a security problem and should not be used.NotActiveExceptionThis can mean two things. Either something is inactiveand 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 amovie.ObjectStreamExceptionYou have issued a stream of objections. Please limityourself to one at a time and wait for the judge to make a ruling beforeissuing a new one. See InvalidObjectException.OptionalDataExceptionYou seem to think that some optional data isrequired. Don't make things harder than they are.

    StreamCorruptedExceptionYour data stream is corrupted, which means that ithas been stealing packages and selling them on the black market.SyncFailedExceptionYou have tried to synchronize your failures withsomeone else and you have turned out to be a bigger failure that thatperson. Try to find someone on your own level.UnsupportedEncodingExceptionIf you want to send something coded over thenetwork, 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 isa 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 inyour program. It usually doesn't matter where, you just have to do it.

    java.netBindExceptionJava 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 ispossible to connect your things to eachother via a special connectionobject that connects to both ends of your desired connection.MalformedURLExceptionYou are making an urn and either it has the wrongshape (e.g. an "L" shape) or you have misspelled the word "urn" (e.g."url").NoRouteToHostExceptionThere is no route to the host. Contact the RoadAdministration.PortUnreachableExceptionPorts and harbors must be placed right next to awater body. If placed inland, they will be unreachable.ProtocolExceptionThis is the result of a serious breach of etiquette (such

    as pukng on your host). The solution is simple: Don't do that!SocketExceptionYou have connected your computer to a power outlet of thewrong kind. Most of the times you have to find another outlet, but somecomputers have a switch on the back where you can set the power outlettype.

    SocketTimeoutExceptionYou have connected your computer a power outlet with

    a timer and the time has run out. Such outlets should only be used for

  • 8/6/2019 Explanations to Common Java Exceptions

    4/5

    flat-irons and similar things.UnknownHostExceptionDidn't your parents teach you to not talk to

    strangers?UnknownServiceExceptionYou are trying to access an unknown service. Themost 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.rmiAccessExceptionYou are using Microsoft Access. Please don't.AlreadyBoundExceptionDespite what is stated in the description ofjava.net.BindException, RMI does support bondage. However, you cannot tieup 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 ispossible to connect your things to eachother via a special connectionobject 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 somethingelse. Perhaps it is possible to connect your things to eachother via aspecial connection object that connects to both ends of your desiredconnection.MarshalExceptionSomething is wrong with your marshal. What you should dodepends on what kind of marshal we are talking about. It can be a fieldmarshal, police, firefighter or just your ordinary basic marshal. Notethat this exception has nothing to do with the Republic of the MarshallIslands, 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 leastone person is tied up.

    RemoteExceptionThis is a special exception that is thrown remotely. Ifsomeone else's application has become so instable that it can't evenproduce an exception, then you may get the exception instead. Please findthe source and inform that programmer of the error.RMISecurityExceptionThe Republic of the Marshall Islands has becomeinstable. If you live there, you should probably leave and don't come back

    until your security can be guaranteed. If you live elsewhere, you canignore this exception.ServerExceptionSecond serve. (Or double fault if applicable.)ServerRuntimeExceptionTennis matches are long enough as it is. You willget this exception if you take too long to serve.StubNotFoundExceptionWhen you go to the movies, you should always keepyour stub. If you don't, and also leave the theater, you will not be letback 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 termis "used to". You have been fired (which is really ironic if you were afirefighter).

    java.securityAccessControlExceptionYou have lost control of Microsoft Access. If youcannot regain control or stop the program in some other way, you should

  • 8/6/2019 Explanations to Common Java Exceptions

    5/5

    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 youhave 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 adisabled person in a way that is not suited to that person's level ofunderstanding. Keep it simple!InvalidKeyExceptionThere are two rather different reasons for thisexception: 1. You are using the wrong key. My advice is to paint smalldots in different colors on your keys to help you remember which one isfor which lock. 2. You are not allowed to lock up disabled people withoutgiving 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 adisabled person.KeyExceptionDo not try to unlock locks without a key.KeyManagementExceptionYou have lost your key. Most likely you left it atthe office (if you're trying to enter your home) or at home (if you'retrying to enter the office).KeyStoreExceptionThe explanation for the previous KeyManagementExceptionis that there is a hole in your pocket.NoSuchAlgorithmExceptionYou are trying to solve a problem in a previouslyunknown way. Stop being so damn creative and rewrite your program usingold algorithms. You can also patent your idea and wait for it to beincorporated 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 nothave the privilege to take. For example, getting away with murder issomething that only famous people can do, child molestation is only forcatholic 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 afamily. Obviously, your husband cannot be a housewife, so you need to lethim do the providing. Thinking that Java is old-fashioned will not changereality. 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 ortoo large.UnrecoverableKeyExceptionDamn. You dropped your key down a drain. The only

    comfort I can offer is that the key should be unrecoverable for otherpeople as well, so it may not be necessary to change your locks.

    java.textParseExceptionYou are not making any sense. Calm down and try again.

    Copyright 2005 Bjrn Andersson