@ekolis said:
I'm guessing OP's code used to return an error message
Actually, no. The code here was originally meant to be called similarly to the Guava library Preconditions.checkNotNull
method. So, something like this:
String checked = Preconditions.checkNotNull(argv[0], "the input was null"); // throws NullPointerException
String thing = validator.validateThing(argv[1], "thing", "thingy"); // throws IllegalArgumentException
But, the other Guava precondition check methods in that class don't return their argument, and in the code that calls our validators the return value is always discarded. So, I think I should just make them void
return types, like leonardo suggests...
My WTF, perhaps?