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

Geo: Fix comparison of doubles in ShapeBuilder.intersections() #7016

Closed
colings86 opened this issue Jul 24, 2014 · 0 comments · Fixed by #7188
Closed

Geo: Fix comparison of doubles in ShapeBuilder.intersections() #7016

colings86 opened this issue Jul 24, 2014 · 0 comments · Fixed by #7188

Comments

@colings86
Copy link
Contributor

Code in question: https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/common/geo/builders/ShapeBuilder.java#L297-299

This code seems to compare the current point with the one after next and continue if their comparison value is equal. The reason for doing this is not clear and there are no tests which rely on this code.

The compare method is not limited to return -1, 0 and 1 so the chance of this condition being met seems slim, further adding to the confusion as to what its purpose is.

@jpountz jpountz removed the adoptme label Aug 1, 2014
colings86 added a commit that referenced this issue Aug 12, 2014
If a geo_shape had edges which either ran vertically along the dateline or touched the date line but did not cross it they would fail to parse.  This is because the code which splits a polygon along the dateline did not take into account the case where the polygon touched but did not cross the dateline.  This PR fixes those issues and provides tests for them.

Close #7016
@colings86 colings86 changed the title Fix comparison of doubles in ShapeBuilder.intersections() Geo: Fix comparison of doubles in ShapeBuilder.intersections() Aug 12, 2014
colings86 added a commit that referenced this issue Sep 8, 2014
If a geo_shape had edges which either ran vertically along the dateline or touched the date line but did not cross it they would fail to parse.  This is because the code which splits a polygon along the dateline did not take into account the case where the polygon touched but did not cross the dateline.  This PR fixes those issues and provides tests for them.

Close #7016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants