Skip to content

Commit

Permalink
Revert "Handles the status code for . properties (#4246) (#4251)" (#…
Browse files Browse the repository at this point in the history
…4276)

This reverts commit fafdd28.

Signed-off-by: Owais Kazi <[email protected]>

Signed-off-by: Owais Kazi <[email protected]>
  • Loading branch information
owaiskazi19 authored Aug 23, 2022
1 parent fafdd28 commit 1a1ffa3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,6 @@ protected static void parseProperties(ObjectMapper.Builder objBuilder, Map<Strin
throw new MapperParsingException("No handler for type [" + type + "] declared on field [" + fieldName + "]");
}
String[] fieldNameParts = fieldName.split("\\.");
// field name is just ".", which is invalid
if (fieldNameParts.length < 1) {
throw new MapperParsingException("Invalid field name " + fieldName);
}
String realFieldName = fieldNameParts[fieldNameParts.length - 1];
Mapper.Builder<?> fieldBuilder = typeParser.parse(realFieldName, propNode, parserContext);
for (int i = fieldNameParts.length - 2; i >= 0; --i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,26 +178,6 @@ public void testFieldsWithFilledArrayShouldThrowException() throws Exception {
}
}

public void testDotAsFieldName() throws Exception {
String mapping = Strings.toString(
XContentFactory.jsonBuilder()
.startObject()
.startObject("properties")
.startObject(".")
.field("type", "text")
.endObject()
.endObject()
.endObject()
);

try {
createIndex("test").mapperService().documentMapperParser().parse("tweet", new CompressedXContent(mapping));
fail("Expected MapperParsingException");
} catch (MapperParsingException e) {
assertThat(e.getMessage(), containsString("Invalid field name"));
}
}

public void testFieldPropertiesArray() throws Exception {
String mapping = Strings.toString(
XContentFactory.jsonBuilder()
Expand Down

0 comments on commit 1a1ffa3

Please sign in to comment.