Throw BugOrBroken if a ValidationFailed is created with no problems

Reported by Max in blog comments, thanks.
This commit is contained in:
Havoc Pennington 2011-12-13 18:33:59 -05:00
parent 516b38f44a
commit c5028bca3d

View File

@ -339,6 +339,9 @@ public abstract class ConfigException extends RuntimeException {
sb.append(p.problem());
sb.append(", ");
}
if (sb.length() == 0)
throw new ConfigException.BugOrBroken(
"ValidationFailed must have a non-empty list of problems");
sb.setLength(sb.length() - 2); // chop comma and space
return sb.toString();