NEXUS-6591: Ported change from master

https://github.com/sonatype/nexus-pro/commit/7dfc436033c74db45643c4ade92b5cf87e278dcb