JENKINS-12537: patch for the feature request

This is a revised version of the former pull request. The branch was freshly created and merging it to master should work without any conflicts whatsoever. Thanks to Christoph for pointing this out.

What the patch does is implementing the changes requested in 

https://issues.jenkins-ci.org/browse/JENKINS-12537

See the description there for more information.