Skip to content

Commit c06adb8

Browse files
author
Ranjan Dasgupta
authored
Merge pull request #948 from eclipse/develop
Merge develop to master
2 parents 2358b33 + 3daa4dd commit c06adb8

24 files changed

Lines changed: 192 additions & 143 deletions

File tree

org.eclipse.paho.client.mqttv3.internal.traceformat/build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<!-- classpath.folder = ship.folder of org.eclipse.paho.client.mqttv3 build.xml -->
99
<property name="classpath.folder" value="../org.eclipse.paho.client.mqttv3/target/ship" />
1010

11-
<property name="client.release.version" value="1.2.5" />
12-
<property name="bundleVersion" value="1.2.5" />
11+
<property name="client.release.version" value="1.2.6" />
12+
<property name="bundleVersion" value="1.2.6" />
1313

1414
<property name="bundleVendor" value="Eclipse.org" />
1515
<property name="build.level" value="LYYMMDD" />

org.eclipse.paho.client.mqttv3.repository/category.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<site>
3-
<bundle id="org.eclipse.paho.client.mqttv3" version="1.2.5">
3+
<bundle id="org.eclipse.paho.client.mqttv3" version="1.2.6">
44
<category name="Paho MQTT Java"/>
55
</bundle>
66
<category-def name="Paho MQTT Java" label="Paho MQTT Java">

org.eclipse.paho.client.mqttv3.repository/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
<parent>
44
<groupId>org.eclipse.paho</groupId>
55
<artifactId>java-parent</artifactId>
6-
<version>1.2.5</version>
6+
<version>1.2.6</version>
77
</parent>
88

99
<artifactId>org.eclipse.paho.client.mqttv3.repository</artifactId>
10-
<version>1.2.5</version>
10+
<version>1.2.6</version>
1111
<packaging>eclipse-repository</packaging>
1212

1313
<name>Paho P2 Repository for mqttv3 client</name>

org.eclipse.paho.client.mqttv3.test/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>org.eclipse.paho</groupId>
66
<artifactId>java-parent</artifactId>
7-
<version>1.2.5</version>
7+
<version>1.2.6</version>
88
</parent>
99

1010
<artifactId>org.eclipse.paho.client.mqttv3.test</artifactId>
11-
<version>1.2.5</version>
11+
<version>1.2.6</version>
1212
<packaging>jar</packaging>
1313

1414
<build>
@@ -87,7 +87,7 @@
8787
<dependency>
8888
<groupId>org.eclipse.paho</groupId>
8989
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
90-
<version>1.2.5</version>
90+
<version>1.2.6</version>
9191
</dependency>
9292

9393
<dependency>

org.eclipse.paho.client.mqttv3.test/src/test/java/org/eclipse/paho/client/mqttv3/test/MqttDataTypesTest.java

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.eclipse.paho.client.mqttv3.test;
22

33
import java.io.*;
4-
import java.nio.charset.Charset;
54
import java.nio.charset.StandardCharsets;
65

76
import org.eclipse.paho.client.mqttv3.MqttException;
@@ -72,6 +71,25 @@ public void TestEncodeInvalidUTF8StringInDifferentRange() throws MqttException {
7271
encodeAndDecodeString(invalidString);
7372
}
7473

