Question

In: Computer Science

Describe why overly broad exceptions are a problem. In particular, what should you do if you...

Describe why overly broad exceptions are a problem. In particular, what should you do if you are worried you might catch an exception you cannot directly deal with?

Solutions

Expert Solution

Multiple catch blocks can get repetitive, but condensing catch blocks by catching a high-level class such as Exception can obscure exceptions that deserve special treatment .

Catching an overly broad exception essentially defeats the purpose of Java's typed exceptions , and can become particularly dangerous if the program grows and begins to throw new types of exceptions.The new exception types will not receive any attention.

  • If you don't handle an exception at all, it could lead to the program crashing. This could be used for a denial of service attack - simply overflow the server with malicious requests that will crash it, and it will spend all it's time restarting instead of serving legitimate requests.
  • Unhandled exception might lead to disclosure of sensitive information, if error messages are passed on in HTTP responses.
  • Overly broad catch statement that catch everything could lead to security critical exceptions being glossed over.

Related Solutions

Why are exceptions to the warrant requirement sometimes allowed? Do you feel exceptions should be permitted?...
Why are exceptions to the warrant requirement sometimes allowed? Do you feel exceptions should be permitted? Explain your reasoning using at least three sources (only one source may be your text book and the other two must be from peer reviewed journals). Please adhere to the syllabus and rubric guidelines.
What is UBIT and what are some exceptions to the rule? Why do you think these...
What is UBIT and what are some exceptions to the rule? Why do you think these exceptions exist? Include tax policy considerations in your discussion. What is the significance of the “regularly carried on” test as it relates to UBIT?
C++ problem 1) Describe briefly what exceptions are and what their purpose is. What is the...
C++ problem 1) Describe briefly what exceptions are and what their purpose is. What is the try block? What is the catch block? What happens with the flow of control if the catch block does not catch a thrown exception? Give a simple example. 2) Describe briefly what templates are and what their purpose is.
Do you feel that executives are overly compensated? Explain.
Do you feel that executives are overly compensated? Explain.
What is Instagram’s BMH? What problem do they solve for their customers? Why should their customers care?
What is Instagram’s BMH? What problem do they solve for their customers? Why should their customers care?
why there are differences among what you do, and what your employee thinks you should do?
why there are differences among what you do, and what your employee thinks you should do?
What exceptions to the "hearsay rule" have courts recognized? Describe the reasoning behind these exceptions. 300+...
What exceptions to the "hearsay rule" have courts recognized? Describe the reasoning behind these exceptions. 300+ words
Why use exception handlers? Why not include logic in the program to ensure exceptions do not...
Why use exception handlers? Why not include logic in the program to ensure exceptions do not occur? Are there types of exceptions for which this approach would be suitable?
In this make or buy problem, you should compute the total cost of making a particular...
In this make or buy problem, you should compute the total cost of making a particular part and the total costs of buying the same part. Try following the solutions steps: Determine the parameters of the make cost function - the variable costs per unit and the fixed costs. Determine the fixed costs that are avoidable and the fixed costs that are unavoidable. Determine the buy price. Determine the alternative use of the idle resources under the buy, Note that...
In this make or buy problem, you should compute the total cost of making a particular...
In this make or buy problem, you should compute the total cost of making a particular part and the total costs of buying the same part. Try following the solutions steps: Determine the parameters of the make cost function - the variable costs per unit and the fixed costs. Determine the fixed costs that are avoidable and the fixed costs that are unavoidable. Determine the buy price. Determine the alternative use of the idle resources under the buy, Note that...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT