...
Note that the null check is redundant; if it were removed, the subsequent call to s.equals("")
would throw a NullPointerException
when s
is null. However, the null check is suggested because it explicitly indicates the programmer's intent. More complex code may require explicit testing of invariants and appropriate throw statements.
...
This compliant solution declares a more specific exception class in the throws
clause of the method declaration for the doSomething()
method.
...
ERR07-EX0: Classes that sanitize exceptions to comply with a security policy are permitted to translate specific exceptions into more general exceptions. This translation could potentially result in throwing RuntimeException
, Exception
, or Throwable
in some cases, depending on the details requirements of the security policy.
Risk Assessment
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="df677ab5ac43b534-10223b7d-4e85476d-8b7c911a-6749df7667e45c326de97b39"><ac:plain-text-body><![CDATA[ | [[Goetz 2004b | AA. Bibliography#Goetz 04b]] |
| ]]></ac:plain-text-body></ac:structured-macro> | |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="f9478deda01c208d-e5474aee-44624431-aa9fbeb2-751adba027d27dc032547bdd"><ac:plain-text-body><![CDATA[ | [[Tutorials 2008 | AA. Bibliography#Tutorials 08]] | [Unchecked Exceptions – The Controversy | http://java.sun.com/docs/books/tutorial/essential/exceptions/runtime.html] | ]]></ac:plain-text-body></ac:structured-macro> |
...