74+
@Test
75+
public void TestEncodeAndDecodeUTF8StringWithSurrogates() throws MqttException {
76+
String testString = "\uD801\uDC37";
77+
String decodedUTF8 = encodeAndDecodeString(testString);
78+
Assert.assertEquals(testString, decodedUTF8);
79+
}
80+
81+
@Test(expected = IllegalArgumentException.class)
82+
public void TestEncodeAndDecodeUTF8StringWithTrailingHighSurrogate() throws MqttException {
83+
String testString = "\uD801";
84+
encodeAndDecodeString(testString);
85+
}
86+
87+
@Test(expected = IllegalArgumentException.class)
88+
public void TestEncodeAndDecodeUTF8StringWithLowSurrogate() throws MqttException {
89+
String testString = "\uDC37";
90+
encodeAndDecodeString(testString);
91+
}
92+
7593
@Test
7694
public void TestEncodeAndDecodeUTF8String() throws MqttException {
7795
String testString = "Answer to life the universe and everything";
@@ -91,14 +109,11 @@ public void TestEncodeAndDecodeChineseUTF8String() throws MqttException {
91109

92110
}
93111

94-
@Test(expected = IllegalArgumentException.class)
112+
@Test
95113
public void TestEncodeAndDecodeEmojiString() throws MqttException {
96114
String testString = "👁🐝Ⓜ️️";
97-
// System.out.println(String.format("'%s' is %d bytes, %d chars long",
98-
// testString, testString.getBytes().length, testString.length()));
99115
String decodedUTF8 = encodeAndDecodeString(testString);
100116
Assert.assertEquals(testString, decodedUTF8);
101-
102117
}
103118

104119
@Test

org.eclipse.paho.client.mqttv3/META-INF/MANIFEST.MF

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: org.eclipse.paho.client.mqttv3
44
Bundle-SymbolicName: org.eclipse.paho.client.mqttv3
5-
Bundle-Version: 1.2.5
5+
Bundle-Version: 1.2.6
66
Bundle-Localization: bundle
7-
Export-Package: org.eclipse.paho.client.mqttv3;version="1.2.5",
8-
org.eclipse.paho.client.mqttv3.logging;version="1.2.5",
9-
org.eclipse.paho.client.mqttv3.persist;version="1.2.5",
10-
org.eclipse.paho.client.mqttv3.util;version="1.2.5"
7+
Export-Package: org.eclipse.paho.client.mqttv3;version="1.2.6",
8+
org.eclipse.paho.client.mqttv3.logging;version="1.2.6",
9+
org.eclipse.paho.client.mqttv3.persist;version="1.2.6",
10+
org.eclipse.paho.client.mqttv3.util;version="1.2.6"
1111
Bundle-Vendor: %bundle.provider
1212
Bundle-ActivationPolicy: lazy
1313
Bundle-RequiredExecutionEnvironment: JavaSE-1.7

org.eclipse.paho.client.mqttv3/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>org.eclipse.paho</groupId>
66
<artifactId>java-parent</artifactId>
7-
<version>1.2.5</version>
7+
<version>1.2.6</version>
88
</parent>
99

1010
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
@@ -133,6 +133,6 @@
133133
</plugins>
134134
</pluginManagement>
135135
</build>
136-
<version>1.2.5</version>
136+
<version>1.2.6</version>
137137
</project>
138138

org.eclipse.paho.client.mqttv3/src/main/java-templates/org/eclipse/paho/client/mqttv3/internal/ClientComms.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@ public void sendNoWait(MqttWireMessage message, MqttToken token) throws MqttExce
186186
//@TRACE 507=Client Connected, Offline Buffer available, but not empty. Adding message to buffer. message={0}
187187
log.fine(CLASS_NAME, methodName, "507", new Object[] {message.getKey()});
188188
if(disconnectedMessageBuffer.isPersistBuffer()){
189-
this.clientState.persistBufferedMessage(message);
189+
if (message instanceof MqttPublish) {
190+
this.clientState.persistBufferedMessage(message);
191+
}
190192
}
191193
disconnectedMessageBuffer.putMessage(message, token);
192194
} else {

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/IMqttAsyncClient.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,21 @@ public interface IMqttAsyncClient extends AutoCloseable {
313313
*/
314314
void disconnectForcibly(long quiesceTimeout, long disconnectTimeout) throws MqttException;
315315

316+
/**
317+
* Disconnects from the server forcibly to reset all the states. Could be
318+
* useful when disconnect attempt failed.
319+
* <p>
320+
* Because the client is able to establish the TCP/IP connection to a none
321+
* MQTT server and it will certainly fail to send the disconnect packet.
322+
*
323+
* @param quiesceTimeout the amount of time in milliseconds to allow for existing work
324+
* to finish before disconnecting. A value of zero or less means the client will not quiesce.
325+
* @param disconnectTimeout the amount of time in milliseconds to allow send disconnect packet to server.
326+
* @param sendDisconnectPacket if true, will send the disconnect packet to the server
327+
* @throws MqttException if any unexpected error
328+
*/
329+
public void disconnectForcibly(long quiesceTimeout, long disconnectTimeout, boolean sendDisconnectPacket) throws MqttException;
330+
316331
/**
317332
* Determines if this client is currently connected to the server.
318333
*

org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/MqttAsyncClient.java

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -857,24 +857,11 @@ public void disconnectForcibly(long quiesceTimeout, long disconnectTimeout) thro
857857
comms.disconnectForcibly(quiesceTimeout, disconnectTimeout);
858858
}
859859

860-
/**
861-
* Disconnects from the server forcibly to reset all the states. Could be
862-
* useful when disconnect attempt failed.
863-
* <p>
864-
* Because the client is able to establish the TCP/IP connection to a none
865-
* MQTT server and it will certainly fail to send the disconnect packet.
866-
*
867-
* @param quiesceTimeout
868-
* the amount of time in milliseconds to allow for existing work
869-
* to finish before disconnecting. A value of zero or less means
870-
* the client will not quiesce.
871-
* @param disconnectTimeout
872-
* the amount of time in milliseconds to allow send disconnect
873-
* packet to server.
874-
* @param sendDisconnectPacket
875-
* if true, will send the disconnect packet to the server
876-
* @throws MqttException
877-
* if any unexpected error
860+
/*
861+
* (non-Javadoc)
862+
*
863+
* @see
864+
* org.eclipse.paho.client.mqttv3.IMqttAsyncClient#disconnectForcibly(long, long, boolean)
878865
*/
879866
public void disconnectForcibly(long quiesceTimeout, long disconnectTimeout, boolean sendDisconnectPacket)
880867
throws MqttException {

0 commit comments

Comments
 (0)