Files
openide/java/java-impl/resources/inspectionDescriptions/ThrowCaughtLocally.html
2025-02-05 04:43:28 +00:00

21 lines
691 B
HTML

<html>
<body>
Reports <code>throw</code> statements whose exceptions are always
caught by containing <code>try</code> statements.
<p>Using <code>throw</code>
statements as a "goto" to change the local flow of control is confusing and results in poor performance.
<p><b>Example:</b></p>
<pre><code>
try {
if (!Files.isDirectory(PROJECTS)) {
throw new IllegalStateException("Directory not found."); // warning: 'throw' caught by containing 'try' statement
}
...
} catch (Exception e) {
LOG.error("run failed");
}
</code></pre>
<!-- tooltip end -->
<p>Use the <b>Ignore rethrown exceptions</b> option to ignore exceptions that are rethrown.</p>
</body>
</html>