Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Exception class diagram ?

Hi I have a terrible memory and I wanted to print out class diagram of Java SE Exception Classes hang it on the wall or something I know I don't need to memorize it, It's just when you're designing a software or preparing for an exam it's good to have stuff like these around you.

I've googled most of the pictures aren't complete and are bad quality, So I was thinking of converting Javadocs to UML ? then print out the uml maybe

Can someone help me please ?

like image 489
Ismail Marmoush Avatar asked Jul 17 '11 17:07

Ismail Marmoush


People also ask

What is Java exception class?

The class Exception and its subclasses are a form of Throwable that indicates conditions that a reasonable application might want to catch. The class Exception and any subclasses that are not also subclasses of RuntimeException are checked exceptions.

What is exception in UML?

In the UML, an exception is a specialization of a signal, which is the specification of an asynchronous communication between objects. This means that in interaction diagramsinteraction diagramsA sequence diagram or system sequence diagram (SSD) shows process interactions arranged in time sequence in the field of software engineering. It depicts the processes involved and the sequence of messages exchanged between the processes needed to carry out the functionality.https://en.wikipedia.org › wiki › Sequence_diagramSequence diagram - Wikipedia, exceptions are illustrated as asynchronous messages.

What is class hierarchy of exceptions in Java?

The class at the top of the exception class hierarchy is the Throwable class, which is a direct subclass of the Object class. Throwable has two direct subclasses - Exception and Error. The Exception class is used for exception conditions that the application may need to handle.

What are the Java exceptions?

Definition: An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions. When an error occurs within a method, the method creates an object and hands it off to the runtime system.


2 Answers

I can't remember all of them, either. When in eclipse I simply use the built-in functionality to display the hierarchy:

  • type F4 on a class definition and it displays the hierarchy
  • type Ctrl+Shift+H, enter the type you're looking for and press enter. Again, it shows you the hierarchy
  • after the hierarchy is available in "Hierarchy" view you can filter by e.g. using working sets.

Not really the answer to your question, but this works fine for me and everyone I've talked to so far.

BTW: Make a screenshot of the "Hierarchy" view and this is the answer to your question :-)

like image 62
home Avatar answered Sep 20 '22 12:09

home


Few statistics from OpenJDK 7u3 rt.jar:

  • Throwable hierarchy: 785 classes
  • Error hierarchy: 63 classes
  • Exception hierarchy: 730 classes
  • RuntimeException hierarchy: 242 classes

So it's impossible to have full diagram. Probably you will not use exceptions from subpackages of com.sun, org.omg or most of javax. Normally you work on some subset of exceptions. I personally use the same approach as SJuan - search for exceptions in one particular package or package subtree.

like image 40
Jonatan Kaźmierczak Avatar answered Sep 18 '22 12:09

Jonatan Kaźmierczak