Jump to ratings and reviews
Rate this book

Java Exception Handling

Rate this book
Based on Java 7.

Exception handling is an aspect of Java development that has not received as much attention as
it deserves. If you do not have exception handling under control, you risk that your application
or data ends up in an unhealthy state, which can have serious consequences. Therefore,
knowing how to implement proper exception handling is a must for every Java developer. This book
is a good step on the road to learning that, although any developer should keep learning more
throughout their whole career.

I have tried to make this book as concise as possible. However, some explanations are maybe longer than what a developer with 10 years of experience needs, in order to make sure that developers with 2 years of experience understand them. Having said that, all suggestions for improvement are appreciated. My email address is in the book.

This book contains 4 parts. Part 1 describes the basic exception handling mechanisms provided
by the Java language. Part 2 lists the requirements for exception handling at the application
level. Part 3 explores how to implement exception handling in applications to meet the
requirements set forth in part 2. Part 4 goes into more detail about what diagnostic information
your applications should gather and include when throwing and logging exceptions.



The book is intended for Java developers with 2 or more years of experience in Java development.
It is not a beginner book.



Table of Contents



Part 1: Basic Java Exception Handling Techniques
- What are Exceptions?
- Try Catch Finally
- Try-with-resources
- Catching Multiple Exceptions
- The Call Stack
- The Execution Path
- Throwing Exceptions
- Propagating Exceptions
- Exception Hierarchies
- Custom Exceptions
- The Exception Class
- Exception Handling Templates
- Checked vs. Unchecked Exceptions

Part 2: Requirements for Application Exception Handling
- Application States
- Application Request Processing
- Application Health
- Requirements for Application Exception Handling
- Application Survival
- Notifying Relevant Parties
- Diagnostics

Part 3: Implementing Application Exception Handling
- Implementation Overview
- Error Detection
- Local Exception Handling
- Error Information Gathering
- Exception Class Design
- Throwing Exceptions in Applications
- Propagating Exceptions in Applications
- Catching and Handling Exceptions in Applications

Part 4: Diagnostic Information
- Error ID and Description
- Error Severity
- Error Origin and Reactions
- Error Reclassification
- Request ID
- Cross Process Exception Handling
- Execution Context
- API Exception Handling

184 pages, Kindle Edition

First published February 14, 2013

4 people are currently reading
33 people want to read

About the author

Jakob Jenkov

4 books

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
4 (15%)
4 stars
11 (42%)
3 stars
6 (23%)
2 stars
3 (11%)
1 star
2 (7%)
Displaying 1 - 3 of 3 reviews
Profile Image for Amit Sahoo.
6 reviews1 follower
November 26, 2017
This book explains the template design pattern on exceptions and resource handling use cases to the required details.An entire book on exception handing is really exciting.It is a must read for beginners and intermediate level.The thoretical explanations could have been more concise and less repititive.I would have liked the book to expound more on logging levels which is closely related to exception handling.I would urge the writter to come up with the sequel on exception handling in OSGI ,JAX WS and JAX RS context.
Profile Image for Zbyszek Sokolowski.
299 reviews16 followers
October 4, 2016
If this book had 30 pages I would say great booklet, but in over 115 pages I have found a lot of fluff. Some information is quite useful most are authors views on how logging or exeption should be implemented in too verbose way.
some useful quotations:

Exception wrapping is often used if you cannot rethrow the original exception. For instance, if your method does not declare that it throws exceptions of the caught type. This could be the case if your method is an implementation of an interface method that does not declare that exception.

You should not use the Throwable class directly if you can avoid it. Below the Throwable class are the classes Exception and Error.

The Error class is used when errors occur that are caused by conditions which the application has no control over. For instance, if the JVM runs out of memory, an OutOfMemoryError is thrown. You should also avoid using the Error class.

The exception caught and rethrown in this example now contains the stack trace of where it was rethrown, instead of where it was originally created.

That makes methods towards the top of the call stack declare lots of different exceptions. Or, alternatively to just declare that they throw Exception, which defeats the purpose of declaring what exceptions a method throws.



45 reviews2 followers
May 15, 2015
not have sufficient codes to implements the description
the book describes how to handle exception in more words than codes.i feel it lack some detail example such as :how to handle exception in some situation?so scan it from one day,and should find some code to understand it deeply.
Displaying 1 - 3 of 3 reviews

Can't find what you're looking for?

Get help and learn more about the design.