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

Catch InputCoercionException thrown by Jackson parser #57287

Merged
merged 2 commits into from
May 29, 2020

Conversation

iverase
Copy link
Contributor

@iverase iverase commented May 28, 2020

Jackson 2.10 library has added a new type of error that is thrown when a numeric value is out of range. This error should be catched and handle properly in case the flag ignore_malformed has been set to true.

fixes #57272

@iverase iverase added >bug :Search Foundations/Mapping Index mappings, including merging and defining field types v8.0.0 v7.9.0 labels May 28, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (:Search/Mapping)

@elasticmachine elasticmachine added the Team:Search Meta label for search team label May 28, 2020
Copy link
Member

@cbuescher cbuescher left a comment

Choose a reason for hiding this comment

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

LGTM, left a small question around potentially moving the test elsewhere, but feel free to decide.

import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.test.ESSingleNodeTestCase;

public class LongIndexingDocTests extends ESSingleNodeTestCase {
Copy link
Member

Choose a reason for hiding this comment

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

nit: Since this is testing NumberFieldMapper behaviour, would it make sense to put this test case in NumberFieldMapperTests instead? We wouldn't need a new isolated test class with all the setup/teardown overhead for it in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can only reproduce if the test is of the type ESSingleNodeTestCase which is not the case for NumberFieldMapperTests

Copy link
Member

Choose a reason for hiding this comment

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

Strange, from my IDE it looked like it extends "ESSingleNodeTestCase". Let me try again...

Copy link
Member

Choose a reason for hiding this comment

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

Works for me :scratcheshead: I moved your test over and only had to change the index name since the "test" index seems to be in use elsewhere already. Failed when removing the new exception type from the catch statement, passes otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are totally right, I have moved the test so we don't add a new whole class. Thanks @cbuescher!

@iverase iverase merged commit 99871b1 into elastic:master May 29, 2020
iverase added a commit that referenced this pull request May 29, 2020
Jackson 2.10 library has added a new type of error that is thrown when a numeric value is out 
of range. This error should be catch and handle properly in case the flag ignore_malformed 
has been set to true.
iverase added a commit to iverase/elasticsearch that referenced this pull request May 29, 2020
…elastic#57330)

Jackson 2.10 library has added a new type of error that is thrown when a numeric value is out 
of range. This error should be catch and handle properly in case the flag ignore_malformed 
has been set to true.
iverase added a commit to iverase/elasticsearch that referenced this pull request May 29, 2020
…elastic#57330)

Jackson 2.10 library has added a new type of error that is thrown when a numeric value is out 
of range. This error should be catch and handle properly in case the flag ignore_malformed 
has been set to true.
iverase added a commit that referenced this pull request May 29, 2020
… (#57334)

Jackson 2.10 library has added a new type of error that is thrown when a numeric value is out 
of range. This error should be catch and handle properly in case the flag ignore_malformed 
has been set to true.
iverase added a commit that referenced this pull request May 29, 2020
… (#57335)

Jackson 2.10 library has added a new type of error that is thrown when a numeric value is out 
of range. This error should be catch and handle properly in case the flag ignore_malformed 
has been set to true.
@iverase iverase deleted the InputCoercionException branch May 29, 2020 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search Foundations/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team v7.7.2 v7.8.1 v7.9.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ignored_malfored flag is ignored in numeric types for out of range values
4 participants