As per commit comment, it was taken from the Git implementation. For what it is worth, I am not a Java programmer, have never used Build Hive/Net Beans or worked on Jenkins or plugins. I was aware that this issue existed on Git at one point, and was resolved, so looked at the source for the Git plugin and made the changes based on that.