Would it be better to add this logic in Jenkins.checkGoodName(String name) instead?

Also I can create a PR for JENKINS-17401 if you want.