1、 外文原文 INTRODUCTION Bad things can happen to a running application. It can run into an error condition caused by incorrect data entered by the user, a problem in accessing a resource, or a bug in the application code, for example. Java has a comprehensive error-trapping and-handling mechanism called
2、exception handling. Exceptions are the messengers that carry the bad news inside the world of applications, from method to method, bean to bean, bean to container, and container to client. There are exceptions that you expect, so you prepare your code for their arrival: undesired but expected guests
3、. These are called checked exceptions because the compiler checks whether your code is prepare to deal with them. The counterpart of checked exceptions is unchecked exceptions, which the compiler does not check. These are the unexpected messengers that catch you unprepared. In EJB, exceptions are cl
4、assified as application exceptions and system exceptions. All application exceptions are checked exceptions, and most system exceptions are unchecked exceptions. We will explore how bad news travels from the bean to the container and from the container to the client. Sometimes the news can be so bad that after hearing it the container will kill the messenger and roll back the transaction in which the news was generated; you witnessed this in the last chapter. In other situations, the container w