File tree Expand file tree Collapse file tree
org.eclipse.paho.client.mqttv3.test/src/test/java/org/eclipse/paho/client/mqttv3/test
org.eclipse.paho.client.mqttv3/src/main/java/org/eclipse/paho/client/mqttv3/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2017 Red Hat Inc.
3+ * All rights reserved. This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Public License v1.0
5+ * which accompanies this distribution, and is available at
6+ * http://www.eclipse.org/legal/epl-v10.html
7+ *
8+ * Contributors:
9+ * Red Hat Inc - initial API and implementation
10+ *******************************************************************************/
11+ package org .eclipse .paho .client .mqttv3 .test ;
12+
13+ import org .eclipse .paho .client .mqttv3 .MqttAsyncClient ;
14+ import org .eclipse .paho .client .mqttv3 .MqttException ;
15+ import org .junit .Test ;
16+
17+ /**
18+ * This is a reproducer for issue #370
19+ */
20+ public class Issue370Test {
21+ @ Test
22+ public void noOpenClose () throws MqttException {
23+ final MqttAsyncClient client = new MqttAsyncClient ("tcp://localhost" , "foo-bar" );
24+ client .close ();
25+ }
26+ }
Original file line number Diff line number Diff line change 11/*******************************************************************************
2- * Copyright (c) 2009, 2016 IBM Corp.
2+ * Copyright (c) 2009, 2017 IBM Corp and others .
33 *
44 * All rights reserved. This program and the accompanying materials
55 * are made available under the terms of the Eclipse Public License v1.0
1717 * James Sutton - Ping Callback (bug 473928)
1818 * Ian Craggs - fix for NPE bug 470718
1919 * James Sutton - Automatic Reconnect & Offline Buffering
20+ * Jens Reimann - Fix issue #370
2021 */
2122package org .eclipse .paho .client .mqttv3 .internal ;
2223
@@ -1354,7 +1355,9 @@ public int getMaxInFlight(){
13541355 */
13551356 protected void close () {
13561357 inUseMsgIds .clear ();
1357- pendingMessages .clear ();
1358+ if (pendingMessages != null ) {
1359+ pendingMessages .clear ();
1360+ }
13581361 pendingFlows .clear ();
13591362 outboundQoS2 .clear ();
13601363 outboundQoS1 .clear ();
You can’t perform that action at this time.
0 commit comments