diff options
author | Joey Grover <joeygrover@gmail.com> | 2017-02-07 21:22:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-07 21:22:32 -0500 |
commit | 42f4e91b6234b74ca1bf963aa894525b09b80380 (patch) | |
tree | 3c20c8a49d0a61374789b94cb981e9ca6c604139 | |
parent | 932f7bcbb2d01a61bed6b8b2c877abfcd9b90b74 (diff) | |
download | sdl_android-revert-400-bugfix/issue_383.tar.gz |
Revert "Fixing case where config.getService() returns null"revert-400-bugfix/issue_383
-rw-r--r-- | sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java | 8 | ||||
-rw-r--r-- | sdl_android_tests/src/com/smartdevicelink/SdlConnection/SdlConnectionTest.java | 14 |
2 files changed, 5 insertions, 17 deletions
diff --git a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java index 7a91c8cee..3c51b9e7e 100644 --- a/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java +++ b/sdl_android_lib/src/com/smartdevicelink/SdlConnection/SdlConnection.java @@ -41,10 +41,10 @@ public class SdlConnection implements IProtocolListener, ITransportListener { // Thread safety locks
static Object TRANSPORT_REFERENCE_LOCK = new Object();
Object PROTOCOL_REFERENCE_LOCK = new Object();
-
+ private Object SESSION_LOCK = new Object();
private CopyOnWriteArrayList<SdlSession> listenerList = new CopyOnWriteArrayList<SdlSession>();
- private static TransportType legacyTransportRequest = null;
+ private static TransportType legacyTransportRequest = null; private final static int BUFF_READ_SIZE = 1000000;
protected static MultiplexTransportConfig cachedMultiConfig = null;
@@ -302,7 +302,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener { }
}
}
- void registerSession(SdlSession registerListener) throws SdlException {
+ void registerSession(SdlSession registerListener) throws SdlException { boolean didAdd = listenerList.addIfAbsent(registerListener);
if (!this.getIsConnected()) {
this.startTransport();
@@ -527,7 +527,7 @@ public class SdlConnection implements IProtocolListener, ITransportListener { MultiplexTransport multi = ((MultiplexTransport)_transport);
MultiplexTransportConfig config = multi.getConfig();
ComponentName tempCompName = SdlBroadcastReceiver.consumeQueuedRouterService();
- if(config.getService() != null && config.getService().equals(tempCompName)){ //If this is the same service that just connected that we are already looking at. Attempt to reconnect
+ if(config.getService().equals(tempCompName)){ //If this is the same service that just connected that we are already looking at. Attempt to reconnect
if(!multi.getIsConnected() && multi.isDisconnecting() ){ //If we aren't able to force a connection it means the
_transport = new MultiplexTransport(config,this);
try {
diff --git a/sdl_android_tests/src/com/smartdevicelink/SdlConnection/SdlConnectionTest.java b/sdl_android_tests/src/com/smartdevicelink/SdlConnection/SdlConnectionTest.java index 90122905a..cf921541a 100644 --- a/sdl_android_tests/src/com/smartdevicelink/SdlConnection/SdlConnectionTest.java +++ b/sdl_android_tests/src/com/smartdevicelink/SdlConnection/SdlConnectionTest.java @@ -50,20 +50,8 @@ public class SdlConnectionTest extends AndroidTestCase { assertEquals(TransportType.MULTIPLEX, connection.getCurrentTransportType()); + - - // Test for handling of null service - MultiplexTransportConfig null_service_config = new MultiplexTransportConfig(this.mContext,SdlUnitTestContants.TEST_APP_ID); - null_service_config.setService(null); - SdlConnectionTestClass null_service_connection = new SdlConnectionTestClass(null_service_config, null); - Exception exception = null; - try{ - null_service_connection.forceHardwareConnectEvent(TransportType.MULTIPLEX); - }catch(NullPointerException e){ - exception = e; - } - - assertNull(exception); // Failed, unhandled NPE } public void testMultiplexConstructor(){ |