Cherry pick of https://github.com/pentaho/pentaho-platform/commit/72616e326648e369f20baddaa5aa142008c4f3f1