YARN-5828. Native services client errors out when config formats are uppercase. Contributed by Billie Rinaldi

This commit is contained in:
Gour Saha 2016-11-03 18:15:44 -07:00 committed by Jian He
parent 7757f6fe4a
commit d1ee95981e
2 changed files with 4 additions and 2 deletions

View File

@ -18,6 +18,8 @@
package org.apache.slider.core.registry.docstore; package org.apache.slider.core.registry.docstore;
import java.util.Locale;
public enum ConfigFormat { public enum ConfigFormat {
JSON("json"), JSON("json"),
@ -51,7 +53,7 @@ public enum ConfigFormat {
*/ */
public static ConfigFormat resolve(String type) { public static ConfigFormat resolve(String type) {
for (ConfigFormat format: values()) { for (ConfigFormat format: values()) {
if (format.getSuffix().equals(type)) { if (format.getSuffix().equals(type.toLowerCase(Locale.ENGLISH))) {
return format; return format;
} }
} }

View File

@ -611,7 +611,7 @@ public class ProviderUtils implements RoleKeys, SliderKeys {
} }
ConfigFormat configFormat = ConfigFormat.resolve(configFileType); ConfigFormat configFormat = ConfigFormat.resolve(configFileType);
if (configFormat == null) { if (configFormat == null) {
throw new BadConfigException("Config format " + configFormat + throw new BadConfigException("Config format " + configFileType +
" doesn't exist"); " doesn't exist");
} }
localizeConfigFile(launcher, roleName, roleGroup, configEntry.getKey(), localizeConfigFile(launcher, roleName, roleGroup, configEntry.getKey(),