File tree Expand file tree Collapse file tree 2 files changed +5
-11
lines changed
main/java/io/ably/lib/realtime
test/java/io/ably/lib/test/realtime Expand file tree Collapse file tree 2 files changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ private void implicitAttachOnSubscribe(CompletionListener completionListener) th
305
305
// RTP6e
306
306
if (!channel .attachOnSubscribeEnabled ()) {
307
307
if (completionListener != null ) {
308
- String errorString = String .format (Locale . ROOT ,
308
+ String errorString = String .format (
309
309
"Channel %s: attachOnSubscribe=false doesn't expect attach completion callback" , channel .name );
310
310
Log .e (TAG , errorString );
311
311
ErrorInfo errorInfo = new ErrorInfo (errorString , 400 ,40000 );
Original file line number Diff line number Diff line change @@ -1692,14 +1692,11 @@ public void presence_subscribe_without_implicit_attach() {
1692
1692
* @throws AblyException
1693
1693
*/
1694
1694
@ Test
1695
- public void presence_subscribe_without_implicit_attach_and_completion_listener_throws_exception () {
1695
+ public void presence_subscribe_without_implicit_attach_and_completion_listener_throws_exception () throws AblyException {
1696
1696
String ablyChannel = "subscribe_" + testParams .name ;
1697
- AblyRealtime ably = null ;
1698
- try {
1699
- ClientOptions option1 = createOptions (testVars .keys [0 ].keyStr );
1700
- option1 .clientId = "client1" ;
1701
- ably = new AblyRealtime (option1 );
1702
-
1697
+ ClientOptions option1 = createOptions (testVars .keys [0 ].keyStr );
1698
+ option1 .clientId = "client1" ;
1699
+ try (AblyRealtime ably = new AblyRealtime (option1 )) {
1703
1700
/* create a channel and set attachOnSubscribe to false */
1704
1701
final Channel channel = ably .channels .get (ablyChannel );
1705
1702
ChannelOptions chOpts = new ChannelOptions ();
@@ -1720,9 +1717,6 @@ public void presence_subscribe_without_implicit_attach_and_completion_listener_t
1720
1717
} catch (AblyException e ) {
1721
1718
e .printStackTrace ();
1722
1719
fail ("presence_subscribe_without_implicit_attach: Unexpected exception" );
1723
- } finally {
1724
- if (ably != null )
1725
- ably .close ();
1726
1720
}
1727
1721
}
1728
1722
You can’t perform that action at this time.
0 commit comments