Skip to content

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

Merged
echeipesh merged 2 commits into
locationtech:masterfrom
mteldridge:cellsize-notrunc-fix
May 2, 2017
Merged

echeipesh merged 2 commits into
locationtech:masterfrom
mteldridge:cellsize-notrunc-fix

Conversation

@mteldridge

Copy link
Copy Markdown
Contributor

No description provided.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants