NEXUS-6242: Backport to Nexus 2.7.x

Commit
95f212c2e946dd6d6f9c8a1a1671ee180bd78d0d