|
|
@ -17,6 +17,7 @@ package org.thingsboard.server.transport.mqtt.session; |
|
|
|
|
|
|
|
|
import com.google.gson.JsonArray; |
|
|
import com.google.gson.JsonArray; |
|
|
import com.google.gson.JsonElement; |
|
|
import com.google.gson.JsonElement; |
|
|
|
|
|
import com.google.gson.JsonNull; |
|
|
import com.google.gson.JsonObject; |
|
|
import com.google.gson.JsonObject; |
|
|
import com.google.gson.JsonSyntaxException; |
|
|
import com.google.gson.JsonSyntaxException; |
|
|
import io.netty.channel.ChannelHandlerContext; |
|
|
import io.netty.channel.ChannelHandlerContext; |
|
|
@ -240,7 +241,7 @@ public class GatewaySessionCtx { |
|
|
|
|
|
|
|
|
private String getDeviceType(JsonElement json) throws AdaptorException { |
|
|
private String getDeviceType(JsonElement json) throws AdaptorException { |
|
|
JsonElement type = json.getAsJsonObject().get("type"); |
|
|
JsonElement type = json.getAsJsonObject().get("type"); |
|
|
return type == null ? DEFAULT_DEVICE_TYPE : type.getAsString(); |
|
|
return type == null || type instanceof JsonNull ? DEFAULT_DEVICE_TYPE : type.getAsString(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private JsonElement getJson(MqttPublishMessage mqttMsg) throws AdaptorException { |
|
|
private JsonElement getJson(MqttPublishMessage mqttMsg) throws AdaptorException { |
|
|
|