| Severity | 2 |
|---|---|
| Enabled | yes |
| Waivable | |
| Rationale | It is not required to list subclasses of RuntimeException in throws clause. If you listed them for documentation purposes then use @throws JavaDoc tag instead. |
| Violation |
public void searchObject(final java.util.Iterator iter, final Object anObj) throws IllegalArgumentException {
if (iter.hasNext()) {
for (Object obj = iter.next(); iter.hasNext(); obj = iter.next()) {
if (obj.equals(anObj)) {
throw new IllegalArgumentException(obj.toString());
}
}
}
}
|
| Fix |
public void searchObject(final java.util.Iterator iter,Final Object anObj) {
if (iter.hasNext()) {
for (Object obj = iter.next(); iter.hasNext(); obj = iter.next()) {
if (obj.equals(anObj)) {
throw new IllegalArgumentException(obj.toString());
}
}
}
}
|