This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have never make in a practice the exception handling and i have no any experience with it. I have some questions about exception chaining and handling could you help me?
In this example I catch Exception1 and rethrow the Exception2. Since JDK 1.4 there is a possibility to add to the Exception2 a cause of the Exception1. But If I didn't throw the cause of the Exception1 is this also an exception chaining? Or the meaning of chaining is only if the cause (Throwable) of one exception will be thrown with the cause of another.
Another example. How is a best way to rethrow an exception in practice?
If I have e.g. three calls of different methods that catch one exception and rethrow the another one. Do I need to rethrow the cause of these exceptions every time and log at the end point all exceptions :
or just log the occurred exception before throwing and throw only the message? How it will be made in a real applications? Thanks a lot for your help!