[1/2] activemq-artemis git commit: ARTEMIS-1335 Update Netty to 4.1.14 - MQTT fix

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[1/2] activemq-artemis git commit: ARTEMIS-1335 Update Netty to 4.1.14 - MQTT fix

clebertsuconic-2
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 012fe58b2 -> ba1b68faf


ARTEMIS-1335 Update Netty to 4.1.14 - MQTT fix

Fix for MQTT in connect due to deprecated methods bug causing NPE, call new methods and null check ourselves.

Also raised https://github.com/netty/netty/issues/7076 upstream but i guess we will keep this, as the old methods are deprecated anyhow.

Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/62e1f7b1
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/62e1f7b1
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/62e1f7b1

Branch: refs/heads/master
Commit: 62e1f7b1e1c3ed6e950823bfe1ded9c716bde313
Parents: 012fe58
Author: Michael Andre Pearce <[hidden email]>
Authored: Thu Aug 10 01:18:00 2017 +0100
Committer: Michael Andre Pearce <[hidden email]>
Committed: Thu Aug 10 01:52:50 2017 +0100

----------------------------------------------------------------------
 .../core/protocol/mqtt/MQTTConnectionManager.java     | 14 +++++++-------
 .../core/protocol/mqtt/MQTTProtocolHandler.java       |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/62e1f7b1/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java
index bd180b6..e550e67 100644
--- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java
+++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java
@@ -17,13 +17,13 @@
 
 package org.apache.activemq.artemis.core.protocol.mqtt;
 
-import java.nio.charset.Charset;
 import java.util.Set;
 import java.util.UUID;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufAllocator;
 import io.netty.handler.codec.mqtt.MqttConnectReturnCode;
+import io.netty.util.CharsetUtil;
 import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.server.ServerSession;
@@ -32,7 +32,7 @@ import org.apache.activemq.artemis.utils.UUIDGenerator;
 import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
 
 /**
- * MQTTConnectionMananager is responsible for handle Connect and Disconnect packets and any resulting behaviour of these
+ * MQTTConnectionManager is responsible for handle Connect and Disconnect packets and any resulting behaviour of these
  * events.
  */
 public class MQTTConnectionManager {
@@ -65,9 +65,9 @@ public class MQTTConnectionManager {
     */
    synchronized void connect(String cId,
                              String username,
-                             String password,
+                             byte[] passwordInBytes,
                              boolean will,
-                             String willMessage,
+                             byte[] willMessage,
                              String willTopic,
                              boolean willRetain,
                              int willQosLevel,
@@ -80,6 +80,7 @@ public class MQTTConnectionManager {
       }
 
       session.setSessionState(getSessionState(clientId));
+      String password = passwordInBytes == null ? null : new String(passwordInBytes, CharsetUtil.UTF_8);
       ServerSessionImpl serverSession = createServerSession(username, password);
       serverSession.start();
 
@@ -88,9 +89,8 @@ public class MQTTConnectionManager {
 
       if (will) {
          isWill = true;
-         byte[] payload = willMessage.getBytes(Charset.forName("UTF-8"));
-         this.willMessage = ByteBufAllocator.DEFAULT.buffer(payload.length);
-         this.willMessage.writeBytes(payload);
+         this.willMessage = ByteBufAllocator.DEFAULT.buffer(willMessage.length);
+         this.willMessage.writeBytes(willMessage);
          this.willQoSLevel = willQosLevel;
          this.willRetain = willRetain;
          this.willTopic = willTopic;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/62e1f7b1/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java
index 6add2db..7c14403 100644
--- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java
+++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTProtocolHandler.java
@@ -171,7 +171,7 @@ public class MQTTProtocolHandler extends ChannelInboundHandlerAdapter {
       connectionEntry.ttl = connect.variableHeader().keepAliveTimeSeconds() * 1500L;
 
       String clientId = connect.payload().clientIdentifier();
-      session.getConnectionManager().connect(clientId, connect.payload().userName(), connect.payload().password(), connect.variableHeader().isWillFlag(), connect.payload().willMessage(), connect.payload().willTopic(), connect.variableHeader().isWillRetain(), connect.variableHeader().willQos(), connect.variableHeader().isCleanSession());
+      session.getConnectionManager().connect(clientId, connect.payload().userName(), connect.payload().passwordInBytes(), connect.variableHeader().isWillFlag(), connect.payload().willMessageInBytes(), connect.payload().willTopic(), connect.variableHeader().isWillRetain(), connect.variableHeader().willQos(), connect.variableHeader().isCleanSession());
    }
 
    void disconnect(boolean error) {

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[2/2] activemq-artemis git commit: This closes #1455

clebertsuconic-2
This closes #1455


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/ba1b68fa
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/ba1b68fa
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/ba1b68fa

Branch: refs/heads/master
Commit: ba1b68faf5221235a1e28a1ead878e04c36aecea
Parents: 012fe58 62e1f7b
Author: Clebert Suconic <[hidden email]>
Authored: Wed Aug 9 21:00:58 2017 -0400
Committer: Clebert Suconic <[hidden email]>
Committed: Wed Aug 9 21:00:58 2017 -0400

----------------------------------------------------------------------
 .../core/protocol/mqtt/MQTTConnectionManager.java     | 14 +++++++-------
 .../core/protocol/mqtt/MQTTProtocolHandler.java       |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


Loading...