The goal of an Exception Fact Sheet is to reveal the design of exception handling in an application.
--Maxence, Martin
For feedback, please contact Martin
Number of Classes | 93 |
Number of Domain Exception Types (Thrown or Caught) | 1 |
Number of Domain Checked Exception Types | 0 |
Number of Domain Runtime Exception Types | 1 |
Number of Domain Unknown Exception Types | 0 |
nTh = Number of Throw | 43 |
nTh = Number of Throw in Catch | 2 |
Number of Catch-Rethrow (may not be correct) | 0 |
nC = Number of Catch | 2 |
nCTh = Number of Catch with Throw | 2 |
Number of Empty Catch (really Empty) | 0 |
Number of Empty Catch (with comments) | 0 |
Number of Empty Catch | 0 |
nM = Number of Methods | 307 |
nbFunctionWithCatch = Number of Methods with Catch | 2 / 307 |
nbFunctionWithThrow = Number of Methods with Throw | 27 / 307 |
nbFunctionWithThrowS = Number of Methods with ThrowS | 1 / 307 |
nbFunctionTransmitting = Number of Methods with "Throws" but NO catch, NO throw (only transmitting) | 1 / 307 |
P1 = nCTh / nC | 100% (1) |
P2 = nMC / nM | 0.7% (0.007) |
P3 = nbFunctionWithThrow / nbFunction | 8.8% (0.088) |
P4 = nbFunctionTransmitting / nbFunction | 0.3% (0.003) |
P5 = nbThrowInCatch / nbThrow | 4.7% (0.047) |
R2 = nCatch / nThrow | 0.047 |
A1 = Number of Caught Exception Types From External Libraries | 2 |
A2 = Number of Reused Exception Types From External Libraries (thrown from application code) | 5 |
W1 is a rough estimation of the richness of the exception model. It does not take into account the inheritance relationships between domain exceptions.
Proportion P1 measures the overall exception flow. According to our experience, it varies from 5% to 70%. Early-catch design generally yields a low P1, libraries that must warn clients about errors (e.g. databases) generally have a high P1.
Proportion P2 measures the dispersion of catch blocks in the application. According to our experience, it varies from 2% to 15%. A small P2 indicates a rather centralized management of errors.
R1 shows how many exceptions types from libraries (incl. JDK) are thrown from application code. For instance, IllegalArgumentException comes from the JDK but is used in many applications.
A1 measures the awareness of the application to library exceptions. A high value of A1 means either that the application is polluted with checked exceptions or that it is able to apply specific recovery depending on the library exception.
Each exception that is used at least once in the project is a dot. A orange dot represents a domain exception that is defined in the application. A blue dot exception is defined in the JDK or in a library. The x-axis represents the number of times an exception is caught, the y-axis the number of times an exception is thrown.
A (Domain) exception is defined in the application. A (Lib) exception is defined in the JDK or in a library. An exception can be thrown, thrown from within a catch, or declared in the signature of a method (usually for checked exceptions). Hovering over a number triggers showing code snippets from the application code.
A (Domain) exception is defined in the application. A (Lib) exception is defined in the JDK or in a library. An exception can be caught, and it happens that the catch block contains a throw (e.g. for wrapping a low-level exception). Hovering over a number triggers showing code snippets from the application code.
Type | Exception | Caught (directly) |
Caught with Thrown |
---|---|---|---|
(Lib) | CloneNotSupportedException |
1
|
1
|
(Lib) | IllegalArgumentException |
1
|
1
|
There is a common practice of throwing exceptions from within a catch block (e.g. for wrapping a low-level exception). The following table summarizes the usage of this practice in the application. The last column gives the number of times it happens for a pair of exceptions. The graph below the table graphically renders the same information. For a given node, its color represents its origin (blue means library exception, orange means domain exception); the left-most number is the number of times it is thrown, the right-most is the number of times it is caught.
Catch | Throw | |||||
---|---|---|---|---|---|---|
(Lib) | IllegalArgumentException |
|
|
|||
(Lib) | CloneNotSupportedException |
|
|
Not all exceptions are thrown AND caught in the same project. The following table gives the exceptions types with respect to this. The lower left hand side sell lists all exceptions thrown but not caught (prevalent for libraries), the upper right-hand side lists all exceptions caught but not thrown (usually coming from external dependencies).
Thrown | Not Thrown | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Caught |
|
|
||||||||||
Not caught |
|
The following shows the methods that are called inside catch blocks (first column) and finally blocks (second column). For each method, we give the number of times it is called in a catch block (second sub-column), and the total number of calls (third sub-column). If the method name is red, it means that it is only called from catch/finally blocks. Hovering over a number triggers showing code snippets from the application code.
Catch | Finally | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|
This table concatenates the results of the previous tables.
nF = Number of Finally | 2 |
nF = Number of Try-Finally (without catch) | 2 |
Number of Methods with Finally (nMF) | 2 / 307 (0.7%) |
Number of Finally with a Continue | 0 |
Number of Finally with a Return | 0 |
Number of Finally with a Throw | 0 |
Number of Finally with a Break | 0 |
Number of different exception types thrown | 5 |
Number of Domain exception types thrown | 0 |
Number of different exception types caught | 2 |
Number of Domain exception types caught | 0 |
Number of exception declarations in signatures | 2 |
Number of different exceptions types declared in method signatures | 2 |
Number of library exceptions types declared in method signatures | 2 |
Number of Domain exceptions types declared in method signatures | 0 |
Number of Catch with a continue | 0 |
Number of Catch with a return | 0 |
Number of Catch with a Break | 0 |
nbIf = Number of If | 410 |
nbFor = Number of For | 62 |
Number of Method with an if | 117 / 307 |
Number of Methods with a for | 49 / 307 |
Number of Method starting with a try | 1 / 307 (0.3%) |
Number of Expressions | 4071 |
Number of Expressions in try | 23 (0.6%) |