Fix unclosed objects & arrays
Original commit: elastic/x-pack-elasticsearch@d4b317a9c6
This commit is contained in:
parent
47d83d37d8
commit
eec4ed90d2
|
@ -185,6 +185,7 @@ public abstract class AbstractExporterTemplateTestCase extends MarvelIntegTestCa
|
|||
.endObject()
|
||||
.endObject()
|
||||
.endObject()
|
||||
.endObject().bytes();
|
||||
.endObject()
|
||||
.endObject().bytes();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class EmailAttachmentParsersTests extends ESTestCase {
|
|||
|
||||
XContentBuilder builder = jsonBuilder();
|
||||
String type = randomAsciiOfLength(8);
|
||||
builder.startObject().startObject("some-id").startObject(type);
|
||||
builder.startObject().startObject("some-id").startObject(type).endObject().endObject().endObject();
|
||||
|
||||
XContentParser xContentParser = JsonXContent.jsonXContent.createParser(builder.bytes());
|
||||
try {
|
||||
|
|
|
@ -206,7 +206,7 @@ public class HipChatMessageTests extends ESTestCase {
|
|||
jsonBuilder.field("notify", notify);
|
||||
}
|
||||
|
||||
BytesReference bytes = jsonBuilder.bytes();
|
||||
BytesReference bytes = jsonBuilder.endObject().bytes();
|
||||
XContentParser parser = JsonXContent.jsonXContent.createParser(bytes);
|
||||
parser.nextToken();
|
||||
|
||||
|
|
|
@ -294,6 +294,8 @@ public class EmailActionTests extends ESTestCase {
|
|||
}
|
||||
builder.endObject();
|
||||
}
|
||||
builder.endObject();
|
||||
|
||||
BytesReference bytes = builder.bytes();
|
||||
logger.info("email action json [{}]", bytes.toUtf8());
|
||||
XContentParser parser = JsonXContent.jsonXContent.createParser(bytes);
|
||||
|
@ -421,7 +423,7 @@ public class EmailActionTests extends ESTestCase {
|
|||
HtmlSanitizer htmlSanitizer = mock(HtmlSanitizer.class);
|
||||
EmailAttachmentsParser emailAttachmentsParser = mock(EmailAttachmentsParser.class);
|
||||
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value");
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value").endObject();
|
||||
XContentParser parser = JsonXContent.jsonXContent.createParser(builder.bytes());
|
||||
parser.nextToken();
|
||||
try {
|
||||
|
|
|
@ -197,7 +197,7 @@ public class HipChatActionFactoryTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testParserInvalid() throws Exception {
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value");
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value").endObject();
|
||||
XContentParser parser = JsonXContent.jsonXContent.createParser(builder.bytes());
|
||||
parser.nextToken();
|
||||
try {
|
||||
|
|
|
@ -247,7 +247,7 @@ public class HipChatActionTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testParserInvalid() throws Exception {
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value");
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value").endObject();
|
||||
XContentParser parser = JsonXContent.jsonXContent.createParser(builder.bytes());
|
||||
parser.nextToken();
|
||||
try {
|
||||
|
|
|
@ -236,7 +236,7 @@ public class PagerDutyActionTests extends ESTestCase {
|
|||
|
||||
public void testParserInvalid() throws Exception {
|
||||
try {
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value");
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value").endObject();
|
||||
XContentParser parser = JsonXContent.jsonXContent.createParser(builder.bytes());
|
||||
parser.nextToken();
|
||||
PagerDutyAction.parse("_watch", "_action", parser);
|
||||
|
|
|
@ -188,7 +188,7 @@ public class SlackActionTests extends ESTestCase {
|
|||
}
|
||||
|
||||
public void testParserInvalid() throws Exception {
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value");
|
||||
XContentBuilder builder = jsonBuilder().startObject().field("unknown_field", "value").endObject();
|
||||
XContentParser parser = JsonXContent.jsonXContent.createParser(builder.bytes());
|
||||
parser.nextToken();
|
||||
try {
|
||||
|
|
|
@ -220,6 +220,7 @@ public class WatcherUtilsTests extends ESTestCase {
|
|||
templateSource = new Template(template.getTemplate(), template.getType(), null, template.getContentType(),
|
||||
template.getParams());
|
||||
}
|
||||
builder.endObject();
|
||||
|
||||
XContentParser parser = XContentHelper.createParser(builder.bytes());
|
||||
assertThat(parser.nextToken(), equalTo(XContentParser.Token.START_OBJECT));
|
||||
|
|
|
@ -153,7 +153,7 @@ public class BasicWatcherTests extends AbstractWatcherIntegrationTestCase {
|
|||
|
||||
watchSource.startObject("condition").startObject("script").field("script", "return true").field("request");
|
||||
WatcherUtils.writeSearchRequest(newInputSearchRequest(), watchSource, ToXContent.EMPTY_PARAMS);
|
||||
watchSource.endObject();
|
||||
watchSource.endObject().endObject();
|
||||
|
||||
watchSource.endObject();
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue