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