Fix null ref exception caused by missing system properties in the message
This commit is contained in:
Родитель
59fd86a004
Коммит
c58364b924
|
@ -6,7 +6,7 @@ organization := "com.microsoft.azure.iot"
|
|||
//version := "0.10.0"
|
||||
|
||||
//https://bintray.com/microsoftazuretoketi/toketi-repo/iothub-react
|
||||
version := "0.10.0-DEV.170725b"
|
||||
version := "0.10.0-DEV.170725c"
|
||||
|
||||
scalaVersion := "2.12.2"
|
||||
crossScalaVersions := Seq("2.11.11", "2.12.2")
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>com.microsoft.azure.iot</groupId>
|
||||
<artifactId>iothub-react-demo</artifactId>
|
||||
<version>0.10.0-DEV.170725b</version>
|
||||
<version>0.10.0-DEV.170725c</version>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<dependency>
|
||||
<groupId>com.microsoft.azure.iot</groupId>
|
||||
<artifactId>iothub-react_2.12</artifactId>
|
||||
<version>0.10.0-DEV.170725b</version>
|
||||
<version>0.10.0-DEV.170725c</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
|
|
|
@ -89,10 +89,16 @@ class MessageFromDevice(
|
|||
lazy val sequenceNumber: Long = systemProps.getSequenceNumber
|
||||
|
||||
// ID of the device who sent the message
|
||||
lazy val deviceId: String = systemProps.get(deviceIdProperty).toString
|
||||
lazy val deviceId: String = {
|
||||
val p = systemProps.get(deviceIdProperty)
|
||||
if (p != null) p.toString else ""
|
||||
}
|
||||
|
||||
// Message ID
|
||||
lazy val messageId: String = systemProps.get(messageIdProperty).toString
|
||||
lazy val messageId: String = {
|
||||
val p = systemProps.get(messageIdProperty)
|
||||
if (p != null) p.toString else ""
|
||||
}
|
||||
|
||||
// IoT message content bytes
|
||||
lazy val content: Array[Byte] = data.get.getBytes
|
||||
|
|
Загрузка…
Ссылка в новой задаче