Exceptions

Good and secure code must have a plan in place for handling errors. Java has included a framework on which we can build error (exception) handling. You have several choices when dealing with exceptions, and Java helps you accomplish any of the following that you choose:

  • Do nothing with the exception, but throw it to the code that called the code with the exception. Throwing exceptions generates a stack trace, which lists the place (line number and code) where the exception occurred and the place that called this block of code (method) and the place that called that method, and so on. You can print the stack trace and see where you were and what happened. Often, the exception itself will tell you why the exception happened; no further ...

Get Expert Oracle and Java Security: Programming Secure Oracle Database Applications with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.