Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix serialization bug in painless execute api request #36075

Merged

Conversation

martijnvg
Copy link
Member

The xContentType was incorrectly serialized:
xContentType.mediaTypeWithoutParameters() was used to serialize, but
xContentType.mediaType() was used to de-serialize.

Also the serialization test class did not test ContextSetup well,
this was due to limitation in serialization test base class. Changed the
test class to manually test xcontent serialization, so that for both binary
and xcontent serialization tests, the ContextSetup is properly tested.

Closes #36050

The `xContentType` was incorrectly serialized:
`xContentType.mediaTypeWithoutParameters()` was used to serialize, but
`xContentType.mediaType()` was used to de-serialize.

Also the serialization test class did not test `ContextSetup` well,
this was due to limitation in serialization test base class. Changed the
test class to manually test xcontent serialization, so that for both binary
and xcontent serialization tests, the `ContextSetup` is properly tested.

Closes elastic#36050
@martijnvg martijnvg added >bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v7.0.0 v6.6.0 v6.5.3 labels Nov 29, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

}

@Override
public void writeTo(StreamOutput out) throws IOException {
out.writeOptionalString(index);
out.writeOptionalBytesReference(document);
out.writeOptionalString(xContentType != null ? xContentType.mediaType(): null);
out.writeOptionalString(xContentType != null ? xContentType.mediaTypeWithoutParameters(): null);
Copy link
Member Author

@martijnvg martijnvg Nov 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line fixes the bug reported in #36050. The rest of this change is to improve testing for the painless execute api request serialization.

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@martijnvg martijnvg merged commit 364badd into elastic:master Nov 30, 2018
martijnvg added a commit that referenced this pull request Nov 30, 2018
The `xContentType` was incorrectly serialized:
`xContentType.mediaTypeWithoutParameters()` was used to serialize, but
`xContentType.mediaType()` was used to de-serialize.

Also the serialization test class did not test `ContextSetup` well,
this was due to limitation in serialization test base class. Changed the
test class to manually test xcontent serialization, so that for both binary
and xcontent serialization tests, the `ContextSetup` is properly tested.

Closes #36050
martijnvg added a commit that referenced this pull request Nov 30, 2018
The `xContentType` was incorrectly serialized:
`xContentType.mediaTypeWithoutParameters()` was used to serialize, but
`xContentType.mediaType()` was used to de-serialize.

Also the serialization test class did not test `ContextSetup` well,
this was due to limitation in serialization test base class. Changed the
test class to manually test xcontent serialization, so that for both binary
and xcontent serialization tests, the `ContextSetup` is properly tested.

Closes #36050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Scripting Scripting abstractions, Painless, and Mustache v6.5.3 v6.6.0 v7.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants