Skip to content

Commit 1a1ffa3

Browse files
authored
Revert "Handles the status code for . properties (#4246) (#4251)" (#4276)
This reverts commit fafdd28. Signed-off-by: Owais Kazi <owaiskazi19@gmail.com> Signed-off-by: Owais Kazi <owaiskazi19@gmail.com>
1 parent fafdd28 commit 1a1ffa3

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

server/src/main/java/org/opensearch/index/mapper/ObjectMapper.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,6 @@ protected static void parseProperties(ObjectMapper.Builder objBuilder, Map<Strin
380380
throw new MapperParsingException("No handler for type [" + type + "] declared on field [" + fieldName + "]");
381381
}
382382
String[] fieldNameParts = fieldName.split("\\.");
383-
// field name is just ".", which is invalid
384-
if (fieldNameParts.length < 1) {
385-
throw new MapperParsingException("Invalid field name " + fieldName);
386-
}
387383
String realFieldName = fieldNameParts[fieldNameParts.length - 1];
388384
Mapper.Builder<?> fieldBuilder = typeParser.parse(realFieldName, propNode, parserContext);
389385
for (int i = fieldNameParts.length - 2; i >= 0; --i) {

server/src/test/java/org/opensearch/index/mapper/ObjectMapperTests.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -178,26 +178,6 @@ public void testFieldsWithFilledArrayShouldThrowException() throws Exception {
178178
}
179179
}
180180

181-
public void testDotAsFieldName() throws Exception {
182-
String mapping = Strings.toString(
183-
XContentFactory.jsonBuilder()
184-
.startObject()
185-
.startObject("properties")
186-
.startObject(".")
187-
.field("type", "text")
188-
.endObject()
189-
.endObject()
190-
.endObject()
191-
);
192-
193-
try {
194-
createIndex("test").mapperService().documentMapperParser().parse("tweet", new CompressedXContent(mapping));
195-
fail("Expected MapperParsingException");
196-
} catch (MapperParsingException e) {
197-
assertThat(e.getMessage(), containsString("Invalid field name"));
198-
}
199-
}
200-
201181
public void testFieldPropertiesArray() throws Exception {
202182
String mapping = Strings.toString(
203183
XContentFactory.jsonBuilder()

0 commit comments

Comments
 (0)