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

CellSize values should not be truncated to integer when parsing from Json. #2174

Merged
merged 2 commits into from May 2, 2017

Conversation

Projects
None yet
3 participants
@mteldridge
Contributor

mteldridge commented May 2, 2017

No description provided.

mteldridge added some commits May 2, 2017

Fixed bug with truncation of CellSize values.
Signed-off-by: Matthew Eldridge <meldridge@astraea.io>
Added a test for json CellSize parsing
Signed-off-by: Matthew Eldridge <meldridge@astraea.io>
@@ -46,7 +46,7 @@ trait Implicits extends HistogramJsonFormats {
)
def read(value: JsValue): CellSize =
value.asJsObject.getFields("width", "height") match {
case Seq(JsNumber(width), JsNumber(height)) => CellSize(width.toInt, height.toInt)
case Seq(JsNumber(width), JsNumber(height)) => CellSize(width.toDouble, height.toDouble)

This comment has been minimized.

@fosskers

fosskers May 2, 2017

Contributor

A reminder to anyone checking this out that JsNumber contains a BigDecimal, so the explicit cast to Double is necessary.

@echeipesh echeipesh added this to the 1.1 milestone May 2, 2017

@echeipesh echeipesh added the bug label May 2, 2017

@echeipesh echeipesh merged commit 3a30cde into locationtech:master May 2, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
ip-validation
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment