Configuration: Tab characters in YAML should throw an exception.

Throw an exception if there is a 'tab' character in the elasticsearch.yml file

Close #8259
This commit is contained in:
Ken Wu 2014-11-05 15:26:25 -05:00 committed by Adrien Grand
parent e77f9720d2
commit 31fa4dc58b
1 changed files with 7 additions and 2 deletions

View File

@ -37,7 +37,12 @@ public class YamlSettingsLoader extends XContentSettingsLoader {
@Override @Override
public Map<String, String> load(String source) throws IOException { public Map<String, String> load(String source) throws IOException {
// replace tabs with whitespace (yaml does not accept tabs, but many users might use it still...) /*
return super.load(source.replace("\t", " ")); * #8259: Better handling of tabs vs spaces in elasticsearch.yml
*/
if (source.indexOf('\t') > -1) {
throw new IOException("Tabs are illegal in YAML. Did you mean to use whitespace character instead?");
}
return super.load(source);
} }
} }