From 31fa4dc58b659295aaa48930277dddbbabb271ae Mon Sep 17 00:00:00 2001 From: Ken Wu Date: Wed, 5 Nov 2014 15:26:25 -0500 Subject: [PATCH] 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 --- .../common/settings/loader/YamlSettingsLoader.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/settings/loader/YamlSettingsLoader.java b/src/main/java/org/elasticsearch/common/settings/loader/YamlSettingsLoader.java index 5c37a153922..248fe090b5d 100644 --- a/src/main/java/org/elasticsearch/common/settings/loader/YamlSettingsLoader.java +++ b/src/main/java/org/elasticsearch/common/settings/loader/YamlSettingsLoader.java @@ -37,7 +37,12 @@ public class YamlSettingsLoader extends XContentSettingsLoader { @Override public Map 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); } }