...
This noncompliant code example attempts to distinguish between different exceptional behaviors by looking at the exception's message.:
Code Block | ||
---|---|---|
| ||
try { doSomething(); } catch(Exception e) { String msg = e.getMessage(); switch (msg) { case "stack underflow": // ... break; case "connection timeout": // ... break; case "security violation": // ... break; default throw e; } } |
...