Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 2d9812d

Browse files
authored
Merge pull request #73 from navicore/master
fix empty string to double
2 parents 02a193c + e701e2b commit 2d9812d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/scala/dtlaboratory/dtlab/ingest/actors/functions/ExtractTelemetry.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ object ExtractTelemetry extends LazyLogging with JsonSupport {
1414
node.query[Double](path)
1515

1616
def extractFromString(path: String, node: JsonNode): Option[Double] =
17-
node.query[String](path).map(_.toDouble)
17+
node.query[String](path).map {
18+
case s if s.trim == "" =>
19+
logger.warn(s"empty string for value $path. returning 0")
20+
0.0
21+
case i =>
22+
i.toDouble
23+
}
1824

1925
def isAllowed(vspec: IndexedValueSpec, v: Double): Boolean = {
2026
v match {

0 commit comments

Comments
 (0)