Merge pull request #5792 from ViacheslavKlimov/fix/mqtt-attr-encoding
[3.3.3] Fix invalid serialization of '=' to \u003d in JsonMqttAdaptor
This commit is contained in:
commit
c77a5d055d
@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.thingsboard.server.transport.mqtt.adaptors;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
@ -56,8 +55,6 @@ public class JsonMqttAdaptor implements MqttTransportAdaptor {
|
||||
|
||||
protected static final Charset UTF8 = StandardCharsets.UTF_8;
|
||||
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
@Override
|
||||
public TransportProtos.PostTelemetryMsg convertToPostTelemetry(MqttDeviceAwareSessionContext ctx, MqttPublishMessage inbound) throws AdaptorException {
|
||||
String payload = validatePayload(ctx.getSessionId(), inbound.payload(), false);
|
||||
@ -246,7 +243,7 @@ public class JsonMqttAdaptor implements MqttTransportAdaptor {
|
||||
new MqttFixedHeader(MqttMessageType.PUBLISH, false, ctx.getQoSForTopic(topic), false, 0);
|
||||
MqttPublishVariableHeader header = new MqttPublishVariableHeader(topic, ctx.nextMsgId());
|
||||
ByteBuf payload = ALLOCATOR.buffer();
|
||||
payload.writeBytes(GSON.toJson(json).getBytes(UTF8));
|
||||
payload.writeBytes(json.toString().getBytes(UTF8));
|
||||
return new MqttPublishMessage(mqttFixedHeader, header, payload);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user