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

Do not track named queries that are null #12691

Merged
merged 1 commit into from Aug 6, 2015
Merged

Do not track named queries that are null #12691

merged 1 commit into from Aug 6, 2015

Conversation

jasontedor
Copy link
Member

Adding a named query that is null can lead to a NullPointerException
when copying the named queries. This is due to an implementation detail
in QueryParseContent.copyNamedQueries. In particular, this method uses
com.google.common.collect.ImmutableMap.copyOf. A documented requirement
of ImmutableMap is that none of the entries have a null key nor null
value. Therefore, we should not add such queries to the namedQueries
map. This will not change any behavior since Map.get returns null if no
entry with the given key exists anyway.

Closes #12683

.endObject()
.endObject()
.endObject();
client().admin().indices().prepareCreate(index).addMapping(type, mapping).execute().actionGet();
Copy link
Member

Choose a reason for hiding this comment

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

I think you can shorten the mapping here: addMapping(type, "name", "type=string, analyzer=stop" that hurts my eyes less :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Incorporated, thanks!

@javanna
Copy link
Member

javanna commented Aug 6, 2015

left a couple of minor comments, fix looks good though!

@javanna
Copy link
Member

javanna commented Aug 6, 2015

LGTM

Adding a named query that is null can lead to a NullPointerException
when copying the named queries. This is due to an implementation detail
in QueryParseContent.copyNamedQueries. In particular, this method uses
com.google.common.collect.ImmutableMap.copyOf. A documented requirement
of ImmutableMap is that none of the entries have a null key nor null
value. Therefore, we should not add such queries to the namedQueries
map. This will not change any behavior since Map.get returns null if no
entry with the given key exists anyway.

Closes #12683
@jasontedor
Copy link
Member Author

@javanna Thanks for reviewing.

jasontedor added a commit that referenced this pull request Aug 6, 2015
Do not track named queries that are null
@jasontedor jasontedor merged commit 40cd460 into elastic:master Aug 6, 2015
@jasontedor jasontedor deleted the fix/12683 branch August 6, 2015 13:33
jasontedor added a commit that referenced this pull request Aug 6, 2015
This commit backports the fix #12691 for #12683 from master to 1.7.
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Query DSL labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories v1.7.2 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants